private void LoadCard() { List <CardInfo> infoList = mCardMdl.GetAllCards(); state.CardDeck.Clear(); foreach (CardInfo info in infoList) { string eid = info.CardId; CardAsset ca = mCardMdl.GetCardInfo(eid); CardInZhibo card = new CardInZhibo(eid, ca.UseTime); card.ca = ca; state.CardDeck.Add(card); } List <string> platformCards = pRoleMgr.GetNowPlatformInfo().PlatformCards; for (int i = 0; i < platformCards.Count; i++) { string eid = platformCards[i]; CardAsset ca = mCardMdl.GetCardInfo(eid); CardInZhibo card = new CardInZhibo(eid, ca.UseTime); card.ca = ca; state.CardDeck.Add(card); } shuffle <CardInZhibo>(state.CardDeck); }
public string GainCard(int wantBuyIdx) { pCardMgr.GainNewCard(productList[wantBuyIdx].CardRelate); CardAsset ca = pCardMgr.GetCardInfo(productList[wantBuyIdx].CardRelate); if (ca != null) { return(ca.CardName); } return(""); }
private void ShowCards() { List <CardInfo> infos = pCardMgr.GetAllCards(); foreach (CardOutView vv in view.CardsViewList) { pResLoader.ReleaseGO("UI/Card", vv.root.gameObject); } view.CardsViewList.Clear(); preCardView = null; model.NowCardInfos = infos; foreach (CardInfo c in infos) { GameObject go = pResLoader.Instantiate("UI/Card", view.CardsContainer); CardOutView cardOutView = new CardOutView(); cardOutView.BindView(go.transform); view.CardsViewList.Add(cardOutView); cardOutView.Hint.gameObject.SetActive(false); { ClickEventListerner listener = cardOutView.CardFace.gameObject.GetComponent <ClickEventListerner>(); if (listener == null) { listener = cardOutView.CardFace.gameObject.AddComponent <ClickEventListerner>(); } listener.ClearClickEvent(); listener.OnClickEvent += delegate { ShowCardDetail(cardOutView); }; } CardAsset ca = pCardMgr.GetCardInfo(c.CardId); cardOutView.Name.text = ca.CardName; cardOutView.Desp.text = ca.CardEffectDesp; } }
private void UpdateCards(List <CardInfo> infos) { foreach (CardOutView vv in view.CardsViewList) { pResLoader.ReleaseGO("UI/CardOut", vv.root.gameObject); } view.CardsViewList.Clear(); preCardView = null; model.NowCardInfos = infos; foreach (CardInfo c in infos) { GameObject go = pResLoader.Instantiate("UI/CardOut", view.CardsContainer); CardOutView cardOutView = new CardOutView(); cardOutView.BindView(go.transform); view.CardsViewList.Add(cardOutView); cardOutView.Hint.gameObject.SetActive(false); { ClickEventListerner listener = cardOutView.CardFace.gameObject.GetComponent <ClickEventListerner>(); if (listener == null) { listener = cardOutView.CardFace.gameObject.AddComponent <ClickEventListerner>(); } listener.ClearClickEvent(); listener.OnClickEvent += delegate { ShowCardDetail(cardOutView); }; } CardAsset ca = pCardMgr.GetCardInfo(c.CardId); cardOutView.Name.text = ca.CardName; cardOutView.Desp.text = ca.CardEffectDesp; cardOutView.Cost.text = ca.cost + ""; cardOutView.NamePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardName/" + ca.CatdImageName); switch (ca.CardType) { case eCardType.GENG: cardOutView.Cover.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Geng"); cardOutView.Bg.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Geng"); cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Geng"); Color nowColor1 = Color.white; ColorUtility.TryParseHtmlString(CostColor[2], out nowColor1); //color follow the type cardOutView.Cost.color = nowColor1; break; case eCardType.ABILITY: cardOutView.Cover.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Ability"); cardOutView.Bg.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Ability"); cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Ability"); Color nowColor2 = Color.white; ColorUtility.TryParseHtmlString(CostColor[1], out nowColor2); //color follow the type cardOutView.Cost.color = nowColor2; break; case eCardType.ITEM: cardOutView.Cover.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Item"); cardOutView.Bg.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Item"); cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Item"); Color nowColor3 = Color.white; ColorUtility.TryParseHtmlString(CostColor[0], out nowColor3); //color follow the type cardOutView.Cost.color = nowColor3; break; } cardOutView.DaGou.SetActive(!c.isDisabled); if (ca.CatdImageName == null || ca.CatdImageName == string.Empty) { cardOutView.Picture.sprite = ca.Picture; } else { cardOutView.Picture.sprite = pResLoader.LoadResource <Sprite>("CardImage/" + ca.CatdImageName); } //Debug.Log(ca.Picture.name); } }