public void LoadWorld() { if (World != null) { Stream stream = new MemoryStream(); GameData.DumpGame(World , new BinaryOutput(stream)); stream.Seek(0, SeekOrigin.Begin); this.Data = GameData.ReadGame(this.GraphicsDevice, new BinaryInput(stream)); stream.Flush(); stream.Close(); } this.Scene = new MenuScene(this.Data, this.SpriteBatch); }
public MenuScene(GameData data, SpriteBatch spriteBatch) { this.SpriteBatch = spriteBatch; MenuState = MenuState.PressToStart; Boxes = new List<BoxInfo>(); foreach (PlayerData playerData in data.Saves) { Boxes.Add(new BoxInfo("player '" + playerData.Name + "'", true)); } Boxes.Add(new BoxInfo("correct:\ndid the cat escape\nthe old lady?", true)); Boxes.Add(new BoxInfo("so\nvery fun time lots?", true)); Boxes.Add(new BoxInfo("teststs", true)); }
public GameScene(GameData data, SpriteBatch SpriteBatch) { this.SpriteBatch = SpriteBatch; this.UIManager = new UIManager(); this.Data = data; World = Data.RegionData.CreateWorld(this, SpriteBatch.GraphicsDevice); World.Maps.Add(Data.MapDatas[0].CreateMap(World)); EntityTemplate templatePlayer = World.EntityContainer.GetPlayers()[0]; Player = templatePlayer.CreateEntity(World.EntityFactory, true) as PlayerEntity; World.Player = Player; World.Maps[0].AddEntity(Player); new LivingController(Player); World.CurrentMap = Player.Map; this.SceneState = SceneState.Alive; }
public static GameData ReadGame(GraphicsDevice graphicsDevice, BinaryInput input) { GameData result = new GameData(); input.GraphicsDevice = graphicsDevice; result.RegionData = new RegionData(); result.RegionData.Decode(input); int c = input.ReadInt32(); for (int i = 0; i < c; i++) { MapData data = new MapData(); data.Decode(input); result.MapDatas.Add(data); } return result; }
public void LoadWorld(World GameDumpWorld, string GameDumpLocation) { if (GameDumpWorld == null && GameDumpLocation == null) return; if (GameDumpWorld != null) { Stream stream = new MemoryStream(); GameData.DumpGame(GameDumpWorld, new BinaryOutput(stream)); stream.Seek(0, SeekOrigin.Begin); this.Data = GameData.ReadGame(this.GraphicsDevice, new BinaryInput(stream)); stream.Flush(); stream.Close(); } else { if (!string.IsNullOrEmpty(GameDumpLocation)) { this.Data = GameData.ReadGame(this.GraphicsDevice, GameDumpLocation); } else { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Filter = "PokeSharp Game Dump (*.psg)|*.psg"; if (dialog.ShowDialog() == DialogResult.OK) { this.Data = GameData.ReadGame(this.GraphicsDevice, GameDumpLocation); } else { Environment.Exit(0); } } } } }
public void ClearWorld() { this.Data = null; this.Scene = null; }