public override void OnInspectorGUI() { GUILayoutExt.DrawComponentHeader(this.serializedObject, "EXT", () => { GUILayout.Label("WindowSystem Internal module.\nPooling system.", GUILayout.Height(36f)); }, new Color(0.4f, 0.2f, 0.7f, 1f)); var target = this.target as WindowSystemPools; UnityEditor.UI.Windows.GUILayoutExt.DrawHeader("Registered prefabs"); foreach (var item in target.registeredPrefabs) { GUILayout.Label(item.ToString()); } UnityEditor.UI.Windows.GUILayoutExt.DrawHeader("Instances on scene"); foreach (var item in target.instanceOnSceneToPrefab) { UnityEditor.UI.Windows.GUILayoutExt.Box(2f, 2f, () => { GUILayout.Label("Prefab: " + item.Value); EditorGUILayout.ObjectField("Object", item.Key, typeof(Object), allowSceneObjects: true); }); } UnityEditor.UI.Windows.GUILayoutExt.DrawHeader("Instances in pool"); foreach (var item in target.prefabToPooledInstances) { UnityEditor.UI.Windows.GUILayoutExt.Box(2f, 2f, () => { GUILayout.Label("Prefab: " + item.Key); foreach (var comp in item.Value) { EditorGUILayout.ObjectField(comp, typeof(Object), true); } }); } }
public override void OnInspectorGUI() { GUILayoutExt.DrawComponentHeader(this.serializedObject, "EXT", () => { GUILayout.Label("WindowSystem Internal module.\nWorking with resources.", GUILayout.Height(36f)); }, new Color(0.4f, 0.2f, 0.7f, 1f)); var target = this.target as WindowSystemResources; var allObjects = target.GetAllObjects(); GUILayoutExt.Box(2f, 2f, () => { GUILayout.Label("Resources: " + target.GetAllocatedCount()); foreach (var item in allObjects) { //EditorGUILayout.ObjectField("Handler", item.Key as Object, typeof(Object), allowSceneObjects: true); EditorGUILayout.LabelField("Handler", item.Key.ToString() + " (Loaded " + item.Value.Count.ToString() + ")"); ++EditorGUI.indentLevel; foreach (var resItem in item.Value) { EditorGUILayout.LabelField(resItem.resourceId.ToString()); if (resItem.resource is Object) { EditorGUILayout.ObjectField((Object)resItem.resource, typeof(Object), allowSceneObjects: true); } else { EditorGUILayout.LabelField(resItem.resource.ToString()); } } --EditorGUI.indentLevel; } }); }
public override void OnInspectorGUI() { this.serializedObject.Update(); GUILayoutExt.DrawComponentHeader(this.serializedObject, "M", () => { GUILayoutExt.DrawComponentHeaderItem("State", GUILayoutExt.GetPropertyToString(this.objectState)); }, new Color(1f, 0.6f, 1f, 0.4f)); GUILayout.Space(5f); var scroll = this.tabScrollPosition; this.selectedTab = GUILayoutExt.DrawTabs( this.selectedTab, ref scroll, new GUITab("Basic", () => { GUILayoutExt.DrawHeader("Main"); EditorGUILayout.PropertyField(this.hiddenByDefault); EditorGUILayout.PropertyField(this.animationParameters); EditorGUILayout.PropertyField(this.subObjects); GUILayoutExt.DrawHeader("Performance Options"); EditorGUILayout.PropertyField(this.createPool); }), new GUITab("Advanced", () => { GUILayoutExt.DrawHeader("Render Behaviour"); EditorGUILayout.PropertyField(this.renderBehaviourOnHidden); GUILayoutExt.DrawHeader("Animation"); EditorGUILayout.PropertyField(this.animationParameters); GUILayoutExt.DrawHeader("Graph"); EditorGUILayout.PropertyField(this.allowRegisterInRoot); EditorGUILayout.PropertyField(this.autoRegisterSubObjects); EditorGUILayout.PropertyField(this.hiddenByDefault); EditorGUILayout.PropertyField(this.subObjects); GUILayoutExt.DrawHeader("Performance Options"); EditorGUILayout.PropertyField(this.createPool); }) ); this.tabScrollPosition = scroll; GUILayout.Space(10f); var iter = this.serializedObject.GetIterator(); iter.NextVisible(true); do { if (EditorHelpers.IsFieldOfTypeBeneath(this.serializedObject.targetObject.GetType(), typeof(WindowModule), iter.propertyPath) == true) { EditorGUILayout.PropertyField(iter); } } while (iter.NextVisible(false) == true); this.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { this.serializedObject.Update(); GUILayoutExt.DrawComponentHeader(this.serializedObject, "S", () => { GUILayoutExt.DrawComponentHeaderItem("State", GUILayoutExt.GetPropertyToString(this.objectState)); GUILayoutExt.DrawComponentHeaderItem("Focus", GUILayoutExt.GetPropertyToString(this.focusState)); GUILayout.FlexibleSpace(); }, new Color(0f, 0.6f, 0f, 0.4f)); GUILayout.Space(5f); var scroll = this.tabScrollPosition; this.selectedTab = GUILayoutExt.DrawTabs( this.selectedTab, ref scroll, new GUITab("Preferences", () => { GUILayoutExt.DrawProperty(this.preferences); EditorGUILayout.PropertyField(this.createPool); }), new GUITab("Modules (" + this.listModules.count.ToString() + ")", () => { this.listModules.DoLayoutList(); }), new GUITab("Layouts", () => { EditorGUILayout.PropertyField(this.layouts); }), new GUITab("Audio", () => { GUILayoutExt.DrawHeader("Events"); var enterChildren = true; var prop = this.audioEvents.Copy(); var depth = prop.depth + 1; while (prop.NextVisible(enterChildren) == true && prop.depth >= depth) { EditorGUILayout.PropertyField(prop, true); enterChildren = false; } }) ); this.tabScrollPosition = scroll; GUILayout.Space(10f); var iter = this.serializedObject.GetIterator(); iter.NextVisible(true); do { if (EditorHelpers.IsFieldOfTypeBeneath(this.serializedObject.targetObject.GetType(), typeof(UnityEngine.UI.Windows.WindowTypes.LayoutWindowType), iter.propertyPath) == true) { EditorGUILayout.PropertyField(iter); } } while (iter.NextVisible(false) == true); this.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { this.serializedObject.Update(); GUILayoutExt.DrawComponentHeader(this.serializedObject, "L", () => { GUILayoutExt.DrawComponentHeaderItem("State", GUILayoutExt.GetPropertyToString(this.objectState)); }, new Color(1f, 0.6f, 0f, 0.4f)); GUILayout.Space(5f); var scroll = this.tabScrollPosition; this.selectedTab = GUILayoutExt.DrawTabs( this.selectedTab, ref scroll, new GUITab("Basic", () => { GUILayoutExt.DrawHeader("Main"); EditorGUILayout.PropertyField(this.hiddenByDefault); EditorGUILayout.PropertyField(this.animationParameters); EditorGUILayout.PropertyField(this.subObjects); GUILayoutExt.DrawHeader("Performance Options"); EditorGUILayout.PropertyField(this.createPool); }), new GUITab("Advanced", () => { GUILayoutExt.DrawHeader("Render Behaviour"); EditorGUILayout.PropertyField(this.renderBehaviourOnHidden); GUILayoutExt.DrawHeader("Animation"); EditorGUILayout.PropertyField(this.animationParameters); GUILayoutExt.DrawHeader("Graph"); EditorGUILayout.PropertyField(this.allowRegisterInRoot); EditorGUILayout.PropertyField(this.autoRegisterSubObjects); EditorGUILayout.PropertyField(this.hiddenByDefault); EditorGUILayout.PropertyField(this.subObjects); GUILayoutExt.DrawHeader("Performance Options"); EditorGUILayout.PropertyField(this.createPool); }) ); this.tabScrollPosition = scroll; GUILayout.Space(10f); EditorGUILayout.PropertyField(this.useSafeZone); if (this.useSafeZone.boolValue == true) { GUILayoutExt.Box(2f, 2f, () => { EditorGUILayout.PropertyField(this.safeZone); if (this.safeZone.objectReferenceValue == null && this.targets.Length == 1) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Generate", GUILayout.Width(80f), GUILayout.Height(30f)) == true) { var obj = this.target as Component; if (PrefabUtility.IsPartOfAnyPrefab(obj) == true) { var path = AssetDatabase.GetAssetPath(obj.gameObject); using (var edit = new EditPrefabAssetScope(path)) { EditorHelpers.AddSafeZone(edit.prefabRoot.transform); } } else { var root = obj.gameObject; EditorHelpers.AddSafeZone(root.transform); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }); } GUILayout.Space(10f); var iter = this.serializedObject.GetIterator(); iter.NextVisible(true); do { if (EditorHelpers.IsFieldOfTypeBeneath(this.serializedObject.targetObject.GetType(), typeof(WindowLayout), iter.propertyPath) == true) { EditorGUILayout.PropertyField(iter); } } while (iter.NextVisible(false) == true); this.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { this.serializedObject.Update(); GUILayoutExt.DrawComponentHeader(this.serializedObject, "UI", () => { GUILayout.Label("Window System", GUILayout.Height(36f)); }, new Color(0.3f, 0.4f, 0.6f, 0.4f)); GUILayout.Space(5f); var scroll = this.tabScrollPosition; this.selectedTab = GUILayoutExt.DrawTabs( this.selectedTab, ref scroll, new GUITab("Start Up", () => { EditorGUILayout.PropertyField(this.emulatePlatform); EditorGUILayout.PropertyField(this.emulateRuntimePlatform); GUILayout.Space(10f); EditorGUILayout.PropertyField(this.showRootOnStart); EditorGUILayout.PropertyField(this.rootScreen); GUILayout.Space(10f); EditorGUILayout.PropertyField(this.settings); }), new GUITab("Modules", () => { EditorGUILayout.PropertyField(this.breadcrumbs); EditorGUILayout.PropertyField(this.events); EditorGUILayout.PropertyField(this.resources); EditorGUILayout.PropertyField(this.pools); EditorGUILayout.PropertyField(this.tweener); }), new GUITab("Windows", () => { var count = this.registeredPrefabs.arraySize; EditorGUILayout.PropertyField(this.registeredPrefabs, new GUIContent("Registered Prefabs (" + count + ")")); GUILayout.Space(10f); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Collect prefabs", GUILayout.Width(200f), GUILayout.Height(30f)) == true) { var list = new List <WindowBase>(); var gameObjects = AssetDatabase.FindAssets("t:GameObject"); foreach (var guid in gameObjects) { var path = AssetDatabase.GUIDToAssetPath(guid); var asset = AssetDatabase.LoadAssetAtPath <GameObject>(path); var win = asset.GetComponent <WindowBase>(); if (win != null) { list.Add(win); } } this.registeredPrefabs.ClearArray(); this.registeredPrefabs.arraySize = list.Count; for (int i = 0; i < list.Count; ++i) { this.registeredPrefabs.GetArrayElementAtIndex(i).objectReferenceValue = list[i]; } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }) ); this.tabScrollPosition = scroll; /* * GUILayout.Space(10f); * * var iter = this.serializedObject.GetIterator(); * iter.NextVisible(true); * do { * * if (EditorHelpers.IsFieldOfType(typeof(WindowSystem), iter.propertyPath) == true) { * * EditorGUILayout.PropertyField(iter); * * } * * } while (iter.NextVisible(false) == true);*/ this.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { this.serializedObject.Update(); GUILayoutExt.DrawComponentHeader(this.serializedObject, "C", () => { GUILayoutExt.DrawComponentHeaderItem("State", GUILayoutExt.GetPropertyToString(this.objectState)); }); GUILayout.Space(5f); var scroll = this.tabScrollPosition; this.selectedTab = GUILayoutExt.DrawTabs( this.selectedTab, ref scroll, new GUITab("Basic", () => { GUILayoutExt.DrawHeader("Main"); GUILayoutExt.PropertyField(this.hiddenByDefault, (reg) => reg.hiddenByDefault == true ? reg.hiddenByDefaultDescription : string.Empty); EditorGUILayout.PropertyField(this.subObjects); GUILayoutExt.DrawHeader("Animations"); EditorGUILayout.PropertyField(this.animationParameters); GUILayoutExt.DrawHeader("Performance Options"); EditorGUILayout.PropertyField(this.createPool); this.DrawCanvas(); }), new GUITab("Advanced", () => { GUILayoutExt.DrawHeader("Render Behaviour"); EditorGUILayout.PropertyField(this.renderBehaviourOnHidden); GUILayoutExt.DrawHeader("Animations"); EditorGUILayout.PropertyField(this.animationParameters); GUILayoutExt.DrawHeader("Graph"); GUILayoutExt.PropertyField(this.allowRegisterInRoot, (reg) => reg.allowRegisterInRoot == true ? reg.allowRegisterInRootDescription : string.Empty); EditorGUILayout.PropertyField(this.autoRegisterSubObjects); GUILayoutExt.PropertyField(this.hiddenByDefault, (reg) => reg.hiddenByDefault == true ? reg.hiddenByDefaultDescription : string.Empty); EditorGUILayout.PropertyField(this.subObjects); GUILayoutExt.DrawHeader("Performance Options"); EditorGUILayout.PropertyField(this.createPool); this.DrawCanvas(); }), this.listModules == null ? GUITab.none : new GUITab("Modules (" + this.listModules.count + ")", () => { this.listModules.DoLayoutList(); }), new GUITab("Audio", () => { GUILayoutExt.DrawHeader("Events"); var enterChildren = true; var prop = this.audioEvents.Copy(); var depth = prop.depth + 1; while (prop.NextVisible(enterChildren) == true && prop.depth >= depth) { EditorGUILayout.PropertyField(prop, true); enterChildren = false; } }) ); this.tabScrollPosition = scroll; GUILayout.Space(10f); var iter = this.serializedObject.GetIterator(); iter.NextVisible(true); do { if (EditorHelpers.IsFieldOfTypeBeneath(this.serializedObject.targetObject.GetType(), typeof(WindowComponent), iter.propertyPath) == true) { EditorGUILayout.PropertyField(iter); } } while (iter.NextVisible(false) == true); this.serializedObject.ApplyModifiedProperties(); }