Пример #1
0
 private void ClosePopups()
 {
     if (_chestPopup != null)
     {
         _chestPopup.IsOpen = false;
         _chestPopup = null;
     }
     if (_signPopup != null)
     {
         _signPopup.IsOpen = false;
         _signPopup = null;
     }
 }
Пример #2
0
        public override bool ReleaseTool(TileMouseEventArgs e)
        {
            ClosePopups();

            // From Terrafirma
            foreach (Chest c in _world.Chests)
            {
                //chests are 2x2, and their x/y is upper left corner
                if ((c.Location.X == e.Tile.X || c.Location.X + 1 == e.Tile.X) &&
                    (c.Location.Y == e.Tile.Y || c.Location.Y + 1 == e.Tile.Y))
                {
                    _chestPopup = new ChestEditorPopup(c);
                    _chestPopup.IsOpen = true;
                }
            }
            foreach (Sign s in _world.Signs)
            {
                //signs are 2x2, and their x/y is upper left corner
                if ((s.Location.X == e.Tile.X || s.Location.X + 1 == e.Tile.X) && (s.Location.Y == e.Tile.Y || s.Location.Y + 1 == e.Tile.Y))
                {
                    _signPopup = new SignPopup(s);
                    _signPopup.IsOpen = true;
                }
            }
            return false;
        }