private void TraceExit(bool exited, IChapterTarget targetOnExit)
        {
            var ed = area.Element as Exit;

            // ALTERNATIVE
            if ("alternative".Equals(targetOnExit.getXApiClass(), IgnoreCase))
            {
                var parsedType = (AlternativeTracker.Alternative)Enum.Parse(typeof(AlternativeTracker.Alternative), targetOnExit.getXApiType(), true);
                if (ConditionChecker.check(ed.getConditions()))
                {
                    if (targetOnExit.getXApiType() == "menu")
                    {
                        TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType);
                    }
                    else
                    {
                        TrackerAsset.Instance.setSuccess(true);
                        TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType);
                    }
                }
                else
                {
                    if (targetOnExit.getXApiType() != "menu")
                    {
                        TrackerAsset.Instance.setSuccess(false);
                        TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), "Incorrect", parsedType);
                    }
                }
                TrackerAsset.Instance.Flush();
            }

            // ACCESIBLE

            // If no exited, accesible doesnt matter
            if (!exited)
            {
                return;
            }

            // If no destination accesible doesnt matter
            var destination = Game.Instance.GameState.GetChapterTarget(ed.getNextSceneId());

            if (destination == null)
            {
                return;
            }

            if ("accesible".Equals(destination.getXApiClass(), IgnoreCase))
            {
                var type = ExParsers.ParseDefault(destination.getXApiType(), AccessibleTracker.Accessible.Accessible);
                TrackerAsset.Instance.Accessible.Accessed(destination.getId(), type);
            }
        }
        public IRunnerChapterTarget Instantiate(IChapterTarget modelObject)
        {
            GameObject form = null;

            switch (modelObject.getId())
            {
            case "Simva.Login":
                form = GameObject.Instantiate(Resources.Load <GameObject>("SimvaLogin"));
                break;

            case "Simva.Survey":
                form = GameObject.Instantiate(Resources.Load <GameObject>("SimvaSurvey"));
                break;

            case "Simva.End":
                form = GameObject.Instantiate(Resources.Load <GameObject>("SimvaEnd"));
                break;
            }

            if (form != null)
            {
                var runner = form.GetComponent <IRunnerChapterTarget>();
                runner.Data = modelObject;
                return(runner);
            }

            return(null);
        }
Exemplo n.º 3
0
        public void SwitchToLastTarget()
        {
            IChapterTarget last = GameState.PreviousChapterTarget;

            if (last != null)
            {
                RunTarget(last.getId(), 1000, TransitionType.FadeIn);
            }
        }
Exemplo n.º 4
0
        public void TargetChanged(IChapterTarget target)
        {
            if (!string.IsNullOrEmpty(target.getXApiClass()) && target.getXApiClass() == "accesible")
            {
                TrackerAsset.Instance.Accessible.Accessed(target.getId(), ExParsers.ParseEnum <AccessibleTracker.Accessible>(target.getXApiType()));
                TrackerAsset.Instance.Flush();
            }

            UpdateCompletables(completableController => completableController.UpdateMilestones(target));
        }
Exemplo n.º 5
0
        private void trackSceneChange(IChapterTarget target)
        {
            if (!string.IsNullOrEmpty(target.getXApiClass()) && target.getXApiClass() == "accesible")
            {
                TrackerAsset.Instance.Accessible.Accessed(target.getId(), ExParsers.ParseEnum <AccessibleTracker.Accessible>(target.getXApiType()));
                TrackerAsset.Instance.Flush();
            }

            CompletablesController.Instance.TargetChanged(target);
        }
Exemplo n.º 6
0
        private TrackerAsset.TrackerEvent TraceExit(bool exited, IChapterTarget targetOnExit)
        {
            if (!TrackerAsset.Instance.Started)
            {
                return(null);
            }

            var ed = area.Element as Exit;

            // ALTERNATIVE
            if ("alternative".Equals(targetOnExit.getXApiClass(), IgnoreCase))
            {
                var parsedType = (AlternativeTracker.Alternative)Enum.Parse(typeof(AlternativeTracker.Alternative), targetOnExit.getXApiType(), true);
                if (ConditionChecker.check(ed.getConditions()))
                {
                    if (targetOnExit.getXApiType() == "menu")
                    {
                        return(TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType));
                    }
                    else
                    {
                        TrackerAsset.Instance.setSuccess(true);
                        return(TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), ed.getNextSceneId(), parsedType));
                    }
                }
                else
                {
                    if (targetOnExit.getXApiType() != "menu")
                    {
                        TrackerAsset.Instance.setSuccess(false);
                        return(TrackerAsset.Instance.Alternative.Selected(targetOnExit.getId(), "Incorrect", parsedType));
                    }
                }
            }
            return(null);
        }
