Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
 protected override void Execute()
 {
     if (TrackerAsset.Instance.Started)
     {
         trace = TrackerAsset.Instance.GameObject.Interacted(Element, GameObjectTracker.TrackedGameObject.GameObject);
         trace.SetPartial();
         Game.Instance.GameState.BeginChangeAmbit(trace);
     }
     base.Execute();
 }
Exemplo n.º 3
0
 protected override void Execute()
 {
     if (TrackerAsset.Instance.Started)
     {
         trace = TrackerExtension.Movement.Exited(Element, latLonOnExecute);
         trace.SetPartial();
         Game.Instance.GameState.BeginChangeAmbit(trace);
     }
     latLonOnExecute = LatLon;
     base.Execute();
 }
Exemplo n.º 4
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            TrackerAsset.Verb verb;
            Enum.TryParse <TrackerAsset.Verb>(TraceVerb.SelectedValue.ToString(), out verb);
            TrackerAsset.TrackerEvent trace = new TrackerAsset.TrackerEvent()
            {
                Target = new TrackerAsset.TrackerEvent.TraceObject(TraceObjectType.SelectedValue.ToString().ToLower(), TraceObjectId.Text),
                Event  = new TrackerAsset.TrackerEvent.TraceVerb(verb)
            };

            int success   = ((KeyValuePair <int, string>)TraceResultSucced.SelectedValue).Key,
                completed = ((KeyValuePair <int, string>)TraceResultCompleted.SelectedValue).Key;

            if (success != -1 || completed != -1 || TraceResultScoreSend.Checked || TraceResultResponse.Text != "")
            {
                TrackerAsset.TrackerEvent.TraceResult result = new TrackerAsset.TrackerEvent.TraceResult();
                switch (success)
                {
                case 0: result.Success = false; break;

                case 1: result.Success = true; break;

                case -1:
                default: break;
                }

                switch (completed)
                {
                case 0: result.Completion = false; break;

                case 1: result.Completion = true; break;

                case -1:
                default: break;
                }

                if (TraceResultResponse.Text != "")
                {
                    result.Response = TraceResultResponse.Text;
                }

                if (TraceResultScoreSend.Checked)
                {
                    result.Score = (float)TraceResultScore.Value;
                }

                trace.Result = result;
            }


            TrackerAsset.Instance.Trace(trace);
            UpdateTrackerAndConsole();
        }
Exemplo n.º 5
0
 protected override void Execute()
 {
     if (NavigationController.Instance)
     {
         NavigationController.Instance.SomethingReached(Holder);
     }
     if (TrackerAsset.Instance.Started)
     {
         trace = TrackerExtension.Movement.Entered(Element, latLonOnExecute);
         trace.SetPartial();
         Game.Instance.GameState.BeginChangeAmbit(trace);
     }
     latLonOnExecute = LatLon;
     base.Execute();
 }
Exemplo n.º 6
0
 private void Init()
 {
     // First run
     targetOnExit = Game.Instance.GameState.GetChapterTarget(Game.Instance.GameState.CurrentTarget);
     try
     {
         trace = toRun.ExitMb.TraceExit(exits, targetOnExit);
         trace?.SetPartial();
     }
     catch (Exception ex)
     {
         Debug.Log("Error while tracing the exit! (" + ex.Message + ", " + ex.StackTrace + ")");
     }
     Game.Instance.GameState.BeginChangeAmbit(trace);
     exitEffects = toRun.ExitMb.GetExitEffects(out exits);
 }
Exemplo n.º 7
0
        protected override void OnValueChanged(string newValue)
        {
            string oldValue = m_InputField.text;

            if (!string.Equals(m_InputField.text, newValue))
            {
                m_InputField.text = newValue;
            }
            UpdateLayout(XY);

            if (controllingChanges == -1.0f)
            {
                TrackerAsset.Instance.setVar("old_value", oldValue);
                TrackerAsset.Instance.setVar("action", "change_value");
                TrackerAsset.Instance.setVar("field_name", mField.Name.ToLower());
                TrackerAsset.Instance.setVar("field_type", mField.Type.ToLower());
                TrackerAsset.Instance.setVar("block_type", mSourceBlockView.Block.Type.ToLower());
                TrackerAsset.Instance.setVar("level", GameManager.Instance.GetCurrentLevelName().ToLower());
                trace = TrackerAsset.Instance.GameObject.Interacted(GameManager.Instance.GetBlockId(mSourceBlockView.Block));
                trace.IsPartial();
            }
            controllingChanges = Time.time;
        }
Exemplo n.º 8
0
        public void ElementInteracted(bool finished, Element element, Core.Action action)
        {
            if (element == null || !TrackerAsset.Instance.Started)
            {
                return;
            }

            if (!finished)
            {
                if (trace != null)
                {
                    Debug.LogError("An interaction has been made while another element is being interacted!!");
                }

                if (element is NPC)
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.Npc);
                }
                else if (element is Item)
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.Item);
                }
                else if (element is ActiveArea)
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.Item);
                }
                else
                {
                    trace = TrackerAsset.Instance.GameObject.Interacted(element.getId(), GameObjectTracker.TrackedGameObject.GameObject);
                }
                trace.SetPartial();
                Game.Instance.GameState.BeginChangeAmbit(trace);
                //Game.Instance.OnActionCanceled += ActionCanceled;

                UpdateElementsInteracted(element, action.getType().ToString(), element.getId());
            }
            else
            {
                string actionType = string.Empty;
                switch (action.getType())
                {
                case Core.Action.CUSTOM: actionType = (action as CustomAction).getName(); break;

                case Core.Action.CUSTOM_INTERACT: actionType = (action as CustomAction).getName(); break;

                case Core.Action.DRAG_TO: actionType = "drag_to"; break;

                case Core.Action.EXAMINE: actionType = "examine"; break;

                case Core.Action.GIVE_TO: actionType = "give_to"; break;

                case Core.Action.GRAB: actionType = "grab"; break;

                case Core.Action.TALK_TO: actionType = "talk_to"; break;

                case Core.Action.USE: actionType = "use"; break;

                case Core.Action.USE_WITH: actionType = "use_with"; break;
                }

                if (!string.IsNullOrEmpty(action.getTargetId()))
                {
                    TrackerAsset.Instance.setVar("action_target", action.getTargetId());
                }
                if (!string.IsNullOrEmpty(actionType))
                {
                    TrackerAsset.Instance.setVar("action_type", actionType);
                }

                Game.Instance.GameState.EndChangeAmbitAsExtensions(trace);
                trace.Completed();
                trace = null;
            }
        }