Exemple #1
0
 private void EditMap(string name)
 {
     foreach (Entity e in tempTiles)
     {
         tiles.Add(e);
     }
     testLevel = null;
     tempTiles.Clear();
 }
Exemple #2
0
 private void clickMenuItem()
 {
     bool isOverButton = false;
     int menuTileIndex = 0;
     for (int i = 0; i < menu.tiles.Count; i++)
     {
         if (isWithin(cursorPos, menu.tiles[i].boundary))
         {
             menuTileIndex = i;
             isOverButton = true;
             break;
         }
     }
     for (int i = 0; i < menu.buttons.Count; i++)
     {
         if (isWithin(cursorPos, menu.buttons[i].boundary))
         {
             switch (menu.buttons[i].text)
             {
                 case "Play Map":
                     foreach (Entity e in tiles)
                     {
                         tempTiles.Add(e);
                     }
                     Save(true);
                     tiles.Clear();
                     testLevel = new Level("serializeTest.xml");
                     menu.buttons[i].text = "Edit Map";
                     break;
                 case "Save Map":
                     Save(false);
                     break;
                 default:
                     break;
             }
             isOverButton = true;
             break;
         }
     }
     if (isWithin(cursorPos, menu.position, menu.background) && !isOverButton)
     {
         if (menu.isHidden) menu.isHidden = false;
         else menu.isHidden = true;
     }
     else if (isOverButton)
     {
         Vector2 v = new Vector2(replacement.boundary.X, replacement.boundary.Y);
         if (menu.tiles[menuTileIndex] is Player) replacement = ((Player)menu.tiles[menuTileIndex]).Copy(v);
         else if (menu.tiles[menuTileIndex] is Tile) replacement = ((Tile)menu.tiles[menuTileIndex]).Copy(v);
     }
     highlightSelection = true;
 }