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(); } }
void Setup() { // Cut out red up/down arrows Texture2D arrowTexture = ImageReader.GetTexture(redArrowsTextureName); arrowUpTexture = ImageReader.GetSubTexture(arrowTexture, upArrowRect, arrowsFullSize); arrowDownTexture = ImageReader.GetSubTexture(arrowTexture, downArrowRect, arrowsFullSize); // Drop down button dropDownToggleButton = DaggerfallUI.AddButton(new Rect(0, 0, 7, 7), this); dropDownToggleButton.BackgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);//0.5f); dropDownToggleButton.OnMouseClick += DropdownButton_OnMouseClick; dropDownToggleButton.Hotkey = DaggerfallShortcut.GetBinding(DaggerfallShortcut.Buttons.OptionsDropdown); dropDownToggleButton.BackgroundTexture = arrowUpTexture; // Dropdown options panel dropdownPanel = new Panel(); dropdownPanel.Position = new Vector2(0, dropDownToggleButton.Position.y + dropDownToggleButton.Size.y); dropdownPanel.Size = new Vector2(50, 30); dropdownPanel.BackgroundColor = Color.black; dropdownPanel.Enabled = false; dropdownPanel.Outline.Enabled = true; this.Components.Add(dropdownPanel); dropdownList = new ListBox(); dropdownList.Position = new Vector2(2, 2); dropdownList.ShadowPosition = Vector2.zero; dropdownList.RowsDisplayed = unitsDisplayed; SetBackground(dropdownList, Color.black, "pauseDropdownListBackgroundColor"); dropdownList.OnSelectItem += DropdownList_OnUseSelectedItem; dropdownList.SelectedTextColor = dropdownList.TextColor; dropdownList.OnScroll += DropdownList_OnScroll; dropdownPanel.Components.Add(dropdownList); AddOptions(); var height = dropdownList.HeightContent(); dropdownList.Size = new Vector2(maxTextWidth, height > 80 ? 80 : height); dropdownPanel.Size = new Vector2(dropdownList.Size.x + 6, dropdownList.Size.y + 3); dropdownScroller = new VerticalScrollBar(); dropdownScroller.Position = new Vector2(maxTextWidth, 2); dropdownScroller.Size = new Vector2(5, dropdownPanel.Size.y - 3); dropdownScroller.DisplayUnits = unitsDisplayed; dropdownScroller.TotalUnits = dropdownList.Count; dropdownScroller.OnScroll += SavesScroller_OnScroll; dropdownPanel.Components.Add(dropdownScroller); }