Пример #1
0
 public ClickMenu(Town town, Location location, Tile tile, Entity entity)
 {
     this.town = town;
     this.location = location;
     this.tile = tile;
     this.entity = entity;
     InitializeComponent();
 }
Пример #2
0
 public Tile getTileAt(Location loc)
 {
     foreach(Tile tile in tiles)
     {
         if(tile.getLocation() == loc)
         {
             return tile;
         }
     }
     return null;
 }
Пример #3
0
 public Entity getEntityAt(Location loc)
 {
     foreach (Entity entity in entities)
     {
         if (entity.location == loc)
         {
             return entity;
         }
     }
     return null;
 }
Пример #4
0
 public void handleClick(Point point)
 {
     Location location = new Location(point.X, point.Y);
     Location loc = town.getLocationOnGrid(location);
     while (true) {
         Tile tile = town.getTileAt(loc);
         Entity entity = town.getEntityAt(loc);
         ClickMenu menu = new ClickMenu(town, loc, tile, entity);
         menu.Location = board.PointToScreen(point);
         if (Screen.AllScreens[1].Bounds.Right < menu.Location.X + menu.Width)
         {
             menu.Location = new Point(menu.Location.X - menu.Width, menu.Location.Y);
         }
         if (Screen.AllScreens[1].Bounds.Bottom < menu.Location.Y + menu.Height)
         {
             menu.Location = new Point(menu.Location.X, menu.Location.Y - menu.Height);
         }
         menu.ShowDialog();
         if(menu.DialogResult == DialogResult.Cancel){
             break;
         }
     }
 }
Пример #5
0
 public Location getLocationOnGrid(Location location)
 {
     return new Location(location.x / gridSize * gridSize, location.y / gridSize * gridSize);
 }
Пример #6
0
 public Tile(Location location, TileType type)
 {
     this.location = location;
     this.type = type;
 }