public void Initialize() { int LeftStart = (int)(0.05 * Game.ScreenSize.X); int YLevel = (int)(0.1 * Game.ScreenSize.Y); int i = 0; foreach (string f in Directory.GetFiles(GameSaveHandler.PathDirectory)) { GameSave save = GameSaveHandler.RetrieveGameSave(Path.GetFileName(f)); string gClass; try { gClass = save.player.Class.GetType().Name; } catch (Exception e) { gClass = "UNKNOWN"; } string DisplayText = Path.GetFileName(f) + " : " + gClass; Vector2 DisplaySize = Game.GameContent.Load <SpriteFont>(TextureHelper.Fonts.Default).MeasureString(DisplayText); saves.Add(new MenuItem(new Rectangle(LeftStart, (++i) * YLevel, (int)DisplaySize.X, (int)DisplaySize.Y), text: DisplayText) { Action = () => { GameSaveHandler.LoadSave(Path.GetFileName(f)); } }); } saves.Add(new MenuItem( new Rectangle(new Point(LeftStart, ++i * YLevel), new Point((int)(0.13 * Game.ScreenSize.X), (int)(0.05 * Game.ScreenSize.Y))), Game.GameContent.Load <Texture2D>(TextureHelper.Sprites.EnemySprite), "Back") { Action = () => { MenuHandler.ActiveFullScreenMenu = new GameStartMenu(); } }); }
public void Initialize() { player = new PlayerController(new PlayerManager()); // Caster Class Button menuItems.Add(new MenuItem( new Rectangle(new Point(LeftStart, (int)(0.3 * Game.ScreenSize.Y)), IconSize), Game.GameContent.Load <Texture2D>(PlayerManager.basePlayerSpriteName), "Caster") { Action = () => { targetClass = new Caster(); } }); // Knight Class Button menuItems.Add(new MenuItem( new Rectangle(new Point(LeftStart, (int)(0.4 * Game.ScreenSize.Y)), IconSize), Game.GameContent.Load <Texture2D>(PlayerManager.jumpingDPlayerSprite), "Knight") { Action = () => { targetClass = new Knight(); } }); // Rogue Class Button menuItems.Add(new MenuItem( new Rectangle(new Point(LeftStart, (int)(0.6 * Game.ScreenSize.Y)), IconSize), Game.GameContent.Load <Texture2D>(PlayerManager.movingPlayerSprite), "Rogue") { Action = () => { targetClass = new Rogue(); } }); // Create Save Button menuItems.Add(new MenuItem( new Rectangle(new Point(LeftStart, (int)(0.7 * Game.ScreenSize.Y)), IconSize), Game.GameContent.Load <Texture2D>(TextureHelper.Sprites.TestImage), "Create Save") { Action = () => { string saveID = GameSaveHandler.GetNextSaveID().ToString(); if (targetClass is Knight) { GameSaveHandler.CreateSave(saveID, player, new Vector2(100, 100), new CathedralRuinsFBoss(), targetClass, new Flight()); } else if (targetClass is Caster) { GameSaveHandler.CreateSave(saveID, player, new Vector2(100, 100), new CathedralRuinsFBoss(), targetClass, new Iythil()); } else if (targetClass is Rogue) { GameSaveHandler.CreateSave(saveID, player, new Vector2(100, 100), new CathedralRuinsFBoss(), targetClass, new BasicDagger()); } else { Errors = "Choose a class!"; return; } GameSaveHandler.LoadSave(saveID); } }); // Back Button menuItems.Add(new MenuItem( new Rectangle(new Point(LeftStart, (int)(0.8 * Game.ScreenSize.Y)), IconSize), Game.GameContent.Load <Texture2D>(TextureHelper.Sprites.EnemySprite), "Back") { Action = () => { MenuHandler.ActiveFullScreenMenu = new GameStartMenu(); } }); }