public override void DrawWindow() { GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.Label("<color=orange><size=16><b>Options</b></size></color>", new GUILayoutOption[0]); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUIUnstrip.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label($"Menu Toggle Key:", new GUILayoutOption[] { GUILayout.Width(215f) }); toggleKeyInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label($"Default Window Size:", new GUILayoutOption[] { GUILayout.Width(215f) }); defaultSizeInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label($"Default Items per Page:", new GUILayoutOption[] { GUILayout.Width(215f) }); defaultPageLimitInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label($"Enable Bitwise Editing:", new GUILayoutOption[] { GUILayout.Width(215f) }); bitwiseSupportInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label($"Enable Tab View:", new GUILayoutOption[] { GUILayout.Width(215f) }); tabViewInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label($"Default Output Path:", new GUILayoutOption[] { GUILayout.Width(215f) }); defaultOutputPathInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f); GUILayout.EndHorizontal(); if (GUILayout.Button("<color=lime><b>Apply and Save</b></color>", new GUILayoutOption[0])) { ApplyAndSave(); } GUILayout.EndVertical(); GUIUnstrip.Space(10f); GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.Label("<color=orange><size=16><b>Other</b></size></color>", new GUILayoutOption[0]); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUIUnstrip.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]); if (GUILayout.Button("Inspect Test Class", new GUILayoutOption[0])) { WindowManager.InspectObject(Tests.TestClass.Instance, out bool _); } GUILayout.EndVertical(); }
private void DrawHeaderArea() { GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); // Current Scene label GUILayout.Label("Current Scene:", new GUILayoutOption[] { GUILayout.Width(120) }); SceneChangeButtons(); GUILayout.Label("<color=cyan>" + m_currentScene + "</color>", new GUILayoutOption[0]); GUILayout.EndHorizontal(); // ----- GameObject Search ----- GUIUnstrip.BeginHorizontal(GUIContent.none, GUI.skin.box, null); GUILayout.Label("<b>Search Scene:</b>", new GUILayoutOption[] { GUILayout.Width(100) }); m_searchInput = GUIUnstrip.TextField(m_searchInput, new GUILayoutOption[0]); if (GUILayout.Button("Search", new GUILayoutOption[] { GUILayout.Width(80) })) { Search(); } GUILayout.EndHorizontal(); GUIUnstrip.Space(5); }
public override void DrawValue(Rect window, float width) { if (OwnerCacheObject.CanWrite) { if (!IsExpanded) { if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } GUILayout.Label($"<color=#2df7b2>Quaternion</color>: {((Quaternion)Value).eulerAngles.ToString()}", new GUILayoutOption[0]); if (OwnerCacheObject.CanWrite && IsExpanded) { GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); x = GUIUnstrip.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); y = GUIUnstrip.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) }); z = GUIUnstrip.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); // draw set value button GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); } }
public override void DrawValue(Rect window, float width) { if (m_isBool) { var b = (bool)Value; var label = $"<color={(b ? "lime" : "red")}>{b}</color>"; if (OwnerCacheObject.CanWrite) { b = GUILayout.Toggle(b, label, new GUILayoutOption[0]); if (b != (bool)Value) { Value = b; OwnerCacheObject.SetValue(); } } else { GUILayout.Label(label, new GUILayoutOption[0]); } return; } // all other non-bool values use TextField GUIUnstrip.BeginVertical(new GUILayoutOption[0]); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("<color=#2df7b2><i>" + ValueType.Name + "</i></color>", new GUILayoutOption[] { GUILayout.Width(50) }); m_valueToString = GUIUnstrip.TextArea(m_valueToString, new GUILayoutOption[] { GUILayout.ExpandWidth(true) }); if (OwnerCacheObject.CanWrite) { if (GUILayout.Button("<color=#00FF00>Apply</color>", new GUILayoutOption[] { GUILayout.Width(60) })) { SetValueFromInput(); } } if (ModConfig.Instance.Bitwise_Support && m_canBitwiseOperate) { m_inBitwiseMode = GUILayout.Toggle(m_inBitwiseMode, "Bitwise?", new GUILayoutOption[0]); } GUIUnstrip.Space(10); GUILayout.EndHorizontal(); if (ModConfig.Instance.Bitwise_Support && m_inBitwiseMode) { DrawBitwise(); } GUILayout.EndVertical(); }
public override void DrawValue(Rect window, float width) { if (OwnerCacheObject.CanWrite) { if (!IsExpanded) { if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } GUILayout.Label(Value.ToString() + "<color=#2df7b2><i> (" + ValueType + ")</i></color>", new GUILayoutOption[0]); if (IsExpanded) { GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); for (int i = 0; i < EnumNames.Length; i++) { GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); m_enabledFlags[i] = GUILayout.Toggle(m_enabledFlags[i], EnumNames[i], new GUILayoutOption[0]); GUILayout.EndHorizontal(); } GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) })) { SetFlagsFromInput(); } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); } }
private void MainHeader() { GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); for (int i = 0; i < Pages.Count; i++) { if (m_currentPage == i) { GUI.color = Color.green; } else { GUI.color = Color.white; } if (GUILayout.Button(Pages[i].Name, new GUILayoutOption[0])) { m_currentPage = i; } } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUI.color = Color.white; InspectUnderMouse.EnableInspect = GUILayout.Toggle(InspectUnderMouse.EnableInspect, "Inspect Under Mouse (Shift + RMB)", new GUILayoutOption[0]); bool mouseState = ForceUnlockCursor.Unlock; bool setMouse = GUILayout.Toggle(mouseState, "Force Unlock Mouse (Left Alt)", new GUILayoutOption[0]); if (setMouse != mouseState) { ForceUnlockCursor.Unlock = setMouse; } //WindowManager.TabView = GUILayout.Toggle(WindowManager.TabView, "Tab View", new GUILayoutOption[0]); GUILayout.EndHorizontal(); //GUIUnstrip.Space(10); GUIUnstrip.Space(10); GUI.color = Color.white; }
private void DrawTextureControls() { GUIUnstrip.BeginHorizontal(); GUILayout.Label("Save folder:", new GUILayoutOption[] { GUILayout.Width(80f) }); saveFolder = GUIUnstrip.TextField(saveFolder, new GUILayoutOption[0]); GUIUnstrip.Space(10f); GUILayout.EndHorizontal(); if (GUILayout.Button("Save to PNG", new GUILayoutOption[] { GUILayout.Width(100f) })) { if (currentTex) { var name = RemoveInvalidFilenameChars(currentTex.name ?? ""); if (string.IsNullOrEmpty(name)) { if (OwnerCacheObject is CacheMember cacheMember) { name = cacheMember.MemInfo.Name; } else { name = "UNTITLED"; } } SaveTextureAsPNG(currentTex, saveFolder, name, false); ExplorerCore.Log($@"Saved to {saveFolder}\{name}.png!"); } else { ExplorerCore.Log("Cannot save a null texture!"); } } }
public override void DrawValue(Rect window, float width) { if (OwnerCacheObject.CanWrite) { if (!IsExpanded) { if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } //var c = (Color)Value; //GUI.color = c; GUILayout.Label($"<color=#2df7b2>Color:</color> {((Color)Value).ToString()}", new GUILayoutOption[0]); //GUI.color = Color.white; if (OwnerCacheObject.CanWrite && IsExpanded) { GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("R:", new GUILayoutOption[] { GUILayout.Width(30) }); r = GUIUnstrip.TextField(r, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("G:", new GUILayoutOption[] { GUILayout.Width(30) }); g = GUIUnstrip.TextField(g, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("B:", new GUILayoutOption[] { GUILayout.Width(30) }); b = GUIUnstrip.TextField(b, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("A:", new GUILayoutOption[] { GUILayout.Width(30) }); a = GUIUnstrip.TextField(a, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); // draw set value button GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); } }
// =========== GUI DRAW =========== // public override void WindowFunction(int windowID) { try { // ====== HEADER ====== var rect = WindowManager.TabView ? TabViewWindow.Instance.m_rect : this.m_rect; if (!WindowManager.TabView) { Header(); GUIUnstrip.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box); } var asInstance = this as InstanceInspector; GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); var labelWidth = (asInstance != null && asInstance.m_uObj) ? new GUILayoutOption[] { GUILayout.Width(245f) } : new GUILayoutOption[0]; GUILayout.Label("<b>Type:</b> <color=cyan>" + TargetType.FullName + "</color>", labelWidth); if (asInstance != null) { asInstance.DrawInstanceControls(rect); } else { GUILayout.EndHorizontal(); } UIStyles.HorizontalLine(Color.grey); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("<b>Search:</b>", new GUILayoutOption[] { GUILayout.Width(75) }); m_search = GUIUnstrip.TextField(m_search, new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("<b>Filter:</b>", new GUILayoutOption[] { GUILayout.Width(75) }); FilterTypeToggle(MemberTypes.All, "All"); FilterTypeToggle(MemberTypes.Property, "Properties"); FilterTypeToggle(MemberTypes.Field, "Fields"); FilterTypeToggle(MemberTypes.Method, "Methods"); GUILayout.EndHorizontal(); if (this is InstanceInspector) { GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("<b>Scope:</b>", new GUILayoutOption[] { GUILayout.Width(75) }); FilterScopeToggle(MemberScopes.Both, "Both"); FilterScopeToggle(MemberScopes.Instance, "Instance"); FilterScopeToggle(MemberScopes.Static, "Static"); GUILayout.EndHorizontal(); } GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("<b>Values:</b>", new GUILayoutOption[] { GUILayout.Width(75) }); if (GUILayout.Button("Update", new GUILayoutOption[] { GUILayout.Width(100) })) { UpdateValues(); } GUI.color = m_autoUpdate ? Color.green : Color.red; m_autoUpdate = GUILayout.Toggle(m_autoUpdate, "Auto-update?", new GUILayoutOption[] { GUILayout.Width(100) }); GUI.color = m_hideFailedReflection ? Color.green : Color.red; m_hideFailedReflection = GUILayout.Toggle(m_hideFailedReflection, "Hide failed Reflection?", new GUILayoutOption[] { GUILayout.Width(150) }); GUI.color = Color.white; GUILayout.EndHorizontal(); GUIUnstrip.Space(10); Pages.ItemCount = m_cachedMembersFiltered.Length; // prev/next page buttons GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); Pages.DrawLimitInputArea(); if (Pages.ItemCount > Pages.ItemsPerPage) { if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Left, ref this.scroll); } Pages.CurrentPageLabel(); if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Right, ref this.scroll); } } GUILayout.EndHorizontal(); // ====== BODY ====== scroll = GUIUnstrip.BeginScrollView(scroll); GUIUnstrip.Space(10); UIStyles.HorizontalLine(Color.grey); GUIUnstrip.BeginVertical(GUIContent.none, GUI.skin.box, null); var members = this.m_cachedMembersFiltered; int start = Pages.CalculateOffsetIndex(); for (int j = start; (j < start + Pages.ItemsPerPage && j < members.Length); j++) { var holder = members[j]; GUIUnstrip.BeginHorizontal(new GUILayoutOption[] { GUILayout.Height(25) }); try { holder.Draw(rect, 180f); } catch { GUILayout.EndHorizontal(); continue; } GUILayout.EndHorizontal(); // if not last element if (!(j == (start + Pages.ItemsPerPage - 1) || j == (members.Length - 1))) { UIStyles.HorizontalLine(new Color(0.07f, 0.07f, 0.07f), true); } } GUILayout.EndVertical(); GUIUnstrip.EndScrollView(); if (!WindowManager.TabView) { m_rect = ResizeDrag.ResizeWindow(rect, windowID); GUIUnstrip.EndArea(); } } catch (Exception e) when(e.Message.Contains("in a group with only")) { // suppress } catch (Exception e) { ExplorerCore.LogWarning("Exception drawing ReflectionWindow: " + e.GetType() + ", " + e.Message); DestroyWindow(); return; } }
public override void DrawValue(Rect window, float width) { if (OwnerCacheObject.CanWrite) { if (!IsExpanded) { if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } GUILayout.Label($"<color=#2df7b2>Vector{VectorSize}</color>: {(string)ToStringMethod.Invoke(Value, new object[0])}", new GUILayoutOption[0]); if (OwnerCacheObject.CanWrite && IsExpanded) { GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); // always draw x and y GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); x = GUIUnstrip.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); y = GUIUnstrip.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); if (VectorSize > 2) { // draw z GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) }); z = GUIUnstrip.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); } if (VectorSize > 3) { // draw w GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) }); w = GUIUnstrip.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) }); GUILayout.EndHorizontal(); } // draw set value button GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(whitespace); if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); } }
public void Draw(Rect window, float labelWidth = 215f) { if (labelWidth > 0) { ClampLabelWidth(window, ref labelWidth); } var cacheMember = OwnerCacheObject as CacheMember; if (cacheMember != null && cacheMember.MemInfo != null) { GUILayout.Label(cacheMember.RichTextName, new GUILayoutOption[] { GUILayout.Width(labelWidth) }); } else { GUIUnstrip.Space(labelWidth); } var cacheMethod = OwnerCacheObject as CacheMethod; if (cacheMember != null && cacheMember.HasParameters) { GUIUnstrip.BeginVertical(new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); if (cacheMember.m_isEvaluating) { if (cacheMethod != null && cacheMethod.GenericArgs.Length > 0) { cacheMethod.DrawGenericArgsInput(); } if (cacheMember.m_arguments.Length > 0) { cacheMember.DrawArgsInput(); } GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) { if (cacheMethod != null) { cacheMethod.Evaluate(); } else { cacheMember.UpdateValue(); } } if (GUILayout.Button("Cancel", new GUILayoutOption[] { GUILayout.Width(70) })) { cacheMember.m_isEvaluating = false; } GUILayout.EndHorizontal(); } else { var lbl = $"Evaluate ("; int len = cacheMember.m_arguments.Length; if (cacheMethod != null) { len += cacheMethod.GenericArgs.Length; } lbl += len + " params)"; if (GUILayout.Button(lbl, new GUILayoutOption[] { GUILayout.Width(150) })) { cacheMember.m_isEvaluating = true; } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(labelWidth); } else if (cacheMethod != null) { if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) { cacheMethod.Evaluate(); } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); GUIUnstrip.Space(labelWidth); } string typeName = $"<color={Syntax.Class_Instance}>{ValueType.FullName}</color>"; if (cacheMember != null && !string.IsNullOrEmpty(cacheMember.ReflectionException)) { GUILayout.Label("<color=red>Reflection failed!</color> (" + cacheMember.ReflectionException + ")", new GUILayoutOption[0]); } else if (cacheMember != null && (cacheMember.HasParameters || cacheMember is CacheMethod) && !cacheMember.m_evaluated) { GUILayout.Label($"<color=grey><i>Not yet evaluated</i></color> ({typeName})", new GUILayoutOption[0]); } else if (Value == null && !(cacheMember is CacheMethod)) { GUILayout.Label($"<i>null ({typeName})</i>", new GUILayoutOption[0]); } else { float _width = window.width - labelWidth - 90; if (OwnerCacheObject is CacheMethod cm) { cm.DrawValue(window, _width); } else { DrawValue(window, _width); } } }
private void ComponentList(Rect m_rect) { GUIUnstrip.BeginVertical(GUIContent.none, GUI.skin.box, null); m_compScroll = GUIUnstrip.BeginScrollView(m_compScroll); GUILayout.Label("<b><size=15>Components</size></b>", new GUILayoutOption[0]); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); CompPages.DrawLimitInputArea(); if (CompPages.ItemCount > CompPages.ItemsPerPage) { CompPages.CurrentPageLabel(); GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { CompPages.TurnPage(Turn.Left, ref this.m_compScroll); } if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { CompPages.TurnPage(Turn.Right, ref this.m_compScroll); } } GUILayout.EndHorizontal(); GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); var width = m_rect.width / 2 - 135f; m_addComponentInput = GUIUnstrip.TextField(m_addComponentInput, new GUILayoutOption[] { GUILayout.Width(width) }); if (GUILayout.Button("Add Comp", new GUILayoutOption[0])) { if (ReflectionHelpers.GetTypeByName(m_addComponentInput) is Type compType) { if (typeof(Component).IsAssignableFrom(compType)) { #if CPP TargetGO.AddComponent(Il2CppType.From(compType)); #else TargetGO.AddComponent(compType); #endif } else { ExplorerCore.LogWarning($"Type '{compType.Name}' is not assignable from Component!"); } } else { ExplorerCore.LogWarning($"Could not find a type by the name of '{m_addComponentInput}'!"); } } GUILayout.EndHorizontal(); GUI.skin.button.alignment = TextAnchor.MiddleLeft; if (m_cachedDestroyList.Count > 0) { m_cachedDestroyList.Clear(); } if (m_components != null) { int start = CompPages.CalculateOffsetIndex(); for (int j = start; (j < start + CompPages.ItemsPerPage && j < CompPages.ItemCount); j++) { var component = m_components[j]; if (!component) { continue; } var type = #if CPP component.GetIl2CppType(); #else component.GetType(); #endif GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]); if (ReflectionHelpers.BehaviourType.IsAssignableFrom(type)) { #if CPP BehaviourEnabledBtn(component.TryCast <Behaviour>()); #else BehaviourEnabledBtn(component as Behaviour); #endif } else { GUIUnstrip.Space(26); } if (GUILayout.Button("<color=cyan>" + type.Name + "</color>", new GUILayoutOption[] { GUILayout.Width(m_rect.width / 2 - 100) })) { ReflectObject(component); } if (GUILayout.Button("<color=red>-</color>", new GUILayoutOption[] { GUILayout.Width(20) })) { m_cachedDestroyList.Add(component); } GUILayout.EndHorizontal(); } } GUI.skin.button.alignment = TextAnchor.MiddleCenter; if (m_cachedDestroyList.Count > 0) { for (int i = m_cachedDestroyList.Count - 1; i >= 0; i--) { var comp = m_cachedDestroyList[i]; GameObject.Destroy(comp); } } GUIUnstrip.EndScrollView(); GUILayout.EndVertical(); }