Example #1
0
        public void onRewardTaken(RewardTakenEvent _Event)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onRewardTaken:" + _Event.RewardId);
            string rewardId = _Event.RewardId;

            CoreEvents.OnRewardTaken(Reward.GetReward(rewardId));
        }
Example #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
        }
Example #3
0
        /// <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 onRewardTaken(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onRewardTaken:" + message);

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

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