Ejemplo n.º 1
0
        void DrawConditions()
        {
            GUILayout.BeginArea(ConditionalSection);
            conditionsScroll = GUILayout.BeginScrollView(conditionsScroll);
            GUILayout.BeginVertical();


            if (_ai.actions[behaviour].conditions.Length < 1)
            {
                //TODO: Tradução
                EditorGUILayout.HelpBox("No conditions!", MessageType.Warning);
            }
            else
            {
                for (int i = 0; i < _ai.actions[behaviour].conditions.Length; i++)
                {
                    try
                    {
                        EditorGUILayout.BeginVertical("box");

                        _ai.actions[behaviour].conditions[i].drawConditionHeader(_ai.actions[behaviour].conditions[i].getName(), _ai.actions[behaviour].conditions[i].BtnIcon(), _ai, behaviour, i);

                        if (!_ai.actions[behaviour].conditions[i].open)
                        {
                            EditorGUILayout.EndVertical();
                            continue;
                        }

                        _ai.actions[behaviour].conditions[i].drawGUI(_ai, behaviour, i);


                        EditorGUILayout.EndVertical();

                        if (_ai.actions[behaviour].conditions.Length > 1 && i + 1 < _ai.actions[behaviour].conditions.Length)
                        {
                            EditorGUILayout.LabelField("-------- " + ((_ai.actions[behaviour].isAndGroup) ? "AND" : "OR") + " --------", secondScreenLayout.GetStyle("conditionDivision"), new GUILayoutOption[] { GUILayout.Height(8) });
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.Log(e.Message);
                        continue;
                    }
                }
            }


            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();

            WindowHelpers.drawLabel("Add condition");
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("+", GUILayout.Width(25)))
            {
                secondScreenMoment = addMoment.condition;
                moment             = windowMoments.second;
            }

            EditorGUILayout.EndHorizontal();


            GUILayout.EndVertical();
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
Ejemplo n.º 2
0
        void DrawActions()
        {
            GUILayout.BeginArea(ActionSection);
            buildMenuScrollPosition2 = GUILayout.BeginScrollView(buildMenuScrollPosition2);
            GUILayout.BeginVertical();


            if (_ai.actions[behaviour].actions.Length < 1)
            {
                //TODO: Tradução
                EditorGUILayout.HelpBox("No actions!", MessageType.Warning);
            }
            else
            {
                for (int i = 0; i < _ai.actions[behaviour].actions.Length; i++)
                {
                    try
                    {
                        if (i % 2 == 0)
                        {
                            EditorGUILayout.BeginVertical("box");
                        }
                        else
                        {
                            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        }


                        _ai.actions[behaviour].actions[i].drawActionHeader(_ai.actions[behaviour].actions[i].getName(), _ai.actions[behaviour].actions[i].BtnIcon(), _ai, behaviour, i);

                        if (!_ai.actions[behaviour].actions[i].open)
                        {
                            EditorGUILayout.EndVertical();
                            continue;
                        }


                        _ai.actions[behaviour].actions[i].drawGUI(_ai, behaviour, i);
                        EditorGUILayout.Space();

                        EditorGUILayout.EndVertical();
                    }
                    catch (Exception e)
                    {
                        Debug.Log(e.Message);
                        continue;
                    }
                }
            }



            GUILayout.Space(5);
            EditorGUILayout.BeginHorizontal();

            WindowHelpers.drawLabel("Add action");
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("+", GUILayout.Width(25)))
            {
                secondScreenMoment = addMoment.action;
                moment             = windowMoments.second;
            }

            EditorGUILayout.EndHorizontal();


            GUILayout.EndVertical();
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
Ejemplo n.º 3
0
        void DrawHeader()
        {
            Rect HeaderSectionContent = HeaderSection;

            GUI.color = Color.white;

            HeaderSectionContent.y      += headerPadding;
            HeaderSectionContent.x      += headerPadding;
            HeaderSectionContent.width  -= headerPadding * 2;
            HeaderSectionContent.height -= headerPadding;


            Rect saveButtonR = new Rect();

            saveButtonR.y      = 0;
            saveButtonR.x      = HeaderSection.width;
            saveButtonR.width  = 70;
            saveButtonR.height = HeaderSection.height;

            if (GUI.Button(saveButtonR, "Save"))
            {
                _ai.save();
            }

            GUILayout.BeginArea(HeaderSection);

            GUILayout.BeginArea(HeaderSectionContent);

            //Action name
            EditorGUILayout.BeginHorizontal();
            WindowHelpers.drawLabel(Language.nameOfAction(gameConfig.selectedLanguage));
            string wNameHelper = EditorGUILayout.TextField(_ai.actions[behaviour].name);

            if (wNameHelper != _ai.actions[behaviour].name)
            {
                _ai.actions[behaviour].name = wNameHelper;
                _ai.save();
            }
            EditorGUILayout.EndHorizontal();

            //Color picker
            EditorGUILayout.BeginHorizontal();
            WindowHelpers.drawLabel(Language.colorOfAction(gameConfig.selectedLanguage));
            Color wColorHelper = EditorGUILayout.ColorField(_ai.actions[behaviour].color);

            if (wColorHelper != _ai.actions[behaviour].color)
            {
                _ai.actions[behaviour].color = wColorHelper;
                _ai.save();
            }
            EditorGUILayout.EndHorizontal();

            //TODO: Mudar lingua
            EditorGUILayout.BeginHorizontal();
            WindowHelpers.drawLabel("Kind of condition group: ");

            if (!_ai.actions[behaviour].isAndGroup)
            {
                if (GUILayout.Button("AND", GUILayout.Width(50)))
                {
                    _ai.actions[behaviour].isAndGroup = true;
                    _ai.save();
                }

                GUILayout.Button("OR", WindowHelpers.pressedButton(), GUILayout.Width(50));
            }
            else
            {
                GUILayout.Button("AND", WindowHelpers.pressedButton(), GUILayout.Width(50));
                if (GUILayout.Button("OR", GUILayout.Width(50)))
                {
                    _ai.actions[behaviour].isAndGroup = false;
                    _ai.save();
                }
            }

            WindowHelpers.drawLabel("    Can it break another behaviour: ", 230);

            bool wPrioritaryHelper = EditorGUILayout.Toggle(_ai.actions[behaviour].prioritary, GUILayout.Width(30));

            if (wPrioritaryHelper != _ai.actions[behaviour].prioritary)
            {
                _ai.actions[behaviour].prioritary = wPrioritaryHelper;
                _ai.save();
            }

            WindowHelpers.drawLabel("  Run until be break: ", 140);

            bool wContinuosRunHelper = EditorGUILayout.Toggle(_ai.actions[behaviour].continuosRun, GUILayout.Width(30));

            if (wContinuosRunHelper != _ai.actions[behaviour].continuosRun)
            {
                _ai.actions[behaviour].continuosRun = wContinuosRunHelper;
                _ai.save();
            }

            GUILayout.FlexibleSpace();

            EditorGUILayout.EndHorizontal();


            GUILayout.EndArea();

            GUILayout.EndArea();
        }