public override void OnGUI()
        {
            base.OnGUI();

            CanvasGUI.BeginGroup(Position, GUI.skin.box, actor.Tint, HasControl);

            if (Locked)
            {
                GUI.Label(new Rect(5, 5, 240, 20), name);
            }
            else
            {
                string nodeName = name;

                if (CanvasGUI.TextField(new Rect(5, 5, 240, 20), ref nodeName))
                {
                    name = DialogueEditorGUI.Cache.Nodes.ItemNames[DialogueEditorGUI.Cache.Nodes.ItemNames.IndexOf(name)] = nodeName;
                }
            }

            if (CanvasGUI.Button(new Rect(Position.size.x - 50, 5, 20, 20), new GUIContent("L"), GUI.skin.button))
            {
                Locked = !Locked;
            }

            if (CanvasGUI.Button(new Rect(Position.size.x - 25, 5, 20, 20), new GUIContent("X"), GUI.skin.button))
            {
                Delete();
            }
            textArea = CanvasGUI.TextArea(new Rect(5, 30, 290, 65), textArea);

            CanvasGUI.EndGroup();
        }
Beispiel #2
0
        public override void OnGUI()
        {
            for (int i = 1; i < Count; i++)
            {
                Condition condition = Get(i);

                if (CanvasGUI.Button(new Rect(condition.Position.xMax + 2, condition.Position.yMin, 20, 20), "X"))
                {
                    condition.Delete();
                    i--;
                    continue;
                }
                condition.OnGUI();
            }

            if (CanvasGUI.Button(new Rect(CanvasGUI.OptionRect.width - 25, 5, 20, 20), "+"))
            {
                GenericMenu menu   = new GenericMenu(CanvasGUI.OptionRect);
                string[]    values = Enum.GetNames(typeof(ConditionalState));

                for (int i = 1; i < values.Length; i++)
                {
                    menu.AddMenuItem(new GUIContent(values[i]), false, AddConditionCallback, values[i]);
                }
                menu.Show(new Vector2(CanvasGUI.OptionRect.width - 5, 25));
            }
        }
        void ToolBar()
        {
            CanvasGUI.BeginGroup(CanvasGUI.ToolBarRect, GUI.skin.box, cache.States.curSpace == EventSpace.Toolbar);

            GUI.Label(new Rect(5, 5, CanvasGUI.ToolBarRect.width - 10, 20), new GUIContent(cache.CanvasName + (cache.AutoLoaded ? " (Last Session)" : "")));

            if (CanvasGUI.Button(new Rect(5, 30, CanvasGUI.ToolBarRect.width - 10, 20), "Save"))
            {
                cache = (cache.IsFileSaved && !cache.AutoLoaded) ? EditorCache.SaveCache(cache.SavePath ?? AssetDatabase.GetAssetPath(cache), cache) : SaveCanvas();
            }

            if (CanvasGUI.Button(new Rect(5, 55, CanvasGUI.ToolBarRect.width - 10, 20), "Save As"))
            {
                SaveCanvas();
            }

            if (CanvasGUI.Button(new Rect(5, 80, CanvasGUI.ToolBarRect.width - 10, 20), "Load"))
            {
                LoadCanvas();
            }

            if (CanvasGUI.Button(new Rect(5, 105, CanvasGUI.ToolBarRect.width - 10, 20), "New Canvas"))
            {
                cache = EditorCache.NewCache();
            }

            if (CanvasGUI.Button(new Rect(5, 130, CanvasGUI.ToolBarRect.width - 10, 20), "Settings"))
            {
                Setting();
            }

            CanvasGUI.EndGroup();
        }
        public static void OnGUI(EditorStates states)
        {
            States = states;
            EditorState curState = states.curState;

            CanvasGUI.BeginGroup(new Rect(curState.panDelta, curState.canvasSize), (states.curSpace | EventSpace.CanvasSpace) == EventSpace.CanvasSpace);

            for (int i = 0; i < Cache.Nodes.Count; i++)
            {
                Cache.Nodes.Get(i).DrawConnection();
            }

            if (curState.connectionIndex > -1)
            {
                BaseNodule startNodule = curState.selectedObject as BaseNodule;

                if (curState.connectionIndex > startNodule.Nodules.Count - 1)
                {
                    InputHandlers.OnSelectConnection(states);
                }
                else
                {
                    CanvasGUI.DrawConnection(startNodule, startNodule.Nodules.Get(curState.connectionIndex), Color.red);
                }
            }
            Cache.Nodes.OnGUI();

            CanvasGUI.EndGroup();
            CanvasGUI.BeginGroup(CanvasGUI.OptionRect, GUI.skin.box, states.curSpace == EventSpace.Actor);

            switch (tab)
            {
            case OptionTab.actor:
                Cache.Actors.OnGUI();
                break;

            case OptionTab.condition:
                Cache.Conditions.OnGUI();
                break;
            }

            if (CanvasGUI.Button(new Rect(5, 5, 70, 20), "Conditions"))
            {
                tab = OptionTab.condition;
            }
            else if (CanvasGUI.Button(new Rect(80, 5, 50, 20), "Actors"))
            {
                tab = OptionTab.actor;
            }

            CanvasGUI.EndGroup();
        }
