Пример #1
0
        public override void DrawWindows()
        {
            base.DrawWindows();
            Rect zone = new Rect(0, 0, 200, 100);

            EditorGUI.DrawRect(zone, settings.otherGUIColor);
            GUILayout.BeginArea(new Rect(zone.x + 2, zone.y + 2, zone.width, zone.height));
            GetEGLLable("Character: ", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleCenter, 20));
            currentGraph = (BehaviourGraph)EditorGUILayout.ObjectField(currentGraph, typeof(BehaviourGraph), false, GUILayout.Width(200)); // field to choose graph

            if (GUI.Button(new Rect(43, 50, 100, 20), "New graph"))
            {
                ScriptableObjectUtility.CreateAsset <BehaviourGraph>("NewBehaviourGraph");
            }
            GUILayout.EndArea();


            if (currentGraph == null)
            {
                GUILayout.BeginArea(new Rect(150, 300, 1920, 200));

                GetEGLLable("No Character Assign!", GUIStylizer.GetStyle(GUIStylizer.Colors.RED, TextAnchor.MiddleLeft, 200, 0, 0, 130, 0f));
                GUILayout.EndArea();
            }
        }
        protected void DrawTransitionSettings(Transition t)
        {
            if (t.clicked)
            {
                if (selectedTransition != null && selectedTransition != t)
                {
                    selectedTransition.clicked = false;
                }
                selectedTransition = t;

                EditorGUI.DrawRect(new Rect(10, 150, 200, 300), DialogEditor.DialogEditor.settings.otherGUIColor);

                GUILayout.BeginArea(new Rect(10, 150, 200, 300));

                GetEGLLable("Transition settings: ", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleCenter, 25));
                GetEGLLable("color: ", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleCenter, 25));
                t.Color = EditorGUILayout.ColorField(t.Color);

                GetEGLLable("start position: ", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleCenter, 25));
                t.startPlacement = (EWindowCurvePlacement)EditorGUILayout.EnumPopup(t.startPlacement);

                GetEGLLable("end position: ", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleCenter, 25));
                t.endPlacement = (EWindowCurvePlacement)EditorGUILayout.EnumPopup(t.endPlacement);


                GUILayout.EndArea();

                if (t.removable && GUI.Button(new Rect(10, 300, 80, 20), "Remove"))
                {
                    t.startNode.AddTransitionsToRemove(t.ID);
                }
            }
        }
