Exemplo n.º 1
0
        public void OverwriteLevel(bool Choice)
        {
            this.IsFinished = true;
            if (Choice)
            {
                CustomLevelButton oldData = null;
                foreach (CustomLevelButton customLevelButton in LevelButton.lvButtonList)
                {
                    if (customLevelButton != Level.CurrentLevelButton &&                  // Don't compare the button with itself
                        customLevelButton.Name == Level.CurrentLevelButton.Name)                            // If the level name already exists
                    {
                        oldData = customLevelButton;
                        break;
                    }
                }
                LevelButton.lvButtonList.Remove(oldData);

                LevelSaver.SaveMap();
            }
        }
Exemplo n.º 2
0
 private static bool Save()
 {
     if (TextInput.TextInputList[0].Text.Length == 0)
     {
         MessageBox.StatusMessage = new MessageBox("Level must have a name!", new Microsoft.Xna.Framework.Vector2(217, 190), 120);
         return(false);
     }
     foreach (CustomLevelButton customLevelButton in LevelButton.lvButtonList)
     {
         if (customLevelButton != Level.CurrentLevelButton &&              // Don't compare the button with itself
             customLevelButton.Name == TextInput.TextInputList[0].Text)                        // If the level name already exists
         {
             MainMethod.popupBox = new PopupBox(new string[] {
                 "This filename already exists",
                 "This will overwrite the existing level",
                 "Really overwrite the old data?"
             }, PopupType.OVERWRITE_LEVEL);
             return(false);
         }
     }
     return(LevelSaver.SaveMap());
 }