public bool ProcessHotkeySequences(HotkeySequence.KeyModifiers keyModifiers) { foreach (BaseScreenComponent component in components) { if (component.Enabled && component is Button) { Button buttonComponent = (Button)component; if (buttonComponent.ProcessHotkeySequences(keyModifiers)) { return(true); } } } foreach (BaseScreenComponent component in components) { if (component.Enabled && component is Panel) { Panel panelComponent = (Panel)component; if (panelComponent.ProcessHotkeySequences(keyModifiers)) { return(true); } } } return(false); }
public HotkeySequence.HotkeySequenceProcessStatus ProcessHotkeySequences(HotkeySequence.KeyModifiers keyModifiers) { foreach (BaseScreenComponent component in components) { if (component.Enabled && component is Button) { Button buttonComponent = (Button)component; if (buttonComponent.ProcessHotkeySequences(keyModifiers)) { return(HotkeySequence.HotkeySequenceProcessStatus.Handled); } } } foreach (BaseScreenComponent component in components) { if (component.Enabled && component is Panel) { Panel panelComponent = (Panel)component; if (panelComponent.ProcessHotkeySequences(keyModifiers) == HotkeySequence.HotkeySequenceProcessStatus.Handled) { return(HotkeySequence.HotkeySequenceProcessStatus.Handled); } } } return(HotkeySequence.HotkeySequenceProcessStatus.NotFound); }
public override void Update() { base.Update(); // Display nothing and exit if quest debugger not enabled if (!DaggerfallUnity.Settings.EnableQuestDebugger) { displayState = DisplayState.Nothing; return; } // Do not tick while HUD fading or load in progress // This is to prevent quest popups or other actions while player/world unavailable if (DaggerfallUI.Instance.FadeBehaviour.FadeInProgress || SaveLoadManager.Instance.LoadInProgress) { return; } if (QuestMachine.Instance.QuestCount == 0 && currentQuest != null) { ClearCurrentQuest(); FullRefresh(); return; } if (allQuests == null || allQuests.Length != QuestMachine.Instance.QuestCount) { FullRefresh(); } // Clamp display state if (displayState < DisplayState.Nothing || displayState > DisplayState.QuestStateFull) { displayState = DisplayState.Nothing; } // Change quest selection HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers(); if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.DebuggerPrevQuest).IsDownWith(keyModifiers)) { MovePreviousQuest(); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.DebuggerNextQuest).IsDownWith(keyModifiers)) { MoveNextQuest(); } // Change marker selection if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.DebuggerPrevMarker).IsDownWith(keyModifiers)) { MovePreviousMarker(); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.DebuggerNextMarker).IsDownWith(keyModifiers)) { MoveNextMarker(); } }
new public bool ProcessHotkeySequences(HotkeySequence.KeyModifiers keyModifiers) { bool isActivated = shortcutKey.IsUpWith(keyModifiers); if (isActivated) { TriggerMouseClick(); } return(isActivated); }
new public bool ProcessHotkeySequences(HotkeySequence.KeyModifiers keyModifiers) { bool isKeyDown = DaggerfallUI.Instance.KeyEvent.type == EventType.KeyDown; bool isActivated = isKeyDown ? shortcutKey.IsDownWith(keyModifiers) : shortcutKey.IsUpWith(keyModifiers); if (isActivated) { if (!KeyboardEvent(DaggerfallUI.Instance.KeyEvent)) { // Legacy support fallback, OnMouseClick handlers receive KeyDown events as faked clicks if (isKeyDown) { TriggerMouseClick(); } } } return(isActivated); }
public override void Update() { base.Update(); if (lastChunk && !answerGiven) { HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers(); if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.Yes).IsUpWith(keyModifiers)) { HandleAnswer(QuestMachine.QuestMessages.AcceptQuest); QuestMachine.Instance.StartQuest(daedraQuest); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.No).IsUpWith(keyModifiers)) { HandleAnswer(QuestMachine.QuestMessages.RefuseQuest); GameObjectHelper.CreateFoeSpawner(true, DaggerfallQuestPopupWindow.daedricFoes[UnityEngine.Random.Range(0, 5)], UnityEngine.Random.Range(3, 6), 8, 64); } } }
public override void Update() { base.Update(); Cursor.visible = true; HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers(); // Shortcuts for options if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuLoad).IsUpWith(keyModifiers)) { LoadGame(); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuStart).IsUpWith(keyModifiers)) { StartNewGame(); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.MainMenuExit).IsUpWith(keyModifiers)) { ExitGame(); } }
public override void Update() { base.Update(); HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers(); if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookPageRight).IsDownWith(keyModifiers)) { ScrollBook(-scrollAmount); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookPageLeft).IsDownWith(keyModifiers)) { ScrollBook(scrollAmount); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookLineUp).IsDownWith(keyModifiers)) { ScrollBook(1); } else if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.BookLineDown).IsDownWith(keyModifiers)) { ScrollBook(-1); } }
public override void Update() { // Update HUD visibility popupText.Enabled = ShowPopupText; midScreenTextLabel.Enabled = ShowMidScreenText; crosshair.Enabled = ShowCrosshair; vitals.Enabled = ShowVitals; compass.Enabled = ShowCompass; interactionModeIcon.Enabled = ShowInteractionModeIcon; placeMarker.Enabled = ShowLocalQuestPlaces; escortingFaces.EnableBorder = ShowEscortingFaces; questDebugger.Enabled = !(questDebugger.State == HUDQuestDebugger.DisplayState.Nothing); activeSpells.Enabled = ShowActiveSpells; // Large HUD will force certain other HUD elements off as they conflict in space or utility bool largeHUDEnabled = false;//DaggerfallUnity.Settings.LargeHUD; if (largeHUDEnabled) { largeHUD.Enabled = true; vitals.Enabled = false; compass.Enabled = false; interactionModeIcon.Enabled = false; } else { largeHUD.Enabled = false; } // Scale HUD elements largeHUD.Scale = NativePanel.LocalScale * DaggerfallUnity.Settings.LargeHUDScale; compass.Scale = NativePanel.LocalScale; vitals.Scale = NativePanel.LocalScale; crosshair.CrosshairScale = CrosshairScale; interactionModeIcon.Scale = NativePanel.LocalScale; // Align compass to screen panel Rect screenRect = ParentPanel.Rectangle; float compassX = screenRect.width - (compass.Size.x); float compassY = screenRect.height - (compass.Size.y); compass.Position = new Vector2(compassX, compassY); // Update midscreen text timer and remove once complete if (midScreenTextTimer != -1) { midScreenTextTimer += Time.deltaTime; if (midScreenTextTimer > midScreenTextDelay) { midScreenTextTimer = -1; midScreenTextLabel.Text = string.Empty; } } // Update arrow count if player holding an unsheathed bow // TODO: Find a spot for arrow counter when large HUD enabled (remembering player could be in 320x200 retro mode) arrowCountTextLabel.Enabled = false; if (!largeHUDEnabled && ShowArrowCount && !GameManager.Instance.WeaponManager.Sheathed) { EquipSlots slot = DaggerfallUnity.Settings.BowLeftHandWithSwitching ? EquipSlots.LeftHand : EquipSlots.RightHand; DaggerfallUnityItem held = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(slot); if (held != null && held.ItemGroup == ItemGroups.Weapons && (held.TemplateIndex == (int)Weapons.Long_Bow || held.TemplateIndex == (int)Weapons.Short_Bow)) { // Arrow count label position is offset to left of compass and centred relative to compass height // This is done every frame to handle adaptive resolutions Vector2 arrowLabelPos = compass.Position; arrowLabelPos.x -= arrowCountTextLabel.TextWidth; arrowLabelPos.y += compass.Size.y / 2 - arrowCountTextLabel.TextHeight / 2; DaggerfallUnityItem arrows = GameManager.Instance.PlayerEntity.Items.GetItem(ItemGroups.Weapons, (int)Weapons.Arrow); arrowCountTextLabel.Text = (arrows != null) ? arrows.stackCount.ToString() : "0"; arrowCountTextLabel.TextScale = NativePanel.LocalScale.x; arrowCountTextLabel.Position = arrowLabelPos; arrowCountTextLabel.Enabled = true; } } HotkeySequence.KeyModifiers keyModifiers = HotkeySequence.GetKeyboardKeyModifiers(); // Cycle quest debugger state if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.DebuggerToggle).IsDownWith(keyModifiers)) { questDebugger.NextState(); } if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.Pause).IsUpWith(keyModifiers)) { DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenPauseOptionsDialog); } // Toggle HUD rendering if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.HUDToggle).IsDownWith(keyModifiers)) { renderHUD = !renderHUD; } // Toggle Retro Renderer Postprocessing if (DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.ToggleRetroPP).IsDownWith(keyModifiers)) { RetroRenderer.enablePostprocessing = !RetroRenderer.enablePostprocessing; } flickerController.NextCycle(); // Don't display persistent HUD elements during initial startup // Prevents HUD elements being shown briefly at wrong size/scale at game start if (!startupComplete && !GameManager.Instance.IsPlayingGame()) { largeHUD.Enabled = false; vitals.Enabled = false; crosshair.Enabled = false; compass.Enabled = false; } else { startupComplete = true; } base.Update(); }
public static bool CheckSetModifiers(HotkeySequence.KeyModifiers pressedModifiers, HotkeySequence.KeyModifiers triggeringModifiers) { return(((pressedModifiers & triggeringModifiers) == triggeringModifiers) && // all of the modifiers in triggeringModifiers are pressed ((pressedModifiers & (virtualKeys & ~triggeringModifiers)) == 0)); // only the virtual modifiers specified in triggeringModifiers are pressed }