private void OnTileHover(TileEventArgs e) { if (this.leftMouseDown && Mouse.LeftButton != MouseButtonState.Pressed) { this.IsTilePressed = false; } if (e.X < 0 || e.Y < 0) { this.HoverTile = TileBoardViewModelBase.EmptyPoint; return; } if (!e.Tile.Shown) { this.SelectedTiles = null; if (this.leftMouseDown && e.Tile.ExtraTileData != ExtraTileData.None) { this.HoverTile = TileBoardViewModelBase.EmptyPoint; } else { this.HoverTile = new Point <int>(e.X, e.Y); } } else { this.HoverTile = TileBoardViewModelBase.EmptyPoint; if (this.SelectedTiles != null) { this.SelectSurroundingTiles(e); } } }
private void OnDrawTile(TileEventArgs e) { var tileWidth = e.TileSize.Width; var tileHeight = e.TileSize.Height; var tilePos = e.TileLocation.ToVector(); var npc = m_mapMeta?.GetNPC(tilePos); if (npc != null) { var destRect = new Rectangle(e.Location.X - npc.Animation.spriteWidth + tileWidth, e.Location.Y - npc.Animation.spriteHeight + tileHeight, npc.Animation.spriteWidth, npc.Animation.spriteHeight); m_actorManager.Graphics = e.Graphics; e.Graphics.DrawImage(m_actorManager.Actors[npc.CharSet], destRect, npc.Animation.SourceRect.X, npc.Animation.SourceRect.Y, npc.Animation.spriteWidth, npc.Animation.spriteHeight, GraphicsUnit.Pixel, new System.Drawing.Imaging.ImageAttributes()); } var eventId = m_mapMeta?.GetEventId(tilePos); if (eventId != null) { var destRect = new Rectangle(e.Location.X, e.Location.Y, tileWidth, tileHeight); var tileBitmap = Properties.Resources.Event_32; e.Graphics.DrawImage(tileBitmap, destRect, 0, 0, tileWidth, tileHeight, GraphicsUnit.Pixel, new System.Drawing.Imaging.ImageAttributes()); } }
public void TileIsSolved(Object sender, TileEventArgs e) { Tile tile = sender as Tile; this.ReduceAnswers(Grid.getRow(tile.Y)); this.ReduceAnswers(Grid.getColumn(tile.X)); this.ReduceAnswers(Grid.getGroup(tile.Group)); }
private void TilePoolTileRemoved(object sender, TileEventArgs e) { if (_selectedTile == e.Tile) { SelectTile(null); } }
private void TileTapRightUp(TileEventArgs e) { if (this.leftAndRightMouseDown) { this.CheckFlagCountAndSurroundingTiles(e); } }
//Implementation of tile unchecking method private void OnTileUnchecked(object sender, TileEventArgs e) { checkedItems--; pictureBoxExport.Visible = checkedItems > 0; pictureBoxSave.Visible = checkedItems > 0; labelExport.Visible = checkedItems > 0; labelSave.Visible = checkedItems > 0; }
public void TileIsSolved(Object sender, TileEventArgs e) { Tile tile = sender as Tile; this.ReduceAnswers(Grid.getRow(tile.Y)); this.ReduceAnswers(Grid.getColumn(tile.X)); this.ReduceAnswers(Grid.getGroup(tile.Group)); }
public void OnTileChanged(TileEventArgs args) { if (TileChanged == null) { return; } TileChanged(this, args); }
private void c1TileControl1_TileClicked(object sender, TileEventArgs e) { CurrencyManager cm = this.BindingContext[dataSet11, "Products"] as CurrencyManager; IBindingList list = cm.List as IBindingList; PropertyDescriptor pd = cm.GetItemProperties()["ProductID"]; cm.Position = list.Find(pd, e.Tile.Tag); }
//Implementation of tile checking method private void OnTileChecked(object sender, TileEventArgs e) { checkedItems++; pictureBoxExport.Visible = true; pictureBoxSave.Visible = true; labelExport.Visible = true; labelSave.Visible = true; }
public TileTapEventArgs(TileEventArgs tileEventArgs, InputButtons button, bool doubleClicked, bool pressedDown, InputButtons allButtons = InputButtons.None) { this.TileEventArgs = tileEventArgs; this.Button = button; this.DoubleClicked = doubleClicked; this.PressedDown = pressedDown; this.AllButtonStates = allButtons; }
private void OnDrawTile(object sender, TileEventArgs e) { if (m_drawTile == null) { return; } m_drawTile(e); }
protected void OnTileAdded(TileEventArgs e) { var handler = TileAdded; if (handler != null) { handler(this, e); } }
public TileTapEventArgs(TileEventArgs tileEventArgs, InputButtons button, bool doubleClicked, bool pressedDown, InputButtons allButtons = InputButtons.None) { this.TileEventArgs = tileEventArgs; this.Button = button; this.DoubleClicked = doubleClicked; this.PressedDown = pressedDown; this.AllButtonStates = allButtons; }
protected virtual void OnTileSelected(TileEventArgs e) { var ev = TileSelected; if (ev != null) { ev(this, e); } }
/// <summary> /// Force a redraw when the cursor leaves. Also clean up anythine we were doing with the tile /// </summary> private void PlugIn1_TileMouseLeave(object sender, TileEventArgs ea) { ea.Tile.Invalidate(); _hoveredTest = null; if (CodeRush.SmartTags.IsSmartTagVisible) { CodeRush.SmartTags.HidePopupMenu(); } }
private void SelectSurroundingTiles(TileEventArgs e) { var tiles = (from tilePoint in this.GetSurroundingTiles(e.X, e.Y) let tile = this.Minesweeper.Tiles[tilePoint.X, tilePoint.Y] where (!tile.Shown) && (tile.ExtraTileData == ExtraTileData.None) select tilePoint).ToList(); this.SelectedTiles = tiles.Count > 0 ? AnimatedTilesCollection.Create(tiles) : null; }
private void LeftDoubleClicked(TileEventArgs e) { if (!e.Tile.Shown || !e.Tile.Type.IsNumber()) { return; } this.CheckFlagCountAndSurroundingTiles(e); }
private void TileMouseMove(object sender, System.Windows.Input.MouseEventArgs e) { var eargs = new TileEventArgs(this); MouseMoved?.Invoke(sender, eargs); if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed) { MouseClick?.Invoke(sender, eargs); } }
private void LeftRightDown(TileEventArgs e) { this.leftAndRightMouseDown = true; if (e.Tile.Type == TileType.EmptySpace) { return; } this.SelectSurroundingTiles(e); }
private void OnFirstTileClicked(object sender, TileEventArgs tileEventArgs) { var firstTilePosition = new TilePosition { X = tileEventArgs.FirstTileX, Y = tileEventArgs.FirstTileY }; var firstTile = new Tile((TileType)tileEventArgs.FirstTileTypeIndex, firstTilePosition); this.gameBoard.FirstTileClicked(firstTile); this.view.Tiles = this.gameBoard.GenerateNumericGameBoard(); this.view.DrawGameBoard(); }
private void OnMouseEntered(object sender, TileEventArgs e) { hoveredTiles = GetAllTiles(e.tile, uiManager.HexSelectionManager.HoverHighlightSize); foreach (Tile tile in hoveredTiles) { if (tile != selectedTile) { SetHoverColor(tile); } } }
private void OnTileCreated(object sender, TileEventArgs args) { GameObject tileGameObject = new GameObject($"Tile_{args.Tile.Position}"); tileGameObject.transform.position = (Vector2)args.Tile.Position; tileGameObject.transform.SetParent(tileParent); SpriteRenderer spriteRenderer = tileGameObject.AddComponent <SpriteRenderer>(); spriteRenderer.sprite = Resources.Load <Sprite>("Tiles/_Default"); spriteRenderer.sortingLayerName = "Tiles"; tileGameObjects.Add(args.Tile, tileGameObject); }
private void SecondTileClicked(object sender, TileEventArgs tileEventArgs) { var firstTilePosition = new TilePosition { X = tileEventArgs.FirstTileX, Y = tileEventArgs.FirstTileY }; var firstTile = new Tile((TileType)tileEventArgs.FirstTileTypeIndex, firstTilePosition); var secondTilePosition = new TilePosition { X = tileEventArgs.SecondTileX, Y = tileEventArgs.SecondTileY }; var secondTile = new Tile((TileType)tileEventArgs.SecondTileTypeIndex, secondTilePosition); this.gameBoard.CheckForValidMove(firstTile, secondTile); this.view.Tiles = this.gameBoard.GenerateNumericGameBoard(); this.view.DrawGameBoard(); }
private async void TileTapLeftUp(TileEventArgs e) { this.IsTilePressed = false; if (!this.leftMouseDown) { return; } this.leftMouseDown = false; if (!this.boardInitialized) { await Task.Run(() => this.GenerateMinefield(e.X, e.Y)); this.GameStatistics[Statistic.GameStartTime] = DateTime.Now; } if (this.leftAndRightMouseDown) { this.CheckFlagCountAndSurroundingTiles(e); this.HoverTile = TileBoardViewModelBase.EmptyPoint; return; } if (e.Tile.Shown || e.Tile.ExtraTileData != ExtraTileData.None) { return; } if (e.Tile.Type == TileType.Mine) { this.GameOver(e.X, e.Y); } else { this.revealSurroundingTiles(new List <Point <int> >(1) { new Point <int>(e.X, e.Y) }); this.HoverTile = TileBoardViewModelBase.EmptyPoint; } if (!this.boardInitialized && this.CanInteractWithBoard()) { this.boardInitialized = true; this.Mediator.Notify(ViewModelMessages.GameStarted); } }
private void CheckFlagCountAndSurroundingTiles(TileEventArgs e) { var surroundingTiles = this.GetSurroundingTiles(e.X, e.Y); var flaggedTiles = (from tilePoint in surroundingTiles let tile = this.Minesweeper.Tiles[tilePoint.X, tilePoint.Y] where (!tile.Shown) && (tile.ExtraTileData == ExtraTileData.Flag) select tilePoint).ToList(); var mineCount = e.Tile.Type.Value; if (flaggedTiles.Count == mineCount) { foreach (var tile in flaggedTiles) { if (this.Minesweeper.Tiles[tile.X, tile.Y].Type != TileType.Mine) { this.GameOver(e.X, e.Y); return; } } var tilesToCheck = new List<Point<int>>(); foreach (var tilePoint in surroundingTiles) { var tile = this.Minesweeper.Tiles[tilePoint.X, tilePoint.Y]; if (tile.Type == TileType.Unset && !tile.Shown && tile.ExtraTileData != ExtraTileData.Flag) { tilesToCheck.Add(tilePoint); } } if (tilesToCheck.Count > 0) { this.revealSurroundingTiles(tilesToCheck); } } }
private void TileTapRightDown(TileEventArgs e) { if (!this.boardInitialized) { return; } if (!e.Tile.Shown) { if (e.Tile.ExtraTileData == ExtraTileData.None) { this.SetTile(e.X, e.Y, new Tile(e.Tile.Type, e.Tile.Shown, ExtraTileData.Flag)); this.Minesweeper.MinesRemaining--; this.GameStatistics[Statistic.FlagsPlaced] = (int)this.GameStatistics[Statistic.FlagsPlaced] + 1; } else if (e.Tile.ExtraTileData == ExtraTileData.Flag) { this.SetTile( e.X, e.Y, new Tile( e.Tile.Type, e.Tile.Shown, (this.areQuestionMarksEnabled) ? ExtraTileData.QuestionMark : ExtraTileData.None)); this.Minesweeper.MinesRemaining++; this.GameStatistics[Statistic.FlagsPlaced] = (int)this.GameStatistics[Statistic.FlagsPlaced] - 1; } else // ExtraTileData.QuestionMark { this.SetTile(e.X, e.Y, new Tile(e.Tile.Type, e.Tile.Shown, ExtraTileData.None)); } this.TilesToUpdate = AnimatedTilesCollection.Create(new List <Point <int> >(1) { new Point <int>(e.X, e.Y) }); } }
private void CheckFlagCountAndSurroundingTiles(TileEventArgs e) { var surroundingTiles = this.GetSurroundingTiles(e.X, e.Y); var flaggedTiles = (from tilePoint in surroundingTiles let tile = this.Minesweeper.Tiles[tilePoint.X, tilePoint.Y] where (!tile.Shown) && (tile.ExtraTileData == ExtraTileData.Flag) select tilePoint).ToList(); var mineCount = e.Tile.Type.Value; if (flaggedTiles.Count == mineCount) { foreach (var tile in flaggedTiles) { if (this.Minesweeper.Tiles[tile.X, tile.Y].Type != TileType.Mine) { this.GameOver(e.X, e.Y); return; } } var tilesToCheck = new List <Point <int> >(); foreach (var tilePoint in surroundingTiles) { var tile = this.Minesweeper.Tiles[tilePoint.X, tilePoint.Y]; if (tile.Type == TileType.Unset && !tile.Shown && tile.ExtraTileData != ExtraTileData.Flag) { tilesToCheck.Add(tilePoint); } } if (tilesToCheck.Count > 0) { this.revealSurroundingTiles(tilesToCheck); } } }
private void OnTileChanged(object sender, TileEventArgs args) { if (tileGameObjectMap.ContainsKey(args.Tile) == false) { return; } GameObject tileGameObject = tileGameObjectMap[args.Tile]; if (tileGameObject == null) { return; } if (args.Tile.Type == TileType.Empty) { tileGameObject.SetActive(false); return; } tileGameObject.SetActive(true); tileGameObject.GetComponent <SpriteRenderer>().sprite = SpriteManager.Get("Tile", GetSpriteNameForTile(args.Tile)); }
private void OnTileUnchecked(object sender, TileEventArgs e) { checkedItems--; //_exportImage.Visible = checkedItems > 0; }
private void TileTapLeftDown(TileEventArgs e) { this.IsTilePressed = true; }
private void TileSelected(object sender, TileEventArgs e) { _selectedTile = e.Tile; _annotations.Clear(); if (_selectedTile != null) { TileCoord location = _tileLayer.TileToCoord(e.Tile); int x = location.X * _tileSet.TileWidth; int y = location.Y * _tileSet.TileHeight; SelectionAnnot annot = new SelectionAnnot() { Start = new Treefrog.Framework.Imaging.Point(x, y), End = new Treefrog.Framework.Imaging.Point(x + _tileSet.TileWidth, y + _tileSet.TileHeight), Fill = new SolidColorBrush(new Treefrog.Framework.Imaging.Color(192, 0, 0, 128)), }; _annotations.Add(annot); } OnSelectedTileChanged(EventArgs.Empty); }
private void TilePoolTileRemoved(object sender, TileEventArgs e) { if (_selectedTile == e.Tile) SelectTile(null); }
private void LeftRightDown(TileEventArgs e) { this.leftAndRightMouseDown = true; if (e.Tile.Type == TileType.EmptySpace) { return; } this.SelectSurroundingTiles(e); }
private void OnValidMove(object sender, TileEventArgs tilesInfo) { this.view.Tiles[tilesInfo.FirstTileX, tilesInfo.FirstTileY] = tilesInfo.SecondTileTypeIndex; this.view.Tiles[tilesInfo.SecondTileX, tilesInfo.SecondTileY] = tilesInfo.FirstTileTypeIndex; this.view.DrawGameBoard(); }
private void OnTileUnchecked(object sender, TileEventArgs e) { Console.WriteLine(checkedItems); checkedItems--; exportImage.Visible = checkedItems > 0; }
/// <summary> /// Force a tile redraw when the cursor enters a tile /// </summary> private void PlugIn1_TileMouseEnter(object sender, TileEventArgs ea) { ea.Tile.Invalidate(); }
/// <summary> /// Force a redraw when the cursor leaves. Also clean up anythine we were doing with the tile /// </summary> private void PlugIn1_TileMouseLeave(object sender, TileEventArgs ea) { ea.Tile.Invalidate(); _hoveredTest = null; if(CodeRush.SmartTags.IsSmartTagVisible) { CodeRush.SmartTags.HidePopupMenu(); } }
protected virtual void OnTileSelected(TileEventArgs e) { var ev = TileSelected; if (ev != null) ev(this, e); }
private void SelectSurroundingTiles(TileEventArgs e) { var tiles = (from tilePoint in this.GetSurroundingTiles(e.X, e.Y) let tile = this.Minesweeper.Tiles[tilePoint.X, tilePoint.Y] where (!tile.Shown) && (tile.ExtraTileData == ExtraTileData.None) select tilePoint).ToList(); this.SelectedTiles = tiles.Count > 0 ? AnimatedTilesCollection.Create(tiles) : null; }
private void OnTileChecked(object sender, TileEventArgs e) { checkedItems++; exportImage.Visible = true; }
private void TileTapRightUp(TileEventArgs e) { if (this.leftAndRightMouseDown) { this.CheckFlagCountAndSurroundingTiles(e); } }
private void OnTileHover(TileEventArgs e) { if (this.leftMouseDown && Mouse.LeftButton != MouseButtonState.Pressed) { this.IsTilePressed = false; } if (e.X < 0 || e.Y < 0) { this.HoverTile = TileBoardViewModelBase.EmptyPoint; return; } if (!e.Tile.Shown) { this.SelectedTiles = null; if (this.leftMouseDown && e.Tile.ExtraTileData != ExtraTileData.None) { this.HoverTile = TileBoardViewModelBase.EmptyPoint; } else { this.HoverTile = new Point<int>(e.X, e.Y); } } else { this.HoverTile = TileBoardViewModelBase.EmptyPoint; if (this.SelectedTiles != null) { this.SelectSurroundingTiles(e); } } }
private void TileTapRightDown(TileEventArgs e) { if (!this.boardInitialized) { return; } if (!e.Tile.Shown) { if (e.Tile.ExtraTileData == ExtraTileData.None) { this.SetTile(e.X, e.Y, new Tile(e.Tile.Type, e.Tile.Shown, ExtraTileData.Flag)); this.Minesweeper.MinesRemaining--; this.GameStatistics[Statistic.FlagsPlaced] = (int)this.GameStatistics[Statistic.FlagsPlaced] + 1; } else if (e.Tile.ExtraTileData == ExtraTileData.Flag) { this.SetTile( e.X, e.Y, new Tile( e.Tile.Type, e.Tile.Shown, (this.areQuestionMarksEnabled) ? ExtraTileData.QuestionMark : ExtraTileData.None)); this.Minesweeper.MinesRemaining++; this.GameStatistics[Statistic.FlagsPlaced] = (int)this.GameStatistics[Statistic.FlagsPlaced] - 1; } else // ExtraTileData.QuestionMark { this.SetTile(e.X, e.Y, new Tile(e.Tile.Type, e.Tile.Shown, ExtraTileData.None)); } this.TilesToUpdate = AnimatedTilesCollection.Create(new List<Point<int>>(1) {new Point<int>(e.X, e.Y)}); } }
private void LeftDoubleClicked(TileEventArgs e) { if (!e.Tile.Shown || !e.Tile.Type.IsNumber()) { return; } this.CheckFlagCountAndSurroundingTiles(e); }
private async void TileTapLeftUp(TileEventArgs e) { this.IsTilePressed = false; if (!this.leftMouseDown) { return; } this.leftMouseDown = false; if (!this.boardInitialized) { await Task.Run(() => this.GenerateMinefield(e.X, e.Y)); this.GameStatistics[Statistic.GameStartTime] = DateTime.Now; } if (this.leftAndRightMouseDown) { this.CheckFlagCountAndSurroundingTiles(e); this.HoverTile = TileBoardViewModelBase.EmptyPoint; return; } if (e.Tile.Shown || e.Tile.ExtraTileData != ExtraTileData.None) { return; } if (e.Tile.Type == TileType.Mine) { this.GameOver(e.X, e.Y); } else { this.revealSurroundingTiles(new List<Point<int>>(1) {new Point<int>(e.X, e.Y)}); this.HoverTile = TileBoardViewModelBase.EmptyPoint; } if (!this.boardInitialized && this.CanInteractWithBoard()) { this.boardInitialized = true; this.Mediator.Notify(ViewModelMessages.GameStarted); } }