Пример #3
0
        public override void DrawWindows()
        {
            base.DrawWindows();
            #region Graph field
            Rect zone = new Rect(0, 0, 200, 100);
            EditorGUI.DrawRect(zone, settings.otherGUIColor);
            GUILayout.BeginArea(new Rect(zone.x + 2, zone.y + 2, zone.width, zone.height));
            GetEGLLable("Dialog: ", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));
            currentGraph = (NodeGraph)EditorGUILayout.ObjectField(currentGraph, typeof(DialogGraph), false, GUILayout.Width(200)); // field to choose graph
            if (GUI.Button(new Rect(43, 50, 100, 20), "New graph"))
            {
                currentGraph = ScriptableObjectUtility.CreateAsset <DialogGraph>("NewDialogGraph");
            }
            GUILayout.EndArea();

            if (currentGraph == null)
            {
                GUILayout.BeginArea(new Rect(150, 300, 1920, 200));

                GetEGLLable("No Dialog Assign!", GUIStylizer.GetStyle(GUIStylizer.Colors.RED, TextAnchor.MiddleLeft, 200, 0, 0, 130, 0f));
                GUILayout.EndArea();
            }
            #endregion


            if (currentGraph != null)
            {
                GUILayout.BeginArea(new Rect(205, 20, 150, 50));
                GUILayout.BeginHorizontal();
                showDialogSettings = GUILayout.Toggle(showDialogSettings, "");
                GetEGLLable("Show settings", GUIStylizer.GetStyle(GUIStylizer.Colors.REDPING, TextAnchor.MiddleLeft, 15));

                GUILayout.EndHorizontal();

                GUILayout.EndArea();

                if (showDialogSettings)
                {
                    DialogGraph d    = currentGraph as DialogGraph;
                    Rect        sett = new Rect(355, 10, 1500, 50);
                    GUIStyle    s    = GUIStylizer.GetStyle(settings.otherGUIColor, TextAnchor.UpperCenter, 20, 0, 0, 10, 0f);
                    EditorGUI.DrawRect(sett, settings.otherGUIColor);
                    GUI.contentColor = Color.white;
                    float spacing = -70;
                    if (d.unlimitedRepeating)
                    {
                        spacing = -150;
                    }
                    if (d.repeatable)
                    {
                        spacing = 0;
                    }

                    GUILayout.BeginArea(sett, s);
                    GUILayout.BeginHorizontal();



                    d.IsEnable = GUILayout.Toggle(d.IsEnable, "");
                    GUILayout.Space(spacing);
                    GetEGLLable("Enable", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));

                    d.unlimitedRepeating = GUILayout.Toggle(d.unlimitedRepeating, "");
                    GUILayout.Space(spacing);
                    GetEGLLable("Unlimited Repeating", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));


                    if (!d.unlimitedRepeating)
                    {
                        d.repeatable = GUILayout.Toggle(d.repeatable, "");
                        GUILayout.Space(spacing);
                        GetEGLLable("Repeatable", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));


                        if (d.repeatable)
                        {
                            GetEGLLable("Repeat Limit", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));
                            GUILayout.Space(spacing);
                            d.repeatLimit = EditorGUILayout.IntField(d.repeatLimit, "");
                        }
                    }
                    d.skipable = GUILayout.Toggle(d.skipable, "");
                    GUILayout.Space(spacing);
                    GetEGLLable("Skipable", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));


                    d.destroyOnEnd = GUILayout.Toggle(d.destroyOnEnd, "");
                    GUILayout.Space(spacing);
                    GetEGLLable("Destroy On End", GUIStylizer.GetStyle(GUIStylizer.Colors.WHITE, TextAnchor.MiddleLeft, 20));

                    GUILayout.EndHorizontal();
                    GUILayout.EndArea();
                }
            }
        }
        public static void DrawNodeCurve(Transition t, Rect start, Rect end, EWindowCurvePlacement start_, EWindowCurvePlacement end_, Color curveColor, bool disable)
        {
            Vector3 endPos   = Vector3.zero;
            Vector3 startPos = Vector3.zero;

            switch (start_)
            {
            case EWindowCurvePlacement.LeftTop:
                startPos = new Vector3(start.x + 1, start.y + 3, 0);

                break;

            case EWindowCurvePlacement.LeftBottom:
                startPos = new Vector3(start.x + 1, start.y + start.height - 3, 0);
                break;

            case EWindowCurvePlacement.CenterBottom:
                startPos = new Vector3(start.x + (start.width * 0.5f), start.y + start.height - 2, 0);

                break;

            case EWindowCurvePlacement.CenterTop:
                startPos = new Vector3(start.x + (start.width * 0.5f), start.y + 2, 0);
                break;

            case EWindowCurvePlacement.RightTop:
                startPos = new Vector3(start.x + start.width, start.y + 3, 0);
                break;

            case EWindowCurvePlacement.RightBottom:
                startPos = new Vector3(start.x + start.width, start.y + start.height - 3, 0);
                break;

            case EWindowCurvePlacement.RightCenter:
                startPos = new Vector3(start.x + start.width, start.y + (start.height * 0.5f), 0);
                break;

            case EWindowCurvePlacement.LeftCenter:
                startPos = new Vector3(start.x, start.y + (start.height * 0.5f), 0);

                break;

            case EWindowCurvePlacement.Center:
                startPos = new Vector3(start.x + (start.width * 0.5f), start.y + (start.height * 0.5f), 0);
                break;

            case EWindowCurvePlacement.Decision1:
                startPos = new Vector3(start.x + start.width, start.y + (start.height / 2 - 60), 0);
                break;

            case EWindowCurvePlacement.Decision2:
                startPos = new Vector3(start.x + start.width, start.y + (start.height / 2 - 40), 0);
                break;

            case EWindowCurvePlacement.Decision3:
                startPos = new Vector3(start.x + start.width, start.y + (start.height / 2 - 20), 0);
                break;

            case EWindowCurvePlacement.Decision4:
                startPos = new Vector3(start.x + start.width, start.y + (start.height / 2 - 0), 0);
                break;

            case EWindowCurvePlacement.Decision5:
                startPos = new Vector3(start.x + start.width, start.y + (start.height / 2 + 20), 0);
                break;
            }
            switch (end_)
            {
            case EWindowCurvePlacement.LeftTop:
                endPos = new Vector3(end.x + 1, end.y + 3, 0);

                break;

            case EWindowCurvePlacement.LeftBottom:
                endPos = new Vector3(end.x + 1, end.y + end.height - 3, 0);
                break;

            case EWindowCurvePlacement.CenterBottom:
                endPos = new Vector3(end.x + (end.width * 0.5f), end.y + end.height - 2, 0);

                break;

            case EWindowCurvePlacement.CenterTop:
                endPos = new Vector3(end.x + (end.width * 0.5f), end.y + 2, 0);
                break;

            case EWindowCurvePlacement.RightTop:
                endPos = new Vector3(end.x + end.width, end.y + 3, 0);
                break;

            case EWindowCurvePlacement.RightBottom:
                endPos = new Vector3(end.x + end.width, end.y + end.height - 3, 0);
                break;

            case EWindowCurvePlacement.RightCenter:
                endPos = new Vector3(end.x + end.width, end.y + (end.height * 0.5f), 0);
                break;

            case EWindowCurvePlacement.LeftCenter:
                endPos = new Vector3(end.x, end.y + (end.height * 0.5f), 0);

                break;

            case EWindowCurvePlacement.Center:
                endPos = new Vector3(end.x + (end.width * 0.5f), end.y + (end.height * 0.5f), 0);
                break;

            case EWindowCurvePlacement.Decision1:
                endPos = new Vector3(end.x + end.width, end.y + (end.height / 2 - 60), 0);
                break;

            case EWindowCurvePlacement.Decision2:
                endPos = new Vector3(end.x + end.width, end.y + (end.height / 2 - 40), 0);
                break;

            case EWindowCurvePlacement.Decision3:
                endPos = new Vector3(end.x + end.width, end.y + (end.height / 2 - 20), 0);
                break;

            case EWindowCurvePlacement.Decision4:
                endPos = new Vector3(end.x + end.width, end.y + (end.height / 2 - 0), 0);
                break;

            case EWindowCurvePlacement.Decision5:
                endPos = new Vector3(end.x + end.width, end.y + (end.height / 2 + 20), 0);
                break;
            }


            Vector3 startTan = startPos + Vector3.right * 50;
            Vector3 endTan   = endPos + Vector3.left * 50;

            Handles.Label(((startPos + endPos) * .5f) + Vector3.down * -5, t != null ? t.Value : "", GUIStylizer.GetStyle(curveColor, TextAnchor.MiddleCenter, 25));

            for (int i = 0; i < 3; i++)
            {
                Handles.DrawBezier(startPos, endPos, startTan, endTan, Color.black, null, 4);
            }
            Handles.DrawBezier(startPos, endPos, startTan, endTan, disable ? Color.black : curveColor, null, 3);
            if (t != null && t.enableClickPoint)
            {
                DrawTransitionClickPoint(t, startPos, endPos);
            }
        }