// private PVPRecordWindow m_parent; public static PVPRecordListItem CreateItem(GameObject grid, GameObject resItem, string name, PVPRecordWindow parent, string timeText, string nameText, string rankText, bool isSuccess) { GameObject curItem = Utils.BindObjToParent(resItem, grid, name); if (null != curItem) { PVPRecordListItem curItemComponent = curItem.GetComponent <PVPRecordListItem>(); if (null != curItemComponent) { if (isSuccess) { nameText = StrDictionary.GetClientDictionaryString("#{11017}", nameText); rankText = StrDictionary.GetClientDictionaryString("#{11019}", rankText); curItemComponent.SetData(parent, timeText, nameText, rankText, isSuccess); } else { nameText = StrDictionary.GetClientDictionaryString("#{11018}", nameText); rankText = StrDictionary.GetClientDictionaryString("#{11020}", rankText); curItemComponent.SetData(parent, timeText, nameText, rankText, isSuccess); } } return(curItemComponent); } return(null); }
void OnLoadHistoryListItem(GameObject resItem, object param) { Utils.CleanGrid(RecordListGrid); int nIndex = 0; for (int i = 0; i < PVPData.ChallengeHistory.Count; ++i) { DateTime startTime = new DateTime(1970, 1, 1); DateTime sendDate = new DateTime((long)PVPData.ChallengeHistory[i].occurTime * 10000000L + startTime.Ticks, DateTimeKind.Unspecified); sendDate = sendDate.ToLocalTime(); string strtime = sendDate.ToString("yyyy-MM-dd HH:mm:ss"); int pos = PVPData.ChallengeHistory[i].rankPos + 1; if (PVPData.ChallengeHistory[i].isActive == 0) { // string history = StrDictionary.GetClientDictionaryString("#{1227}", strtime, PVPData.ChallengeHistory[i].opponentName, pos); PVPRecordListItem.CreateItem(RecordListGrid, resItem, nIndex.ToString(), this, strtime, PVPData.ChallengeHistory[i].opponentName, pos.ToString(), true); } else { //string history = StrDictionary.GetClientDictionaryString("#{1228}", strtime, PVPData.ChallengeHistory[i].opponentName, pos); PVPRecordListItem.CreateItem(RecordListGrid, resItem, nIndex.ToString(), this, strtime, PVPData.ChallengeHistory[i].opponentName, pos.ToString(), false); } ++nIndex; } RecordListGrid.GetComponent <UIGrid>().Reposition(); RecordListGrid.GetComponent <UITopGrid>().Recenter(true); }