static public void Update(List <Actions.ActionKey> keys) { if (Game1.bIsDebug) { if (!KeyboardMouseUtility.AnyButtonsPressed() && keys.Count != 0 && keys[0].actionIndentifierString.Equals(Game1.cameraMoveLeftString)) { SceneUtility.currentScene = (int)Game1.Screens.Editor; StartScreen.bIsRunning = false; } } if (keys.Count != 0) { switch (sc.currentScreen) { case StartScreen.Screens.start: StandardControlsStart(keys[0]); break; case StartScreen.Screens.load: StandardControlsLoad(keys[0]); break; default: break; } } }
private static void LootScreenKeys(ActionKey key) { if (key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) { LootScreen.HandleConfirmPress(); } }
static public void Update(List <ActionKey> keys) { if (!ScriptProcessor.bIsRunning) { Stop(); } if (keys.Count != 0) { ActionKey actionKey = keys[0]; switch (ScriptProcessor.currentDisplayMode) { case (int)ScriptProcessor.ActiveScriptDisplayMode.Text: if (!KeyboardMouseUtility.AnyButtonsPressed() && (actionKey.actionIndentifierString.Equals(Game1.confirmString) || actionKey.actionIndentifierString.Equals(Game1.openMenuString))) { ScriptProcessor.ConversationTextConfirmHandle(); } break; case (int)ScriptProcessor.ActiveScriptDisplayMode.Choice: if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.confirmString) && KeyboardMouseUtility.bMouseButtonPressed) { ScriptProcessor.ChoiceHandleMouseClick(); } if (!KeyboardMouseUtility.AnyButtonsPressed() && (actionKey.actionIndentifierString.Equals(Game1.confirmString) || actionKey.actionIndentifierString.Equals(Game1.openMenuString))) { ScriptProcessor.HandleChoiceConfirmButton(); } if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveUpString)) { ScriptProcessor.HandleChoiceMoveUp(); } if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveDownString)) { ScriptProcessor.HandleChoiceMoveDown(); } break; case (int)ScriptProcessor.ActiveScriptDisplayMode.Conversation: if (!KeyboardMouseUtility.AnyButtonsPressed() && (actionKey.actionIndentifierString.Equals(Game1.confirmString) || actionKey.actionIndentifierString.Equals(Game1.openMenuString))) { ScriptProcessor.ConversationTextConfirmHandle(); } break; case (int)ScriptProcessor.ActiveScriptDisplayMode.None: break; default: break; } } }
private static void StandardControlsStart(ActionKey actionKey) { if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveDownString)) { if (sc.selectedButton == null) { sc.selectedButton = sc.mButtons.Last(); } int index = sc.mButtons.IndexOf(sc.selectedButton); if (++index >= sc.mButtons.Count) { index = 0; } sc.selectedButton = sc.mButtons[index]; } if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveUpString)) { if (sc.selectedButton == null) { sc.selectedButton = sc.mButtons[0]; } int index = sc.mButtons.IndexOf(sc.selectedButton); if (--index < 0) { index = sc.mButtons.Count - 1; } sc.selectedButton = sc.mButtons[index]; } if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.confirmString)) { if (sc.selectedButton == sc.mButtons[0]) { sc.NewGameButton(); } if (sc.selectedButton == sc.mButtons[1]) { sc.LoadGameButton(); } if (sc.selectedButton == sc.mButtons[2]) { sc.OptionsButton(); //Game1.gameRef.Run(); } if (sc.selectedButton == sc.mButtons[3]) { Game1.gameRef.Exit(); Game1.gameRef.Dispose(); //Game1.gameRef.Run(); } } }
public static void Update() { CombatCtrl.selectedChar = selectedChar; if (Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed()) { selectedChar = CombatProcessor.heroCharacters.Find(c => c.spriteGameSize.Contains(GameProcessor.EditorCursorPos)); secondaryChar = null; } if (selectedChar != null) { if (Mouse.GetState().RightButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed()) { secondaryChar = CombatProcessor.heroCharacters.Find(c => c.spriteGameSize.Contains(GameProcessor.EditorCursorPos)); Vector2 temp = new Vector2(-1); if (availableTiles.Find(t => t.mapPosition.Contains(GameProcessor.EditorCursorPos)) != null) { temp = (GameProcessor.EditorCursorPos / 64).ToPoint().ToVector2() * 64; } if (secondaryChar != null) { temp = secondaryChar.position; } if (temp != new Vector2(-1)) { /* * if (secondaryChar != null) * { * secondaryChar.position = selectedChar.position; * } * * selectedChar.position = temp;*/ if (CombatProcessor.zone.Contains(GameProcessor.EditorCursorPos) && !PathMoveHandler.bIsBusy) { // allPossibleNodes = PathFinder.NewPathSearch(PlayerController.selectedSprite.position, GameProcessor.EditorCursorPos, zoneTiles); CombatProcessor.allPossibleNodes = PathFinder.NewPathSearch(selectedChar.position, GameProcessor.EditorCursorPos, CombatProcessor.radiusTiles); PathMoveHandler.Start(selectedChar, CombatProcessor.allPossibleNodes); } else if (CombatProcessor.zone.Contains(GameProcessor.EditorCursorPos) && PathMoveHandler.bIsBusy) { PathMoveHandler.SkipPathMovement(); CombatProcessor.allPossibleNodes = PathFinder.NewPathSearch(selectedChar.position, GameProcessor.EditorCursorPos, CombatProcessor.radiusTiles); PathMoveHandler.Start(selectedChar, CombatProcessor.allPossibleNodes); } } } } }
static public void Update(List <ActionKey> keys) { ActionKey key = keys.Last(); if ((!KeyboardMouseUtility.AnyButtonsPressed()) && (key.actionIndentifierString.Equals(Game1.confirmString) || key.actionIndentifierString.Equals(Game1.openMenuString))) { SettingsMenu.HandleConfirmOrClick(); KeyboardMouseUtility.bPressed = true; } if ((!KeyboardMouseUtility.AnyButtonsPressed()) && (key.actionIndentifierString.Equals(Game1.moveDownString) || key.actionIndentifierString.Equals(Game1.cameraMoveDownString))) { SettingsMenu.HandleUpDown(true); KeyboardMouseUtility.bPressed = true; } if ((!KeyboardMouseUtility.AnyButtonsPressed()) && (key.actionIndentifierString.Equals(Game1.moveUpString) || key.actionIndentifierString.Equals(Game1.cameraMoveUpString))) { SettingsMenu.HandleUpDown(false); KeyboardMouseUtility.bPressed = true; } if ((!KeyboardMouseUtility.AnyButtonsPressed()) && (key.actionIndentifierString.Equals(Game1.moveLeftString) || key.actionIndentifierString.Equals(Game1.cameraMoveLeftString))) { SettingsMenu.HandleLeftRight(false); KeyboardMouseUtility.bPressed = true; } if ((!KeyboardMouseUtility.AnyButtonsPressed()) && (key.actionIndentifierString.Equals(Game1.moveRightString) || key.actionIndentifierString.Equals(Game1.cameraMoveRightString))) { SettingsMenu.HandleLeftRight(true); KeyboardMouseUtility.bPressed = true; } if ((!KeyboardMouseUtility.AnyButtonsPressed()) && (key.actionIndentifierString.Equals(Game1.cancelString) || key.actionIndentifierString.Equals(Game1.SettingsMenu))) { SettingsMenu.HandleCancel(); KeyboardMouseUtility.bPressed = true; } if (KeyboardMouseUtility.ScrollingDown()) { LoadFileTab.AddScrollOffSet(4.2f * 10); } if (KeyboardMouseUtility.ScrollingUp()) { LoadFileTab.AddScrollOffSet(-4.2f * 10); } }
private static bool StandardControlsLoad(ActionKey actionKey) { if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.cancelString)) { sc.CloseLoadScreen(); KeyboardMouseUtility.bPressed = true; return(false); } if (actionKey.actionIndentifierString.Equals(Game1.cameraMoveDownString)) { LoadFileTab.AddScrollOffSet(4.2f); } if (KeyboardMouseUtility.ScrollingDown()) { LoadFileTab.AddScrollOffSet(4.2f * 10); } if (actionKey.actionIndentifierString.Equals(Game1.cameraMoveUpString)) { LoadFileTab.AddScrollOffSet(-4.2f); } if (KeyboardMouseUtility.ScrollingUp()) { LoadFileTab.AddScrollOffSet(-4.2f * 10); } if (!KeyboardMouseUtility.AnyButtonsPressed() && (actionKey.actionIndentifierString.Equals(Game1.moveDownString))) { sc.lgs.HandleDown(); } if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveUpString)) { sc.lgs.HandleUp(); } if (!KeyboardMouseUtility.AnyButtonsPressed() && !KeyboardMouseUtility.bMouseButtonPressed && actionKey.actionIndentifierString.Equals(Game1.confirmString)) { sc.lgs.HandleConfirm(); } if (!KeyboardMouseUtility.AnyButtonsPressed() && KeyboardMouseUtility.bMouseButtonPressed && actionKey.actionIndentifierString.Equals(Game1.confirmString)) { sc.lgs.HandleMouseClick(); } return(false); }
private static void NoSpriteSelectedControls(ActionKey key) { int normalCameraSpeed = 3; if (EncounterInfo.currentTurn().bIsPlayerTurnSet&& !BattleGUI.bIsRunning) { if (KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed() && !PathMoveHandler.bIsBusy && EncounterInfo.currentTurn().selectedCharTurn == null && CombatProcessor.bMainCombat && !EncounterInfo.currentTurn().bPlayerMustSelectAction) { EncounterInfo.currentTurn().SelectCharacter(); KeyboardMouseUtility.bPressed = true; } if (KeyboardMouseUtility.bMouseButtonPressed && key.actionIndentifierString.Equals(Game1.cancelString) && !KeyboardMouseUtility.AnyButtonsPressed() && !PathMoveHandler.bIsBusy && EncounterInfo.currentTurn().selectedCharTurn == null && CombatProcessor.bMainCombat && !EncounterInfo.currentTurn().bPlayerMustSelectAction) { EncounterInfo.currentTurn().RightButtonPlayerAction(); KeyboardMouseUtility.bPressed = true; } if (key.actionIndentifierString.Equals(Game1.tabKeyString) && !KeyboardMouseUtility.AnyButtonsPressed() && !PathMoveHandler.bIsBusy && CombatProcessor.bMainCombat && !EncounterInfo.currentTurn().bPlayerMustSelectAction) { EncounterInfo.currentTurn().TabSelect(); } } if (EncounterInfo.currentTurn().selectedCharTurn == null) { if (key.actionIndentifierString.Equals(Game1.moveUpString) || key.actionIndentifierString.Equals(Game1.cameraMoveUpString)) { GameProcessor.sceneCamera.Y += (normalCameraSpeed / GameProcessor.zoom) * SettingsFile.speedModCamera; } if (key.actionIndentifierString.Equals(Game1.moveDownString) || key.actionIndentifierString.Equals(Game1.cameraMoveDownString)) { GameProcessor.sceneCamera.Y -= (normalCameraSpeed / GameProcessor.zoom) * SettingsFile.speedModCamera; } if (key.actionIndentifierString.Equals(Game1.moveLeftString) || key.actionIndentifierString.Equals(Game1.cameraMoveLeftString)) { GameProcessor.sceneCamera.X += (normalCameraSpeed / GameProcessor.zoom) * SettingsFile.speedModCamera; } if (key.actionIndentifierString.Equals(Game1.moveRightString) || key.actionIndentifierString.Equals(Game1.cameraMoveRightString)) { GameProcessor.sceneCamera.X -= (normalCameraSpeed / GameProcessor.zoom) * SettingsFile.speedModCamera; } } }
private static void FinalCheck(ActionKey actionKey) { if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.cancelString)) { GameProcessor.bInGameMenu = false; if (CombatProcessor.bIsRunning) { GameProcessor.DisableMenuStage(); PlayerController.currentController = PlayerController.Controllers.Combat; } else { PlayerController.currentController = PlayerController.Controllers.NonCombat; } } }
private static void GlobalControls(List <Actions.ActionKey> keys) { if (!BattleGUI.bIsRunning && !TurnSet.bSelectingArea && EncounterInfo.encounterGroups.Count != 0) { if (!KeyboardMouseUtility.AnyButtonsPressed() && EncounterInfo.currentTurn().bIsPlayerTurnSet&& KeyboardMouseUtility.bMouseButtonPressed && keys.Last().actionIndentifierString.Equals(Game1.confirmString)) { BattleGUI.HandleLowerTabSelect(); } } //if (keys[keys.Count - 1].actionIndentifierString.Equals(Game1.openMenuString) && !KeyboardMouseUtility.AnyButtonsPressed() && !BattleGUI.bIsRunning && EncounterInfo.currentTurn().bIsPlayerTurnSet) //{ // GameProcessor.bInGameMenu = true; // GameMenuHandler.Start(); // KeyboardMouseUtility.bPressed = true; // GameProcessor.EnableMenuStage(); //} }
private static void SpecificCharactersPageControls(ActionKey key) { bool bChangeMatrix = false; if (GameMenuHandler.charTabList.Count > 2 && key.actionIndentifierString.Equals(Game1.cameraMoveDownString) && -GameMenuHandler.characterTabVerticalModifier <= GameMenuHandler.charTabList[GameMenuHandler.charTabList.Count - 2].tabLocation.Y - 25) { GameMenuHandler.characterTabVerticalModifier -= 4.2f; bChangeMatrix = true; } if (GameMenuHandler.charTabList.Count > 2 && key.actionIndentifierString.Equals(Game1.cameraMoveUpString) && GameMenuHandler.characterTabVerticalModifier < 0) { GameMenuHandler.characterTabVerticalModifier += 4.2f; bChangeMatrix = true; } if (GameMenuHandler.CharacterTabContainsMouse()) { if (!KeyboardMouseUtility.AnyButtonsPressed() && key.actionIndentifierString.Equals(Game1.confirmString)) { var selectedTab = GameMenuHandler.selectedCharacterTab(); if (!selectedTab.Equals(default(GameMenuHandler.CharacterTabdisplay))) { GameMenuHandler.selectedCharacterContext = new CharacterContextMenu(GameMenuHandler.characterTabVerticalModifier, new Point(100, 50), new Point(100, 150), selectedTab); } } } if (GameMenuHandler.charTabList.Count > 2 && KeyboardMouseUtility.ScrollingDown() && -GameMenuHandler.characterTabVerticalModifier <= GameMenuHandler.charTabList[GameMenuHandler.charTabList.Count - 2].tabLocation.Y - 25) { GameMenuHandler.characterTabVerticalModifier -= 4.2f * 4; bChangeMatrix = true; } if (GameMenuHandler.charTabList.Count > 2 && KeyboardMouseUtility.ScrollingUp() && GameMenuHandler.characterTabVerticalModifier < 0) { GameMenuHandler.characterTabVerticalModifier += 4.2f * 4; bChangeMatrix = true; } if (bChangeMatrix) { GameMenuHandler.characterTabAdjustedMatrix = Matrix.CreateTranslation(new Vector3(0, GameMenuHandler.characterTabVerticalModifier, 1)); } }
private void ZoomGameBox() { //Up Arrow Key Control if ((KeyboardMouseUtility.mouseScrollValue > 0) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (zoomScale < zoomScaleMax) { zoomScale += zoomScaleStep; } } //Down Arrow Key Control if ((KeyboardMouseUtility.mouseScrollValue < 0) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (zoomScale > zoomScaleMin) { zoomScale -= zoomScaleStep; } } }
private void ObjectLayerAddingControls(GameTime gt, Vector2 editorCursorPos) { if (MapBuilder.objAddition != null && MapBuilder.objAddition.IsCorrect()) { if (Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed()) { KeyboardMouseUtility.bMouseButtonPressed = true; MapBuilder.objAddition.HandleCopyAtMousePos(editorCursorPos); } if (!KeyboardMouseUtility.AnyButtonsPressed() && KeyboardMouseUtility.ScrollingUp()) { MapBuilder.objAddition.Scale(0.05f); } if (!KeyboardMouseUtility.AnyButtonsPressed() && KeyboardMouseUtility.ScrollingDown()) { MapBuilder.objAddition.Scale(-0.05f); } } }
private void ButtonControlPopUp(GameTime gameTime) { if (buttonPressUtility.isPressed(Game1.moveRightString) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (currentPauseChoice < pauseScreen.popUpButtons.Length - 1) { currentPauseChoice++; } else { currentPauseChoice = 0; } } if (buttonPressUtility.isPressed(Game1.moveLeftString) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (currentPauseChoice == 0) { currentPauseChoice = pauseScreen.popUpButtons.Length - 1; } else { currentPauseChoice--; } } int i = 0; foreach (var button in pauseScreen.popUpButtons) { if (button.ContainsMouse()) { currentPauseChoice = i; } i++; } PopUpRunUpdate(gameTime); }
private void MouseControl(GameTime gametime, Game1 game) { CurrentMouseSelection(); //Up Arrow Key Control if ((KeyboardMouseUtility.mouseScrollValue > 0) && !KeyboardMouseUtility.AnyButtonsPressed()) { buttonPressUtility.bPressed = true; if (currentChoice > 1) { currentChoice--; } else { currentChoice = mainMenuButtons.Count; } } //Down Arrow Key Control if ((KeyboardMouseUtility.mouseScrollValue < 0) && !KeyboardMouseUtility.AnyButtonsPressed()) { buttonPressUtility.bPressed = true; if (currentChoice < mainMenuButtons.Count) { currentChoice++; } else { currentChoice = 1; } } if (buttonPressUtility.isMousePressed(Mouse.GetState().LeftButton)) { SceneSelect(game); buttonPressUtility.bPressed = true; } }
/// <summary> /// Handles open menu /// </summary> /// <param name="gameTime"></param> private void PopUpRunUpdate(GameTime gameTime) { pauseScreen.Update(gameTime); if ((buttonPressUtility.isPressed(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) || (buttonPressUtility.isMousePressed(Mouse.GetState().LeftButton))) { switch (currentPauseChoice) { case 0: SceneUtility.ChangeScene((int)Game1.Screens.Options); break; case 1: SceneUtility.ChangeScene((int)Game1.Screens.ExitGame); break; } } if (buttonPressUtility.isPressed(Game1.openMenuString) && !KeyboardMouseUtility.AnyButtonsPressed() && bShowPopUp) { bShowPopUp = false; } }
/// <summary> /// Handles general functionality, use CommandUpdate(Paused) for character controll /// </summary> /// <param name="gameTime"></param> private void NormalRunUpdate(GameTime gameTime) { if (buttonPressUtility.isPressed(Game1.openMenuString)) { if (!bShowPopUp) { bShowPopUp = true; KeyboardMouseUtility.bPressed = true; currentPauseChoice = 0; } } if (buttonPressUtility.isPressed(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) { bFriendlyFire = !bFriendlyFire; foreach (var item in activeObjects) { item.bFriendlyFire = bFriendlyFire; } } if (SelectionUtility.HasMemberSelected()) { HandleHotBarKeys(gameTime); } if (buttonPressUtility.isPressedSub(Game1.moveUpString) && !KeyboardMouseUtility.AnyButtonsPressed()) { } //if (buttonPressUtility.isPressedSub(Game1.cameraMoveCenterString)) //{ // Vector2 tempVec = SceneUtility.CenterCamera(xAxis,yAxis); // xAxis = tempVec.X; // yAxis = tempVec.Y; //} if (buttonPressUtility.isPressedSub(Game1.moveLeftString) && !KeyboardMouseUtility.AnyButtonsPressed()) { /* * enemies.Add(new BasicEnemy(game.Content.Load<Texture2D>(@"Graphics\Characters\Hostile\BasicEnemy"), 1, CursorUtility.trueCursorPos, true)); * activeObjects.Clear(); * activeObjects.AddRange(enemies); * activeObjects.AddRange(heroes); */ } if (buttonPressUtility.isPressedSub(Game1.moveRightString) && !KeyboardMouseUtility.AnyButtonsPressed()) { /* * heroes.Add(new BasicHero(game.Content.Load<Texture2D>(@"Graphics\Characters\Friendly\BasicHero"), 1, CursorUtility.trueCursorPos, true)); * activeObjects.Clear(); * activeObjects.AddRange(enemies); * activeObjects.AddRange(heroes); */ } if (buttonPressUtility.isPressedSub(Game1.pauseString) && !KeyboardMouseUtility.AnyButtonsPressed()) { bPaused = true; KeyboardMouseUtility.bPressed = true; } if (buttonPressUtility.isPressedSub(Game1.debugInfoString) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (SceneUtility.isWithinMap(CursorUtility.trueCursorPos)) { switch (tempH) { case 0: heroes.Add(new BasicHero(CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero1], 1, CursorUtility.trueCursorPos, true)); heroes[heroes.Count - 1].rectangleToDraw = CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero1].shapeTextureBounds; BasicTeamUtility.parties[(int)BasicTeamUtility.FriendlyParties.Party].Add(heroes[heroes.Count - 1]); activeObjects.Clear(); activeObjects.AddRange(enemies); activeObjects.AddRange(heroes); break; case 1: heroes.Add(new BasicHero(CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero2], 1, CursorUtility.trueCursorPos, true)); heroes[heroes.Count - 1].rectangleToDraw = CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero2].shapeTextureBounds; BasicTeamUtility.parties[(int)BasicTeamUtility.FriendlyParties.Party].Add(heroes[heroes.Count - 1]); heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.MaxHealth] = 200; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.Health] = 200; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.MaxMana] = 30; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.Mana] = 30; heroes[heroes.Count - 1].stats.ResetCurrentStats(); heroes[heroes.Count - 1].activeSpells = new Spell[9] { SpellsAssetLoader.basicMissileFire, SpellsAssetLoader.basicMissileIce, default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell) }; activeObjects.Clear(); activeObjects.AddRange(enemies); activeObjects.AddRange(heroes); break; case 2: heroes.Add(new BasicHero(CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero3], 1, CursorUtility.trueCursorPos, true)); heroes[heroes.Count - 1].rectangleToDraw = CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero3].shapeTextureBounds; BasicTeamUtility.parties[(int)BasicTeamUtility.FriendlyParties.Party].Add(heroes[heroes.Count - 1]); heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.MaxHealth] = 450; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.Health] = 450; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.MaxMana] = 0; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.Mana] = 0; heroes[heroes.Count - 1].stats.ResetCurrentStats(); heroes[heroes.Count - 1].activeSpells = new Spell[9] { SpellsAssetLoader.basicMissileGrass, SpellsAssetLoader.basicMissileArcane, default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell) }; activeObjects.Clear(); activeObjects.AddRange(enemies); activeObjects.AddRange(heroes); break; case 3: heroes.Add(new BasicHero(CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero4], 1, CursorUtility.trueCursorPos, true)); heroes[heroes.Count - 1].rectangleToDraw = CharacterAssetsLoader.heroAssetsC1[(int)CharacterAssetsLoader.heroesC1.hero4].shapeTextureBounds; BasicTeamUtility.parties[(int)BasicTeamUtility.FriendlyParties.Party].Add(heroes[heroes.Count - 1]); heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.MaxHealth] = 75; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.Health] = 75; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.MaxMana] = 200; heroes[heroes.Count - 1].stats.baseStats[(int)BasicStatChart.stats.Mana] = 200; heroes[heroes.Count - 1].stats.ResetCurrentStats(); heroes[heroes.Count - 1].activeSpells = new Spell[9] { SpellsAssetLoader.basicMissileDark, default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell), default(Spell) }; activeObjects.Clear(); activeObjects.AddRange(enemies); activeObjects.AddRange(heroes); break; } tempH++; } } foreach (var character in activeObjects) { character.Update(gameTime, activeObjects); character.bFriendlyFire = bFriendlyFire; } foreach (var character in activeObjects) { if (!character.bHasTarget) { if (character.GetType() == typeof(BasicEnemy) && heroes.Count != 0) { character.setTarget(heroes[heroes.Count - 1]); } else if (character.GetType() == typeof(BasicHero) && enemies.Count != 0) { character.setTarget(enemies[enemies.Count - 1]); } } } ClearNotRenderedActiveObjects(); ClearNotRenderedShapeObjects(); }
static public void Update(List <Actions.ActionKey> keys) { switch (currentControls) { case ControlSetup.Standard: foreach (var key in keys) { StandardControls(key); } break; case ControlSetup.LootPickUp: if (keys.Count > 0) { LootPickUpControls(keys.Last()); } break; default: break; } if (keys.Count == 0) { if (typeof(BaseCharacter) == PlayerController.selectedSprite.GetType()) { (PlayerController.selectedSprite as BaseCharacter).animationIndex = (int)BaseCharacter.CharacterAnimations.Idle; } } if (keys[keys.Count - 1].actionIndentifierString.Equals(Game1.openMenuString) && !KeyboardMouseUtility.AnyButtonsPressed() && !BattleGUI.bIsRunning) { GameProcessor.bInGameMenu = true; GameMenuHandler.Start(); KeyboardMouseUtility.bPressed = true; GameProcessor.EnableMenuStage(); } if (keys[keys.Count - 1].actionIndentifierString.Equals(Game1.SettingsMenu) && !KeyboardMouseUtility.AnyButtonsPressed() && !BattleGUI.bIsRunning) { SettingsMenu.Start(); } PlayerController.selectedSprite.rotationIndex = ri; if (GameProcessor.bCameraOnController) { // GameProcessor.sceneCamera = ((new Vector2(-(PlayerController.selectedSprite.position.X + 32 - 1366 / GameProcessor.zoom / 2), -(PlayerController.selectedSprite.position.Y + 32 - 768 / GameProcessor.zoom / 2)))); } /* * var region = GameProcessor.loadedMap.mapRegions.Find(r => r.Contains(PlayerController.selectedSprite)); * if (region != null) * { * var zone = region.regionZones.Find(z => z.Contains(PlayerController.selectedSprite)); * if (zone != null) * { * zoneInfoForm.Start(zone, region); * } * } */ }
static public void StandardControls(ActionKey key) { var c = (PlayerController.selectedSprite as BaseCharacter); c.speed = 3f; if (PlayerController.selectedSprite.groundTile.tileSource.tileType != TileSource.TileType.Stairs && (key.actionIndentifierString.Equals(Game1.moveUpString) || key.actionIndentifierString.Equals(Game1.cameraMoveUpString)) && !ScriptProcessor.bIsRunning) { ri = (int)BaseSprite.Rotation.Up; if (PlayerController.selectedSprite.GetType() == typeof(BaseCharacter)) { (PlayerController.selectedSprite as BaseCharacter).Move(new Vector2(0, -c.speed)); } else { PlayerController.selectedSprite.Move(new Vector2(0, -c.speed)); } } else if (PlayerController.selectedSprite.groundTile.tileSource.tileType == TileSource.TileType.Stairs && (key.actionIndentifierString.Equals(Game1.moveUpString) || key.actionIndentifierString.Equals(Game1.cameraMoveUpString)) && !ScriptProcessor.bIsRunning) { ri = (int)BaseSprite.Rotation.Up; } else if (PlayerController.selectedSprite.groundTile.tileSource.tileType != TileSource.TileType.Stairs && (key.actionIndentifierString.Equals(Game1.moveDownString) || key.actionIndentifierString.Equals(Game1.cameraMoveDownString)) && !ScriptProcessor.bIsRunning) { ri = (int)BaseSprite.Rotation.Down; if (PlayerController.selectedSprite.GetType() == typeof(BaseCharacter)) { (PlayerController.selectedSprite as BaseCharacter).Move(new Vector2(0, c.speed)); } else { PlayerController.selectedSprite.Move(new Vector2(0, c.speed)); } } else if (PlayerController.selectedSprite.groundTile.tileSource.tileType == TileSource.TileType.Stairs && (key.actionIndentifierString.Equals(Game1.moveDownString) || key.actionIndentifierString.Equals(Game1.cameraMoveDownString)) && !ScriptProcessor.bIsRunning) { ri = (int)BaseSprite.Rotation.Down; } else if ((key.actionIndentifierString.Equals(Game1.moveLeftString) || key.actionIndentifierString.Equals(Game1.cameraMoveLeftString)) && !ScriptProcessor.bIsRunning) { ri = (int)BaseSprite.Rotation.Left; if (PlayerController.selectedSprite.GetType() == typeof(BaseCharacter)) { (PlayerController.selectedSprite as BaseCharacter).Move(new Vector2(-c.speed, 0)); } else { PlayerController.selectedSprite.Move(new Vector2(-c.speed, 0)); } } else if ((key.actionIndentifierString.Equals(Game1.moveRightString) || key.actionIndentifierString.Equals(Game1.cameraMoveRightString)) && !ScriptProcessor.bIsRunning) { ri = (int)BaseSprite.Rotation.Right; if (PlayerController.selectedSprite.GetType() == typeof(BaseCharacter)) { (PlayerController.selectedSprite as BaseCharacter).Move(new Vector2(c.speed, 0)); } else { PlayerController.selectedSprite.Move(new Vector2(c.speed, 0)); } } if (key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (GameProcessor.loadedMap.mapSaveInfo.CanPickUp(PlayerController.selectedSprite)) { GameProcessor.loadedMap.mapSaveInfo.HandlePickUp(); } else { if (PlayerController.selectedSprite.GetType() == typeof(BaseCharacter)) { (PlayerController.selectedSprite as BaseCharacter).Interact(); } else { PlayerController.selectedSprite.Interact(); } } } if (key.actionIndentifierString.Equals(Game1.cameraDefaultZoom)) { GameProcessor.zoom = 2.1f; } if (key.actionIndentifierString.Equals(Game1.cameraZoomIn)) { GameProcessor.zoom += 0.01f; } if (key.actionIndentifierString.Equals(Game1.cameraZoomOut)) { GameProcessor.zoom -= 0.01f; } if (key.actionIndentifierString.Equals(Game1.pauseString) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (typeof(BaseCharacter) == PlayerController.selectedSprite.GetType()) { try { var temp = PlayerSaveData.heroParty.IndexOf(PlayerController.selectedSprite as BaseCharacter) + 1; if (temp == PlayerSaveData.heroParty.Count) { temp = 0; } Vector2 pos = PlayerController.selectedSprite.position; var oi = MapChunk.consideredSprites.FindAll(s => s.objectType == objectInfo.type.Character).Find(s => s.obj == PlayerController.selectedSprite); var oil = MapChunk.consideredSprites.FindAll(s => s.objectType == objectInfo.type.Character); PlayerController.selectedSprite = PlayerSaveData.heroParty[temp]; oi.obj = PlayerController.selectedSprite; PlayerController.selectedSprite.position = pos; PlayerController.selectedSprite.UpdatePosition(); GameProcessor.cameraFollowTarget = PlayerController.selectedSprite; } catch { } } } if (!KeyboardMouseUtility.AnyButtonsPressed() && key.actionIndentifierString.Equals(Game1.SettingsMenu)) { SettingsMenu.Start(); } }
private static void LootPickUpControls(ActionKey key) { if (key.actionIndentifierString.Equals(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed() && !KeyboardMouseUtility.bMouseButtonPressed && !KeyboardMouseUtility.bMousePressed) { (currentlyControlledScreen as PickUpScreen).TryPickUp(); } if (key.actionIndentifierString.Equals(Game1.confirmString) && KeyboardMouseUtility.bMouseButtonPressed && !KeyboardMouseUtility.bMousePressed) { (currentlyControlledScreen as PickUpScreen).Clicked(); } if (key.actionIndentifierString.Equals(Game1.confirmString) && KeyboardMouseUtility.bMouseButtonPressed && (currentlyControlledScreen as PickUpScreen).bBeingDragged) { (currentlyControlledScreen as PickUpScreen).Drag(); } if (key.actionIndentifierString.Equals(Game1.cameraMoveDownString) && !ScriptProcessor.bIsRunning && (currentlyControlledScreen.Location().Y + currentlyControlledScreen.Location().Height < 768)) { Vector2 movement = new Vector2(0, 5); (currentlyControlledScreen as PickUpScreen).MoveRenderControl(movement); } if (key.actionIndentifierString.Equals(Game1.cameraMoveUpString) && !ScriptProcessor.bIsRunning && (currentlyControlledScreen.Location().Y > 0)) { Vector2 movement = new Vector2(0, -5); (currentlyControlledScreen as PickUpScreen).MoveRenderControl(movement); } if (key.actionIndentifierString.Equals(Game1.cameraMoveLeftString) && !ScriptProcessor.bIsRunning && (currentlyControlledScreen.Location().X > 0)) { Vector2 movement = new Vector2(-5, 0); (currentlyControlledScreen as PickUpScreen).MoveRenderControl(movement); } if (key.actionIndentifierString.Equals(Game1.cameraMoveRightString) && !ScriptProcessor.bIsRunning && (currentlyControlledScreen.Location().X + currentlyControlledScreen.Location().Width < 1366)) { Vector2 movement = new Vector2(5, 0); (currentlyControlledScreen as PickUpScreen).MoveRenderControl(movement); } if ((currentlyControlledScreen as PickUpScreen).getPanels().Count != 0) { bool bMoved = false; var temp = (currentlyControlledScreen as PickUpScreen).getPanels(); int selectIndex = 0; selectIndex = temp.IndexOf((currentlyControlledScreen as PickUpScreen).selectedItemPanel); if (key.actionIndentifierString.Equals(Game1.moveDownString) && !ScriptProcessor.bIsRunning && !KeyboardMouseUtility.AnyButtonsPressed()) { selectIndex++; bMoved = true; } if (key.actionIndentifierString.Equals(Game1.moveUpString) && !ScriptProcessor.bIsRunning && !KeyboardMouseUtility.AnyButtonsPressed()) { selectIndex--; bMoved = true; } if (key.actionIndentifierString.Equals(Game1.moveLeftString) && !ScriptProcessor.bIsRunning && !KeyboardMouseUtility.AnyButtonsPressed()) { selectIndex -= 4; bMoved = true; } if (key.actionIndentifierString.Equals(Game1.moveRightString) && !ScriptProcessor.bIsRunning && !KeyboardMouseUtility.AnyButtonsPressed()) { selectIndex += 4; bMoved = true; } if (selectIndex >= temp.Count) { selectIndex = 0; } else if (selectIndex < 0) { selectIndex = temp.Count - 1; } if (bMoved) { (currentlyControlledScreen as PickUpScreen).selectedItemPanel = temp[selectIndex]; (currentlyControlledScreen as PickUpScreen).verticalModifier = temp[selectIndex].End(); (currentlyControlledScreen as PickUpScreen).itemPanelScrollMatrix = Matrix.CreateTranslation(0, -(currentlyControlledScreen as PickUpScreen).verticalModifier, 0); (currentlyControlledScreen as PickUpScreen).openDifferentDescription(); } } }
public void Update() { var gts = groupTurnSet.Find(g => !g.bIsCompleted); //CombatProcessor.encounterEnemies if (bIsPlayerTurnSet && !EncounterInfo.currentTurn().bPlayerTurnEnemyOverriden&& !BattleGUI.bIsRunning && !bSelectingArea) { if (!KeyboardMouseUtility.AnyButtonsPressed() && Keyboard.GetState().IsKeyDown(Keys.X)) { var temp = EncounterInfo.encounterGroups.FindAll(eg => eg.bIsPlayerTurnSet); foreach (var item in temp) { item.bIsCompleted = true; } } if (EncounterInfo.currentTurn().selectedCharTurn != null && bRegenerateRadius) { RegenerateRadius(); } currentEnemy = null; if (selectedCharTurn != null && !selectedCharTurn.bIsCompleted) { var tempTile = selectedCharTurn.returnCompleteArea().Find(t => t.mapPosition.Contains(GameProcessor.EditorCursorPos)); if (tempTile != null) { if (CombatArrowLayout.bShouldRecheck(tempTile)) { CombatArrowLayout.Start(tempTile, selectedCharTurn); } } else { CombatArrowLayout.bMustDraw = false; CombatArrowLayout.Clear(); } } else { if (CombatArrowLayout.CanClear()) { CombatArrowLayout.Clear(); } } } else if (bIsPlayerTurnSet && BattleGUI.bIsRunning) { } else if (bIsEnemyTurnSet || EncounterInfo.currentTurn().bPlayerTurnEnemyOverriden) { UpdateEnemyLogic(gts); } if (bSelectingArea) { } if (gts == null) { bIsCompleted = true; } if (bIsCompleted && !bPlayerTurnEnemyOverriden && !LUA.LuaExecutionList.DemandOverride() && !PathMoveHandler.bIsBusy && BattleGUI.TurnEffectsList.Find(te => te.bMustShow) == default(ChangeTurnEffect)) { ResetAndChangeGroup(); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { gameRef = this; if (bExited) { Exit(); } if (bIsDebug && TestEnvironment.bDoTest && false) { TestEnvironment.Test(); } if (Keyboard.GetState().IsKeyDown(Keys.M) && !KeyboardMouseUtility.AnyButtonsPressed()) { ToggleMouse(); } //Console.WriteLine("Hello from Update"); if (Keyboard.GetState().IsKeyDown(Keys.End) && !KeyboardMouseUtility.AnyButtonsPressed()) { Console.WriteLine(Steamworks.SteamAPI.InitSafe()); } SceneUtility.UpdateTransform(); SceneUtility.Update(gameTime); SceneUtility.scenes = scenes; ResolutionUtility.bMouseIsVisible = this.IsMouseVisible; ResolutionUtility.mousePos.X = Mouse.GetState().X; ResolutionUtility.mousePos.Y = Mouse.GetState().Y; ResolutionUtility.KeyHandler(graphics, gameTime); //MouseMustStayWithinGame(); buttonPressUtility.Update(gameTime); if (ResolutionUtility.stdScale != new Vector2(1)) { this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; } bIsActive = this.IsActive; //if (!bRunEditMode) //{ // MusicBGPlayer.Update(gameTime); //} //CursorUtility.update(gameTime); if (!bRunEditMode && !StartScreen.bIsRunning) { scenes[SceneUtility.currentScene].Update(gameTime, this); } else if (StartScreen.bIsRunning) { startScreen.Update(gameTime); } //else //{ // ScripTestingScene.Update(gameTime, this); //} if (SceneUtility.currentScene != (int)Screens.Editor) { buttonPressUtility.bPressed = true; Console.Out.WriteLine("You called the editor!"); (scenes[(int)Screens.Editor] as Editor).preScreen = SceneUtility.prevScene; SceneUtility.ChangeScene((int)Screens.Editor); // SceneUtility.prevScene = SceneUtility.currentScene; // SceneUtility.currentScene = (int)Screens.Editor; (scenes[(int)Screens.Editor] as Editor).scenes = scenes; (scenes[(int)Screens.Editor] as Editor).Start(this); } KeyboardMouseUtility.Update(this); //if (!bRunEditMode) //{ // if (SceneUtility.prevScene != SceneUtility.currentScene) // { // if (!scenes[SceneUtility.currentScene].bIsInitialized) // { // Console.Out.WriteLine("Called for: " + scenes[SceneUtility.currentScene]); // scenes[SceneUtility.currentScene].Initialize(this); // } // else // { // scenes[SceneUtility.currentScene].Reload(); // } // } // if (SceneUtility.currentScene == (int)(Game1.Screens.ExitGame)) // { // foreach (Scene scene in scenes) // { // scene.UnloadContent(this); // } // Exit(); // } // if (buttonPressUtility.isPressedSub(EditorString) && !buttonPressUtility.bPressed && SceneUtility.currentScene != (int)Screens.Editor) // { // buttonPressUtility.bPressed = true; // Console.Out.WriteLine("You called the editor!"); // (scenes[(int)Screens.Editor] as Editor).preScreen = SceneUtility.prevScene; // SceneUtility.ChangeScene((int)Screens.Editor); // // SceneUtility.prevScene = SceneUtility.currentScene; // // SceneUtility.currentScene = (int)Screens.Editor; // (scenes[(int)Screens.Editor] as Editor).scenes = scenes; // (scenes[(int)Screens.Editor] as Editor).Start(this); // } // else if (buttonPressUtility.isPressedSub(EditorString) && !buttonPressUtility.bPressed && SceneUtility.currentScene == (int)Screens.Editor) // { // buttonPressUtility.bPressed = true; // Console.Out.WriteLine("You left the editor!"); // //TODO set the actual prevscreen before entering the editor // SceneUtility.currentScene = SceneUtility.prevScene; // SceneUtility.prevScene = (scenes[(int)Screens.Editor] as Editor).preScreen; // (scenes[(int)Screens.Editor] as Editor).ResetBackToGame(this); // } //} base.Update(gameTime); }
public override void Update(GameTime gameTime, Game1 game) { Vector2 EditorCursorPos = Mouse.GetState().Position.ToVector2(); if (localScenes.Count == 0) { localScenes.Add(spritePicker); localScenes.Add(spriteCollisionPicker); localScenes.Add(spriteCollisionSelect); localScenes.Add(spriteTypeSelection); localScenes.Add(simpleTypeSpriteEditor); } if (Keyboard.GetState().IsKeyDown(Keys.L) && !bShowed) { bShowed = true; var types = Assembly.GetAssembly(typeof(Shape)).GetTypes().Where(t => t.IsSubclassOf(typeof(Shape))); foreach (var type in types) { Console.Out.WriteLine(type); } //System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); } if ((int)SpriteEditor.SpriteEditorScenes.SpriteTypeSelection >= currentScene && Mouse.GetState().RightButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed() && currentScene > 0) { currentScene--; } switch (currentScene) { case (int)SpriteEditor.SpriteEditorScenes.SpriteEditor: if (Game1.bIsDebug) { System.Windows.Forms.MessageBox.Show("Choose a texture file from within the application's Content folder please."); openTextureBase.Filter = "Texture File|*.xnb"; openTextureBase.InitialDirectory = Game1.rootContent; } else { System.Windows.Forms.MessageBox.Show("Choose a texture file from within the application's Content Mod folder please."); openTextureBase.Filter = "Texture File|*.jpg;*.png;*.jpeg"; openTextureBase.InitialDirectory = Game1.rootContentExtra; } openTextureBase.Title = "Load Base Texture"; if (Game1.bIsDebug) { System.Windows.Forms.DialogResult dia = openTextureBase.ShowDialog(); if (System.Windows.Forms.DialogResult.OK == dia && openTextureBase.FileName.Contains(Game1.rootContent)) { String fi = Path.GetFileNameWithoutExtension(openTextureBase.FileName); String fo = Path.GetDirectoryName(openTextureBase.FileName.Replace(Game1.rootContent, "")); Console.WriteLine(fo + fi); spritePicker.Initialize(game, Path.Combine(fo, fi)); } else if (System.Windows.Forms.DialogResult.Cancel == dia) { Editor.currentEditor = (int)Editor.EditorsCollection.MapEditor; System.Windows.Forms.MessageBox.Show("Cancelled, returning to MapEditor."); } } else { System.Windows.Forms.DialogResult dia = openTextureBase.ShowDialog(); if (System.Windows.Forms.DialogResult.OK == dia && openTextureBase.FileName.Contains(Game1.rootContentExtra)) { String fi = Path.GetFileNameWithoutExtension(openTextureBase.FileName); String fo = Path.GetDirectoryName(openTextureBase.FileName.Replace(Game1.rootContent, "")); Console.WriteLine(fo + fi); spritePicker.Initialize(game, Path.Combine(fo, fi)); } else if (System.Windows.Forms.DialogResult.Cancel == dia) { Editor.currentEditor = (int)Editor.EditorsCollection.MapEditor; System.Windows.Forms.MessageBox.Show("Cancelled, returning to MapEditor."); } } break; case (int)SpriteEditor.SpriteEditorScenes.SpritePicker: spritePicker.Update(gameTime, game); if (spritePicker.EnableNextStep() != default(Rectangle)) { spritePicker.ResetCamera(); Step3Box = spritePicker.EnableNextStep(); spritePicker.selectedTextureBox = default(Rectangle); Step2Texture = spritePicker.ProcessedTexture(); currentScene = (int)SpriteEditorScenes.SpriteCollisionPicker; spriteCollisionPicker.Initialize(game, Step3Box, spritePicker.ProcessedTexture()); } break; case (int)SpriteEditor.SpriteEditorScenes.SpriteCollisionPicker: spriteCollisionPicker.Update(gameTime, game); if (!spriteCollisionPicker.EnableNextStep().Equals("") && !spriteCollisionPicker.EnableNextStep().Equals("SKIP")) { CollisionStepFileName = spriteCollisionPicker.EnableNextStep(); spriteCollisionPicker.selectedFile = ""; currentScene = (int)SpriteEditorScenes.SpriteCollisionSelect; spriteCollisionSelect.Initialize(game, CollisionStepFileName, Step3Box, Step2Texture); } else if (spriteCollisionPicker.EnableNextStep().Equals("SKIP")) { Console.Out.WriteLine("Attempting to skip..."); currentScene = (int)SpriteEditor.SpriteEditorScenes.SpriteTypeSelection; spriteCollisionSelect.Initialize(game, spritePicker.ProcessedTexture().Name, Step3Box, Step2Texture); spriteTypeSelection.Initialize(game, Step3Box, Step2Texture, Step2Texture); } break; case (int)SpriteEditor.SpriteEditorScenes.SpriteCollisionSelect: if (!CollisionStepFileName.Equals("SKIP") || !CollisionStepFileName.Equals("nope")) { spriteCollisionPicker.selectedFile = ""; spriteCollisionSelect.Update(gameTime, game); if (spriteCollisionSelect.EnableNextStep() != default(Rectangle)) { spriteCollisionSelect.ResetCamera(); Step5Box = spriteCollisionSelect.EnableNextStep(); Step4Texture = spriteCollisionSelect.ProcessedTexture(); currentScene = (int)SpriteEditorScenes.SpriteTypeSelection; spriteCollisionSelect.selectedTextureBox = default(Rectangle); spriteTypeSelection.Initialize(game, Step3Box, Step2Texture, Step4Texture, Step5Box); } } else { spriteCollisionSelect.ResetCamera(); currentScene = (int)SpriteEditorScenes.SpritePicker; spriteTypeSelection.Initialize(game, Step3Box, Step2Texture, Step4Texture); } break; case (int)SpriteEditor.SpriteEditorScenes.SpriteTypeSelection: spriteTypeSelection.Update(gameTime, game); spriteType = spriteTypeSelection.EnableNextStep(); if (spriteType >= 0) { switch (spriteType) { case (int)SpriteTypeSelection.SpriteTypes.SimpleType: spriteTypeSelection.ResetCamera(); spriteTypeSelection.selectedType = -1; currentScene = (int)SpriteEditor.SpriteEditorScenes.SimpleTypeSpriteEditor; simpleTypeSpriteEditor.Start(); break; } } break; case (int)SpriteEditor.SpriteEditorScenes.SimpleTypeSpriteEditor: simpleTypeSpriteEditor.Update(gameTime, game); if (Mouse.GetState().RightButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed() && currentScene > 0) { currentScene = (int)SpriteEditor.SpriteEditorScenes.SpriteTypeSelection; } break; } }
public void Update(GameTime gameTime) { LPartInputHitBox = new Rectangle((int)defaultFont.MeasureString(propertyText).X + (int)position.X, (int)position.Y, 8, 64); MPartInputHitBox = new Rectangle((int)defaultFont.MeasureString(propertyText).X + (int)position.X + 8, (int)position.Y, (int)defaultFont.MeasureString(inputText).X + 1 + 32, 64); RPartInputHitBox = new Rectangle((int)defaultFont.MeasureString(propertyText).X + (int)position.X + MPartInputHitBox.Width + 8, (int)position.Y, 8, 64); cursorTimerElapsed += gameTime.ElapsedGameTime.Milliseconds; if (bEnableInput) { if (!bNumericInputOnly) { if (Keyboard.GetState().GetPressedKeys().Length >= 1) { // Console.Out.WriteLine((int)Keyboard.GetState().GetPressedKeys()[0]); if (!Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { //Numdpad keys are not enabled...yet?... They need manual reprogramming they're values 96-105 starting at 0-9 if (((int)Keyboard.GetState().GetPressedKeys()[0] > 47 && (int)Keyboard.GetState().GetPressedKeys()[0] < 91) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (inputText.Length > 0) { inputText = inputText.Insert(inputText.Length, ((char)Keyboard.GetState().GetPressedKeys()[0]).ToString().ToLower()); } else { inputText = ((char)Keyboard.GetState().GetPressedKeys()[0]).ToString().ToLower(); } } else if (inputText.Length > 0 && Keyboard.GetState().IsKeyDown(Keys.Back) && !KeyboardMouseUtility.AnyButtonsPressed()) { inputText = inputText.Remove(inputText.Length - 1); } else if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !KeyboardMouseUtility.AnyButtonsPressed()) { bEnableInput = false; } } else if (Keyboard.GetState().IsKeyDown(Keys.LeftShift) && Keyboard.GetState().GetPressedKeys().Length == 2) { //Numdpad keys are not enabled...yet?... They need manual reprogramming they're values 96-105 starting at 0-9 if (((int)Keyboard.GetState().GetPressedKeys()[0] > 47 && (int)Keyboard.GetState().GetPressedKeys()[0] < 91) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (inputText.Length > 0) { inputText = inputText.Insert(inputText.Length, ((char)Keyboard.GetState().GetPressedKeys()[0]).ToString().ToUpper()); } else { inputText = ((char)Keyboard.GetState().GetPressedKeys()[0]).ToString().ToUpper(); } // Console.Out.WriteLine((char)Keyboard.GetState().GetPressedKeys()[0]); } else if (inputText.Length > 0 && Keyboard.GetState().IsKeyDown(Keys.Back) && !KeyboardMouseUtility.AnyButtonsPressed()) { inputText = inputText.Remove(inputText.Length - 1); } else if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !KeyboardMouseUtility.AnyButtonsPressed()) { bEnableInput = false; } } } } else if (bNumericInputOnly) { if (Keyboard.GetState().GetPressedKeys().Length > 0) { if (((int)Keyboard.GetState().GetPressedKeys()[0] > 47 && (int)Keyboard.GetState().GetPressedKeys()[0] < 58) && !KeyboardMouseUtility.AnyButtonsPressed()) { if (inputText.Length > 0) { inputText = inputText.Insert(inputText.Length, ((char)Keyboard.GetState().GetPressedKeys()[0]).ToString().ToLower()); } else { inputText = ((char)Keyboard.GetState().GetPressedKeys()[0]).ToString().ToLower(); } } else if (inputText.Length > 0 && Keyboard.GetState().IsKeyDown(Keys.Back) && !KeyboardMouseUtility.AnyButtonsPressed()) { inputText = inputText.Remove(inputText.Length - 1); } else if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !KeyboardMouseUtility.AnyButtonsPressed()) { bEnableInput = false; } } } } if (bNumericInputOnly) { if (bHasMinValue && !inputText.Equals("")) { if (minValue > ReturnInputNumbers()) { inputText = minValue.ToString(); } } } }
private void HandleHotBarKeys(GameTime gameTime) { if (buttonPressUtility.isPressedSub(Game1.QKey1String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[0] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[0]); } } if (buttonPressUtility.isPressedSub(Game1.QKey2String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[1] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[1]); } } if (buttonPressUtility.isPressedSub(Game1.QKey3String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[2] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[2]); } } if (buttonPressUtility.isPressedSub(Game1.QKey4String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[3] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[3]); } } if (buttonPressUtility.isPressedSub(Game1.QKey5String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[4] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[4]); } } if (buttonPressUtility.isPressedSub(Game1.QKey6String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[5] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[5]); } } if (buttonPressUtility.isPressedSub(Game1.QKey7String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[6] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[6]); } } if (buttonPressUtility.isPressedSub(Game1.QKey8String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[7] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[7]); } } if (buttonPressUtility.isPressedSub(Game1.QKey9String) && !KeyboardMouseUtility.AnyButtonsPressed()) { if ((SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[8] != default(Spell)) { (SelectionUtility.primarySelectedCharacter as BasicHero).Shoot(gameTime, (SelectionUtility.primarySelectedCharacter as BasicHero).activeSpells[8]); } } }
private static void ProcessEnd(ActionKey actionKey) { if (actionKey.actionIndentifierString.Equals(Game1.confirmString, StringComparison.OrdinalIgnoreCase) && !KeyboardMouseUtility.AnyButtonsPressed()) { BattleGUI.CharacterSoloStop(); } }
public override void Update(GameTime gameTime, Game1 game) { base.Update(gameTime, game); goToBattleButton.Update(gameTime); if (goToBattleButton.ContainsMouse()) { buttonSelected = true; if (Game1.bIsActive && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed()) { buttonPressed = true; } else { buttonPressed = false; } } else { buttonSelected = false; } if (buttonPressed) { HandleSelection(); } }
static public void Update(GameTime gt) { CheckMouse(); // selectedSprite.position = new Vector2(400,300); anyButtonsPressed = false; mouseState = Mouse.GetState(); keyboardState = Keyboard.GetState(); //var wot = keyboardState.GetPressedKeys(); //String test = ""; //foreach (var item in wot) //{ // test += item; // test += " + "; //} //Console.WriteLine(test); if (!KeyboardMouseUtility.AnyButtonsPressed() && Keyboard.GetState().IsKeyDown(Keys.LeftAlt) && Keyboard.GetState().IsKeyDown(Keys.Enter)) { // ResolutionUtility.AdjustResolution(Game1.monitorSize.X, Game1.monitorSize.Y, Game1.graphics); ResolutionUtility.toggleFullscreen(); KeyboardMouseUtility.bPressed = true; } if (keyboardState.GetPressedKeys().Length > 1) { foreach (var key in Game1.actionKeyList) { if (keyboardState.GetPressedKeys()[keyboardState.GetPressedKeys().Length - 1] == (key.assignedActionKey)) { lastPressedKey = key; } } } else { foreach (var key in Game1.actionKeyList) { if (keyboardState.IsKeyDown(key.assignedActionKey)) { lastPressedKey = key; //selectedSprite.MoverMustUpdateHitboxes = true; } } } if (Keyboard.GetState().IsKeyDown(Keys.NumPad8)) { } //if (keyboardState.GetPressedKeys().Length >= 1) //{ // foreach (var key in Game1.actionKeyList) // { // if (keyboardState.IsKeyDown(key.assignedActionKey)) // { // lastPressedKey = key; // break; // } // } //} List <Actions.ActionKey> pressedKeys = new List <Actions.ActionKey>(); foreach (var key in Game1.actionKeyList) { if (keyboardState.IsKeyDown(key.assignedActionKey)) { #region EDITOR PLAYTEST FUNCTION if (MapBuilder.bPlayTest && Game1.bIsDebug) { if (key.actionIndentifierString.Equals(Game1.cancelString) && Keyboard.GetState().IsKeyDown(Keys.LeftShift) && MapBuilder.bPlayTest) { ReturnToEditorAction(); break; } } #endregion pressedKeys.Add(key); } } if (Mouse.GetState().LeftButton == ButtonState.Pressed) { // KeyboardMouseUtility.bPressed = true; pressedKeys.Add(Game1.actionKeyList.Find(key => key.actionIndentifierString.Equals(Game1.confirmString, StringComparison.OrdinalIgnoreCase))); KeyboardMouseUtility.bMouseButtonPressed = true; } if (Mouse.GetState().RightButton == ButtonState.Pressed) { // KeyboardMouseUtility.bPressed = true; pressedKeys.Add(Game1.actionKeyList.Find(key => key.actionIndentifierString.Equals(Game1.cancelString, StringComparison.OrdinalIgnoreCase))); KeyboardMouseUtility.bMouseButtonPressed = true; } if (Mouse.GetState().RightButton != ButtonState.Pressed && Mouse.GetState().LeftButton != ButtonState.Pressed) { KeyboardMouseUtility.bMouseButtonPressed = false; } if (KeyboardMouseUtility.ScrollingDown() || KeyboardMouseUtility.ScrollingUp()) { pressedKeys.Add(new Actions.ActionKey()); pressedKeys.Last().actionIndentifierString = "Scroll"; } #region NON EDITOR PLAYER CONTROLS if (pressedKeys.Count != 0) { // GameProcessor.bUpdateShadows = true; GameProcessor.bUpdateOnceMore = true; anyButtonsPressed = true; // GameProcessor.GenerateCamera(GameProcessor.cameraFollowTarget, .06f, GameProcessor.zoom); if (LUA.LuaExecutionList.DemandOverride()) { LUA.LuaExecutionList.ControlOverride(pressedKeys); } switch (currentController) { case Controllers.NonCombat: NonCombatCtrl.Update(pressedKeys); break; case Controllers.Combat: CombatCtrl.Update(pressedKeys); break; case Controllers.Menu: MenuCtrl.Update(pressedKeys); break; case Controllers.Dialogue: DialogueCtrl.Update(pressedKeys); break; case Controllers.SoloCombat: SoloCombatCtrl.Update(pressedKeys); break; case Controllers.EXPGainScreen: ExpGainCtrl.Update(pressedKeys); break; case Controllers.StartScreen: ContextControllers.StartScreenCtrl.Update(pressedKeys); break; case Controllers.ScriptProcessor: ScriptProcessorCtrl.Update(pressedKeys); break; case Controllers.GameSettingsMenu: if (!SettingsMenu.bIsRunning) { currentController = Controllers.NonCombat; } GameSettingsMenuCtrl.Update(pressedKeys); break; case Controllers.GameOptions: if (!OptionsMenu.bIsRunning) { currentController = Controllers.NonCombat; } GameOptionsMenuCtrl.Update(pressedKeys); break; default: break; } } else if (KeyboardMouseUtility.bMouseMoved) { switch (currentController) { case Controllers.NonCombat: break; case Controllers.Combat: break; case Controllers.Menu: MenuCtrl.MouseMove(); break; case Controllers.Dialogue: break; case Controllers.SoloCombat: break; case Controllers.EXPGainScreen: break; case Controllers.StartScreen: ContextControllers.StartScreenCtrl.MouseMove(); break; case Controllers.ScriptProcessor: ScriptProcessorCtrl.HandleMouseMove(); break; case Controllers.GameSettingsMenu: GameSettingsMenuCtrl.HandleMouseMove(); break; case Controllers.GameOptions: GameOptionsMenuCtrl.HandleMouseMove(); break; default: break; } } else if (selectedSprite != null && !CombatProcessor.bIsRunning) { selectedSprite.animationIndex = (int)BaseCharacter.CharacterAnimations.Idle; } #endregion if (selectedSprite != null && (!CombatProcessor.bStartPhase1 && !CombatProcessor.bMainCombat && !CombatProcessor.bIsRunning) && !ScriptProcessor.bIsRunning) { selectedSprite.Update(gt); } stop : { } }
private void KeyBoardControl(GameTime gametime, Game1 game) { if (buttonPressUtility.isPressed(Game1.moveRightString)) { if (!bEditingSubMenu) { if (!bSubMenu) { bSubMenu = true; cursorPosition.X = 1; } else if (currentChoiceMainOptions == 3 && cursorPosition.Y == 0) { cursorPosition.Y++; } else if (currentChoiceMainOptions == 3 && cursorPosition.Y == 1) { cursorPosition.Y = 1; } else { } } else { buttonPressUtility.bPressed = false; } } if (buttonPressUtility.isPressed(Game1.debugInfoString)) { int i = 1; foreach (var item in activeSceneButtonCollections) { FileWriter.Writer(@"My Games\The Betrayer\Options\", "Buttons" + i + ".xml", item); i++; } i = 1; foreach (var item in activeSceneShapeCollections) { FileWriter.Writer(@"My Games\The Betrayer\Options\", "Shapes" + i + ".xml", item); i++; } i = 1; foreach (var item in activeSceneCharactersCollections) { FileWriter.Writer(@"My Games\The Betrayer\Options\", "Characters" + i + ".xml", item); i++; } } if (buttonPressUtility.isPressed(Game1.moveLeftString) && cursorPosition.Y != 1) { if (!bEditingSubMenu) { if (!bSubMenu) { } else if (currentChoiceMainOptions == 2 && cursorPosition.Y == 1 && currentChoiceMainOptions == 3) { cursorPosition.Y--; } else { bSubMenu = false; cursorPosition.X = 0; cursorPosition.Y = 0; } } else { buttonPressUtility.bPressed = false; } } else if (buttonPressUtility.isPressedSub(Game1.moveLeftString) && cursorPosition.Y == 1) { cursorPosition.Y--; } //Down Arrow Key Control if (buttonPressUtility.isPressed(Game1.moveDownString) && !bEditingSubMenu) { if (!bSubMenu) { if (currentChoiceMainOptions < mainOptionButtons.Count) { currentChoiceMainOptions++; } else { currentChoiceMainOptions = 1; } } else if (bSubMenu) { if (cursorPosition.X < subMenuArray[currentChoiceMainOptions - 1].Count) { cursorPosition.X++; } else { cursorPosition.X = 1; } } } if (buttonPressUtility.isPressed(Game1.moveUpString) && !bEditingSubMenu) { if (!bSubMenu) { if (currentChoiceMainOptions > 1) { currentChoiceMainOptions--; } else { currentChoiceMainOptions = mainOptionButtons.Count; } } else if (bSubMenu) { if (cursorPosition.X > 1) { cursorPosition.X--; } else { cursorPosition.X = subMenuArray[currentChoiceMainOptions - 1].Count; } } } if (Keyboard.GetState().IsKeyDown(Keys.I)) { } if ((((buttonPressUtility.isPressed(Game1.cancelString))) && !KeyboardMouseUtility.AnyButtonsPressed() || (Game1.bIsActive && Mouse.GetState().RightButton == ButtonState.Pressed && SceneUtility.currentScene != (int)Game1.Screens.Editor)) && !bEditingSubMenu) { SwitchScenes(); } if (bSubMenu) { switch (currentChoiceMainOptions) { //Video options case 1: videoOptionHandle(); break; //Music options case 2: musicOptionHandle(); break; //Control options case 3: controlOptionHandle(); break; //Misc. options case 4: miscOptionHandle(); break; } } }
public override void Update(GameTime gameTime, Game1 game) { if (MapEditor.bIsRunning) { #region firstrun if (firstRun) { mapXSizeInput = new ActiveInput("X-Size map: ", "0", Vector2.Zero, game); mapYSizeInput = new ActiveInput("Y-Size map: ", "0", Vector2.Zero, game); mapNameInput = new ActiveInput("Map name: ", "Map", Vector2.Zero, game); mapXSizeInput.bNumericInputOnly = true; mapYSizeInput.bNumericInputOnly = true; activeInputButtons.Add(mapXSizeInput); activeInputButtons.Add(mapYSizeInput); activeInputButtons.Add(mapNameInput); mapXSizeInput.bHasMinValue = true; mapXSizeInput.minValue = 1; mapYSizeInput.bHasMinValue = true; mapYSizeInput.minValue = 1; firstRun = false; localScenes.Add(mapBuilder); } #endregion if (Game1.bIsDebug) { openMap.Filter = "CGMAPC Files (.cgmapc)|*.cgmapc"; openMap.InitialDirectory = Game1.rootTBAGW; } else { openMap.Filter = "CGMAP Files (.cgmap)|*.cgmap"; openMap.InitialDirectory = Game1.rootContentExtra; } openMap.FilterIndex = 1; openMap.Multiselect = false; saveMap.Filter = "CGMAP Files (.cgmap)|*.cgmap"; saveMap.Title = "Save a CGMAP File"; if (Game1.bIsDebug) { saveMap.InitialDirectory = Game1.rootTBAGW; } else { saveMap.InitialDirectory = Game1.rootContentExtra; } bool usingActiveInput = false; Vector2 EditorCursorPos = Mouse.GetState().Position.ToVector2() + new Vector2(cameraPosX, -cameraPosY); loadMapButton.Update(gameTime); if (loadMapButton.buttonBox.Contains(EditorCursorPos)) { if (Mouse.GetState().LeftButton == ButtonState.Pressed && Game1.bIsActive && !KeyboardMouseUtility.AnyButtonsPressed()) { System.Windows.Forms.DialogResult testDia = openMap.ShowDialog(); if (testDia == System.Windows.Forms.DialogResult.OK && openMap.FileName.Contains(openMap.InitialDirectory)) { // Console.WriteLine("You selected: " + openMap.FileName); loadedMap = EditorFileWriter.MapReader(openMap.FileName); } } } #region MapEditor only logic foreach (var item in activeInputButtons) { item.Update(gameTime); item.Contains(EditorCursorPos); } foreach (var item in activeInputButtons) { if (item.bEnableInput) { usingActiveInput = true; break; } } int i = 0; foreach (var item in activeInputButtons) { item.position = new Vector2(100, 200 + 75 * i); i++; } CreateMapButton.position = new Vector2(activeInputButtons[activeInputButtons.Count - 1].position.X, activeInputButtons[activeInputButtons.Count - 1].position.Y + 75); CreateMapButton.Update(gameTime); if (CreateMapButton.ButtonBox().Contains(EditorCursorPos) && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed()) { bool bCorrectSave = false; while (!bCorrectSave) { try { if (Game1.bIsDebug) { BasicMap newMap = new BasicMap(); newMap.mapName = mapNameInput.ReturnInputString(); saveMap.InitialDirectory = Game1.rootTBAGW; System.Windows.Forms.DialogResult dia = saveMap.ShowDialog(); if (saveMap.FileName != "" && dia == System.Windows.Forms.DialogResult.OK && saveMap.FileName.StartsWith(saveMap.InitialDirectory)) { newMap.mapName = Path.GetFileNameWithoutExtension(saveMap.FileName); mapNameInput.AssignInput(Path.GetFileNameWithoutExtension(saveMap.FileName)); // Console.WriteLine("Line= " + Path.GetDirectoryName(saveMap.FileName)); EditorFileWriter.MapWriter(saveMap.FileName, newMap); Console.WriteLine(newMap.mapLocation); loadedMap = EditorFileWriter.MapReader(saveMap.FileName);; bCorrectSave = true; } else if (dia == System.Windows.Forms.DialogResult.Cancel) { bCorrectSave = true; } else { // Console.WriteLine("Yow"); System.Windows.Forms.MessageBox.Show("Make sure you save the map within the application folder."); } } else { BasicMap newMap = new BasicMap(); newMap.mapName = mapNameInput.ReturnInputString(); saveMap.InitialDirectory = Game1.rootContentExtra; System.Windows.Forms.DialogResult dia = saveMap.ShowDialog(); if (saveMap.FileName != "" && dia == System.Windows.Forms.DialogResult.OK && saveMap.FileName.StartsWith(Game1.rootContentExtra)) { newMap.mapName = Path.GetFileNameWithoutExtension(saveMap.FileName); mapNameInput.AssignInput(Path.GetFileNameWithoutExtension(saveMap.FileName)); // Console.WriteLine("Line= " + Path.GetDirectoryName(saveMap.FileName)); EditorFileWriter.MapWriter(saveMap.FileName, newMap); Console.WriteLine(newMap.mapLocation); loadedMap = EditorFileWriter.MapReader(saveMap.FileName);; bCorrectSave = true; } else if (dia == System.Windows.Forms.DialogResult.Cancel) { bCorrectSave = true; } else { // Console.WriteLine("Yow"); System.Windows.Forms.MessageBox.Show("Make sure you save the map within the application folder."); } } } catch (Exception e) { Console.Out.WriteLine("Error:\n" + e); } } } if (currentScene == 0 && !usingActiveInput) { if (Keyboard.GetState().IsKeyDown(Keys.S)) { cameraPosY -= cameraSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Z)) { cameraPosY += cameraSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.Q)) { cameraPosX -= cameraSpeed; } if (Keyboard.GetState().IsKeyDown(Keys.D)) { cameraPosX += cameraSpeed; } } #endregion if (loadedMap != default(BasicMap)) { currentScene = (int)MapEditor.MapEditorScenes.MapBuilder; bRerunFileLoader = true; mapBuilder.Start(game, loadedMap); loadedMap = default(BasicMap); bIsRunning = false; } if (Mouse.GetState().RightButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed() && currentScene > 0) { switch (currentScene) { case (int)MapEditorScenes.MapEditor: System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("You sure want to exit Map editing? NOTE: be sure to save first!", "Leaving", System.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { currentScene--; } else if (dialogResult == System.Windows.Forms.DialogResult.No) { //do something else } break; } } } else if (!MapEditor.bIsRunning) { mapBuilder.Update(gameTime, game); } MapEditorMatrix = Matrix.CreateTranslation(-cameraPosX, cameraPosY, 1); }