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(); }
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; } }
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 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 OnGUI() { SNWindow.CreateWindow(new Rect(0, 0, Screen.width / 6, hotkeyLabels.Count * 47), $"SlotExtender Configuration Window ({SEConfig.PROGRAM_VERSION})", false, false); GUI.FocusControl("SlotExtender.ConfigUI"); guiItem_Labels.DrawGuiItemsGroup(); GuiItemEvent sBtn = guiItem_Buttons.DrawGuiItemsGroup(); if (sBtn.ItemID != -1 && sBtn.MouseButton == 0) { StartAssignment(hotkeyButtons[sBtn.ItemID]); selected = sBtn.ItemID; guiItem_Buttons[sBtn.ItemID].Name = "Press any key!"; } SNDropDown.CreateDropdown(hotkeyButtonsRect[hotkeyButtonsRect.Count - 2], ref isVisible, ref dropdownSelection, dropDownContent); 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 / 22.5f), "Save", SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON))) { SaveAndExit(); } if (!isVisible) { if (GUI.Button(new Rect(hotkeyButtonsRect[0].x, y, hotkeyButtonsRect[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; } }
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 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 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; } }
private void OnGUI() { if (isDirty) { return; } SafetyCheck(); Rect windowRect = SNWindow.CreateWindow(new Rect(0, 30, 298, 700), RuntimeHelper_Config.TitleText); GUI.Label(new Rect(windowRect.x + 5, windowRect.y, 290, 25), $"Base : {baseObject.name}", SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft)); ScrollView_transforms_event = SNScrollView.CreateScrollView(new Rect(windowRect.x + 5, windowRect.y + 22, windowRect.width - 10, 212), ref scrollpos_transforms, ref guiItems_transforms, isRootList ? "Active Scenes Root Game Objects" : "Childs of", isRootList ? string.Empty : baseObject.name, 10); GUI.Label(new Rect(windowRect.x + 5, windowRect.y + 300, 40, 22), "Base :", SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft)); if (GUI.Button(new Rect(windowRect.x + 60, windowRect.y + 300, 60, 22), MainWindow[0], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { OnBaseObjectChange(selectedObject); } if (GUI.Button(new Rect(windowRect.x + 125, windowRect.y + 300, 60, 22), MainWindow[1], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { OnRefreshBase(); } if (GUI.Button(new Rect(windowRect.x + 190, windowRect.y + 300, 103, 22), MainWindow[2], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { GetRoots(); } GUI.Label(new Rect(windowRect.x + 5, windowRect.y + 325, 40, 22), "Object :", SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft)); if (GUI.Button(new Rect(windowRect.x + 60, windowRect.y + 325, 30, 22), selectedObject.activeSelf ? MainWindow[4] : MainWindow[3], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (selectedObject == gameObject) { OutputWindow_Log(WARNING_TEXT[WARNINGS.OBJECT_STATE_CANNOT_MODIFIED], LogType.Warning, selectedObject.name); return; } selectedObject.SetActive(!selectedObject.activeSelf); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.ACTIVE_STATE_CHANGE], selectedObject.name, selectedObject.activeSelf.ToString()); } if (GUI.Button(new Rect(windowRect.x + 95, windowRect.y + 325, 40, 22), MainWindow[17], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { AddToMarkList(selectedObject); } if (GUI.Button(new Rect(windowRect.x + 140, windowRect.y + 325, 40, 22), MainWindow[5], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (selectedObject == gameObject) { OutputWindow_Log(WARNING_TEXT[WARNINGS.OBJECT_CANNOT_COPIED], LogType.Warning, selectedObject.name); } else { if (tempObject) { DestroyImmediate(tempObject); } selectedObject.CopyObject(out tempObject); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.OBJECT_COPIED], tempObject.name); } } if (GUI.Button(new Rect(windowRect.x + 185, windowRect.y + 325, 45, 22), MainWindow[6], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (tempObject) { OnPasteObject(); } else { OutputWindow_Log(WARNING_TEXT[WARNINGS.TEMP_OBJECT_EMPTY], LogType.Warning); } } if (GUI.Button(new Rect(windowRect.x + 235, windowRect.y + 325, 58, 22), MainWindow[7], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (selectedObject == gameObject) { OutputWindow_Log(WARNING_TEXT[WARNINGS.PROGRAM_OBJECT_CANNOT_DESTROY], LogType.Warning, selectedObject.name); } /* * else if (selectedObject.IsRoot()) * { * OutputWindow_Log(WARNING_TEXT[WARNINGS.ROOT_OBJECT_CANNOT_DESTROY], LogType.Warning); * }*/ else { DestroyObject(true); } } GUI.TextArea(new Rect(windowRect.x + 5, windowRect.y + 355, windowRect.width - 10, 100), OBJECTINFO); if (isColliderSelected) { GUI.TextArea(new Rect(windowRect.x + 5, windowRect.y + 465, windowRect.width - 10, 72), COLLIDERINFO); } GUI.Label(new Rect(windowRect.x + 5, windowRect.y + 542, 145, 22), "Transform shorthands:", SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft)); if (GUI.Button(new Rect(windowRect.x + 150, windowRect.y + 542, 140, 22), showLocal ? MainWindow[8] : MainWindow[9], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { showLocal = !showLocal; if (showLocal) { OutputWindow_Log(MESSAGE_TEXT[MESSAGES.TRANSFORM_TO_LOCAL]); } else { OutputWindow_Log(MESSAGE_TEXT[MESSAGES.TRANSFORM_TO_WORLD]); } } if (GUI.Button(new Rect(windowRect.x + 5, windowRect.y + 567, 140, 22), MainWindow[10], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (showLocal) { selectedObject.transform.SetLocalsToZero(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.LOCALS_TO_ZERO], selectedObject.name); } else { selectedObject.transform.SetWorldToZero(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.WORLD_TO_ZERO], selectedObject.name); } } if (GUI.Button(new Rect(windowRect.x + 150, windowRect.y + 567, 140, 22), MainWindow[11], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (showLocal) { selectedObject.transform.SetLocalPositionToZero(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.LOCAL_POS_TO_ZERO], selectedObject.name); } else { selectedObject.transform.SetPositionToZero(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.WORLD_POS_TO_ZERO], selectedObject.name); } } if (GUI.Button(new Rect(windowRect.x + 5, windowRect.y + 592, 140, 22), MainWindow[12], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { if (showLocal) { selectedObject.transform.SetLocalRotationToZero(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.LOCAL_ROT_TO_ZERO], selectedObject.name); } else { selectedObject.transform.SetRotationToZero(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.WORLD_ROT_TO_ZERO], selectedObject.name); } } if (GUI.Button(new Rect(windowRect.x + 150, windowRect.y + 592, 140, 22), MainWindow[13], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { selectedObject.transform.SetLocalScaleToOne(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.LOCAL_SCALE_TO_ONE], selectedObject.name); } if (GUI.Button(new Rect(windowRect.x + 5, windowRect.y + 617, 140, 22), MainWindow[14], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { DrawObjectBounds dob = selectedObject.GetOrAddVisualBase(BaseType.Object).GetComponent <DrawObjectBounds>(); selectedObject.transform.SetTransformInfo(ref dob.transformBase); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.TRANSFORM_TO_ORIGINAL], selectedObject.name); } if (isColliderSelected) { if (GUI.Button(new Rect(windowRect.x + 150, windowRect.y + 617, 140, 22), MainWindow[15], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { DrawColliderControl dcc = selectedObject.GetComponentInChildren <DrawColliderControl>(); int colliderID = objects[selected_component].GetInstanceID(); selectedObject.ResetCollider(dcc.ColliderBases[colliderID].ColliderBase, colliderID); GetColliderInfo(); OutputWindow_Log(MESSAGE_TEXT[MESSAGES.COLLIDER_TO_ORIGINAL], dcc.ColliderBases[colliderID].ColliderBase.ColliderType.ToString()); } } if (GUI.Button(new Rect(windowRect.x + 5, (windowRect.y + windowRect.height) - 27, windowRect.width - 10, 22), MainWindow[16], SNStyles.GetGuiItemStyle(GuiItemType.NORMALBUTTON, GuiColor.Gray))) { OnDestroy(); } OutputWindow_OnGUI(); EditWindow_OnGUI(); ObjectWindow_OnGUI(); ComponentWindow_OnGUI(); RendererWindow_OnGUI(); ObjectInfoWindow_OnGUI(); AddComponentWindow_OnGUI(); MarkWindow_OnGUI(); if (GUI.tooltip != "") { GUIStyle gUIStyle = SNStyles.GetGuiItemStyle(GuiItemType.TEXTAREA, GuiColor.Green, TextAnchor.MiddleLeft); Vector2 vector2 = gUIStyle.CalcSize(new GUIContent(GUI.tooltip)); GUI.Label(new Rect(Event.current.mousePosition.x + 10, Event.current.mousePosition.y + 10, vector2.x, vector2.y), GUI.tooltip, gUIStyle); } }
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 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; } }
void OnGUI() { if (!show) { return; } logStyle = SNStyles.GetGuiItemStyle(GuiItemType.LABEL, GuiColor.Green, TextAnchor.MiddleLeft, wordWrap: true); SNWindow.CreateWindow(windowRect, $"CheatManagerZero Console (Press {CmZConfig.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 (Event.current.Equals(Event.KeyboardEvent("return")) && inputField != "") * { * history.Add(inputField); * historyIndex = history.Count; * Log(inputField); * DevConsole.SendConsoleCommand(inputField); * inputField = ""; * } * * if (Event.current.Equals(Event.KeyboardEvent("up"))) * { * if (history.Count > 0 && historyIndex >= 1) * { * historyIndex--; * inputField = history[historyIndex]; * } * } * * if (Event.current.Equals(Event.KeyboardEvent("down"))) * { * if (history.Count > 0 && historyIndex < history.Count - 1) * { * historyIndex++; * inputField = history[historyIndex]; * } * } * * inputField = GUI.TextField(new Rect(scrollRect.x + 5, scrollRect.y + scrollRect.height + 5, 300, 22), inputField); */ if (GUI.Button(buttonRect, "Clear Window")) { logMessage.Clear(); drawingPos = scrollRect.y; } }
public void OnGUI() { SNWindow.CreateWindow(new Rect(0, 0, Screen.width / 5, hotkeyLabels.Count * 48), $"QuickSlot Extender Zero Configuration Window ({QSEzConfig.PROGRAM_VERSION})", false, false); GUI.FocusControl("QSEzConfigUI"); 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.KeyCodeToString(keyEvent.keyCode); waitingForKey = false; } }