private void InitItems() { foreach (KeyValuePair <string, string> key in SEConfig.Hotkeys_Config) { hotkeyLabels.Add(key.Key); hotkeyButtons.Add(key.Value); } hotkeyLabels.Add("MaxSlots"); windowRect = SNWindow.InitWindowRect(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47)); hotkeyLabelsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyLabels.Count, Screen.height / 45, space, space, false, true); hotkeyButtonsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x + windowRect.width / 2, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyButtons.Count + 1, Screen.height / 45, space, space, false, true); guiItem_Labels.CreateGuiItemsGroup(hotkeyLabels, hotkeyLabelsRect, GuiItemType.LABEL, new GuiItemColor(normal: GuiColor.White), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleLeft); guiItem_Buttons.CreateGuiItemsGroup(hotkeyButtons, hotkeyButtonsRect, GuiItemType.NORMALBUTTON, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleCenter); guiItem_Labels.SetGuiItemsGroupLabel("Functions", hotkeyLabelsRect.GetLast(), new GuiItemColor()); guiItem_Buttons.SetGuiItemsGroupLabel("Hotkeys", hotkeyButtonsRect.GetLast(), new GuiItemColor()); }
private void RendererWindow_OnGUI() { if (!showRendererWindow) { return; } Rect windowrect = SNWindow.CreateWindow(new Rect(700, 732, 550, 348), "Renderer Window"); ScrollView_renderer_event = SNScrollView.CreateScrollView(new Rect(windowrect.x + 5, windowrect.y, windowrect.width - 10, windowrect.height - 60), ref scrollPos_Renderer, ref guiItems_Renderer, currentRenderer, MESSAGE_TEXT[MESSAGES.RENDERER_WINDOW_INFOTEXT], 10); if (undo) { if (GUI.Button(new Rect(windowrect.x + 5, windowrect.y + (windowrect.height - 50), 60, 22), RendererWindow[0])) { ResetMaterials(); } } Renderer renderer = (Renderer)components[selected_component]; if (GUI.Button(new Rect(windowrect.x + 70, windowrect.y + (windowrect.height - 50), 60, 22), renderer.enabled ? "Off" : "On")) { renderer.enabled = !renderer.enabled; } }
private void InitItems() { foreach (KeyValuePair <string, string> key in CmZConfig.Section_hotkeys) { HotkeyLabels.Add(key.Key); HotkeyButtons.Add(key.Value); } foreach (KeyValuePair <string, string> key in CmZConfig.Section_settings) { SettingLabels.Add(key.Key); } drawRect = SNWindow.InitWindowRect(windowRect, true); List <Rect> itemsRect = SNWindow.SetGridItemsRect(new Rect(drawRect.x, drawRect.y, drawRect.width / 2, drawRect.height), 1, HotkeyLabels.Count, Screen.height / 45, 10, 10); buttonsRect = SNWindow.SetGridItemsRect(new Rect(drawRect.x + drawRect.width / 2, drawRect.y, drawRect.width / 2, drawRect.height), 1, HotkeyButtons.Count + 1, Screen.height / 45, 10, 10); itemInfo.CreateGuiItemsGroup(HotkeyLabels.ToArray(), itemsRect, GuiItemType.TEXTFIELD, new GuiItemColor()); buttonInfo.CreateGuiItemsGroup(HotkeyButtons.ToArray(), buttonsRect, GuiItemType.NORMALBUTTON, new GuiItemColor(GuiColor.Gray, GuiColor.White, GuiColor.Green), null, GuiItemState.NORMAL, true, FontStyle.Bold, TextAnchor.MiddleCenter); }
public void OnGUI() { SNWindow.CreateWindow(windowRect, "CheatManager: Configuration interface", false, true); GUI.FocusControl("CheatManager.ConfigUI"); itemInfo.DrawGuiItemsGroup(); GuiItemEvent sBtn = buttonInfo.DrawGuiItemsGroup(); if (sBtn.ItemID != -1) { StartAssignment(HotkeyButtons[sBtn.ItemID]); selected = sBtn.ItemID; buttonInfo[sBtn.ItemID].Name = "Press any key!"; } if (GUI.Button(new Rect(drawRect.x + space, buttonsRect.GetLast().y + space * 2, drawRect.width / 2 - space * 2, 40), "Save")) { SaveAndExit(); } else if (GUI.Button(new Rect(drawRect.x + space + drawRect.width / 2, buttonsRect.GetLast().y + space * 2, drawRect.width / 2 - space * 2, 40), "Cancel")) { Destroy(Instance); } keyEvent = Event.current; if (keyEvent.isKey && waitingForKey) { newKey = keyEvent.keyCode; waitingForKey = false; } }
private void MarkWindow_OnGUI() { SNWindow.CreateWindow(MarkWindow_Rect, "Marked Objects Window"); ScrollView_marklist_event = SNScrollView.CreateScrollView(new Rect(MarkWindow_drawRect.x + 5, MarkWindow_drawRect.y, MarkWindow_drawRect.width - 10, 168), ref scrollpos_marklist, ref guiItems_marklist, "Selected:", markList[current_marklist_index], 7); if (GUI.Button(new Rect(MarkWindow_drawRect.x + 5, MarkWindow_drawRect.y + 218, 40, 22), MarkWindow[0], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (isEmpty) { OutputWindow_Log(WARNING_TEXT[WARNINGS.CANNOT_SET_MARKED], LogType.Warning); } else { OnBaseObjectChange(MARKED_OBJECTS[current_marklist_index]); } } if (GUI.Button(new Rect(MarkWindow_drawRect.x + 50, MarkWindow_drawRect.y + 218, 60, 22), MarkWindow[1], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (isEmpty) { OutputWindow_Log(WARNING_TEXT[WARNINGS.CANNOT_REMOVE_MARKED], LogType.Warning); } else { RemoveFromMarkList(MARKED_OBJECTS[current_marklist_index]); } } }
public void OnGUI() { if (!isActive) { return; } SNWindow.CreateWindow(windowRect, windowTitle); normalButtonID = SNGUI.DrawGuiItemsGroup(ref commands); toggleButtonID = SNGUI.DrawGuiItemsGroup(ref toggleCommands); daynightTabID = SNGUI.DrawGuiItemsGroup(ref daynightTab); weatherTabID = SNGUI.DrawGuiItemsGroup(ref weatherTab); categoriesTabID = SNGUI.DrawGuiItemsGroup(ref categoriesTab); if (currentTab == 0) { scrollviewID = SNScrollView.CreateScrollView(scrollRect, ref scrollPos, ref scrollItemsList[currentTab], "Select Item in Category:", categoriesTab[currentTab].Name, MAXSHOWITEMS); vehicleSettingsID = SNGUI.DrawGuiItemsGroup(ref vehicleSettings); SNHorizontalSlider.CreateHorizontalSlider(sliders[0].Rect, ref seamothSpeedMultiplier, 1f, 5f, sliders[0].Name, sliders[0].OnChangedEvent); SNHorizontalSlider.CreateHorizontalSlider(sliders[1].Rect, ref exosuitSpeedMultiplier, 1f, 5f, sliders[1].Name, sliders[1].OnChangedEvent); SNHorizontalSlider.CreateHorizontalSlider(sliders[2].Rect, ref hoverbikeSpeedMultiplier, 1f, 5f, sliders[2].Name, sliders[2].OnChangedEvent); } else { scrollviewID = SNScrollView.CreateScrollView(scrollRect, ref scrollPos, ref scrollItemsList[currentTab], "Select Item in Category:", categoriesTab[currentTab].Name); } }
private void OutputWindow_OnGUI() { logStyle = SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft, wordWrap: true); SNWindow.CreateWindow(OutputWindow_Rect, "Output Window", false, false); scrollPos = GUI.BeginScrollView(OutputWindow_scrollRect, scrollPos, new Rect(OutputWindow_scrollRect.x, OutputWindow_scrollRect.y, scrollWidth, drawingPos - OutputWindow_scrollRect.y)); for (int i = 0; i < logMessage.Count; i++) { if (i == 0) { drawingPos = OutputWindow_scrollRect.y; } contentHeight = logStyle.CalcHeight(new GUIContent(logMessage[i].message), scrollWidth); logStyle.normal.textColor = SNStyles.GetGuiColor(logTypeColors[logMessage[i].type]); GUI.Label(new Rect(OutputWindow_scrollRect.x + 5, drawingPos, 15, 21), "> ", logStyle); GUI.Label(new Rect(OutputWindow_scrollRect.x + 20, drawingPos, scrollWidth, contentHeight), logMessage[i].message, logStyle); drawingPos += contentHeight + 1; } if (messageCount != logMessage.Count) { scrollPos.y += Mathf.Infinity; messageCount = logMessage.Count; } GUI.EndScrollView(); }
public void OnGUI() { if (!isActive) { return; } SNWindow.CreateWindow(windowRect, windowTitle); CommandsGroup = commands.DrawGuiItemsGroup(); ToggleCommandsGroup = toggleCommands.DrawGuiItemsGroup(); DayNightGroup = daynightTab.DrawGuiItemsGroup(); CategoriesGroup = categoriesTab.DrawGuiItemsGroup(); if (currentTab == 0) { ScrollViewGroup = SNScrollView.CreateScrollView(scrollRect, ref scrollPos, ref scrollItemsList[currentTab], "Select Item in Category:", categoriesTab[currentTab].Name, MAXSHOWITEMS); VehicleSettingsGroup = vehicleSettings.DrawGuiItemsGroup(); SNHorizontalSlider.CreateHorizontalSlider(sliders[0].Rect, ref seamothSpeedMultiplier, 1f, 5f, sliders[0].Name, sliders[0].OnChangedEvent); SNHorizontalSlider.CreateHorizontalSlider(sliders[1].Rect, ref exosuitSpeedMultiplier, 1f, 5f, sliders[1].Name, sliders[1].OnChangedEvent); SNHorizontalSlider.CreateHorizontalSlider(sliders[2].Rect, ref cyclopsSpeedMultiplier, 1f, 5f, sliders[2].Name, sliders[2].OnChangedEvent); } else { ScrollViewGroup = SNScrollView.CreateScrollView(scrollRect, ref scrollPos, ref scrollItemsList[currentTab], "Select Item in Category:", categoriesTab[currentTab].Name); } }
public void Awake() { #if DEBUG show = true; #endif DontDestroyOnLoad(this); useGUILayout = false; drawRect = SNWindow.InitWindowRect(windowRect); scrollRect = new Rect(drawRect.x, drawRect.y + 5, drawRect.width - 5, drawRect.height - 37); scrollWidth = scrollRect.width - 40; #if DEBUGTOFILE if (!File.Exists(LogFilePath)) { try { File.Delete(LogFilePath); } catch (Exception ex) { Debug.Log(ex); } } #endif Application.logMessageReceived += HandleLog; }
private void EditWindow_OnGUI() { SNWindow.CreateWindow(EditWindow_Rect, "Edit Window"); ScrollView_editmode_event = SNScrollView.CreateScrollView(new Rect(EditWindow_drawRect.x + 5, EditWindow_drawRect.y, EditWindow_drawRect.width - 10, 168), ref scrollpos_editmode, ref guiItems_editmode, "Current mode:", EDIT_MODE[current_editmode_index], 7); SNHorizontalSlider.CreateHorizontalSlider(new Rect(EditWindow_drawRect.x + 5, EditWindow_drawRect.y + 200, EditWindow_drawRect.width - 10, 35), ref scaleFactor, 0.01f, 1f, "Scale Factor:", onScaleFactorChanged); }
void OnGUI() { if (!show) { return; } logStyle = SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft, wordWrap: true); SNWindow.CreateWindow(windowRect, $"CheatManager Console (Press {CmConfig.KEYBINDINGS["ToggleConsole"]} to toggle)", true, true); scrollPos = GUI.BeginScrollView(scrollRect, scrollPos, new Rect(scrollRect.x, scrollRect.y, scrollWidth, drawingPos - scrollRect.y)); for (int i = 0; i < logMessage.Count; i++) { if (i == 0) { drawingPos = scrollRect.y; } contentHeight = logStyle.CalcHeight(new GUIContent(logMessage[i].message), scrollWidth); logStyle.normal.textColor = SNStyles.GetGuiColor(logTypeColors[logMessage[i].type]); GUI.Label(new Rect(scrollRect.x + 5, drawingPos, 15, 21), "> ", logStyle); GUI.Label(new Rect(scrollRect.x + 20, drawingPos, scrollWidth, contentHeight), logMessage[i].message, logStyle); drawingPos += contentHeight + 1; if (logMessage[i].stackTrace != "") { contentHeight = logStyle.CalcHeight(new GUIContent(logMessage[i].stackTrace), scrollWidth); logStyle.normal.textColor = SNStyles.GetGuiColor(logTypeColors[logMessage[i].type]); GUI.Label(new Rect(scrollRect.x + 20, drawingPos, scrollWidth, contentHeight), logMessage[i].stackTrace, logStyle); drawingPos += contentHeight + 1; } } #if AUTOSCROLL if (messageCount != logMessage.Count) { scrollPos.y += Mathf.Infinity; messageCount = logMessage.Count; } #endif GUI.EndScrollView(); if (GUI.Button(buttonRect, "Clear Window")) { logMessage.Clear(); drawingPos = scrollRect.y; } }
private void EditWindow_Awake() { EditModeStrings.Init(); RefreshEditModeList(); EditWindow_drawRect = SNWindow.InitWindowRect(EditWindow_Rect, true); scaleFactor = value; onScaleFactorChanged.AddHandler(this, new Event <object> .HandleFunction(OnScaleFactorChanged)); }
public void OnGUI() { if (!isShow) { return; } SNWindow.CreateWindow(windowRect, null); GUI.Label(drawRect, infoText, SNStyles.GetGuiItemStyle(GuiItemType.LABEL, textColor: GuiColor.Green, textAnchor: TextAnchor.MiddleLeft)); }
private void ComponentInfoWindow_OnGUI() { if (!showComponentInfoWindow) { return; } Rect windowrect = SNWindow.CreateWindow(new Rect(700, 732, 550, 348), "Component Information Window"); ScrollView_componentInfoEvent = SNScrollView.CreateScrollView(new Rect(windowrect.x + 5, windowrect.y, windowrect.width - 10, windowrect.height - 60), ref scrollPos_ComponentInfo, ref guiItems_componentInfo, $"Information of this", components[selected_component].GetType().ToString().Split('.').GetLast(), 10); }
private void AddComponentWindow_OnGUI() { if (!showAddComponentWindow) { return; } Rect windowrect = SNWindow.CreateWindow(new Rect(700, 732, 550, 348), "Add Component Window"); ScrollView_addComponents_event = SNScrollView.CreateScrollView(new Rect(windowrect.x + 5, windowrect.y, windowrect.width - 10, windowrect.height - 60), ref scrollPos_componentsToAdd, ref guiItems_componentsToAdd, "Available Components", "", 10); }
private void OnGUI() { SNWindow.CreateWindow(windowRect, "File Dialog"); Scroll_retval = SNScrollView.CreateScrollView(new Rect(drawRect.x + 5, drawRect.y, drawRect.width - 10, 168), ref scrollpos, ref guiItems, "Current Directory:", directoryInfo.Name, 7); if (Scroll_retval.ItemID != -1) { current_index = Scroll_retval.ItemID; } }
private void FMODWindow_OnGUI() { SNWindow.CreateWindow(FmodWindow_Rect, "FMOD assets window"); ScrollView_fmodlist_event = SNScrollView.CreateScrollView(new Rect(fmodWindow_drawRect.x + 5, fmodWindow_drawRect.y, fmodWindow_drawRect.width - 10, 80), ref scrollpos_fmodlist, ref guiItems_fmodlist, "Selected:", fmodList[current_fmodlist_index], 5); if (GUI.Button(new Rect(fmodWindow_drawRect.x + 5, fmodWindow_drawRect.y + 152, 40, 22), FMODWindow[0], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (isFmodEmpty) { FindFMODAssets(); ListPrefabDatabase(); } else { OutputWindow_Log(WARNING_TEXT[WARNINGS.CANNOT_GET_FMODS_IS_READY], LogType.Warning); } } if (GUI.Button(new Rect(fmodWindow_drawRect.x + 50, fmodWindow_drawRect.y + 152, 60, 22), FMODWindow[1], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (isFmodEmpty) { OutputWindow_Log(WARNING_TEXT[WARNINGS.CANNOT_PLAY_FMOD_ASSET], LogType.Warning); } else { PlayFMODAsset(FMOD_ASSETS[current_fmodlist_index]); } } if (GUI.Button(new Rect(fmodWindow_drawRect.x + 115, fmodWindow_drawRect.y + 152, 60, 22), FMODWindow[2], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (isFmodEmpty) { OutputWindow_Log(WARNING_TEXT[WARNINGS.CANNOT_STOP_FMOD_ASSET], LogType.Warning); } else { customEmitter.Stop(); } } if (GUI.Button(new Rect(fmodWindow_drawRect.x + 180, fmodWindow_drawRect.y + 152, 60, 22), FMODWindow[3], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (!isFmodEmpty) { FMODAsset currentAsset = FMOD_ASSETS[current_fmodlist_index]; OutputWindow_Log(MESSAGE_TEXT[MESSAGES.FMOD_ASSET_PRINTED], LogType.Log, currentAsset.name, currentAsset.path); } } }
private void FMODWindow_Awake() { GameObject fmodPlayer = new GameObject("fmodPlayer"); fmodPlayer.transform.SetParent(MainCamera.camera.transform, false); Utils.ZeroTransform(fmodPlayer.transform); customEmitter = fmodPlayer.AddComponent <FMOD_CustomEmitter>(); RefreshFMODList(); fmodWindow_drawRect = SNWindow.InitWindowRect(FmodWindow_Rect, true); }
public void Awake() { #if DEBUG show = true; #endif Instance = this; DontDestroyOnLoad(this); useGUILayout = false; drawRect = SNWindow.InitWindowRect(windowRect); scrollRect = new Rect(drawRect.x, drawRect.y + 5, drawRect.width - 5, drawRect.height - 37); scrollWidth = scrollRect.width - 42; Application.logMessageReceived += HandleLog; }
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; } }
private void InitItems() { foreach (KeyValuePair <string, string> key in QSEConfig.Section_hotkeys) { labels.Add(key.Key); buttons.Add(key.Value); } windowRect = new Rect(0, 0, Screen.width / 6, buttons.Count * 48); drawrect = SNWindow.InitWindowRect(windowRect); List <Rect> labelRects = SNWindow.SetGridItemsRect(new Rect(drawrect.x, drawrect.y, drawrect.width / 2, drawrect.height), 1, labels.Count, 24, 10, 10, false); labelInfo.CreateGuiItemsGroup(labels.ToArray(), labelRects, GuiItemType.TEXTFIELD, new GuiItemColor(normal: GuiColor.White)); buttonRects = SNWindow.SetGridItemsRect(new Rect(drawrect.x + drawrect.width / 2, drawrect.y, drawrect.width / 2, drawrect.height), 1, buttons.Count, 24, 10, 10, false); buttonInfo.CreateGuiItemsGroup(buttons.ToArray(), buttonRects, GuiItemType.NORMALBUTTON, new GuiItemColor(normal: GuiColor.White)); }
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; } }
private void ComponentWindow_OnGUI() { if (isDirty) { return; } ComponentWindow_drawRect = SNWindow.CreateWindow(ComponentWindow_Rect, "Component Window"); ScrollView_components_event = SNScrollView.CreateScrollView(new Rect(ComponentWindow_drawRect.x + 5, ComponentWindow_drawRect.y, ComponentWindow_drawRect.width - 10, 168), ref scrollPos_Components, ref guiItems_Components, "Components of", selectedObject.name, 7); if (changeEnabledproperty != null) { if (GUI.Button(new Rect(ComponentWindow_drawRect.x + 5, (ComponentWindow_drawRect.y + ComponentWindow_drawRect.height) - 27, 50, 22), enabledValue ? "Off" : "On", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { enabledValue = !enabledValue; changeEnabledproperty.SetValue(objects[selected_component], enabledValue, BindingFlags.Instance | BindingFlags.Public, null, null, null); showObjectInfoWindow = false; ObjectInfoWindow_Awake(objects[selected_component]); showObjectInfoWindow = true; OutputWindow_Log(MESSAGE_TEXT[MESSAGES.COMPONENT_STATE_MODIFIED], LogType.Warning, GetComponentShortType(objects[selected_component]), enabledValue); } } if (GUI.Button(new Rect(ComponentWindow_drawRect.x + 60, (ComponentWindow_drawRect.y + ComponentWindow_drawRect.height) - 27, 150, 22), ComponentWindow[0], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { showObjectInfoWindow = false; RemoveComponent(objects[selected_component]); } if (GUI.Button(new Rect(ComponentWindow_drawRect.x + 220, (ComponentWindow_drawRect.y + ComponentWindow_drawRect.height) - 27, 150, 22), ComponentWindow[1], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { showRendererWindow = false; showObjectInfoWindow = false; showAddComponentWindow = true; } }
public void ObjectWindow_OnGUI() { ObjectWindow_drawRect = SNWindow.CreateWindow(ObjectWindow_Rect, "Object Window"); if (GUI.Button(new Rect(ObjectWindow_drawRect.x + 5, ObjectWindow_drawRect.y + 5, 120, 22), ObjectWindow[0])) { if (!isDirty) { AddNewEmptyObject(); } } if (GUI.Button(new Rect(ObjectWindow_drawRect.x + 130, ObjectWindow_drawRect.y + 5, 163, 22), ObjectWindow[1])) { StartCoroutine(AddNewTechObjectAsync(techTypeDatas[selected_TechType].TechType)); } GuiItemEvent selValue = SNScrollView.CreateScrollView(new Rect(ObjectWindow_drawRect.x + 5, ObjectWindow_drawRect.y + 30, ObjectWindow_drawRect.width - 10, ObjectWindow_drawRect.height - 5), ref scrollPos_TechTypes, ref guiItems_TechTypes, "Selected TechType:", techTypeDatas[selected_TechType].Name, 7); if (selValue.ItemID != -1 && selValue.MouseButton == 0) { selected_TechType = selValue.ItemID; } }
private void ObjectInfoWindow_OnGUI() { if (!showObjectInfoWindow) { return; } Rect windowrect = SNWindow.CreateWindow(new Rect(700, 732, 550, 348), "Object Information Window"); ScrollView_objectInfo_event = SNScrollView.CreateScrollView(new Rect(windowrect.x + 5, windowrect.y, windowrect.width - 10, windowrect.height - 60), ref scrollPos_objectInfo, ref guiItems_objectInfo, $"Information of this", componentNames[selected_component], 10); if (GUI.Button(new Rect(windowrect.x + 5, windowrect.y + (windowrect.height - 50), 120, 22), ComponentInfoWindow[0], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { AddToLog(); } if (showSetButton) { if (GUI.Button(new Rect(windowrect.x + 130, windowrect.y + (windowrect.height - 50), 60, 22), ComponentInfoWindow[1], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { SwitchGameObject(); } } }
public void ObjectWindow_OnGUI() { ObjectWindow_drawRect = SNWindow.CreateWindow(ObjectWindow_Rect, "Object Window"); if (GUI.Button(new Rect(ObjectWindow_drawRect.x + 5, ObjectWindow_drawRect.y + 5, 120, 22), ObjectWindow[0], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (!isDirty) { AddNewEmptyObject(); } } if (GUI.Button(new Rect(ObjectWindow_drawRect.x + 130, ObjectWindow_drawRect.y + 5, 163, 22), ObjectWindow[1], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { AddNewTechObject(techTypeDatas[selected_TechType].TechType); } GuiItemEvent selValue = SNScrollView.CreateScrollView(new Rect(ObjectWindow_drawRect.x + 5, ObjectWindow_drawRect.y + 30, ObjectWindow_drawRect.width - 10, ObjectWindow_drawRect.height - 5), ref scrollPos_TechTypes, ref guiItems_TechTypes, "Selected TechType:", techTypeDatas[selected_TechType].Name, 7); if (selValue.ItemID != -1 && selValue.MouseButton == 0) { selected_TechType = selValue.ItemID; } }
public void OnGUI() { SNWindow.CreateWindow(windowRect, "QuickSlot Extender Configuration Window", false, false); GUI.FocusControl("QuickSlotExtender.ConfigUI"); labelInfo.DrawGuiItemsGroup(); GuiItemEvent sBtn = buttonInfo.DrawGuiItemsGroup(); if (sBtn.ItemID != -1) { StartAssignment(buttons[sBtn.ItemID]); selected = sBtn.ItemID; buttonInfo[sBtn.ItemID].Name = "Press any key!"; } float lastY = SNWindow.GetNextYPos(ref buttonRects); if (GUI.Button(new Rect(windowRect.x + space, lastY + space * 2, windowRect.width / 2 - space * 2, Screen.height / 22.5f), "Save")) { SaveAndExit(); } else if (GUI.Button(new Rect(windowRect.x + space + windowRect.width / 2, lastY + space * 2, windowRect.width / 2 - space * 2, Screen.height / 22.5f), "Cancel")) { Destroy(Instance); } keyEvent = Event.current; if (keyEvent.isKey && waitingForKey) { newKey = InputHelper.GetKeyCodeAsInputName(keyEvent.keyCode); waitingForKey = false; } }
private void InitItems() { foreach (KeyValuePair <string, string> key in Config.Section_hotkeys) { hotkeyLabels.Add(key.Key); hotkeyButtons.Add(key.Value); } hotkeyLabels.Add("MaxSlots"); windowRect = SNWindow.InitWindowRect(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47)); itemsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyLabels.Count, Screen.height / 45, space, space, false, true); buttonsRect = SNWindow.SetGridItemsRect(new Rect(windowRect.x + windowRect.width / 2, windowRect.y, windowRect.width / 2, windowRect.height), 1, hotkeyButtons.Count + 1, Screen.height / 45, space, space, false, true); SNGUI.CreateGuiItemsGroup(hotkeyLabels.ToArray(), itemsRect, GuiItemType.LABEL, ref itemInfo, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleLeft); SNGUI.CreateGuiItemsGroup(hotkeyButtons.ToArray(), buttonsRect, GuiItemType.NORMALBUTTON, ref buttonInfo, new GuiItemColor(), fontStyle: FontStyle.Bold, textAnchor: TextAnchor.MiddleCenter); SNGUI.SetGuiItemsGroupLabel("Functions", itemsRect.GetLast(), ref itemInfo, new GuiItemColor()); SNGUI.SetGuiItemsGroupLabel("Hotkeys", buttonsRect.GetLast(), ref buttonInfo, new GuiItemColor()); }
public void Awake() { Instance = this; useGUILayout = false; #if DEBUG isActive = true; #endif UpdateTitle(); warpSound = ScriptableObject.CreateInstance <FMODAsset>(); warpSound.path = "event:/tools/gravcannon/fire"; techMatrix = new TechnologyMatrix(); tMatrix = new List <TechTypeData> [techMatrix.baseTechMatrix.Count]; techMatrix.InitTechMatrixList(ref tMatrix); if (Main.isExistsSMLHelperV2) { techMatrix.IsExistsModdersTechTypes(ref tMatrix, techMatrix.Known_Modded_TechTypes); } else { SNLogger.Log($"[{Config.PROGRAM_NAME}] Warning: 'SMLHelper.V2' not found! Some functions are not available!"); } techMatrix.SortTechLists(ref tMatrix); buttonText = new ButtonText(); drawRect = SNWindow.InitWindowRect(windowRect, true); List <Rect> commandRects = drawRect.SetGridItemsRect(4, 2, ITEMSIZE, SPACE, SPACE, true, true); commands.CreateGuiItemsGroup(buttonText.Buttons, commandRects, GuiItemType.NORMALBUTTON, new GuiItemColor()); commands.SetGuiItemsGroupLabel("Commands", commandRects.GetLast(), new GuiItemColor(GuiColor.White)); List <Rect> toggleCommandRects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref commandRects), drawRect.width, drawRect.height).SetGridItemsRect(4, 5, ITEMSIZE, SPACE, SPACE, true, true); toggleCommands.CreateGuiItemsGroup(buttonText.ToggleButtons, toggleCommandRects, GuiItemType.TOGGLEBUTTON, new GuiItemColor(GuiColor.Red, GuiColor.Green)); toggleCommands.SetGuiItemsGroupLabel("Toggle Commands", toggleCommandRects.GetLast(), new GuiItemColor(GuiColor.White)); List <Rect> daynightTabrects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref toggleCommandRects), drawRect.width, drawRect.height).SetGridItemsRect(6, 1, ITEMSIZE, SPACE, SPACE, true, true); daynightTab.CreateGuiItemsGroup(buttonText.DayNightTab, daynightTabrects, GuiItemType.TAB, new GuiItemColor()); daynightTab.SetGuiItemsGroupLabel("Day/Night Speed:", daynightTabrects.GetLast(), new GuiItemColor(GuiColor.White)); List <Rect> categoriesTabrects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref daynightTabrects), drawRect.width, drawRect.height).SetGridItemsRect(4, 5, ITEMSIZE, SPACE, SPACE, true, true); categoriesTab.CreateGuiItemsGroup(buttonText.CategoriesTab, categoriesTabrects, GuiItemType.TAB, new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White)); categoriesTab.SetGuiItemsGroupLabel("Categories:", categoriesTabrects.GetLast(), new GuiItemColor(GuiColor.White)); float nextYpos = SNWindow.GetNextYPos(ref categoriesTabrects); scrollRect = new Rect(drawRect.x + SPACE, nextYpos, drawRect.width - (SPACE * 2), drawRect.height - nextYpos); List <Rect>[] scrollItemRects = new List <Rect> [tMatrix.Length + 1]; for (int i = 0; i < tMatrix.Length; i++) { float width = drawRect.width; if (i == 0 && tMatrix[0].Count > MAXSHOWITEMS) { width -= 20; } if (tMatrix[i].Count * 26 > scrollRect.height) { width -= 20; } scrollItemRects[i] = SNWindow.SetGridItemsRect(new Rect(0, 0, width, tMatrix[i].Count * (ITEMSIZE + SPACE)), 1, tMatrix[i].Count, ITEMSIZE, SPACE, 2, false, false, true); } scrollItemRects[tMatrix.Length] = SNWindow.SetGridItemsRect(new Rect(0, 0, drawRect.width - 20, warpTargets.Targets.Count * (ITEMSIZE + SPACE)), 1, warpTargets.Targets.Count, ITEMSIZE, SPACE, 2, false, false, true); scrollItemsList = new List <GuiItem> [tMatrix.Length + 1]; for (int i = 0; i < tMatrix.Length; i++) { scrollItemsList[i] = new List <GuiItem>(); CreateTechGroup(tMatrix[i], scrollItemRects[i], GuiItemType.NORMALBUTTON, ref scrollItemsList[i], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); } scrollItemsList[tMatrix.Length] = new List <GuiItem>(); AddListToGroup(warpTargets.Targets, scrollItemRects[tMatrix.Length], GuiItemType.NORMALBUTTON, ref scrollItemsList[tMatrix.Length], new GuiItemColor(GuiColor.Gray, GuiColor.Green, GuiColor.White), GuiItemState.NORMAL, true, FontStyle.Normal, TextAnchor.MiddleLeft); var searchSeaGlide = new TechnologyMatrix.TechTypeSearch(TechType.Seaglide); string seaglideName = tMatrix[1][tMatrix[1].FindIndex(searchSeaGlide.EqualsWith)].Name; var searchSeamoth = new TechnologyMatrix.TechTypeSearch(TechType.Seamoth); seamothName = tMatrix[0][tMatrix[0].FindIndex(searchSeamoth.EqualsWith)].Name; var searchExosuit = new TechnologyMatrix.TechTypeSearch(TechType.Exosuit); exosuitName = tMatrix[0][tMatrix[0].FindIndex(searchExosuit.EqualsWith)].Name; var searchCyclops = new TechnologyMatrix.TechTypeSearch(TechType.Cyclops); cyclopsName = tMatrix[0][tMatrix[0].FindIndex(searchCyclops.EqualsWith)].Name; string[] vehicleSetButtons = { $"{seamothName} Can Fly", $"{seaglideName} Speed Fast" }; float scrollRectheight = 5 * (scrollItemsList[0][0].Rect.height + 2); float y = scrollRect.y + scrollRectheight + SPACE; List <Rect> vehicleSettingsRects = new Rect(drawRect.x, y, drawRect.width, drawRect.height).SetGridItemsRect(2, 1, ITEMSIZE, SPACE, SPACE, false, true); vehicleSettings.CreateGuiItemsGroup(vehicleSetButtons, vehicleSettingsRects, GuiItemType.TOGGLEBUTTON, new GuiItemColor(GuiColor.Red, GuiColor.Green)); vehicleSettings.SetGuiItemsGroupLabel("Vehicle settings:", vehicleSettingsRects.GetLast(), new GuiItemColor(GuiColor.White)); string[] sliderLabels = { $"{seamothName} speed multiplier:", $"{exosuitName} speed multiplier:", $"{cyclopsName} speed multiplier:" }; List <Rect> slidersRects = new Rect(drawRect.x, SNWindow.GetNextYPos(ref vehicleSettingsRects), drawRect.width, drawRect.height).SetGridItemsRect(1, 3, SLIDERHEIGHT, SPACE, SPACE, false, false); sliders.CreateGuiItemsGroup(sliderLabels, slidersRects, GuiItemType.HORIZONTALSLIDER, new GuiItemColor()); sliders[0].OnChangedEvent = onSeamothSpeedValueChanged; sliders[1].OnChangedEvent = onExosuitSpeedValueChanged; sliders[2].OnChangedEvent = onCyclopsSpeedValueChanged; commands[(int)Commands.BackWarp].Enabled = false; commands[(int)Commands.BackWarp].State = GuiItemState.PRESSED; daynightTab.SetStateInverseTAB(4); categoriesTab[0].State = GuiItemState.PRESSED; seamothSpeedMultiplier = 1; exosuitSpeedMultiplier = 1; cyclopsSpeedMultiplier = 1; buttonControl = new ButtonControl(); }
public void Awake() { drawRect = SNWindow.InitWindowRect(windowRect, true); GetDirectoryStructure(-1); }