private void OnMouseClickWorldGen(Control control, InterfaceArgs args) { //dispose of this screen this.ScreenManager.removeScreen(this); //load the world screen //LoadingScreen.Load(this.ScreenManager, true, new WorldScreen()); NewLoadingScreen.Load(this.ScreenManager, true, new WorldScreen()); }
private void OnMouseClickNewGame(Control control, InterfaceArgs args) { //dispose of this screen this.ScreenManager.removeScreen(this); //setup new game parameters object[] parameters = new object[GameScreen.GAMESCREEN_PARAM_SIZE]; parameters [GameScreen.GAMESCREEN_SEED] = GameConfig.StartDefs.Seed; parameters [GameScreen.GAMESCREEN_SKILLLEVEL] = GameConfig.StartDefs.SkillLevel; parameters [GameScreen.GAMESCREEN_RETURNING] = false; parameters [GameScreen.GAMESCREEN_LAST_PLAYER_POSITION] = null; //load the world screen NewLoadingScreen.Load(this.ScreenManager, true, new GameScreen(true, GameConfig.StartDefs.MapType, parameters)); }
/// <summary> /// handles all screen related input /// </summary> public override void hasFocusUpdate(GameTime gameTime) { base.hasFocusUpdate(gameTime); //check to see if escape was recently pressed if (InputManager.isKeyToggled(Keys.Escape)) { this.ScreenManager.removeScreen(this); NewLoadingScreen.Load(this.ScreenManager, false, new StartScreen()); } if (InputManager.isKeyToggled(Keys.R)) { this.ScreenManager.removeScreen(this); NewLoadingScreen.Load(this.ScreenManager, true, new WorldScreen()); } if (InputManager.isKeyPressed(Keys.Up)) { w_MapEngine.ViewPort.Origin.Y -= MOVE_VALUE; w_ViewPort.Origin.Y -= MOVE_VALUE; UpdateView(); } if (InputManager.isKeyPressed(Keys.Down)) { w_MapEngine.ViewPort.Origin.Y += MOVE_VALUE; w_ViewPort.Origin.Y += MOVE_VALUE; UpdateView(); } if (InputManager.isKeyPressed(Keys.Left)) { w_MapEngine.ViewPort.Origin.X -= MOVE_VALUE; w_ViewPort.Origin.X -= MOVE_VALUE; UpdateView(); } if (InputManager.isKeyPressed(Keys.Right)) { w_MapEngine.ViewPort.Origin.X += MOVE_VALUE; w_ViewPort.Origin.X += MOVE_VALUE; UpdateView(); } if (InputManager.isKeyToggled(Keys.Tab)) { InputManager.YesScreenshot = true; } if (InputManager.isKeyToggled(Keys.T)) { if (!w_MapEngine.ShowTemperature) { w_MapEngine.ShowTemperature = true; w_MapEngine.ShowPrecipitation = false; } else { w_MapEngine.ShowTemperature = false; } } if (InputManager.isKeyToggled(Keys.P)) { if (!w_MapEngine.ShowPrecipitation) { w_MapEngine.ShowPrecipitation = true; w_MapEngine.ShowTemperature = false; } else { w_MapEngine.ShowPrecipitation = false; } } // if (InputManager.isKeyToggled(Keys.PrintScreen)) // { // w_MapEngine.YesScreenshot = true; // } }
public override void hasFocusUpdate(GameTime gameTime) { base.hasFocusUpdate(gameTime); //check to see if escape was recently pressed if (InputManager.isKeyToggled(Keys.Escape)) { this.ScreenManager.removeScreen(this); NewLoadingScreen.Load(this.ScreenManager, false, new StartScreen()); } if (InputManager.isKeyToggled(Keys.Enter)) { Console.Out.WriteLine("CHANGING LEVEL..."); //set skill level Skills skills = new Skills(); int skilllevel = ((Skills)ecsInstance.component_manager.get_component(player, skills.getTypeId())).Ranged.Value; //set seed Position pos = new Position(); pos = (Position)ecsInstance.component_manager.get_component(player, pos.getTypeId()); int x = (int)(pos.Pos.X + pos.Offset.X) / 32; int y = (int)(pos.Pos.Y + pos.Offset.Y) / 32; /* WILL HELP DETECT ENTRANCES LATER * if (map.Map.Terrain[x,y].TerrainType != TerrainType.CAVE_ENTRANCE) * return; */ mapState.LastPlayerPosition = pos; GameSession.MapStack.Push(mapState); //setup the parameters for the new zone object[] parameters = new object[GameScreen.GAMESCREEN_PARAM_SIZE]; parameters[GameScreen.GAMESCREEN_SEED] = x * y + x + y + (int)g_Parameters[GAMESCREEN_SEED]; parameters[GameScreen.GAMESCREEN_SKILLLEVEL] = mapState.SkillLevel + 5;//skilllevel + 5; parameters[GameScreen.GAMESCREEN_RETURNING] = false; parameters[GameScreen.GAMESCREEN_LAST_PLAYER_POSITION] = null; this.ScreenManager.removeScreen(this); if ((int)parameters[GameScreen.GAMESCREEN_SEED] % 2 == 0) { NewLoadingScreen.Load(this.ScreenManager, false, new GameScreen(false, MapType.CAVE, parameters)); } else { NewLoadingScreen.Load(this.ScreenManager, false, new GameScreen(false, MapType.DUNGEON, parameters)); } } //return to previous map if (InputManager.isKeyToggled(Keys.F12)) { if (GameSession.MapStack.Count == 0) { return; } MapState state = GameSession.MapStack.Pop(); //setup the parameters for the previous zone object[] parameters = new object[GameScreen.GAMESCREEN_PARAM_SIZE]; parameters[GameScreen.GAMESCREEN_SEED] = state.Seed; parameters[GameScreen.GAMESCREEN_SKILLLEVEL] = state.SkillLevel; parameters[GameScreen.GAMESCREEN_RETURNING] = true; parameters[GameScreen.GAMESCREEN_LAST_PLAYER_POSITION] = state.LastPlayerPosition; this.ScreenManager.removeScreen(this); NewLoadingScreen.Load(this.ScreenManager, true, new GameScreen(false, state.MapType, parameters)); } if (InputManager.isKeyToggled(Keys.F6)) { string json = g_JsonManager.objToJsonString(g_Map); g_JsonManager.saveJSON("./map_" + g_Parameters[GAMESCREEN_SEED] + ".v", json); json = g_JsonManager.objToJsonString(GameSession.PlayerState); g_JsonManager.saveJSON("./player.v", json); } if (PLAYER_IS_DEAD) { GameScreen.PLAYER_IS_DEAD = false; this.ScreenManager.removeScreen(this); NewLoadingScreen.Load(this.ScreenManager, false, new StartScreen()); } }