public void OnGUI() { SNWindow.CreateWindow(new Rect(0, 0, Screen.width / 5, hotkeyLabels.Count * 48), $"QuickSlot Extender Configuration Window ({QSEConfig.PROGRAM_VERSION})", false, false); GUI.FocusControl("QSEConfigUI"); guiItem_Labels.DrawGuiItemsGroup(); GuiItemEvent sBtn = guiItem_Buttons.DrawGuiItemsGroup(); if (sBtn.ItemID != -1) { StartAssignment(hotkeyButtons[sBtn.ItemID]); selected = sBtn.ItemID; guiItem_Buttons[sBtn.ItemID].Name = "Press any key!"; } SNDropDown.CreateDropdown(hotkeyButtonsRect[hotkeyButtonsRect.Count - 3], ref isMaxSlotsDropDownVisible, ref MaxSlotDropDownSelection, MaxSlotDropDownContent); if (!isMaxSlotsDropDownVisible) { SNDropDown.CreateDropdown(hotkeyButtonsRect[hotkeyButtonsRect.Count - 2], ref isTextColorDropDownVisible, ref TextColorDropDownSelection, TextColorDropDownContent); } float y = hotkeyLabelsRect[hotkeyLabelsRect.Count - 2].y + space * 2 + hotkeyLabelsRect[0].height; if (GUI.Button(new Rect(hotkeyLabelsRect[0].x, y, hotkeyLabelsRect[0].width, Screen.height / 25f), "Save", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON))) { SaveAndExit(); } if (!isMaxSlotsDropDownVisible && !isTextColorDropDownVisible) { if (GUI.Button(new Rect(hotkeyButtonsRect[0].x, y, hotkeyButtonsRect[0].width, Screen.height / 25f), "Cancel", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON))) { Destroy(this); } } keyEvent = Event.current; if (keyEvent.isKey && waitingForKey) { newKey = InputHelper.GetKeyCodeAsInputName(keyEvent.keyCode); waitingForKey = false; } }
public void OnGUI() { SNWindow.CreateWindow(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47), "SlotExtenderZero Configuration Window", false, false); GUI.FocusControl("SlotExtenderZero.ConfigUI"); SNGUI.DrawGuiItemsGroup(ref itemInfo); int sBtn = SNGUI.DrawGuiItemsGroup(ref buttonInfo); if (sBtn != -1) { StartAssignment(hotkeyButtons[sBtn]); selected = sBtn; buttonInfo[sBtn].Name = "Press any key!"; } SNDropDown.CreateDropdown(buttonsRect[buttonsRect.Count - 2], ref isVisible, ref dropdownSelection, dropDownContent); float y = itemsRect[itemsRect.Count - 2].y + space * 2 + itemsRect[0].height; if (GUI.Button(new Rect(itemsRect[0].x, y, itemsRect[0].width, Screen.height / 22.5f), "Save", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON))) { SaveAndExit(); } if (!isVisible) { if (GUI.Button(new Rect(buttonsRect[0].x, y, buttonsRect[0].width, Screen.height / 22.5f), "Cancel", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON))) { Destroy(Instance); } } keyEvent = Event.current; if (keyEvent.isKey && waitingForKey) { newKey = InputHelper.GetKeyCodeAsInputName(keyEvent.keyCode); waitingForKey = false; } }