Exemple #1
0
        public AdvancedFeaturesWindowMacros(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            macroList = new DataControlList()
            {
                RequestRepaint = Repaint,
                footerHeight   = 25,
                elementHeight  = 40,
                Columns        = new System.Collections.Generic.List <ColumnList.Column>()
                {
                    new ColumnList.Column()
                    {
                        Text        = TC.get("MacrosList.ID"),
                        SizeOptions = new GUILayoutOption[] { GUILayout.Width(150) }
                    },
                    new ColumnList.Column()
                    {
                        Text        = TC.get("Macro.Documentation"),
                        SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) }
                    },
                    new ColumnList.Column()
                    {
                        Text        = TC.get("Element.Effects"),
                        SizeOptions = new GUILayoutOption[] { GUILayout.Width(220) }
                    }
                },
                drawCell = (rect, index, column, isActive, isFocused) =>
                {
                    var macro = macroList.list[index] as MacroDataControl;
                    switch (column)
                    {
                    case 0:
                        EditorGUI.BeginChangeCheck();
                        var id = EditorGUI.DelayedTextField(rect, macro.getId());
                        if (EditorGUI.EndChangeCheck())
                        {
                            macro.setId(id);
                        }
                        break;

                    case 1:
                        EditorGUI.BeginChangeCheck();
                        var documentation = EditorGUI.TextArea(rect, macro.getDocumentation() ?? string.Empty);
                        if (EditorGUI.EndChangeCheck())
                        {
                            macro.setDocumentation(documentation);
                        }
                        break;

                    case 2:
                        if (GUI.Button(rect, TC.get("GeneralText.EditEffects")))
                        {
                            EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>();
                            window.Init(macro.getController());
                        }
                        break;
                    }
                }
            };
        }
        public void Init(Effects e)
        {
            editor   = EditorWindow.GetWindow <EffectEditorWindow>();
            editor.s = Color.black;

            editor.Effects = e;

            EffectEditorFactory.Intance.ResetInstance();

            InitWindows();
        }
        public void Init(EffectsController e)
        {
            editor   = EditorWindow.GetWindow <EffectEditorWindow>();
            editor.s = Color.black;

            editor.Effects = e.getEffectsDirectly();

            EffectEditorFactory.Intance.ResetInstance();

            InitWindows();
        }
        public void draw()
        {
            EditorGUILayout.HelpBox(TC.get("RandomEffect.Description"), MessageType.Info);
            EditorGUI.BeginChangeCheck();
            var newProbability = EditorGUILayout.IntSlider("RandomEffect.Probability.Description".Traslate(),
                                                           effect.getProbability(), 0, 100);

            if (EditorGUI.EndChangeCheck())
            {
                effect.setProbability(newProbability);
            }

            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Label("RandomEffect.Positive.Title".Traslate());
                if (GUILayout.Button(effect.getPositiveEffect() == null ? addTexture : removeTexture, GUILayout.Width(20)))
                {
                    if (effect.getPositiveEffect() == null)
                    {
                        EffectEditorWindow.CreateEffect(newEffect =>
                        {
                            effect.setPositiveEffect(newEffect);
                        });
                    }
                    else
                    {
                        effect.setPositiveEffect(null);
                        effect.setNegativeEffect(null);
                    }
                }
            }

            using (new EditorGUI.DisabledScope(effect.getPositiveEffect() == null))
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("RandomEffect.Negative.Title".Traslate());
                    if (GUILayout.Button(effect.getNegativeEffect() == null ? addTexture : removeTexture, GUILayout.Width(20)))
                    {
                        if (effect.getNegativeEffect() == null)
                        {
                            EffectEditorWindow.CreateEffect(effect.setNegativeEffect);
                        }
                        else
                        {
                            effect.setNegativeEffect(null);
                        }
                    }
                }
            }
        }
            public override void Draw(int aID)
            {
                var exit = Target as ExitDataControl;


                // Conditions
                GUILayout.Label(TC.get("Exit.EditConditions"));
                if (GUILayout.Button(exit.getConditions().getBlocksCount() > 0 ? conditionsTex : noConditionsTex))
                {
                    ConditionEditorWindow window =
                        (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                    window.Init(exit.getConditions());
                }

                GUILayout.Label(TC.get("Exit.ConditionsActive"));
                // Effects
                if (GUILayout.Button(TC.get("GeneralText.EditEffects")))
                {
                    EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>();
                    window.Init(exit.getEffects());
                }

                // Post Effects
                if (GUILayout.Button(TC.get("Exit.EditPostEffects")))
                {
                    EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>();
                    window.Init(exit.getPostEffects());
                }

                GUILayout.Label(TC.get("Exit.ConditionsInactive"));
                // HasNotEffets
                EditorGUI.BeginChangeCheck();
                var hasNotEffects = EditorGUILayout.BeginToggleGroup(TC.get("Exit.ActiveWhenConditionsArent"), exit.isHasNotEffects());

                if (EditorGUI.EndChangeCheck())
                {
                    exit.setHasNotEffects(hasNotEffects);
                }

                // Not Effects
                if (GUILayout.Button(TC.get("Exit.EditNotEffects")))
                {
                    EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>();
                    window.Init(exit.getNotEffects());
                }

                EditorGUILayout.EndToggleGroup();
            }
Exemple #6
0
        public void draw()
        {
            using (new GUILayout.VerticalScope())
            {
                EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None);

                var min = linesList.headerHeight + linesList.footerHeight + linesList.elementHeight + 5;
                linesList.DoList(Mathf.Max(min, Mathf.Min(200, linesList.elementHeight * (linesList.count - 1) + min)));

                EditorGUILayout.HelpBox(TC.get("ConversationEditor.NodeOption"), MessageType.None);

                using (new GUILayout.HorizontalScope())
                {
                    using (new EditorGUI.DisabledGroupScope(myNode.getChildCount() > 0 || myNode.getAddableNodes().Length == 0))
                    {
                        if (GUILayout.Button(TC.get("ConversationEditor.CreateChild")))
                        {
                            var options = new List <GUIContent>();
                            foreach (var addable in Node.getAddableNodes())
                            {
                                options.Add(new GUIContent("Create " + TC.get("Element.Name" + addable)));
                            }

                            EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition, Vector2.one), options.ToArray(), -1, (param, ops, selected) =>
                            {
                                var option = Node.getAddableNodes()[selected];
                                parent.Content.addNode(myNode, option);
                            }, Event.current.mousePosition);
                        }
                    }

                    if (GUILayout.Button(TC.get("ConversationEditor.SetChild")))
                    {
                        parent.StartSetChild(this.myNode, 0);
                    }

                    var hasEffects = myNode.getEffects().getEffects().Count > 0;
                    if (GUILayout.Button(hasEffects ? effectTex : noEffectTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24)))
                    {
                        EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                        window.Init(myNode.getEffects());
                    }
                }
            }
        }
