Exemplo n.º 1
0
        public int GetRequiredXPForLevel(int in_iLevel)
        {
            LevelUpRewards reward = GetRewardAtLevel(in_iLevel);

            if (reward != null)
            {
                return(reward.Experience);
            }
            return(0);
        }
Exemplo n.º 2
0
 public void CheckForRequireLevelupDialogue()
 {
     if (m_iCachedPlayerLevel != 0 && m_iCachedPlayerLevel < GPlayerMgr.Instance.PlayerData.PlayerXPData.CurrentLevel)
     {
         LevelUpRewards currentReward = GetRewardAtLevel(GPlayerMgr.Instance.PlayerData.PlayerXPData.CurrentLevel);
         if (currentReward != null)
         {
             // TODO
         }
     }
 }
Exemplo n.º 3
0
        public LevelUpRewards GetRewardAtLevel(int in_iLevel)
        {
            LevelUpRewards rewardToReturn = null;

            for (int i = 0; i < Rewards.Count; i++)
            {
                if (Rewards[i].LevelUnlocked == in_iLevel)
                {
                    rewardToReturn = Rewards[i];
                    break;
                }
            }
            return(rewardToReturn);
        }
Exemplo n.º 4
0
        private void parseLevelPackData(Dictionary <string, object> in_levelPacks, int in_iLevel)
        {
            string key = LEVEL_PREFIX + in_iLevel.ToString();

            if (in_levelPacks.ContainsKey(key))
            {
                LevelUpRewards reward = GetRewardAtLevel(in_iLevel);
                if (reward != null)
                {
                    Dictionary <string, object> rewardValues = (Dictionary <string, object>)in_levelPacks[key];

                    /*
                     * // TODO: make this generic!
                     * reward.CurrencyRewards[BrainCloudUNETExample.GiftRewardData.AWARD_XP_BOOST] = HudHelper.GetLongValue(rewardValues, BrainCloudUNETExample.GiftRewardData.AWARD_XP_BOOST);
                     * reward.CurrencyRewards[BrainCloudUNETExample.GiftRewardData.AWARD_XP_POINTS] = HudHelper.GetLongValue(rewardValues, BrainCloudUNETExample.GiftRewardData.AWARD_XP_POINTS);
                     */
                }
            }
        }
Exemplo n.º 5
0
        private void onReadMetaDataSuccess(string in_sJsonResponse, object in_cbObject)
        {
            Dictionary <string, object> jsonMessage = (Dictionary <string, object>)JsonReader.Deserialize(in_sJsonResponse);
            Dictionary <string, object> jsonData    = (Dictionary <string, object>)jsonMessage[BrainCloudConsts.JSON_DATA];

            if (jsonData.ContainsKey(XP_LEVELS))
            {
                try
                {
                    Dictionary <string, object>[] jsonLevels = (Dictionary <string, object>[])jsonData[XP_LEVELS];

                    LevelUpRewards reward;
                    for (int i = 0; i < jsonLevels.Length; i++)
                    {
                        reward = new LevelUpRewards(jsonLevels[i]);
                        Rewards.Add(reward);
                    }
                    GCore.Wrapper.GlobalEntityService.GetListByIndexedId("playerLevelUp", 1, onGetEntitySuccess);
                }
                catch (System.Exception) { GEventManager.TriggerEvent(GEventManager.ON_PLAYER_DATA_UPDATED); }
            }
        }