Exemplo n.º 7
0
        public bool Update(IChapterTarget target)
        {
            bool hasBeenUpdated = false;

            if (!Reached)
            {
                switch (GetMilestone().getType())
                {
                case Completable.Milestone.MilestoneType.SCENE:
                    var isTargetedScene = GetMilestone().getId() == target.getId();

                    if (isTargetedScene)
                    {
                        Reached        = true;
                        hasBeenUpdated = true;
                    }
                    break;

                case Completable.Milestone.MilestoneType.ENDING:
                    if (target is Cutscene || target.getId() == "EndScene")
                    {
                        if (target.getId() == "EndScene" || ((Cutscene)target).isEndScene())
                        {
                            Reached        = true;
                            hasBeenUpdated = true;
                        }
                    }
                    break;

                default:
                    break;
                }
            }

            return(hasBeenUpdated);
        }
Exemplo n.º 8
0
        public IRunnerChapterTarget RunTarget(string scene_id, int transition_time = 0, TransitionType transition_type = 0, Interactuable notifyObject = null, bool trace = true)
        {
            Debug.Log("Run target: " + scene_id);
            GUIManager.Instance.ShowHand(false);
            MenuMB.Instance.hide(true);

            IChapterTarget target = GameState.GetChapterTarget(scene_id);

            var transition = new Transition();

            transition.setTime(transition_time);
            transition.setType(transition_type);
            transitionManager.PrepareTransition(transition);

            if (runnerTarget != null && runnerTarget.Data == target && scene_id == GameState.CurrentTarget)
            {
                runnerTarget.RenderScene();
            }
            else
            {
                if (runnerTarget != null)
                {
                    runnerTarget.Destroy();
                }

                // Here we connect with the IChapterTargetFactory and create an IRunnerChapterTarget

                runnerTarget            = RunnerChapterTargetFactory.Instance.Instantiate(target);
                runnerTarget.Data       = target;
                GameState.CurrentTarget = target.getId();
            }

            if (trace && OnTargetChanged != null)
            {
                OnTargetChanged(target);
            }

            waitingRunTarget = true;
            if (notifyObject != null)
            {
                executeStack.Push(new KeyValuePair <Interactuable, ExecutionEvent>(notifyObject, null));
            }
            uAdventureRaycaster.Instance.Override = this.gameObject;

            return(runnerTarget);
        }
Exemplo n.º 9
0
        private void trackSceneChange(IChapterTarget target)
        {
            alternative = null;

            if (!string.IsNullOrEmpty(target.getXApiClass()))
            {
                if (target.getXApiClass() == "accesible")
                {
                    Tracker.T.accessible.Accessed(target.getId(), ParseEnum <AccessibleTracker.Accessible>(target.getXApiType()));
                }
                else if (target.getXApiClass() == "alternative")
                {
                    alternative = target;
                }
            }

            CompletableController.Instance.targetChanged(target);

            Tracker.T.RequestFlush();
        }
Exemplo n.º 10
0
        public IRunnerChapterTarget RunTarget(string scene_id, int transition_time = 0, int transition_type = 0)
        {
            MenuMB.Instance.hide(true);
            if (runnerTarget != null)
            {
                runnerTarget.Destroy(transition_time / 1000f);
            }

            // Here we connect with the IChapterTargetFactory and create an IRunnerChapterTarget
            IChapterTarget target = GameState.getChapterTarget(scene_id);

            runnerTarget = RunnerChapterTargetFactory.Instance.Instantiate(target);

            runnerTarget.Data = target;

            trackSceneChange(target);

            GameState.CurrentTarget = target.getId();

            return(runnerTarget);
        }