Exemple #7
0
        protected void OnGUI()
        {
            current = this;

            if (effects == null)
            {
                Close();
                DestroyImmediate(this);
                return;
            }
            this.wantsMouseMove = true;

            var buttonRect = new Rect(position.width - 100, position.height - 100, 80, 80);
            var lastEvent  = Event.current.type;
            var eventUsed  = false;

            if (buttonRect.Contains(Event.current.mousePosition) &&
                Event.current.type != EventType.Repaint &&
                Event.current.type != EventType.Layout)
            {
                eventUsed = true;
                Event.current.Use();
            }

            effectsEditor.OnInspectorGUI();

            if (eventUsed)
            {
                Event.current.type = lastEvent;
            }


            if (GUI.Button(buttonRect, addButton))
            {
                CreateEffect((effect) =>
                {
                    effects.Add(effect);
                    Repaint();
                });
            }

            current = null;
        }
        public void draw()
        {
            if (closeStyle == null)
            {
                closeStyle                   = new GUIStyle(GUI.skin.button);
                closeStyle.padding           = new RectOffset(0, 0, 0, 0);
                closeStyle.margin            = new RectOffset(0, 5, 2, 0);
                closeStyle.normal.textColor  = Color.red;
                closeStyle.focused.textColor = Color.red;
                closeStyle.active.textColor  = Color.red;
                closeStyle.hover.textColor   = Color.red;
            }

            if (buttonstyle == null)
            {
                buttonstyle         = new GUIStyle();
                buttonstyle.padding = new RectOffset(5, 5, 5, 5);
            }

            GUIStyle style = new GUIStyle();

            style.padding = new RectOffset(5, 5, 5, 5);

            EditorGUILayout.BeginVertical();

            EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None);
            bool infoShown = false;

            if (myNode.getLineCount() > 0)
            {
                bool isScrolling = false;

                if (myNode.getLineCount() > 10)
                {
                    scroll      = EditorGUILayout.BeginScrollView(scroll, GUILayout.MinWidth(360), GUILayout.Height(190));
                    isScrolling = true;
                }

                for (int i = 0; i < myNode.getLineCount(); i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    //myNode.getLine(i).IsEntityFragment = EditorGUILayout.Toggle("Is entity: ", frg.IsEntityFragment);

                    bool showInfo = false;
                    EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent(TC.get("ConversationEditor.Speaker"))).x;
                    myNode.getLine(i).setName(npc[EditorGUILayout.Popup(TC.get("ConversationEditor.Speaker"), npc.IndexOf(myNode.getLine(i).getName()), npc.ToArray())]);

                    EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent(TC.get("ConversationEditor.Line"))).x;
                    myNode.getLine(i).setText(EditorGUILayout.TextField(TC.get("ConversationEditor.Line"), myNode.getLine(i).getText(), GUILayout.Width(200)));

                    tmpTex = (myNode.getLine(i).getConditions().getConditionsList().Count > 0
                        ? conditionsTex
                        : noConditionsTex);

                    if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(15), GUILayout.Height(15)))
                    {
                        ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(myNode.getLine(i).getConditions());
                    }

                    if (GUILayout.Button("X", closeStyle, GUILayout.Width(15), GUILayout.Height(15)))
                    {
                        myNode.removeLine(i);
                    }
                    ;
                    EditorGUILayout.EndHorizontal();
                }
                if (isScrolling)
                {
                    EditorGUILayout.EndScrollView();
                }
            }


            GUIContent bttext = new GUIContent(TC.get("ConversationLine.DefaultText"));
            Rect       btrect = GUILayoutUtility.GetRect(bttext, style);

            if (GUI.Button(btrect, bttext))
            {
                myNode.addLine(new ConversationLine(TC.get("ConversationLine.PlayerName"), ""));
            }
            ;


            EditorGUILayout.HelpBox(TC.get("ConversationEditor.NodeOption"), MessageType.None);

            EditorGUILayout.BeginHorizontal();
            GUI.enabled = (myNode.getChildCount() == 0) || myNode.getType() == ConversationNodeViewEnum.OPTION;
            bttext      = new GUIContent(TC.get("ConversationEditor.CreateChild"));
            btrect      = GUILayoutUtility.GetRect(bttext, buttonstyle);
            if (GUI.Button(btrect, bttext))
            {
                parent.addChild(myNode, new DialogueConversationNode());
            }
            GUI.enabled = true;

            bttext = new GUIContent(TC.get("ConversationEditor.SetChild"));
            btrect = GUILayoutUtility.GetRect(bttext, buttonstyle);
            if (GUI.Button(btrect, bttext))
            {
                parent.startSetChild(this.myNode, 0);
            }

            tmpTex = (myNode.getEffects().getEffects().Count > 0
                ? effectTex
                : noEffectTex);
            if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24)))
            {
                EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                window.Init(myNode.getEffects());
            }

            GUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
