Пример #1
0
        private void DrawControlPanel()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();

            if (GUILayout.Button("", EditorToolkit.BoundariesIconButton()))
            {
                Selection.activeGameObject = MenuExtensions.GetBoundariesControllerRoot();
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("", EditorToolkit.ZonesIconButton()))
            {
                Selection.activeGameObject = MenuExtensions.GetZonesControllerRoot();
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("", EditorToolkit.PoolsIconButton()))
            {
                Selection.activeGameObject = MenuExtensions.GetPoolControllerRoot();
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            EditorGUILayout.Space();
        }
Пример #2
0
 private void DrawToolbar()
 {
     if (GUILayout.Button("< Back", EditorToolkit.LargeToolbarButtonLayoutOption()))
     {
         Selection.activeGameObject = pool.transform.parent.gameObject;
     }
 }
        private void DrawZone(Zone zone)
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("X", EditorToolkit.CloseButtonLayoutOption()))
            {
                GameObject.DestroyImmediate(zone.gameObject);
                return;
            }

            if (zone.messageReceiver == null && zone.triggerType == Zone.ZoneTriggerTypes.SendMessage)
            {
                EditorGUILayout.LabelField(
                    string.Format("{0} (no receiver)", zone.gameObject.name),
                    EditorToolkit.ErrorLabelStyle()
                    );
            }
            else
            {
                zone.gameObject.name = EditorGUILayout.TextField(
                    zone.gameObject.name,
                    EditorToolkit.BoundaryGroupSytle(zone.color)
                    );
            }

            if (GUILayout.Button("Go >", EditorToolkit.GoButtonLayoutOption()))
            {
                Selection.activeGameObject = zone.gameObject;
            }

            EditorGUILayout.EndHorizontal();
        }
Пример #4
0
        /// <summary>
        /// Draws the zone settings
        /// </summary>
        private void DrawSettings()
        {
            zone.gameObject.name = EditorGUILayout.TextField("Name", zone.gameObject.name);
            zone.color           = EditorGUILayout.ColorField("Color", zone.color);
            zone.triggerType     = (Zone.ZoneTriggerTypes)EditorGUILayout.EnumPopup("Trigger Type", zone.triggerType);

            if (zone.triggerType == Zone.ZoneTriggerTypes.SendMessage)
            {
                EditorToolkit.DrawSeparator();
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;

                zone.messageReceiver     = (GameObject)EditorGUILayout.ObjectField("Message Receiver", zone.messageReceiver, typeof(GameObject), true);
                zone.RequireReceivers    = EditorGUILayout.Toggle("Require Receivers", zone.RequireReceivers);
                zone.MessageEnterHandler = EditorGUILayout.TextField("OnEnter Handler", zone.MessageEnterHandler);
                zone.MessageStayHandler  = EditorGUILayout.TextField("OnStay Handler", zone.MessageStayHandler);
                zone.MessageExitHandler  = EditorGUILayout.TextField("OnExit Handler", zone.MessageExitHandler);

                EditorGUI.indentLevel--;
                EditorToolkit.DrawSeparator();
            }
            else
            {
                EditorToolkit.DrawSeparator();
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;

                EditorGUILayout.HelpBox(
                    "You must provide your own component on this game object to handle OnTriggerEnter, OnTriggerStay and/or OnTriggerExit",
                    MessageType.Info
                    );
                EditorGUI.indentLevel--;
                EditorToolkit.DrawSeparator();
            }
        }
Пример #5
0
 /// <summary>
 /// Unity3D OnSceneGUI event
 /// </summary>
 private void OnSceneGUI()
 {
     HandlesHelpers.VisibleLabel(
         zone.transform.position,
         100f,
         zone.name,
         EditorToolkit.ZoneLabelStyle(zone.color)
         );
 }
