Пример #1
0
    public void ClaimReward()
    {
        int currentTime = this.CurrentTime();

        if (!RewardSystem.mFreezeResetTime && this.ResetTimePassed(currentTime, RewardSystem.CurrentRewardStatus.ResetTime))
        {
            this.mServerTime.RefreshServerTime();
            return;
        }
        if (this.EligibleForReward(currentTime, RewardSystem.CurrentRewardStatus.RewardTime))
        {
            RewardSystem.CurrentRewardStatus.PendingRewardLevel = RewardSystem.CurrentRewardStatus.Level;
        }
        else if (RewardSystem.CurrentRewardStatus.PendingRewardLevel < 0)
        {
            return;
        }
        DailyRewardBundle rewardBundle = this.rewards[RewardSystem.CurrentRewardStatus.PendingRewardLevel];

        this.GiveReward(rewardBundle);
        RewardSystem.CurrentRewardStatus.PendingRewardLevel = -1;
        RewardSystem.CurrentRewardStatus.Level = RewardSystem.CurrentRewardStatus.Level + 1;
        this.mNeedReset = true;
        this.mServerTime.RefreshServerTime();
    }
Пример #2
0
    private void GiveReward(DailyRewardBundle rewardBundle)
    {
        if (rewardBundle == null)
        {
            return;
        }
        List <DailyReward> list = rewardBundle.GetRewards(RewardSystem.CurrentRewardStatus.PendingRewardLevel);

        if (list == null)
        {
            return;
        }
        for (int i = 0; i < list.Count; i++)
        {
            DailyReward dailyReward      = list[i];
            string      customTypeOfGain = "Odyssey daily reward";
            switch (dailyReward.prize)
            {
            case PrizeType.SuperGlue:
                GameProgress.AddSuperGlue(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperGlueSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.SuperMagnet:
                GameProgress.AddSuperMagnet(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperMagnetSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.TurboCharge:
                GameProgress.AddTurboCharge(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.TurboChargeSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.SuperMechanic:
                GameProgress.AddBluePrints(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.BlueprintSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.NightVision:
                GameProgress.AddNightVision(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.NightVisionSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;
            }
        }
    }