Exemple #9
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            macroTableRect  = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, 0.5f * windowHeight);
            rightPanelRect  = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.5f * windowHeight);
            descriptionRect = new Rect(0f, 0.6f * windowHeight, 0.95f * windowWidth, 0.2f * windowHeight);
            effectsRect     = new Rect(0f, 0.8f * windowHeight, windowWidth, windowHeight * 0.15f);

            GUILayout.BeginArea(macroTableRect);
            GUILayout.Box(TC.get("MacrosList.ID"), GUILayout.Width(0.85f * windowWidth));

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros().Count;
                 i++)
            {
                if (i != selectedMacro)
                {
                    GUI.skin = noBackgroundSkin;

                    if (
                        GUILayout.Button(
                            Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros()[
                                i].getId(), GUILayout.Width(0.85f * windowWidth)))
                    {
                        OnSelectedMacroChanged(i);
                    }
                }
                else
                {
                    GUI.skin = selectedAreaSkin;

                    macroName = GUILayout.TextField(macroName, GUILayout.Width(0.85f * windowWidth));
                    if (!macroName.Equals(macroNameLast))
                    {
                        OnMacroNameChanged(macroName);
                    }
                }
                GUI.skin = defaultSkin;
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl()
                .addElement(Controller.MACRO, "Macro" + Random.Range(0, 10000).ToString());
            }
            if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl()
                .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros()[selectedMacro]);
            }
            if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl()
                .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getMacrosListDataControl().getMacros()[selectedMacro], false);
                selectedMacro = -1;
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();

            if (selectedMacro != -1)
            {
                GUILayout.Space(10);
                GUILayout.BeginArea(descriptionRect);
                GUILayout.Label(TC.get("Macro.Documentation"));
                GUILayout.Space(10);
                macroDocumentation = GUILayout.TextArea(macroDocumentation, GUILayout.MinHeight(0.15f * windowHeight));
                if (!macroDocumentation.Equals(macroDocumentationLast))
                {
                    OnMacroDocumentationChanged(macroDocumentation);
                }
                GUILayout.EndArea();

                GUILayout.BeginArea(effectsRect);
                if (GUILayout.Button(TC.get("Element.Effects")))
                {
                    EffectEditorWindow window =
                        (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                    window.Init(Controller.getInstance()
                                .getSelectedChapterDataControl()
                                .getMacrosListDataControl().getMacros()[selectedMacro].getController());
                }
                GUILayout.EndArea();
            }
        }
        public override void Draw(int aID)
        {
            var workingTimerList = Controller.Instance.SelectedChapterDataControl.getTimersList();

            timerList.SetData(workingTimerList, (data) => (data as TimersListDataControl).getTimers().Cast <DataControl>().ToList());
            timerList.DoList(220);

            using (new EditorGUI.DisabledScope(timerList.index < 0 || timerList.index >= workingTimerList.getTimers().Count))
            {
                var workingTimer = timerList.index >= 0 ? workingTimerList.getTimers()[timerList.index] : new TimerDataControl(new Timer());

                // ################
                // ### Time section
                // ################

                EditorGUI.BeginChangeCheck();
                var showTime = EditorGUILayout.BeginToggleGroup(TC.get("TimersList.Display"), workingTimer.isShowTime());
                if (EditorGUI.EndChangeCheck())
                {
                    workingTimer.setShowTime(showTime);
                }
                {
                    EditorGUI.indentLevel++;

                    // Display name
                    EditorGUI.BeginChangeCheck();
                    var id = EditorGUILayout.TextField(TC.get("Item.Name"), workingTimer.getDisplayName());
                    if (EditorGUI.EndChangeCheck())
                    {
                        workingTimer.setDisplayName(id);
                    }

                    // CountDown
                    EditorGUI.BeginChangeCheck();
                    var countDown = EditorGUILayout.ToggleLeft(TC.get("Timer.CountDown"), workingTimer.isCountDown());
                    if (EditorGUI.EndChangeCheck())
                    {
                        workingTimer.setCountDown(countDown);
                    }

                    // Show when stopped
                    EditorGUI.BeginChangeCheck();
                    var shownWhenStopped = EditorGUILayout.ToggleLeft(TC.get("Timer.ShowWhenStopped"), workingTimer.isShowWhenStopped());
                    if (EditorGUI.EndChangeCheck())
                    {
                        workingTimer.setShowWhenStopped(shownWhenStopped);
                    }

                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndToggleGroup();

                // ################
                // ### Loop Control
                // ################

                GUILayout.Label(TC.get("Timer.LoopControl"));
                {
                    EditorGUI.indentLevel++;

                    // Show when stopped
                    EditorGUI.BeginChangeCheck();
                    var multipleStarts = EditorGUILayout.ToggleLeft(TC.get("Timer.MultipleStarts"), workingTimer.isMultipleStarts());
                    if (EditorGUI.EndChangeCheck())
                    {
                        workingTimer.setMultipleStarts(multipleStarts);
                    }

                    EditorGUILayout.HelpBox(TC.get("Timer.MultipleStartsDesc"), MessageType.Info);

                    // Show when stopped
                    EditorGUI.BeginChangeCheck();
                    var runsInLoop = EditorGUILayout.ToggleLeft(TC.get("Timer.RunsInLoop"), workingTimer.isRunsInLoop());
                    if (EditorGUI.EndChangeCheck())
                    {
                        workingTimer.setRunsInLoop(runsInLoop);
                    }

                    EditorGUILayout.HelpBox(TC.get("Timer.RunsInLoopDesc"), MessageType.Info);

                    EditorGUI.indentLevel--;
                }

                // ################
                // ### Conditions
                // ################

                // Init conditions
                GUILayout.Label(TC.get("Timer.InitConditions"));
                {
                    EditorGUI.indentLevel++;

                    if (GUILayout.Button(TC.get("GeneralText.EditInitConditions")))
                    {
                        ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(workingTimer.getInitConditions());
                    }

                    EditorGUI.indentLevel--;
                }

                // End conditions
                GUILayout.Label(TC.get("Timer.EndConditions"));
                {
                    EditorGUI.indentLevel++;

                    EditorGUI.BeginChangeCheck();
                    var usesEndCondition = EditorGUILayout.BeginToggleGroup(TC.get("Timer.UsesEndConditionShort"), workingTimer.isUsesEndCondition());
                    if (EditorGUI.EndChangeCheck())
                    {
                        workingTimer.setUsesEndCondition(usesEndCondition);
                    }

                    if (GUILayout.Button(TC.get("GeneralText.EditEndConditions")))
                    {
                        ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(workingTimer.getEndConditions());
                    }

                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }

                // ################
                // ### Effects
                // ################

                // Header
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.Label(TC.get("Timer.Effects"));
                GUILayout.FlexibleSpace();
                GUILayout.Label(TC.get("Timer.PostEffects"));
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                // Buttons
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(TC.get("GeneralText.EditEffects")))
                {
                    EffectEditorWindow window =
                        (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                    window.Init(workingTimer.getEffects());
                }
                if (GUILayout.Button(TC.get("GeneralText.EditPostEffects")))
                {
                    EffectEditorWindow window =
                        (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                    window.Init(workingTimer.getPostEffects());
                }
                GUILayout.EndHorizontal();


                GUILayout.Label(TC.get("Timer.Documentation"));
                EditorGUI.BeginChangeCheck();
                var newDocumentation = GUILayout.TextArea(workingTimer.getDocumentation() ?? string.Empty, GUILayout.ExpandHeight(true));
                if (EditorGUI.EndChangeCheck())
                {
                    workingTimer.setDocumentation(newDocumentation);
                }
            }
        }
        public void draw()
        {
            using (new GUILayout.VerticalScope())
            {
                // Options configuration
                using (new GUILayout.HorizontalScope())
                {
                    // KeepShowing
                    questionContent.tooltip = TC.get("Conversation.KeepShowing");
                    EditorGUI.BeginChangeCheck();
                    var keepShowing = GUILayout.Toggle(myNode.KeepShowing, questionContent, "Button");
                    if (EditorGUI.EndChangeCheck())
                    {
                        myNode.KeepShowing = keepShowing;
                    }

                    // KeepShowing
                    shuffleContent.tooltip = TC.get("Conversation.OptionRandomly");
                    EditorGUI.BeginChangeCheck();
                    var random = GUILayout.Toggle(myNode.Random, shuffleContent, "Button");
                    if (EditorGUI.EndChangeCheck())
                    {
                        myNode.Random = random;
                    }

                    // Show User Option
                    answerContent.tooltip = TC.get("Conversation.ShowUserOption");
                    EditorGUI.BeginChangeCheck();
                    var showUserOption = GUILayout.Toggle(myNode.ShowUserOption, answerContent, "Button");
                    if (EditorGUI.EndChangeCheck())
                    {
                        myNode.ShowUserOption = showUserOption;
                    }
                }

                EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None);

                using (new GUILayout.HorizontalScope())
                {
                    GUILayout.Label("Question ID: ");
                    EditorGUI.BeginChangeCheck();
                    var newXApiQuestion = EditorGUILayout.TextField(myNode.getXApiQuestion());
                    if (EditorGUI.EndChangeCheck())
                    {
                        myNode.setXApiQuestion(newXApiQuestion);
                    }

                    if (myNode.getXApiQuestion() == "")
                    {
                        var lastRect = GUILayoutUtility.GetLastRect();
                        var guistyle = new GUIStyle(GUI.skin.label);
                        guistyle.normal.textColor = Color.gray;
                        GUI.Label(lastRect, " Required for analytics", guistyle);
                    }
                }

                var min = linesList.headerHeight + linesList.footerHeight + linesList.elementHeight + 5;
                linesList.DoList(Mathf.Max(min, Mathf.Min(150, linesList.elementHeight * (linesList.count - 1) + min)));

                // Timer
                using (new GUILayout.HorizontalScope())
                {
                    if (EditorGUILayout.Toggle("Timeout: ", myNode.Timeout >= 0))
                    {
                        myNode.Timeout = Mathf.Clamp(EditorGUILayout.FloatField(myNode.Timeout), 0.1f, float.MaxValue);
                        GUILayout.Space(5);
                        DoConditionsEditor(GUILayoutUtility.GetRect(15, 15), myNode.TimeoutConditions);
                        DoChildEditor(GUILayoutUtility.GetRect(15, 15), myNode.getChildCount() - 1);
                    }
                    else
                    {
                        myNode.Timeout = -1f;
                    }
                }

                using (new GUILayout.HorizontalScope())
                {
                    var hasEffects = myNode.getEffects().getEffects().Count > 0;
                    if (GUILayout.Button(hasEffects ? effectTex : noEffectTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24)))
                    {
                        EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                        window.Init(myNode.getEffects());
                    }
                }
            }
        }
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            timerTableRect = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, 0.2f * windowHeight);
            rightPanelRect = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.2f * windowHeight);
            settingsTable  = new Rect(0f, 0.3f * windowHeight, windowWidth, windowHeight * 0.65f);

            /*
             * Timer table
             */
            GUILayout.BeginArea(timerTableRect);

            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("TimersList.Timer"), GUILayout.MaxWidth(windowWidth * 0.3f));
            GUILayout.Box(TC.get("TimersList.Time"), GUILayout.MaxWidth(windowWidth * 0.3f));
            GUILayout.Box(TC.get("TimersList.Display"), GUILayout.MaxWidth(windowWidth * 0.3f));
            GUILayout.EndHorizontal();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0;
                 i < Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers().Count;
                 i++)
            {
                if (i == selectedTimer)
                {
                    GUI.skin = selectedAreaSkin;
                }
                else
                {
                    GUI.skin = noBackgroundSkin;
                }

                GUILayout.BeginHorizontal();

                if (i == selectedTimer)
                {
                    if (GUILayout.Button("Timer #" + i, GUILayout.MaxWidth(windowWidth * 0.3f)))
                    {
                        OnTimerSelectedChange(i);
                    }

                    timerTime = GUILayout.TextField(timerTime, GUILayout.MaxWidth(windowWidth * 0.3f));
                    timerTime = (Regex.Match(timerTime, "^[0-9]{1,4}$").Success ? timerTime : timerTimeLast);
                    if (timerTime != timerTimeLast)
                    {
                        OnTimerTime(timerTime);
                    }

                    Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i].setShowTime(GUILayout
                                                                                                                        .Toggle(
                                                                                                                            Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i]
                                                                                                                            .isShowTime(),
                                                                                                                            "", GUILayout.MaxWidth(windowWidth * 0.3f)));
                }
                else
                {
                    if (GUILayout.Button("Timer #" + i, GUILayout.MaxWidth(windowWidth * 0.3f)))
                    {
                        OnTimerSelectedChange(i);
                    }
                    if (
                        GUILayout.Button(
                            Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i].getTime()
                            .ToString(), GUILayout.MaxWidth(windowWidth * 0.3f)))
                    {
                        OnTimerSelectedChange(i);
                    }
                    if (
                        GUILayout.Button(
                            Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[i].isShowTime().ToString(), GUILayout.MaxWidth(windowWidth * 0.3f)))
                    {
                        OnTimerSelectedChange(i);
                    }
                }
                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }

            GUILayout.EndScrollView();

            GUILayout.EndArea();

            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getTimersList().addElement(Controller.TIMER, "");
            }
            if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList()
                .duplicateElement(
                    Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer]);
            }
            if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList()
                .deleteElement(
                    Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer],
                    false);
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();

            /*
             * Properties panel
             */

            if (selectedTimer != -1 &&
                Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer] != null)
            {
                GUILayout.BeginArea(settingsTable);

                GUILayout.Label(TC.get("Timer.Documentation"));
                fullTimerDescription = GUILayout.TextArea(fullTimerDescription, GUILayout.MinHeight(0.1f * windowHeight));
                if (fullTimerDescription != fullTimerDescriptionLast)
                {
                    OnTimerDocumentationChanged(fullTimerDescription);
                }


                GUILayout.FlexibleSpace();


                GUILayout.Label(TC.get("TimersList.Time"));

                GUILayout.BeginHorizontal();
                if (
                    !Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer]
                    .isShowTime())
                {
                    GUI.enabled = false;
                }
                GUILayout.Label(TC.get("Timer.DisplayName"));
                displayName = GUILayout.TextField(displayName);
                if (displayName != displayNameLast)
                {
                    OnTimerDisplayNameChanged(displayName);
                }

                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList().getTimers()[selectedTimer].setCountDown(GUILayout.Toggle(Controller.getInstance()
                                                                                          .getSelectedChapterDataControl()
                                                                                          .getTimersList().getTimers()[selectedTimer].isCountDown(), TC.get("Timer.CountDown")));

                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList().getTimers()[selectedTimer].setShowWhenStopped(GUILayout.Toggle(Controller.getInstance()
                                                                                                .getSelectedChapterDataControl()
                                                                                                .getTimersList().getTimers()[selectedTimer].isShowWhenStopped(), TC.get("Timer.ShowWhenStopped")));
                GUI.enabled = true;
                GUILayout.EndHorizontal();


                GUILayout.FlexibleSpace();


                GUILayout.Label(TC.get("Timer.LoopControl"));
                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList().getTimers()[selectedTimer].setMultipleStarts(GUILayout.Toggle(Controller.getInstance()
                                                                                               .getSelectedChapterDataControl()
                                                                                               .getTimersList().getTimers()[selectedTimer].isMultipleStarts(), TC.get("Timer.MultipleStarts")));
                GUILayout.Label(TC.get("Timer.MultipleStartsDesc"), smallFontStyle);
                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList().getTimers()[selectedTimer].setRunsInLoop(GUILayout.Toggle(Controller.getInstance()
                                                                                           .getSelectedChapterDataControl()
                                                                                           .getTimersList().getTimers()[selectedTimer].isRunsInLoop(), TC.get("Timer.RunsInLoop")));
                GUILayout.Label(
                    TC.get("Timer.RunsInLoopDesc"), smallFontStyle);


                GUILayout.FlexibleSpace();


                GUILayout.Label(TC.get("Timer.InitConditions"));
                if (GUILayout.Button(TC.get("GeneralText.EditInitConditions")))
                {
                    ConditionEditorWindow window =
                        (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                    window.Init(Controller.getInstance()
                                .getSelectedChapterDataControl()
                                .getTimersList().getTimers()[selectedTimer].getInitConditions());
                }


                GUILayout.FlexibleSpace();


                GUILayout.Label(TC.get("Timer.EndConditions"));
                Controller.getInstance()
                .getSelectedChapterDataControl()
                .getTimersList().getTimers()[selectedTimer].setUsesEndCondition(
                    GUILayout.Toggle(Controller.getInstance()
                                     .getSelectedChapterDataControl()
                                     .getTimersList().getTimers()[selectedTimer].isUsesEndCondition(),
                                     TC.get("Timer.UsesEndConditionShort")));
                if (
                    !Controller.getInstance().getSelectedChapterDataControl().getTimersList().getTimers()[selectedTimer]
                    .isUsesEndCondition())
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button(TC.get("GeneralText.EditEndConditions")))
                {
                    ConditionEditorWindow window =
                        (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                    window.Init(Controller.getInstance()
                                .getSelectedChapterDataControl()
                                .getTimersList().getTimers()[selectedTimer].getEndConditions());
                }
                GUI.enabled = true;


                GUILayout.FlexibleSpace();


                GUILayout.BeginHorizontal();
                GUILayout.Label(TC.get("Timer.Effects"), GUILayout.Width(0.45f * windowWidth));
                GUILayout.Label(TC.get("Timer.PostEffects"), GUILayout.Width(0.45f * windowWidth));
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(TC.get("GeneralText.EditEffects"), GUILayout.Width(0.45f * windowWidth)))
                {
                    EffectEditorWindow window =
                        (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                    window.Init(Controller.getInstance()
                                .getSelectedChapterDataControl()
                                .getTimersList().getTimers()[selectedTimer].getEffects());
                }
                if (GUILayout.Button(TC.get("GeneralText.EditPostEffects"), GUILayout.Width(0.45f * windowWidth)))
                {
                    EffectEditorWindow window =
                        (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                    window.Init(Controller.getInstance()
                                .getSelectedChapterDataControl()
                                .getTimersList().getTimers()[selectedTimer].getPostEffects());
                }
                GUILayout.EndHorizontal();

                GUILayout.EndArea();
            }
        }