Пример #6
0
        /// <summary>
        /// Unity3D OnInspectorGUI event
        /// </summary>
        public override void OnInspectorGUI()
        {
            EditorToolkit.DrawTitle("Unity Design Tools");

            DrawControlPanel();

            EditorToolkit.DrawSeparator();

            DrawSupportInfo();
        }
        public override void OnInspectorGUI()
        {
            EditorToolkit.DrawTitle("Zone Controller");

            DrawToolbar();
            EditorToolkit.DrawSeparator();

            DrawZones();
            EditorToolkit.DrawSeparator();

            EditorToolkit.DrawFooter();
        }
        private void DrawToolbar()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();

            if (GUILayout.Button("New Zone", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                AddBoxZone();
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();
        }
Пример #9
0
        private void ShowToolbar()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();

            if (GUILayout.Button("New Group", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                AddGroup();
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();
        }
Пример #10
0
        public override void OnInspectorGUI()
        {
            Tools.current = Tool.None;

            EditorToolkit.DrawTitle("Boundaries Controller");

            ShowToolbar();
            EditorToolkit.DrawSeparator();

            ShowGroups();
            EditorToolkit.DrawSeparator();

            EditorToolkit.DrawFooter();
        }
Пример #11
0
        private void DrawSegments()
        {
            showSegments = EditorToolkit.DrawTitleFoldOut(showSegments, "Segments");

            if (showSegments)
            {
                EditorGUI.indentLevel++;

                if (group.segments.Count > 0)
                {
                    for (int i = 0; i < group.segments.Count; i++)
                    {
                        EditorGUI.indentLevel++;

                        EditorGUILayout.BeginHorizontal();

                        group.segments[i].name = EditorGUILayout.TextField(group.segments[i].name);
                        if (GUILayout.Button("X", EditorToolkit.CloseButtonLayoutOption()))
                        {
                            group.segments.RemoveAt(i);
                            return;
                        }

                        EditorGUILayout.EndHorizontal();

                        EditorGUI.indentLevel++;

                        group.segments[i].start = EditorGUILayout.Vector3Field("Start", group.segments[i].start);

                        if (group.segments.Count - 1 == i && !group.isClosed)
                        {
                            group.segments[i].end = EditorGUILayout.Vector3Field("End", group.segments[i].end);
                        }
                        EditorGUI.indentLevel--;

                        EditorGUILayout.Separator();

                        EditorGUI.indentLevel--;
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No segments.  Click Add Segment in the toolbar or use the SceneView click-to-create method.", MessageType.Info);
                }

                EditorGUI.indentLevel--;
                EditorToolkit.DrawSeparator();
            }
        }
Пример #12
0
        private void DrawToolbar()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();

            if (GUILayout.Button("Add Pool", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                CreatePool();
            }

            if (GUILayout.Button("Destroy All", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                DestroyAll();
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();
        }
Пример #13
0
        /// <summary>
        /// Unity3D OnInspectorGUI event
        /// </summary>
        public override void OnInspectorGUI()
        {
            RestrictColliderSettings();
            GUI.changed = false;

            EditorToolkit.DrawTitle("Zone");
            DrawToolbar();

            EditorToolkit.DrawSeparator();

            DrawSettings();
            EditorToolkit.DrawFooter();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
Пример #14
0
        private void DrawToolbar()
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("< Back", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                Selection.activeGameObject = group.gameObject.transform.parent.gameObject;
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Add Segment", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                AddSegment();
            }

            EditorGUILayout.EndHorizontal();
        }
Пример #15
0
        private void DrawSettings()
        {
            showHeader = EditorToolkit.DrawTitleFoldOut(showHeader, "Settings");

            if (showHeader)
            {
                EditorGUI.indentLevel++;
                group.gameObject.name = EditorGUILayout.TextField("Name", group.name);
                group.color           = EditorGUILayout.ColorField("Color", group.color);
                group.layer           = EditorGUILayout.LayerField("Layers", group.layer);
                group.isClosed        = EditorGUILayout.Toggle("Is Closed", group.isClosed);
                forceUpdate.boolValue = EditorGUILayout.Toggle("Force Editor Update", forceUpdate.boolValue);
                group.height          = EditorGUILayout.FloatField("Height", group.height);
                group.depthAnchor     = (DepthAnchorTypes)EditorGUILayout.EnumPopup("Depth Anchor", (Enum)group.depthAnchor);
                group.depth           = EditorGUILayout.FloatField("Depth", group.depth);
                EditorGUI.indentLevel--;
            }
        }
Пример #16
0
        private bool DrawPoolHeader(Pool pool)
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("X", EditorToolkit.CloseButtonLayoutOption()))
            {
                Undo.RegisterSceneUndo("Deleted UDT Pool");
                GameObject.DestroyImmediate(pool.gameObject);

                return(false);
            }

            if (pool.prefab == null)
            {
                var title = string.Format("{0} (no prefab)", pool.name);
                var style = new GUIStyle(EditorStyles.boldLabel);

                style.normal.textColor = Color.red;

                EditorGUILayout.LabelField(title,
                                           style
                                           );
            }
            else
            {
                var style = new GUIStyle(EditorStyles.label);
                style.normal.textColor = Color.green;

                pool.name = pool.prefab.name;

                EditorGUILayout.LabelField(pool.name,
                                           style
                                           );
            }

            if (GUILayout.Button("Go >", EditorToolkit.GoButtonLayoutOption()))
            {
                Selection.activeGameObject = pool.gameObject;
            }

            EditorGUILayout.EndHorizontal();

            return(true);
        }
Пример #17
0
        public override void OnInspectorGUI()
        {
            Tools.current = Tool.None;
            GUI.changed   = false;

            EditorToolkit.DrawTitle("Pool");
            DrawToolbar();
            EditorToolkit.DrawSeparator();

            pool.prefab = EditorGUILayout.ObjectField("Prefab", pool.prefab, typeof(GameObject), false) as GameObject;

            if (pool.prefab)
            {
                pool.name = string.Format("pool-{0}", pool.prefab.name);
            }

            pool.size  = EditorGUILayout.IntField("Pool Size", pool.size);
            pool.limit = EditorGUILayout.Toggle("Limit Growth", pool.limit);

            if (pool.limit)
            {
                pool.limitSize           = EditorGUILayout.IntField("Limit Size", pool.limitSize);
                pool.suppressLimitErrors = EditorGUILayout.Toggle("Ignore Limit Errors", pool.suppressLimitErrors);

                if (pool.limitSize < pool.size)
                {
                    pool.limitSize = pool.size;
                }
            }

            pool.shrinkBack      = EditorGUILayout.Toggle("Shrink Back", pool.shrinkBack);
            pool.hideInHierarchy = EditorGUILayout.Toggle("Hide in Hierarchy", pool.hideInHierarchy);

            EditorToolkit.DrawSeparator();
            EditorToolkit.DrawFooter();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(pool);
            }
        }
Пример #18
0
        private void ShowGroup(Group group)
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("X", EditorToolkit.CloseButtonLayoutOption()))
            {
                GameObject.DestroyImmediate(group.gameObject);
                return;
            }

            group.gameObject.name = EditorGUILayout.TextField(
                group.gameObject.name,
                EditorToolkit.BoundaryGroupSytle(group.color)
                );

            if (GUILayout.Button("Go >", EditorToolkit.GoButtonLayoutOption()))
            {
                Selection.activeGameObject = group.gameObject;
            }

            EditorGUILayout.EndHorizontal();
        }
        private void DrawZones()
        {
            var zones = controller.GetComponentsInChildren <Zone>();

            EditorGUILayout.Space();
            EditorGUI.indentLevel++;

            if (zones.Length > 0)
            {
                for (int i = 0; i < zones.Length; i++)
                {
                    DrawZone(zones[i]);
                }
            }
            else
            {
                EditorGUILayout.LabelField("no zones defined",
                                           EditorToolkit.ErrorLabelStyle()
                                           );
            }

            EditorGUI.indentLevel--;
        }