Exemplo n.º 11
0
        public bool UpdateMilestones(IChapterTarget target)
        {
            if (completed)
            {
                return(false);
            }

            if (completeOnExit && target.getId() != Start.Milestone.getId())
            {
                completed = true;
                CompletablesController.Instance.TrackCompleted(this, DateTime.Now - startTime);
            }
            else
            {
                var wasStarted = Started;
                completed = UpdateMilestones(milestone => milestone.Update(target));
                if (wasStarted != Started && Completable.getEnd() == null)
                {
                    completeOnExit = true;
                }
            }

            return(completed);
        }
        public bool UpdateMilestones(IChapterTarget target)
        {
            if (completed)
            {
                return(false);
            }

            if (completeOnExit && target.getId() != Start.GetMilestone().getId())
            {
                completed = true;
                AnalyticsExtension.Instance.TrackCompleted(this, DateTime.Now - startTime);
            }
            else
            {
                var wasStarted = Started;
                completed = UpdateMilestones(milestone => milestone.Update(target));
                if (wasStarted != Started && GetCompletable().getEnd() == null)
                {
                    completeOnExit = true;
                }
            }

            return(completed);
        }
Exemplo n.º 13
0
        public IRunnerChapterTarget RunTarget(string scene_id, int transition_time = 0, TransitionType transition_type = 0, Interactuable notifyObject = null, bool trace = true)
        {
            Debug.Log("Run target: " + scene_id);
            if (GUIManager.Instance)
            {
                GUIManager.Instance.ShowHand(false);
            }
            if (MenuMB.Instance)
            {
                MenuMB.Instance.hide(true);
            }

            IChapterTarget target = GameState.GetChapterTarget(scene_id);

            if (TransitionManager != null)
            {
                var transition = new Transition();
                transition.setTime(transition_time);
                transition.setType(transition_type);
                TransitionManager.PrepareTransition(transition);
            }

            if (runnerTarget != null && runnerTarget.Data == target && scene_id == GameState.CurrentTarget)
            {
                runnerTarget.RenderScene();
                waitingRunTarget = true;
            }
            else
            {
                waitingTargetDestroy = true;
                System.Action runTarget = () =>
                {
                    waitingTargetDestroy = false;
                    waitingRunTarget     = true;
                    if (trace)
                    {
                        GameState.CurrentTarget = target.getId();
                    }
                    runnerTarget.RenderScene();

                    if (trace && OnTargetChanged != null)
                    {
                        OnTargetChanged(target);
                    }
                };

                var oldTarget = runnerTarget;

                // Here we connect with the IChapterTargetFactory and create an IRunnerChapterTarget
                runnerTarget      = RunnerChapterTargetFactory.Instance.Instantiate(target);
                runnerTarget.Data = target;
                Debug.Log("Target gameobject: " + runnerTarget.gameObject);
                DontDestroyOnLoad(runnerTarget.gameObject);
                Debug.Log("Target creado: " + runnerTarget);

                System.Action afterChapterLoad = () =>
                {
                    if (oldTarget != null)
                    {
                        oldTarget.Destroy(0f, runTarget);
                    }
                    else
                    {
                        runTarget();
                    }
                };

                if (loadedChapter != GameState.CurrentChapter)
                {
                    LoadChapter(GameState.CurrentChapter)
                    .Then(() =>
                    {
                        loadedChapter = GameState.CurrentChapter;
                        afterChapterLoad();
                    })
                    .Catch(ex =>
                    {
                        Debug.LogError(ex);
                    });
                }
                else
                {
                    afterChapterLoad();
                }
            }

            if (notifyObject != null)
            {
                executeStack.Push(new KeyValuePair <Interactuable, ExecutionEvent>(notifyObject, null));
            }

            if (uAdventureRaycaster.Instance)
            {
                uAdventureRaycaster.Instance.Override = this.gameObject;
            }

            return(runnerTarget);
        }
Exemplo n.º 14
0
            public bool Update(IChapterTarget target)
            {
                if (!reached && type == Completable.Milestone.MilestoneType.SCENE && id == target.getId())
                {
                    reached = true;
                }

                return(reached);
            }