public static PvPRankListItem CreateItem(GameObject grid, GameObject resItem, PvPRankWindow parent, string name, PVPData.PvPRankListItemInfo data) { GameObject curItem = Utils.BindObjToParent(resItem, grid, name); if (null != curItem) { PvPRankListItem curItemComponent = curItem.GetComponent <PvPRankListItem>(); if (null != curItemComponent) { curItemComponent.SendData(parent, data); } return(curItemComponent); } return(null); }
public void SendData(PvPRankWindow parent, PVPData.PvPRankListItemInfo data) { Cleanup(); m_Parent = parent; m_data = data; if (data.pos <= 3) { if (data.pos == 1) { m_RankIcon.spriteName = "Icon-Rank01"; } else if (data.pos == 2) { m_RankIcon.spriteName = "Icon-Rank02"; } else if (data.pos == 3) { m_RankIcon.spriteName = "Icon-Rank03"; } m_RankPlayerName.text = data.name; m_RankPlayerIcon.gameObject.SetActive(true); m_RankPlayerLevel.text = data.level.ToString(); } else { m_Label1.text = data.pos.ToString(); m_Label2.text = data.name; m_Label4.text = data.level.ToString(); } m_Label5.text = data.com.ToString(); m_Label6.text = TableManager.GetPvpRankByID(data.pos, 0).Vlue.ToString(); m_RankPlayerIcon.spriteName = Utils.GetHeadPicByProfession((int)data.profession); m_proIcon.spriteName = Utils.GetProfessionIcon((int)data.profession); }
void Awake() { m_Instance = this; }