Beispiel #5
0
        public override void OnGUI()
        {
            for (int i = 0; i < Count; i++)
            {
                OptionNode option = Get(i);
                option.OnGUI();

                if (!mainNode.Locked && CanvasGUI.Button(new Rect(
                                                             new Vector2(option.Position.center.x, option.Position.yMin - optionSpacing * 0.5f) - new Vector2(45, 14) * 0.5f,
                                                             new Vector2(45, 14)), "Unlink"))
                {
                    Remove(option);
                    continue;
                }
            }
        }
        public override void OnGUI()
        {
            base.OnGUI();

            CanvasGUI.BeginGroup(Position, GUI.skin.box, actor.Tint, HasControl);

            if (Locked)
            {
                GUI.Label(new Rect(5, 5, 240, 20), name);
                GUI.Label(new Rect(5, 30, 240, 20), actor.name);
            }
            else
            {
                EditorCache cache    = DialogueEditorGUI.Cache;
                string      nodeName = name;

                if (CanvasGUI.TextField(new Rect(5, 5, 240, 20), ref nodeName))
                {
                    name = cache.Nodes.ItemNames[cache.Nodes.ItemNames.IndexOf(name)] = nodeName;
                }

                ActorDatabase actors = cache.Actors;
                actor = actors.Get(CanvasGUI.DropDownMenu(new Rect(5, 30, 240, 20),
                                                          position, actors.GetIndex(actor), actors.ItemNames.ToArray()));
            }

            if (CanvasGUI.Button(new Rect(Position.size.x - 50, 5, 20, 20), new GUIContent("L"), GUI.skin.button))
            {
                Locked = !Locked;
            }

            if (CanvasGUI.Button(new Rect(Position.size.x - 25, 5, 20, 20), new GUIContent("X"), GUI.skin.button))
            {
                Delete();
            }
            textArea = CanvasGUI.TextArea(new Rect(5, 55, 290, 115), textArea);

            if (CanvasGUI.Button(new Rect(5, 175, 290, 20), new GUIContent("Add Dialogue Option"), GUI.skin.button))
            {
                options.Add(OptionNode.Create(options.NextItemName("Option"), this));
            }

            CanvasGUI.EndGroup();

            options.OnGUI();
        }
        public override void OnGUI()
        {
            for (int i = 0; i < Count; i++)
            {
                Actor actor = Get(i);

                if (i > 0 && CanvasGUI.Button(new Rect(actor.Position.xMax + 2, actor.Position.yMin, 20, 20), "X"))
                {
                    actor.Delete();
                    continue;
                }
                actor.OnGUI();
            }

            if (CanvasGUI.Button(new Rect(CanvasGUI.OptionRect.width - 25, 5, 20, 20), "+"))
            {
                Add(Actor.Create(NextItemName("New Actor"),
                                 new Color(Random.Range(0.000f, 1.000f), Random.Range(0.000f, 1.000f), Random.Range(0.000f, 1.000f)),
                                 new Rect(5, 27 + 22 * (Count), CanvasGUI.OptionRect.width - 34, 20)));
            }
        }