Exemple #13
0
        public void draw()
        {
            if (closeStyle == null)
            {
                closeStyle                   = new GUIStyle(GUI.skin.button);
                closeStyle.padding           = new RectOffset(0, 0, 0, 0);
                closeStyle.margin            = new RectOffset(0, 5, 2, 0);
                closeStyle.normal.textColor  = Color.red;
                closeStyle.focused.textColor = Color.red;
                closeStyle.active.textColor  = Color.red;
                closeStyle.hover.textColor   = Color.red;
            }

            GUIStyle style = new GUIStyle();

            style.padding = new RectOffset(5, 5, 5, 5);

            EditorGUILayout.BeginVertical();

            EditorGUILayout.HelpBox(TC.get("ConversationEditor.AtLeastOne"), MessageType.None);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Question ID: ");
            //Controller.getInstance ().getIdentifierSummary ().add
            myNode.setXApiQuestion(EditorGUILayout.TextField(myNode.getXApiQuestion()));
            if (myNode.getXApiQuestion() == "")
            {
                var lastRect = GUILayoutUtility.GetLastRect();
                var guistyle = new GUIStyle(GUI.skin.label);
                guistyle.normal.textColor = Color.gray;
                GUI.Label(lastRect, " Required for analytics", guistyle);
            }
            GUILayout.EndHorizontal();
            bool infoShown = false;

            if (myNode.getLineCount() > 0)
            {
                bool isScrolling = false;

                if (myNode.getLineCount() > 10)
                {
                    scroll      = EditorGUILayout.BeginScrollView(scroll, GUILayout.MinWidth(360), GUILayout.Height(190));
                    isScrolling = true;
                }

                for (int i = 0; i < myNode.getLineCount(); i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    bool showInfo = false;

                    EditorGUIUtility.labelWidth = GUI.skin.label.CalcSize(new GUIContent((i + 1) + ": ")).x;
                    myNode.getLine(i).setText(EditorGUILayout.TextField((i + 1) + ": ", myNode.getLine(i).getText(), GUILayout.Width(200)));
                    myNode.getLine(i).setXApiCorrect(EditorGUILayout.Toggle(myNode.getLine(i).getXApiCorrect()));
                    GUILayout.Space(5);

                    tmpTex = (myNode.getLine(i).getConditions().getConditionsList().Count > 0
                        ? conditionsTex
                        : noConditionsTex);

                    if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(15), GUILayout.Height(15)))
                    {
                        ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(myNode.getLine(i).getConditions());
                    }

                    if (GUILayout.Button(linkTex, noBackgroundSkin.button, GUILayout.Width(15), GUILayout.Height(15)))
                    {
                        parent.startSetChild(this.myNode, i);
                    }


                    if (GUILayout.Button("X", closeStyle, GUILayout.Width(15), GUILayout.Height(15)))
                    {
                        myNode.removeLine(i);
                        myNode.removeChild(i);
                    }
                    ;
                    EditorGUILayout.EndHorizontal();
                }
                if (isScrolling)
                {
                    EditorGUILayout.EndScrollView();
                }
            }

            EditorGUILayout.BeginHorizontal();
            GUIContent bttext = new GUIContent(TC.get("ConversationEditor.AddOptionChild"));
            Rect       btrect = GUILayoutUtility.GetRect(bttext, style);

            if (GUI.Button(btrect, bttext))
            {
                myNode.addLine(new ConversationLine("Player", ""));
                parent.addChild(this.myNode, new DialogueConversationNode());
            }
            ;

            tmpTex = (myNode.getEffects().getEffects().Count > 0
                ? effectTex
                : noEffectTex);
            if (GUILayout.Button(tmpTex, noBackgroundSkin.button, GUILayout.Width(24), GUILayout.Height(24)))
            {
                EffectEditorWindow window = (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                window.Init(myNode.getEffects());
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            actionTableRect = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, 0.5f * windowHeight);
            rightPanelRect  = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.5f * windowHeight);
            descriptionRect = new Rect(0f, 0.6f * windowHeight, 0.95f * windowWidth, 0.2f * windowHeight);
            effectsRect     = new Rect(0f, 0.8f * windowHeight, windowWidth, windowHeight * 0.15f);

            GUILayout.BeginArea(actionTableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("Element.Action"), GUILayout.Width(windowWidth * 0.39f));
            GUILayout.Box(TC.get("ActionsList.NeedsGoTo"), GUILayout.Width(windowWidth * 0.39f));
            GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.1f));
            GUILayout.EndHorizontal();
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandWidth(false));

            // Action table
            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                     GameRources.GetInstance().selectedItemIndex].getActionsList().getActions().Count;
                 i++)
            {
                if (i == selectedAction)
                {
                    GUI.skin = selectedAreaSkin;
                }
                else
                {
                    GUI.skin = noBackgroundSkin;
                }

                tmpTex = (Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                              GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].getConditions()
                          .getBlocksCount() > 0
                    ? conditionsTex
                    : noConditionsTex);

                GUILayout.BeginHorizontal();
                if (i == selectedAction)
                {
                    int t = Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                        GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].getType();

                    if (t == Controller.ACTION_USE_WITH || t == Controller.ACTION_GIVE_TO || t == Controller.ACTION_DRAG_TO)
                    {
                        selectedTarget =
                            EditorGUILayout.Popup(
                                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                    GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i]
                                .getTypeName(),
                                selectedTarget, joinedNamesList,
                                GUILayout.Width(windowWidth * 0.39f));
                        if (selectedTarget != selectedTargetLast)
                        {
                            ChangeActionTarget(selectedTarget);
                        }
                    }
                    else
                    {
                        GUILayout.Label(
                            Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].getTypeName(),
                            GUILayout.Width(windowWidth * 0.39f));
                    }


                    if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                    {
                        if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f)))
                        {
                            OnActionSelectionChange(i);
                        }
                    }
                    else
                    {
                        GUILayout.BeginHorizontal(GUILayout.Width(windowWidth * 0.39f));

                        Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                            GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].setNeedsGoTo(
                            GUILayout.Toggle(
                                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                    GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i]
                                .getNeedsGoTo(), ""));
                        Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                            GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].setKeepDistance(
                            EditorGUILayout.IntField(
                                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                    GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i]
                                .getKeepDistance()));

                        GUILayout.EndHorizontal();
                    }

                    if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f)))
                    {
                        ConditionEditorWindow window =
                            (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                        GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].getConditions());
                    }
                }
                else
                {
                    if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                             GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i].getTypeName(),
                                         GUILayout.Width(windowWidth * 0.39f)))
                    {
                        OnActionSelectionChange(i);
                    }


                    if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                    {
                        if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f)))
                        {
                            OnActionSelectionChange(i);
                        }
                    }
                    else
                    {
                        if (
                            GUILayout.Button(
                                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                    GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[i]
                                .getNeedsGoTo().ToString(), GUILayout.Width(windowWidth * 0.39f)))
                        {
                            OnActionSelectionChange(i);
                        }
                    }
                    if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f)))
                    {
                        OnActionSelectionChange(i);
                    }
                }
                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                addMenu.menu.ShowAsContext();
            }
            if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                    GameRources.GetInstance().selectedItemIndex].getActionsList()
                .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                      GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[selectedAction]);
            }
            //if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth)))
            //{
            //    Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
            //      GameRources.GetInstance().selectedItemIndex].getActionsList().moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
            //          GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[selectedAction]);
            //}
            //if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth)))
            //{
            //    Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
            //      GameRources.GetInstance().selectedItemIndex].getActionsList().moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
            //          GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[selectedAction]);
            //}
            if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                    GameRources.GetInstance().selectedItemIndex].getActionsList()
                .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                   GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[selectedAction], false);
                if (selectedAction >= 0)
                {
                    selectedAction--;
                }
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();

            GUILayout.BeginArea(descriptionRect);
            GUILayout.Label(TC.get("Action.Documentation"));
            GUILayout.Space(20);
            documentation = GUILayout.TextArea(documentation);
            if (!documentation.Equals(documentationLast))
            {
                OnDocumentationChanged(documentation);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(effectsRect);
            if (selectedAction < 0)
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button(TC.get("Element.Effects")))
            {
                EffectEditorWindow window =
                    (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                window.Init(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                GameRources.GetInstance().selectedItemIndex].getActionsList().getActions()[selectedAction].getEffects());
            }
            GUI.enabled = true;
            GUILayout.EndArea();
        }
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            selectorRect       = new Rect(0f, 0.2f * windowHeight, 0.9f * windowWidth, 0.2f * windowHeight);
            goesToNewSceneRect = new Rect(0.2f * windowWidth, 0.35f * windowHeight, 0.6f * windowWidth, 0.35f * windowHeight);

            GUILayout.Label(TC.get("Cutscene.CutsceneEndReached"));
            GUILayout.Space(20);

            GUILayout.BeginArea(selectorRect);
            selectedOption = GUILayout.SelectionGrid(selectedOption, possibleOptions, 3, GUILayout.Width(0.9f * windowWidth));
            if (selectedOption != selectedOptionLast)
            {
                ChangeSelectedOption(selectedOption);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(goesToNewSceneRect);
            if (selectedOption == 2)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(TC.get("NextScene.Title"));

                selectedSceneNext = EditorGUILayout.Popup(selectedSceneNext, joinedNextScenesList);
                if (selectedSceneNext != selectedSceneNextLast)
                {
                    ChangeSelectedNextScene(selectedSceneNext);
                }

                if (GUILayout.Button(TC.get("GeneralText.EditEffects")))
                {
                    EffectEditorWindow window =
                        (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                    window.Init(Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                                    GameRources.GetInstance().selectedCutsceneIndex].getEffects());
                }
                GUILayout.EndHorizontal();


                GUILayout.BeginHorizontal();
                GUILayout.Label(TC.get("NextScene.Transition"));

                selectedTransitionType = EditorGUILayout.Popup(selectedTransitionType, transitionTypes);
                if (selectedTransitionType != selectedTransitionTypeLast)
                {
                    ChangeSelectedTransitionType(selectedTransitionType);
                }

                GUILayout.Label(TC.get("NextScene.TransitionTime"));
                timeString = GUILayout.TextField(timeString, 3);
                timeString = Regex.Replace(timeString, @"[^0-9 ]", "");
                if (!timeString.Equals(timeStringLast))
                {
                    ChangeSelectedTransitionTime(timeString);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndArea();
        }
Exemple #16
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            tableRect       = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, windowHeight * 0.33f);
            rightPanelRect  = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.33f * windowHeight);
            infoPreviewRect = new Rect(0f, 0.45f * windowHeight, windowWidth, windowHeight * 0.05f);
            previewRect     = new Rect(0f, 0.5f * windowHeight, windowWidth, windowHeight * 0.45f);

            GUILayout.BeginArea(tableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("ExitsList.NextScene"), GUILayout.Width(windowWidth * 0.24f));
            GUILayout.Box(TC.get("ExitsList.Transition"), GUILayout.Width(windowWidth * 0.14f));
            GUILayout.Box(TC.get("ExitsList.Appearance"), GUILayout.Width(windowWidth * 0.34f));
            GUILayout.Box(TC.get("ExitsList.ConditionsAndEffects"), GUILayout.Width(windowWidth * 0.14f));
            GUILayout.EndHorizontal();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                     GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList().Count;
                 i++)
            {
                if (i == selectedExit)
                {
                    GUI.skin = selectedAreaSkin;
                }
                else
                {
                    GUI.skin = noBackgroundSkin;
                }

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                         GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getNextSceneId(),
                                     GUILayout.Width(windowWidth * 0.24f)))
                {
                    ChangeExitSelection(i);
                }

                // When is selected - show transition menu
                if (selectedExit == i)
                {
                    GUILayout.BeginVertical();
                    selectedTransitionType = EditorGUILayout.Popup(selectedTransitionType, transitionTypes,
                                                                   GUILayout.Width(windowWidth * 0.12f), GUILayout.MaxWidth(windowWidth * 0.12f));
                    if (selectedTransitionType != selectedTransitionTypeLast)
                    {
                        ChangeSelectedTransitionType(selectedTransitionType);
                    }
                    transitionTimeString = GUILayout.TextField(transitionTimeString, 3, GUILayout.Width(windowWidth * 0.12f),
                                                               GUILayout.MaxWidth(windowWidth * 0.12f));
                    transitionTimeString = Regex.Replace(transitionTimeString, @"[^0-9 ]", "");
                    if (!transitionTimeString.Equals(transitionTimeStringLast))
                    {
                        ChangeSelectedTransitionTime(transitionTimeString);
                    }
                    GUILayout.EndVertical();
                }
                // When is not selected - show normal text
                else
                {
                    if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.Width(windowWidth * 0.14f)))
                    {
                        ChangeExitSelection(i);
                    }
                }

                if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.Width(windowWidth * 0.34f)))
                {
                    ChangeExitSelection(i);
                    ExitsAppearance window =
                        (ExitsAppearance)ScriptableObject.CreateInstance(typeof(ExitsAppearance));
                    window.Init(this, "", selectedExit);
                }
                if (selectedExit == i)
                {
                    GUILayout.BeginVertical();
                    if (GUILayout.Button(TC.get("Exit.EditConditions"), GUILayout.Width(windowWidth * 0.14f)))
                    {
                        ConditionEditorWindow window =
                            (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getConditions());
                    }
                    if (GUILayout.Button(TC.get("GeneralText.EditEffects"), GUILayout.Width(windowWidth * 0.14f)))
                    {
                        EffectEditorWindow window =
                            (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                        window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getEffects());
                    }
                    if (GUILayout.Button(TC.get("Exit.EditPostEffects"), GUILayout.Width(windowWidth * 0.14f)))
                    {
                        EffectEditorWindow window =
                            (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                        window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getPostEffects());
                    }
                    if (GUILayout.Button(TC.get("Exit.EditNotEffects"), GUILayout.Width(windowWidth * 0.14f)))
                    {
                        EffectEditorWindow window =
                            (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                        window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getExitsList().getExitsList()[i].getNotEffects());
                    }
                    GUILayout.EndVertical();
                }
                else
                {
                    if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.Width(windowWidth * 0.14f)))
                    {
                        ChangeExitSelection(i);
                    }
                }

                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();



            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                ExitNewLinkTo window =
                    (ExitNewLinkTo)ScriptableObject.CreateInstance(typeof(ExitNewLinkTo));
                window.Init(this);
            }
            if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getExitsList()
                .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                      GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit]);
            }
            if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getExitsList()
                .moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                   GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit]);
            }
            if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getExitsList()
                .moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                     GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit]);
            }
            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getExitsList()
                .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                   GameRources.GetInstance().selectedSceneIndex].getExitsList().getExits()[selectedExit], false);
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();


            if (backgroundPath != "")
            {
                GUILayout.BeginArea(infoPreviewRect);
                // Show preview dialog
                if (GUILayout.Button(TC.get("DefaultClickAction.ShowDetails") + "/" + TC.get("GeneralText.Edit")))
                {
                    ExitsEditor window =
                        (ExitsEditor)ScriptableObject.CreateInstance(typeof(ExitsEditor));
                    window.Init(this, Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex], selectedExit);
                }
                GUILayout.EndArea();
                GUI.DrawTexture(previewRect, backgroundPreviewTex, ScaleMode.ScaleToFit);
            }
            else
            {
                GUILayout.BeginArea(infoPreviewRect);
                GUILayout.Button("No background!");
                GUILayout.EndArea();
            }
        }
        void nodeWindow(int id)
        {
            AbstractEffect myEffect = this.effects.getEffects()[id];

            EffectEditor editor = null;

            editors.TryGetValue(myEffect, out editor);

            if (editor != null && editor.Collapsed)
            {
                if (GUILayout.Button(TC.get("GeneralText.Open")))
                {
                    editor.Collapsed = false;
                }
            }
            else
            {
                string[] editorNames = EffectEditorFactory.Intance.CurrentEffectEditors;

                GUILayout.BeginHorizontal();
                int preEditorSelected = EffectEditorFactory.Intance.EffectEditorIndex(myEffect);
                int editorSelected    = EditorGUILayout.Popup(preEditorSelected, editorNames);

                if (GUILayout.Button("-", collapseStyle, GUILayout.Width(15), GUILayout.Height(15)))
                {
                    editor.Collapsed = true;
                }
                if (GUILayout.Button("X", closeStyle, GUILayout.Width(15), GUILayout.Height(15)))
                {
                    effects.getEffects().Remove(myEffect);
                    return;
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginVertical(conditionStyle);
                GUILayout.Label("CONDITIONS");
                if (GUILayout.Button("Add Block"))
                {
                    myEffect.getConditions().add(new FlagCondition(""));
                }

                if (editor == null || preEditorSelected != editorSelected)
                {
                    editor = EffectEditorFactory.Intance.createEffectEditorFor(editorNames[editorSelected]);

                    if (editors.ContainsKey(myEffect))
                    {
                        editor.Window = editors[myEffect].Window;
                        editors.Remove(myEffect);
                    }
                    else
                    {
                        editor.Window = tmpRects[myEffect];
                    }

                    editors.Add(editor.Effect, editor);
                    editor.Effect.setConditions(myEffect.getConditions());
                }

                //##################################################################################
                //############################### CONDITION HANDLING ###############################
                //##################################################################################

                var toRemove      = new List <Condition>();
                var listsToRemove = new List <List <Condition> >();
                var conditions    = editor.Effect.getConditions();
                ConditionEditorWindow.LayoutConditionEditor(conditions);

                //##################################################################################


                GUILayout.EndVertical();

                editor.draw();

                this.effects.getEffects()[id] = editor.Effect;

                if (Event.current.type != EventType.layout)
                {
                    Rect lastRect = GUILayoutUtility.GetLastRect();
                    Rect myRect   = editor.Window;
                    myRect.height = lastRect.y + lastRect.height;
                    editor.Window = myRect;
                    this.Repaint();
                }
            }

            GUI.DragWindow();
        }
Exemple #18
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            tableRect            = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, windowHeight * 0.33f);
            rightPanelRect       = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.33f * windowHeight);
            infoPreviewRect      = new Rect(0f, 0.65f * windowHeight, windowWidth, windowHeight * 0.05f);
            previewRect          = new Rect(0f, 0.7f * windowHeight, windowWidth, windowHeight * 0.25f);
            actionRect           = new Rect(0f, 0.45f * windowHeight, 0.9f * windowWidth, windowHeight * 0.2f);
            actionRightPanelRect = new Rect(0.9f * windowWidth, 0.45f * windowHeight, 0.1f * windowWidth, windowHeight * 0.2f);

            GUILayout.BeginArea(tableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("ActiveAreasList.Id"), GUILayout.Width(windowWidth * 0.54f));
            GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.14f));
            GUILayout.Box(TC.get("ActiveAreasList.Documentation"), GUILayout.Width(windowWidth * 0.18f));
            GUILayout.EndHorizontal();
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                     GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList().Count;
                 i++)
            {
                if (i == selectedArea)
                {
                    GUI.skin = selectedAreaSkin;
                }

                GUILayout.BeginHorizontal();

                if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                         GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i].getId(),
                                     GUILayout.Width(windowWidth * 0.54f)))
                {
                    OnSelectionChanged(i);
                }

                if (GUILayout.Button(conditionTex, GUILayout.Width(windowWidth * 0.14f)))
                {
                    OnSelectionChanged(i);

                    ConditionEditorWindow window =
                        (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                    window.Init(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i]
                                .getConditions());
                }
                if (GUILayout.Button(TC.get("GeneralText.EditDocumentation"), GUILayout.Width(windowWidth * 0.18f)))
                {
                    OnSelectionChanged(i);
                }

                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();



            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                ActiveAreaNewName window =
                    (ActiveAreaNewName)ScriptableObject.CreateInstance(typeof(ActiveAreaNewName));
                window.Init(this, "IdObject");
            }
            if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList()
                .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                      GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]);
            }
            if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList()
                .moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                   GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]);
            }
            if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList()
                .moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                     GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]);
            }
            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList()
                .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                   GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea],
                               false);
                if (selectedArea >= 0)
                {
                    selectedArea--;
                }
                if (selectedAction >= 0)
                {
                    selectedAction--;
                }
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();

            /**
             * ACTION EDITOR
             */
            GUILayout.BeginArea(actionRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("Element.Action"), GUILayout.Width(windowWidth * 0.39f));
            GUILayout.Box(TC.get("ActionsList.NeedsGoTo"), GUILayout.Width(windowWidth * 0.39f));
            GUILayout.Box(TC.get("Element.Effects") + "/" + TC.get("SmallAction.Conditions"), GUILayout.Width(windowWidth * 0.1f));
            GUILayout.EndHorizontal();
            scrollPositionAction = GUILayout.BeginScrollView(scrollPositionAction, GUILayout.ExpandWidth(false));
            if (selectedArea >= 0)
            {
                // Action table
                for (int i = 0;
                     i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                         GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]
                     .getActionsList().getActions().Count;
                     i++)
                {
                    if (i == selectedAction)
                    {
                        GUI.skin = selectedAreaSkin;
                    }
                    else
                    {
                        GUI.skin = noBackgroundSkin;
                    }

                    GUILayout.BeginHorizontal();
                    if (i == selectedAction)
                    {
                        GUILayout.Label(
                            Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                selectedArea
                            ].getActionsList().getActions()[i].getTypeName(),
                            GUILayout.Width(windowWidth * 0.39f));
                        if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                        {
                            if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f)))
                            {
                                selectedAction = i;
                            }
                        }
                        else
                        {
                            GUILayout.BeginHorizontal(GUILayout.Width(windowWidth * 0.39f));
                            Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                selectedArea].getActionsList().getActions()[i].setNeedsGoTo(
                                GUILayout.Toggle(
                                    Controller.getInstance()
                                    .getSelectedChapterDataControl()
                                    .getScenesList()
                                    .getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getActiveAreasList()
                                    .getActiveAreas()[selectedArea].getActionsList().getActions()[i]
                                    .getNeedsGoTo(), ""));
                            Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                selectedArea].getActionsList().getActions()[i].setKeepDistance(
                                EditorGUILayout.IntField(
                                    Controller.getInstance()
                                    .getSelectedChapterDataControl()
                                    .getScenesList()
                                    .getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getActiveAreasList()
                                    .getActiveAreas()[selectedArea].getActionsList().getActions()[i]
                                    .getKeepDistance()));

                            GUILayout.EndHorizontal();
                        }


                        GUILayout.BeginVertical();
                        if (GUILayout.Button(TC.get("ActiveAreasList.Conditions"), GUILayout.Width(windowWidth * 0.1f)))
                        {
                            ConditionEditorWindow window =
                                (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                            window.Init(
                                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                    selectedArea
                                ].getActionsList().getActions()[i].getConditions());
                        }
                        if (GUILayout.Button(TC.get("Element.Effects"), GUILayout.Width(windowWidth * 0.1f)))
                        {
                            EffectEditorWindow window =
                                (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                            window.Init(
                                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                    selectedArea
                                ].getActionsList().getActions()[i].getEffects());
                        }
                        if (GUILayout.Button(TC.get("SmallAction.EditNotEffects"), GUILayout.Width(windowWidth * 0.1f)))
                        {
                            EffectEditorWindow window =
                                (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                            window.Init(
                                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                    selectedArea
                                ].getActionsList().getActions()[i].getNotEffectsController());
                        }
                        GUILayout.EndVertical();
                    }
                    else
                    {
                        if (
                            GUILayout.Button(
                                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                    selectedArea].getActionsList().getActions()[i].getTypeName(),
                                GUILayout.Width(windowWidth * 0.39f)))
                        {
                            selectedAction = i;
                        }

                        if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                        {
                            if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f)))
                            {
                                selectedAction = i;
                            }
                        }
                        else
                        {
                            if (
                                GUILayout.Button(
                                    Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                        GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[
                                        selectedArea].getActionsList().getActions()[i].getNeedsGoTo().ToString(),
                                    GUILayout.Width(windowWidth * 0.39f)))
                            {
                                selectedAction = i;
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUI.skin = defaultSkin;
                }
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();

            /*
             * Right action panel
             */
            GUILayout.BeginArea(actionRightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                addMenu.menu.ShowAsContext();
            }
            if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]
                .getActionsList()
                .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                      GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]
                                  .getActionsList().getActions()[selectedAction]);
            }
            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]
                .getActionsList()
                .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                   GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreas()[selectedArea]
                               .getActionsList().getActions()[selectedAction], false);
                if (selectedAction >= 0)
                {
                    selectedAction--;
                }
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();



            if (backgroundPath != "")
            {
                GUILayout.BeginArea(infoPreviewRect);
                // Show preview dialog
                if (GUILayout.Button(TC.get("DefaultClickAction.ShowDetails") + "/" + TC.get("GeneralText.Edit")))
                {
                    ActiveAreasEditor window =
                        (ActiveAreasEditor)ScriptableObject.CreateInstance(typeof(ActiveAreasEditor));
                    window.Init(this, Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex], selectedArea);
                }
                GUILayout.EndArea();
                GUI.DrawTexture(previewRect, backgroundPreviewTex, ScaleMode.ScaleToFit);
            }
            else
            {
                GUILayout.BeginArea(infoPreviewRect);
                GUILayout.Button("No background!");
                GUILayout.EndArea();
            }
        }