Пример #20
0
        private void ShowGroups()
        {
            var groups = GetChildGroups();

            EditorGUILayout.Space();
            EditorGUI.indentLevel++;

            if (groups.Count > 0)
            {
                for (int i = 0; i < groups.Count; i++)
                {
                    ShowGroup(groups[i]);
                }
            }
            else
            {
                EditorGUILayout.LabelField("no groups defined",
                                           EditorToolkit.ErrorLabelStyle()
                                           );
            }

            EditorGUI.indentLevel--;
        }
Пример #21
0
        public override void OnInspectorGUI()
        {
            Tools.current = Tool.None;
            GUI.changed   = false;

            EditorToolkit.DrawTitle("Pool Controller");
            DrawToolbar();

            if (!controller)
            {
                return;                         // handle a DestroyAll call
            }
            EditorToolkit.DrawSeparator();
            DrawPools();

            EditorToolkit.DrawSeparator();
            EditorToolkit.DrawFooter();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(controller);
            }
        }
Пример #22
0
        private void DrawOperations()
        {
            showOps = EditorToolkit.DrawTitleFoldOut(showOps, "Operations");

            if (showOps)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Mass Apply", GUILayout.MinWidth(80f));
                massApplyPart  = EditorGUILayout.Popup(massApplyPart, new[] { "None", "X", "Y", "Z" }, GUILayout.MinWidth(60f));
                massApplyValue = EditorGUILayout.FloatField(massApplyValue, GUILayout.MinWidth(50f));

                if (GUILayout.Button("Go", EditorToolkit.GoButtonLayoutOption()))
                {
                    MassApply(massApplyPart, massApplyValue);
                }

                EditorGUILayout.EndHorizontal();

                EditorGUI.indentLevel--;
            }
        }
Пример #23
0
        private void DrawSupportInfo()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            if (GUILayout.Button("Forum Link", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                Application.OpenURL("http://forum.unity3d.com/threads/201034-uDesign-Tools-Released");
            }
            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            if (GUILayout.Button("Contact Support", EditorToolkit.LargeToolbarButtonLayoutOption()))
            {
                Application.OpenURL("mailto:[email protected]");
            }
            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
        }
Пример #24
0
        public override void OnInspectorGUI()
        {
            Tools.current = Tool.None;
            GUI.changed   = false;

            EditorToolkit.DrawTitle("Boundaries Group");

            DrawToolbar();
            EditorGUILayout.Space();

            DrawSettings();
            DrawOperations();
            DrawSegments();

            group.Connect();

            EditorToolkit.DrawFooter();

            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
                EditorUtility.SetDirty(target);
            }
        }