public void Fill(NationDonateData memberData) { if (memberData == null || memberData.Rank < 0) { EmptyNode.gameObject.SetActive(true); NoEmptyNode.gameObject.SetActive(false); BG.color = new Color(213f / 255f, 223f / 255f, 232f / 255f); } else { LTUIUtil.SetText(PlayerNameLabel, memberData.Name); LTUIUtil.SetText(PlayerLevelLabel, memberData.Level.ToString()); PortraitUISprite.spriteName = memberData.Portrait; LTUIUtil.SetText(DonateLabel, memberData.WeekDonate.ToString()); EmptyNode.gameObject.CustomSetActive(false); NoEmptyNode.gameObject.CustomSetActive(true); BG.color = (memberData.Uid == LoginManager.Instance.LocalUserId.Value)?new Color(188f / 255f, 254f / 255f, 216f / 255f) : new Color(213f / 255f, 223f / 255f, 232f / 255f); } }
void UpdateUI(Hashtable result) { ArrayList array = Hotfix_LT.EBCore.Dot.Array("rank.personal.nationDegree", result, null); List <NationDonateData> rankdatas = new List <NationDonateData>(); long localPlayerId = LoginManager.Instance.LocalUserId.Value; NationDonateData localPlayerRankData = null; for (int i = 0; i < array.Count; i++) { var data = new NationDonateData(array[i] as Hashtable); if (data.Uid == localPlayerId) { localPlayerRankData = data; } else if (data.Rank >= 0 && data.Rank < 4) { rankdatas.Add(data); } } if (localPlayerRankData != null && localPlayerRankData.Rank >= 0 && localPlayerRankData.Rank < 4) { rankdatas.Add(localPlayerRankData); } rankdatas.Sort(delegate(NationDonateData x, NationDonateData y) { return(x.Rank - y.Rank); }); while (rankdatas.Count < 4) { rankdatas.Add(null); } for (int dataIndex = 0; dataIndex < rankdatas.Count; ++dataIndex) { DonateCellArray[dataIndex].Fill(rankdatas[dataIndex]); } if (localPlayerRankData != null) { LTUIUtil.SetText(MyDonateInfo, string.Format("{0}. {1} {2}", localPlayerRankData.Rank + 1, localPlayerRankData.Name, localPlayerRankData.WeekDonate)); } else { LTUIUtil.SetText(MyDonateInfo, string.Format(EB.Localizer.GetString("ID_codefont_in_NationBattleDonateListController_2991"), BalanceResourceUtil.GetUserName())); } }