Пример #1
0
        public void clicked(int option)
        {
            this.child = option;
            OptionConversationNode onode = ((OptionConversationNode)node);

            if (option == onode.getChildCount()) // Timeout
            {
                // TODO Analytics for timeout
                return;
            }

            if (TrackerAsset.Instance.Started && !string.IsNullOrEmpty(onode.getXApiQuestion()))
            {
                holder.EndTracePending();
                isTracePending = true;
                xAPISuccess    = onode.getLine(option).getXApiCorrect();
                xAPIQuestion   = onode.getXApiQuestion();
                xAPIResponse   = onode.getLine(option).getText().Replace(",", " ");
                trace          = TrackerAsset.Instance.Alternative.Selected(xAPIQuestion, xAPIResponse, AlternativeTracker.Alternative.Question);
                Game.Instance.GameState.BeginChangeAmbit(trace);
                trace.Result.Duration = Time.realtimeSinceStartup - startTime;
                trace.SetPartial();
                Game.Instance.OnActionCanceled += ActionCancelled;
            }
        }
        public void clicked(int option)
        {
            this.child = option;
            OptionConversationNode onode = ((OptionConversationNode)node);

            Tracker.T.alternative.Selected(onode.getXApiQuestion(), onode.getLine(option).getText().Replace(",", " "), onode.getLine(option).getXApiCorrect(), AlternativeTracker.Alternative.Question);
            Tracker.T.RequestFlush();
        }
Пример #3
0
        public void clicked(int option)
        {
            this.child = option;
            OptionConversationNode onode = ((OptionConversationNode)node);

            if (option == onode.getChildCount()) // Timeout
            {
                // TODO Analytics for timeout
                return;
            }

            if (!string.IsNullOrEmpty(onode.getXApiQuestion()))
            {
                isTracePending = true;
                Game.Instance.GameState.BeginChangeAmbit();
                xAPISuccess  = onode.getLine(option).getXApiCorrect();
                xAPIQuestion = onode.getXApiQuestion();
                xAPIResponse = onode.getLine(option).getText().Replace(",", " ");
            }
        }
Пример #4
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();
        }