Ejemplo n.º 1
0
        private void LoadLevelAsyncCompleted(AsyncOperation obj)
        {
            _grid = FindObjectOfType <BulbGrid>();
            if (_grid)
            {
                var currentChapterIndex = ApplicationController.Instance.ChapterController.CurrentChapterIndex;

                try
                {
                    var levelData = ApplicationController.Instance.DataController.GetLevelDataForIngameLevel(currentChapterIndex, CurrentLevelIndex);

                    if (GameState.CurrentState == GameStates.Game)
                    {
                        BulbEvents.StartTimer();

                        var analytics         = ApplicationController.Instance.AnalyticsController;
                        var chapterIndexParam = new KeyValuePair <string, object>(BulbEvents.ChapterIndexParam, currentChapterIndex);
                        var levelIndexParam   = new KeyValuePair <string, object>(BulbEvents.LevelIndexParam, CurrentLevelIndex);
                        analytics.LogCustomEvent(BulbEvents.Category_UserEvents, BulbEvents.Action_Level, BulbEvents.LevelStarted, chapterIndexParam, levelIndexParam);
                    }

                    StartCoroutine(LoadLevel(CurrentLevelIndex.ToString(), levelData));
                }
                catch (Exception e)
                {
                    Debug.LogWarningFormat("{0} | Error while loading level: {1}", this, e.Message);
                }
            }
            else
            {
                Debug.LogError("No grid found in game scene!");
            }
        }
Ejemplo n.º 2
0
        private void Start()
        {
            GetComponent <Button>().onClick.AddListener(() =>
            {
                var levelController = ApplicationController.Instance.LevelController;

                var analytics           = ApplicationController.Instance.AnalyticsController;
                var chapterIndexParam   = new KeyValuePair <string, object>(BulbEvents.ChapterIndexParam, ApplicationController.Instance.ChapterController.CurrentChapterIndex);
                var levelIndexParam     = new KeyValuePair <string, object>(BulbEvents.LevelIndexParam, levelController.CurrentLevelIndex);
                var levelCompletionTime = new KeyValuePair <string, object>(BulbEvents.LevelPlayTime, BulbEvents.FinishTimer().ToString());
                var result = analytics.LogCustomEvent(BulbEvents.Category_UserEvents, BulbEvents.Action_Level, BulbEvents.LevelQuit, chapterIndexParam, levelIndexParam, levelCompletionTime);

                if (result)
                {
                    levelController.GoToChapterMain();
                }
            });
        }