示例#1
0
        void Update()
        {
            if (IsGamePaused())
            {
                m_PauseDuration = Time.time - m_PauseStartingTime;
            }

            if (coinText != null)
            {
                coinText.text = MathFunction.GetCurrencyInFormat(GetInGameCurrency());
            }
        }
        public IEnumerator AwardUserForRetain()
        {
            if (!m_IsShowingAwardPanel)
            {
                float t_AmountOfAbscense = CalculateAbscenceInMinute();

                if (t_AmountOfAbscense >= rewardThreshold &&
                    IsUserAllowedToBeRewarded() &&
                    IsUserBeAwrdedForReturn())
                {
                    //Initial Delay : So Math Function Create It's Instance
                    yield return(new WaitForSeconds(0.25f));

                    m_IsShowingAwardPanel = true;
                    m_IsAwardPicked       = false;

                    long t_UpgradeCostForEngine = (long)playerSkillTree.GetUpgradeCostForNextLevel(0);
                    long t_UpgradeCostOfFuel    = (long)playerSkillTree.GetUpgradeCostForNextLevel(1);
                    long t_RewardAmount         = (long)(t_UpgradeCostForEngine * 0.75f) + System.Convert.ToInt64(Random.Range(0f, 0.25f) * Mathf.Abs(t_UpgradeCostForEngine - t_UpgradeCostOfFuel));
                    t_RewardAmount = System.Convert.ToInt64(((t_RewardAmount * 0.75f) + ((t_RewardAmount * 0.25f) * System.Convert.ToInt64(playerSkillTree.GetCurrentLevelOfSkill(3) / (float)playerSkillTree.GetMaximumLevelOfSkill(3)))) * t_AmountOfAbscense);

                    //SUPER LOCK
                    t_RewardAmount = t_RewardAmount >= 100000000 ? 100000000 : t_RewardAmount;

                    bool t_IsRewardAdReadyToBeDisplayed = false;

                    //Color t_PrimaryColor = GameThemeManager.Instance.GetPrimaryColorOfCurrentColorTheme();
                    //Color t_HighlighterColor = GameThemeManager.Instance.GetHighlighterColorColorOfCurrentColorTheme();
                    //Color t_BackgroundColor = new Color(
                    //    t_HighlighterColor.r,
                    //    t_HighlighterColor.g,
                    //    t_HighlighterColor.b,
                    //    0.4f
                    //);
                    //backgroundImageReference.color = t_BackgroundColor;

                    claimRewardButton.onClick.RemoveAllListeners();
                    claimRewardButton.onClick.AddListener(delegate {
                        Debug.Log("Claim");
                        GiveAward(t_RewardAmount);
                    });

                    claimRewardWithAdButton.onClick.RemoveAllListeners();
                    claimRewardWithAdButton.onClick.AddListener(delegate {
                        Debug.Log("Claim with Ad");
                        GiveAward(t_RewardAmount * 2);
                    });

                    WaitForSeconds t_CycleDelay = new WaitForSeconds(0.25f);

                    awardAmountText.text = t_RewardAmount.ToString();

                    holderReference.SetActive(true);
                    offlineRewardAnimator.SetTrigger("APPEAR");


                    while (!m_IsAwardPicked)
                    {
                        if (!t_IsRewardAdReadyToBeDisplayed)
                        {
                            awardAmountText.text = " " + MathFunction.GetCurrencyInFormat(t_RewardAmount) + " (" + MathFunction.GetCurrencyInFormat(t_RewardAmount * 2) + ")";

                            animatorForClaimRewardWithAd.SetTrigger("ACTIVE");
                            t_IsRewardAdReadyToBeDisplayed = true;
                        }

                        yield return(t_CycleDelay);
                    }

                    offlineRewardAnimator.SetTrigger("DISAPPEAR");
                    animatorForClaimRewardWithAd.SetTrigger("DEACTIVE");
                    yield return(new WaitForSeconds(0.25f));
                }
            }

            m_IsShowingAwardPanel = false;
            StopCoroutine(AwardUserForRetain());
        }