private IEnumerator ColorStepByStep()
    {
        yield return(new WaitForSeconds(0.5f));

        for (int i = 0; i < this.steps.Count; i++)
        {
            FillAlgorithm fillType = this.paintFill.FillType;
            if (fillType != FillAlgorithm.Flood)
            {
                if (fillType == FillAlgorithm.Chop)
                {
                    (this.paintFill as ChopFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
                }
            }
            else
            {
                (this.paintFill as FloodFill).FillOnCopy(this.steps[i].point, this.IdToColor(this.steps[i].colorId), this.pixels);
            }
            this.drawTex.LoadRawTextureData(this.pixels);
            this.drawTex.Apply(false);
            this.colorStepIndex = i;
            yield return(new WaitForSeconds(0.04f));
        }
        yield return(0);

        this.colorCoroutine = null;
        this.IsAnimating    = false;
        PlayTimeEventTracker.AnimWatched();
        this.OpenControls();
        yield break;
    }
    //private void OnFirebaseTokenReceived(object sender, TokenReceivedEventArgs e)
    //{
    //	FMLogger.Log("firebase token received.");
    //	if (e != null && !string.IsNullOrEmpty(e.Token))
    //	{
    //		AdjustHelper.SetUninstallToken(e.Token);
    //	}
    //	FMLogger.vCore("firebase token " + e.Token);
    //}

    private void OnApplicationPause(bool pauseStatus)
    {
        if (!pauseStatus)
        {
            this.CheckDailyBonus();
            base.StartCoroutine(this.DelayAction(0.1f, delegate
            {
                if (this.deepLinker != null)
                {
                    this.deepLinker.Check();
                }
            }));
            float delay = 1f;
            if (AppManager.__f__mg_cache1 == null)
            {
                AppManager.__f__mg_cache1 = new Action(AppState.ResetPauseState);
            }
            base.StartCoroutine(this.DelayAction(delay, AppManager.__f__mg_cache1));
        }
        else
        {
            AppState.ValidatePauseState();
        }
        if (pauseStatus)
        {
            PlayTimeEventTracker.AppPause();
            UserLifecycle.AppPause();
        }
        else
        {
            UserLifecycle.AppResume();
            PlayTimeEventTracker.AppResume();
        }
    }
Exemple #3
0
 public void PictureSolved()
 {
     Gameboard.pictureData.Solved = true;
     Gameboard.pictureData.SetCompleted();
     SharedData.Instance.UpdatePicuteData(Gameboard.pictureData);
     this.SolvedPage.SetData(this.save.Steps, this.paintFill, new Func <int, Color>(this.palette.IdToColor));
     AnalyticsManager.CompletePic(Gameboard.pictureData.Id, this.pictureSaveData.TimeSpentRoundFive(), this.paintFill.TexWidth, Gameboard.pictureData.FillType, this.pictureSaveData.hintsUsed);
     if (Gameboard.pictureData.PicClass == PicClass.Daily)
     {
         AnalyticsManager.CompleteDailyPic(Gameboard.pictureData.Id, this.pictureSaveData.TimeSpentRoundFive(), this.paintFill.TexWidth, Gameboard.pictureData.FillType, this.pictureSaveData.hintsUsed);
     }
     if (Gameboard.pictureData.PicClass == PicClass.Daily)
     {
         int num = SharedData.Instance.CalculateDailyCompletePercent();
         if (num != -1)
         {
             AnalyticsManager.UpdateUserDailyProgressProperty(num);
         }
     }
     else
     {
         int num2 = SharedData.Instance.CalculateLibCompletePercent();
         if (num2 != -1)
         {
             AnalyticsManager.UpdateUserLibProgressProperty(num2);
         }
     }
     PlayTimeEventTracker.PictureSolved();
     AnalyticsManager.LevelTrySucceed(Gameboard.pictureData.Id, this.currentGUID);
 }
 private void Start()
 {
     this.AdjustInit();
     this.FirebaseInit();
     this.CheckDailyBonus();
     try
     {
         PlayTimeEventTracker.AppResume();
     }
     catch (Exception ex)
     {
         UnityEngine.Debug.Log("PlayTimeEventTracker ex. " + ex.Message);
     }
     this.deepLinker = new DeeplinkController(base.GetComponent <FMDeepLink>());
     this.deepLinker.BonusCodeReceived += this.OnFBDeeplinkOpened;
     AppState.ContentReqTime            = DateTime.Now;
     base.StartCoroutine(this.LoadSysParameters(delegate
     {
         AdsManager.Instance.SetParams(this.adsId, this.adsLimitied);
         if (GeneralSettings.AdsDisabled)
         {
             FMLogger.vAds("casual disable ads on startup");
             AdsManager.Instance.DisableAds();
         }
         else
         {
             FMLogger.vAds("ads init");
             AdsManager.Instance.Init();
             AdsManager.Instance.StartFsInterval();
         }
         TGFModule.Instance.Init(this.adsId, this.adsLimitied, this.countryCode, this.langCode);
         ImageManager.Instance.Init();
         SharedData.Instance.Init();
         //FB.Init(null, null, null);
         AppState.LaunchTime = DateTime.Now;
         this.fairyController.StartTimer();
         this.deepLinker.Check();
         TGFModule.Instance.PrecachePages();
         try
         {
             AnalyticsManager.SetUserDeviceTypeProperty(SafeLayout.IsTablet);
         }
         catch (Exception ex2)
         {
             FMLogger.vCore("SetUserDeviceTypeProperty crash. " + ex2.Message);
         }
         float delay = 0.5f;
         if (AppManager.__f__mg_cache0 == null)
         {
             AppManager.__f__mg_cache0 = new Action(UserLifecycle.AppLaunch);
         }
         base.StartCoroutine(this.DelayAction(delay, AppManager.__f__mg_cache0));
         AppManager.inited = true;
         if (this.Loaded != null)
         {
             this.Loaded();
         }
     }));
 }
 public static void AnimWatched()
 {
     PlayTimeEventTracker.AnimWatchedCounter++;
     if (PlayTimeEventTracker.AnimWatchedCounter == 10)
     {
         PlayTimeEventTracker.SendAnimWatchCount(10);
     }
 }
Exemple #6
0
 private void OpenControls()
 {
     if (!this.isReplay)
     {
         if (GeneralSettings.IsShowRate())
         {
             this.popupManager.OpenRate();
             AnalyticsManager.RateShow();
         }
         else if (AdsManager.Instance.HasInterstitial(AdPlacement.Solved))
         {
             AdsManager.Instance.ShowInterstitial(AdPlacement.Solved);
         }
     }
     PlayTimeEventTracker.AnimWatched();
     base.StartCoroutine(this.FadeCoroutine(0f, 1f, 0.2f, 0.2f, this.mediaBtn));
     base.StartCoroutine(this.FadeCoroutine(0f, 1f, 0.2f, 0.4f, this.exitBtn));
     base.StartCoroutine(this.FadeCoroutine(1f, 0f, 0.2f, 0f, this.skipBtn));
 }
    public static void AppPause()
    {
        int num = Mathf.RoundToInt((float)(DateTime.UtcNow - PlayTimeEventTracker.launchTime).TotalSeconds);

        PlayTimeEventTracker.DailyPlayTime += num;
        int num2 = Mathf.FloorToInt((float)PlayTimeEventTracker.DailyPlayTime / 60f);

        //int num3 = Mathf.FloorToInt((float)num / 60f);
        for (int i = 0; i < PlayTimeEventTracker.playTimeSteps.Length; i++)
        {
            if (num2 <= PlayTimeEventTracker.playTimeSteps[i])
            {
                break;
            }
            if (PlayTimeEventTracker.DailyPlaySentStepIndex < i)
            {
                PlayTimeEventTracker.DailyPlaySentStepIndex = i;
                PlayTimeEventTracker.SendDailyPlayTime(PlayTimeEventTracker.playTimeSteps[i]);
            }
        }
    }
    public static void PictureSolved()
    {
        int[] array = new int[]
        {
            5,
            15,
            30,
            50,
            100
        };
        PlayTimeEventTracker.PicsSolvedCounter++;
        int num = PlayTimeEventTracker.PicsSolvedCounter;

        for (int i = 0; i < array.Length; i++)
        {
            if (num == array[i])
            {
                PlayTimeEventTracker.SendPicsSolvedCount(array[i]);
                break;
            }
        }
    }
    public static void AppResume()
    {
        int dayOfYear = DateTime.UtcNow.DayOfYear;

        if (dayOfYear != PlayTimeEventTracker.LastOpenDay)
        {
            if (dayOfYear - 1 == PlayTimeEventTracker.LastOpenDay)
            {
                PlayTimeEventTracker.CurrentOpenStreak++;
                int[] array = new int[]
                {
                    3,
                    5,
                    7,
                    14,
                    28
                };
                for (int i = 0; i < array.Length; i++)
                {
                    if (PlayTimeEventTracker.CurrentOpenStreak == array[i])
                    {
                        PlayTimeEventTracker.SendOpenStreak(array[i]);
                        break;
                    }
                }
            }
            else
            {
                PlayTimeEventTracker.CurrentOpenStreak = 1;
            }
        }
        if (dayOfYear != PlayTimeEventTracker.LastOpenDay)
        {
            PlayTimeEventTracker.DailyPlayTime          = 0;
            PlayTimeEventTracker.DailyPlaySentStepIndex = -1;
        }
        PlayTimeEventTracker.launchTime  = DateTime.UtcNow;
        PlayTimeEventTracker.LastOpenDay = dayOfYear;
    }