Exemple #1
0
    void CreateMainPlayerReward()
    {
        uint myRank = DataManager.Manager <ArenaManager>().Rank;

        ArenaRankRewardDatabase rewardDb = m_rewardList.Find((data) => { return(myRank >= data.rank_cap && myRank <= data.rank_floor); });

        if (rewardDb != null)
        {
            string des = string.Empty;
            if (rewardDb.rank_cap == rewardDb.rank_floor)
            {
                des = string.Format("保持当前名次(第{0}名)可获得奖励:", rewardDb.rank_cap);
            }
            else
            {
                des = string.Format("保持当前名次(第{0}名 - 第{1}名)可获得奖励:", rewardDb.rank_cap, rewardDb.rank_floor);
            }

            m_label_ArenaRewardInfoLbl.text = des;
            m_label_wenqian_label.text      = rewardDb.ticket_reward.ToString();
            m_label_jingbi_label.text       = rewardDb.gold_reward.ToString();
            m_label_gongxian_label.text     = rewardDb.score_reward.ToString();
            m_label_Exp_label.text          = rewardDb.experience_reward.ToString();
        }
        else
        {
            m_label_ArenaRewardInfoLbl.text = string.Format("您的当前排名低于第{0}名,无法获得奖励。再接再厉!", m_rewardList[m_rewardList.Count - 1].rank_floor);
            m_label_wenqian_label.text      = "0";
            m_label_jingbi_label.text       = "0";
            m_label_gongxian_label.text     = "0";
            m_label_Exp_label.text          = "0";
        }
    }
Exemple #2
0
        /// <summary>
        /// 通过[ID]二分快速查表
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns></returns>
        public static ArenaRankRewardDatabase Query(this List <ArenaRankRewardDatabase> sorted, uint id)
        {
            var key = new ArenaRankRewardDatabase()
            {
                id = id
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(ArenaRankRewardDatabase));
        }
Exemple #3
0
 /// <summary>
 /// 获取当前排行奖励
 /// </summary>
 /// <param name="rankReward"></param>
 /// <returns></returns>
 public bool TryGetRankRewardByRank(out ArenaRankRewardDatabase rankReward)
 {
     rankReward = m_lstArenaRankRewardDb.Find((data) => { return(m_rank >= data.rank_floor && m_rank <= data.rank_cap); });
     if (rankReward != null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }