Пример #1
0
        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();
        }
Пример #2
0
            public override void OnGUI()
            {
                Event current   = Event.current;
                Rect  tolerance = new Rect(position);

                tolerance.xMin -= 20;
                tolerance.xMax += 20;
                tolerance.yMin -= 20;
                tolerance.yMax += 20;

                bool hasFocus = tolerance.Contains(current.mousePosition);

                CanvasGUI.BeginGroup(position, GUI.skin.box, hasFocus);

                ConditionDatabase conditions = DialogueEditorGUI.Cache.Conditions;

                obj.Condition = conditions.Get(CanvasGUI.DropDownMenu(new Rect(5, 5, position.width - 10, 20), position,
                                                                      conditions.GetIndex(obj.Condition), conditions.ItemNames.ToArray()));

                for (int i = 0; i < obj.ConditionValues.Count; i++)
                {
                    var val = obj.ConditionValues[i];

                    CanvasGUI.TextLabel(new Rect(30, 30 + 25 * 1, 20, 20), val.userParam.ToString());

                    string[] names = Enum.GetNames(typeof(EqualityState));
                    val.equality = (EqualityState)Enum.Parse(typeof(EqualityState),
                                                             names[CanvasGUI.DropDownMenu(new Rect(5, 30 + 25, 100, 20), (int)val.equality, names)]);
                }

                CanvasGUI.EndGroup();

                if (current.type == EventType.MouseUp && !hasFocus)
                {
                    close = true;
                }

                if (!obj || close)
                {
                    UpdateOverlays(obj);
                }
            }
Пример #3
0
            ValueType DrawParam(Rect rect, ValueType param)
            {
                ConditionalState conditional = obj.Condition.Conditional;

                switch (conditional)
                {
                case (ConditionalState.Bool):
                    return(CanvasGUI.DropDownMenu(rect, (int)param, new string[] { "False", "True" }));

                case (ConditionalState.Float):
                    break;

                case (ConditionalState.Int):
                    break;

                case (ConditionalState.None):
                    break;
                }

                return(null);
            }