Exemple #1
0
        public void CollectReward()
        {
            if (rewardType == Spil.DailyBonusRewardTypeEnum.EXTERNAL)
            {
                List <Reward> rewards = new List <Reward>();

                Reward reward = new Reward();
                reward.externalId = Spil.DailyBonusExternalId;
                reward.amount     = Spil.DailyBonusAmount;

                rewards.Add(reward);

                string rewardsJSON = JsonHelper.getJSONFromObject(rewards);

                JSONObject json = new JSONObject();
                json.AddField("data", rewardsJSON);

                SpilUnityImplementationBase.fireDailyBonusReward(json.Print(false));
            }
            else
            {
                int id     = Spil.DailyBonusId;
                int amount = Spil.DailyBonusAmount;

                if (id == 0 || amount == 0)
                {
                    SpilLogging.Error("Daily Bonus Rewards not configured for Editor!");
                }

                if (rewardType == Spil.DailyBonusRewardTypeEnum.CURRENCY)
                {
                    SpilUnityEditorImplementation.pData.WalletOperation("add", id, amount, PlayerDataUpdateReasons.DailyBonus, null, "DailyBonus", null);
                }
                else if (rewardType == Spil.DailyBonusRewardTypeEnum.ITEM)
                {
                    SpilUnityEditorImplementation.pData.InventoryOperation("add", id, amount, PlayerDataUpdateReasons.DailyBonus, null, "DailyBonus", null);
                }
            }

            Destroy(DailyBonus);
        }
 /// <summary>
 /// This method is called by the native Spil SDK, it should not be used by developers.
 /// </summary>
 public void DailyBonusReward(string receivedReward)
 {
     SpilUnityImplementationBase.fireDailyBonusReward(receivedReward);
 }