Esempio n. 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();
 }
Esempio n. 2
0
 public Tile getTileAt(Location loc)
 {
     foreach(Tile tile in tiles)
     {
         if(tile.getLocation() == loc)
         {
             return tile;
         }
     }
     return null;
 }
Esempio n. 3
0
 public Entity getEntityAt(Location loc)
 {
     foreach (Entity entity in entities)
     {
         if (entity.location == loc)
         {
             return entity;
         }
     }
     return null;
 }
Esempio n. 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;
         }
     }
 }
Esempio n. 5
0
 public Location getLocationOnGrid(Location location)
 {
     return new Location(location.x / gridSize * gridSize, location.y / gridSize * gridSize);
 }
Esempio n. 6
0
 public Tile(Location location, TileType type)
 {
     this.location = location;
     this.type = type;
 }