public void OnClick() { Mailinfo info = transform.parent.parent.GetComponent <ItemInvenCard>().mCardInfo.mMailinfo; mOpenEvent = new OpenCardPackEvent(ReceivedPack); NetMgr.OpenCardPack(info.mailSeq, info.itemFK, mOpenEvent); }
public void Init(GetCardInvenEvent cardEvent, GetMailEvent mailEvent) { transform.gameObject.SetActive(true); transform.FindChild("Top").FindChild("Cards").FindChild("LblCardsV").GetComponent <UILabel>().text = cardEvent.Response.data.Count + " / " + UserMgr.LobbyInfo.userInvenOfCard; // transform.FindChild("Top").FindChild("Skills").FindChild("LblSkillsV").GetComponent<UILabel>().text // = 0+""; mCardEvent = cardEvent; mMailEvent = mailEvent; mList = cardEvent.Response.data; foreach (CardInfo cardInfo in mList) { cardInfo.mType = CardInfo.INVEN_TYPE.CARD; } for (int i = 0; i < mailEvent.Response.data.Count; i++) { Mailinfo mailInfo = mailEvent.Response.data[i]; if (mailInfo.mailType == 1) { CardInfo item = new CardInfo(); item.mType = CardInfo.INVEN_TYPE.PACK; item.mMailinfo = mailInfo; mList.Insert(0, item); } } int listCnt = mList.Count; if (UserMgr.LobbyInfo.userInvenOfCard < UserMgr.LobbyInfo.maxInvenOfCard && cardEvent.Response.data.Count > UserMgr.LobbyInfo.userInvenOfCard) { CardInfo expand = new CardInfo(); expand.mType = CardInfo.INVEN_TYPE.EXPAND; mList.Insert(UserMgr.LobbyInfo.userInvenOfCard, expand); listCnt = UserMgr.LobbyInfo.userInvenOfCard + 1; } transform.FindChild("Body").FindChild("Draggable").GetComponent <UIDraggablePanel2>().RemoveAll(); transform.FindChild("Body").FindChild("Draggable").GetComponent <UIDraggablePanel2>() .Init(listCnt, delegate(UIListItem item, int index){ InitInvenItem(item, index); }); transform.FindChild("Body").FindChild("Draggable").GetComponent <UIDraggablePanel2>().ResetPosition(); }