/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void PlayButton_Selected(object sender, EventArgs e) { if (Heroes.Any(hero => hero == null)) return; var screen = new GameScreen(); // Generate the team GameSettings.SaveGameName = string.Empty; Team gsteam = new Team(); for (int i = 0; i < 4; i++) gsteam.AddHero(Heroes[i], (HeroPosition)i); screen.NewGame(gsteam); ScreenManager.AddScreen(screen); ExitScreen(); }
/// <summary> /// Create a game with new team and the default dungeon /// </summary> /// <param name="theteam">the team</param> public void NewGame(Team theteam) { NewGame(theteam, null); }
/// <summary> /// Loads a saved game /// </summary> /// <param name="slotid">Slot id to load</param> /// <returns>True on success</returns> public bool LoadGameSlot(int slotid) { SaveGameSlot slot = GameSettings.SavedGames.Slots[slotid]; if (slot == null) { Trace.WriteLine("[GameScreen]LoadGameSlot() : Slot " + slotid + " empty !"); return false; } // Load dungeon if (Dungeon != null) Dungeon.Dispose(); else Dungeon = new Dungeon(); // If Shift key is down, create a new dungeon (DEBUG) if (slot.Dungeon == null || Keyboard.IsKeyPress(Keys.ShiftKey)) Dungeon = ResourceManager.CreateAsset<Dungeon>(GameSettings.SavedGames.DungeonName); else Dungeon.Load(slot.Dungeon); Dungeon.Init(); // Load team if (Team != null) Team.Dispose(); else Team = new Team(); Team.Load(slot.Team); Team.Init(); GameMessage.AddMessage("Party loaded...", GameColors.Yellow); return true; }
/// <summary> /// Create a game with new team and new dungeon /// </summary> /// <param name="theteam">the team</param> /// <param name="thedungeon">the dungeon or null to start default one</param> public void NewGame(Team theteam, Dungeon thedungeon) { if (theteam == null) throw new ArgumentNullException("theteam"); // Load dungeon if (Dungeon != null) Dungeon.Dispose(); Dungeon = thedungeon ?? ResourceManager.CreateAsset<Dungeon>("EOB_2"); Dungeon.Init(); // Load team if (Team != null) Team.Dispose(); Team = theteam; Team.Init(); GameMessage.Clear(); GameMessage.AddMessage("New party starting...", GameColors.Yellow); }