public void onRewardGiven(RewardGivenEvent _Event)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onRewardGiven:" + _Event.RewardId);
            string rewardId = _Event.RewardId;

            CoreEvents.OnRewardGiven(Reward.GetReward(rewardId));
        }
Exemple #2
0
        virtual protected void _setTimesGiven(Reward reward, bool up, bool notify)
        {
#if UNITY_EDITOR
            int total = _getTimesGiven(reward) + (up ? 1 : -1);
            if (total < 0)
            {
                total = 0;
            }

            string key = keyRewardTimesGiven(reward.ID);
            PlayerPrefs.SetString(key, total.ToString());

            if (up)
            {
                key = keyRewardLastGiven(reward.ID);
                PlayerPrefs.SetString(key, (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond).ToString());
            }

            if (notify)
            {
                if (up)
                {
                    CoreEvents.OnRewardGiven(reward);
                }
                else
                {
                    CoreEvents.OnRewardTaken(reward);
                }
            }
#endif
        }
        /// <summary>
        /// Will be called when a reward was given to the user.
        /// </summary>
        /// <param name="message">Will contain a JSON representation of a <c>Reward</c> and a flag saying if it's a Badge or not.</param>
        public void onRewardGiven(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onRewardGiven:" + message);

            JSONObject eventJSON = new JSONObject(message);
            string     rewardId  = eventJSON["rewardId"].str;

            CoreEvents.OnRewardGiven(Reward.GetReward(rewardId));
        }