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 : { } }
internal void Load() { GameProcessor.bShadowsEnabled = bShadowGeneration; GameProcessor.bWaterReflectionEnabled = bReflectionGeneration; GameProcessor.shadowQualityPercentage = (float)((float)shadowPercentage / 100f); if (resolution.X < 100 && resolution.Y < 100) { resolution = new Vector2(1366, 768); } ResolutionUtility.AdjustResolution(resolution.X, resolution.Y, Game1.graphics); if (bFullScreen) { ResolutionUtility.toggleFullscreen(); } speedMod = battleSpeed; speedModCamera = battleCameraSpeed; if (Math.Abs(MasterVolume) > 100) { MasterVolume = Math.Abs(MasterVolume) % 100; } SceneUtility.masterVolume = MasterVolume; if (Math.Abs(SoundEffectVolume) > 100) { SoundEffectVolume = Math.Abs(SoundEffectVolume) % 100; } SceneUtility.soundEffectsVolume = SoundEffectVolume; if (Math.Abs(MusicVolume) > 100) { MusicVolume = Math.Abs(MusicVolume) % 100; } SceneUtility.musicVolume = MusicVolume; List <ActionKey> lak = new List <ActionKey>(); if (controls.Count != 0) { foreach (var item in Game1.actionKeyList) { if (controls.Find(ak => ak.actionIndentifierString.Equals(item.actionIndentifierString) && ak.column == item.column) != null) { lak.Add(controls.Find(ak => ak.actionIndentifierString.Equals(item.actionIndentifierString) && ak.column == item.column)); } else { lak.Add(item); } } Game1.actionKeyList = lak; } else { controls = Game1.actionKeyList; } foreach (var act in Game1.actionList) { for (int i = 0; i < act.whatKeysIsActionAssignedTo.Length; i++) { var k = Game1.actionKeyList.Find(ak => ak.actionIndentifierString.Equals(act.actionIndentifierString) && ak.column == i); act.whatKeysIsActionAssignedTo[i] = k; } } }
private void videoOptionHandle() { bDrawOptionsScreen = true; if ((buttonPressUtility.isPressed(Game1.confirmString) || (Game1.bIsActive && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.bMousePressed && Game1.graphics.GraphicsDevice.Viewport.Bounds.Contains(CursorUtility.trueCursorPos)))) { switch ((int)cursorPosition.X) { case 8: ResolutionUtility.toggleFullscreen(); bSubMenu = false; cursorPosition.X = 0; cursorPosition.Y = 0; break; } } if (SceneUtility.prevScene != 5) { bDrawOptionsScreen = true; if ((buttonPressUtility.isPressed(Game1.confirmString) || (Game1.bIsActive && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.bMousePressed))) { switch ((int)cursorPosition.X) { case 1: ResolutionUtility.AdjustResolution(1024, 768, Game1.graphics); break; case 2: ResolutionUtility.AdjustResolution(1280, 800, Game1.graphics); break; case 3: ResolutionUtility.AdjustResolution(1280, 1024, Game1.graphics); break; case 4: ResolutionUtility.AdjustResolution(1366, 768, Game1.graphics); break; case 5: ResolutionUtility.AdjustResolution(1440, 900, Game1.graphics); break; case 6: ResolutionUtility.AdjustResolution(1600, 900, Game1.graphics); break; case 7: ResolutionUtility.AdjustResolution(1920, 1080, Game1.graphics); break; case 8: ResolutionUtility.toggleFullscreen(); bSubMenu = false; cursorPosition.X = 0; cursorPosition.Y = 0; break; } } if (buttonPressUtility.isPressed(Game1.moveLeftString)) { bEditingSubMenu = false; } } }