private void SetDefaultInfo(int index = 0) { for (int i = index; i < 3; i++)//构造无玩家时显示 { CommonRankItemData tempdata = new CommonRankItemData(); tempdata.m_Rank = i; //tempdata.m_Icon = ""; tempdata.m_Uid = 0; //tempdata.m_Frame = ""; tempdata.m_Name = EB.Localizer.GetString("ID_UR_DEFAULT_PLAYER"); tempdata.m_Parm = "0"; rankdatalist.Add(tempdata); } }
private void SetRankData() { if (this == null || this.mDMono == null) { return; } Hashtable activityData = null; DataLookupsCache.Instance.SearchDataByID("tl_acs." + activityId, out activityData); ArrayList list = EB.Dot.Array("leaderboard", activityData, null); if (rankdatalist == null) { rankdatalist = new List <CommonRankItemData>(); } else { rankdatalist.Clear(); } if (list != null) { //设置自己数据 if (list.Count > 0) { var selfdata = list[0]; if (EB.Dot.Long("id", selfdata, 0) == selfuid) { int selfrank = EB.Dot.Integer("rank", selfdata, -1); if (selfrank == -1) { selfrankStr = EB.Localizer.GetString("ID_ARENA_RANK_OUT_OF_RANGE"); } else if (selfrank > MaxRankValue) { selfrankStr = string.Format("{0}+", MaxRankValue); } else { selfrankStr = selfrank.ToString(); } selfRank.text = selfRank.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}[42fe79]{1}[-]", EB.Localizer.GetString("ID_ARENA_LOCAL_RANK"), selfrankStr); int selfscore = EB.Dot.Integer("score", selfdata, 0); selfScore.text = selfScore.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}[42fe79]{1}[-]", EB.Localizer.GetString("ID_ACTIVITY_UR_MYSCORE"), selfscore.ToString()); } } //设置他人数据 object temp; int infoid, skin, index = 0; if (list.Count > 1) { for (int i = 1; i < list.Count; i++) { temp = list[i]; if (temp == null) { continue; } CommonRankItemData tempdata = new CommonRankItemData(); tempdata.m_Rank = EB.Dot.Integer("rank", temp, 0) - 1; infoid = EB.Dot.Integer("template_id", temp, 15011) - 1; skin = EB.Dot.Integer("skin", temp, 0); tempdata.m_Icon = CharacterTemplateManager.Instance.GetHeroInfo(infoid, skin).icon; tempdata.m_Frame = EB.Dot.String("headFrame", temp, ""); tempdata.m_Name = EB.Dot.String("name", temp, "Null"); tempdata.m_Parm = EB.Dot.String("score", temp, "0"); tempdata.m_Uid = EB.Dot.Long("id", temp, 0); tempdata.m_DrawLevel = EB.Dot.String("level", temp, "1"); rankdatalist.Add(tempdata); index = i; } if (index < 3) { SetDefaultInfo(index); } } else { SetDefaultInfo(); } } else { selfrankStr = EB.Localizer.GetString("ID_ARENA_RANK_OUT_OF_RANGE"); selfRank.text = selfRank.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}[42fe79]{1}[-]", EB.Localizer.GetString("ID_ARENA_LOCAL_RANK"), selfrankStr); int selfscore = 0; selfScore.text = selfScore.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}[42fe79]{1}[-]", EB.Localizer.GetString("ID_ACTIVITY_UR_MYSCORE"), selfscore.ToString()); SetDefaultInfo(); } gridscroll.SetItemDatas(rankdatalist.ToArray()); }