//设置公式一升段素材 void SetFormulaOneMaterial(GradeUpRequireInfo info, CSItem card) { SetCostMoney(info.Formula1_Cost);//设置公式一升段所需金钱 //设置素材卡牌头像 与 段位升级卡头像相同 UICardHead tempCardHead = UICardHead.Create(); m_materialList.Add(tempCardHead);//加入到素材列表 tempCardHead.SetParent(m_materialSpritList[0].transform); tempCardHead.SetLocalPosition(Vector3.zero); //获得公式一卡牌 CSItem materialCard = User.Singleton.ItemBag.GetCardBuyIdCardDivisionFormula(card); CardDivisionUpdateProp.Singleton.AddMaterialCard(materialCard); if (null == materialCard) //如果背包里只有一张升段卡牌或者没有所需卡牌时 { tempCardHead.SetCardMask(true); //素材显示黑色遮罩 //升段确定按钮不可点击 m_buttonOk.isEnabled = false; //如果背包里面没有这张卡则创建一张只带有ID的卡牌从表里读取信息 CSItem tempCard = new CSItem(); tempCard.m_id = card.m_id; tempCardHead.SetCardInfo(tempCard); } else { m_materialSpritList[0].GetComponent <Parma>().m_type = 1; //如果表里有这张卡 则显示素材卡信息 tempCardHead.SetCardInfo(materialCard); } tempCardHead.RegisterCallBack(null, PressCardHead); tempCardHead.ShowCard(); tempCardHead.SetCardInfoShow(false); tempCardHead.SetCardLoveShow(false); }
//更新选择的素材卡牌的List void UpdateMaterial() { foreach (KeyValuePair <int, CSItem> item in CardDivisionUpdateProp.Singleton.m_chooseCardList) { UISprite tempSprite = m_materialSpritList[item.Key]; if (null != tempSprite) { //移除以前的素材卡牌头像 Transform cardHead = tempSprite.transform.Find("UICardHead"); if (null != cardHead) { GameObject.Destroy(cardHead.gameObject); } //添加新素材卡牌头像 UICardHead tempCardHead = UICardHead.Create(); tempCardHead.m_materialId = item.Key; m_materialList.Add(tempCardHead);//加入到素材列表 tempCardHead.SetParent(tempSprite.transform); tempCardHead.SetLocalPosition(Vector3.zero); tempCardHead.SetCardInfo(item.Value); tempCardHead.RegisterCallBack(OnClickCardHeadChooseMaterial, PressCardHead); tempCardHead.ShowCard(); tempCardHead.SetCardInfoShow(false); tempCardHead.SetCardLoveShow(false); tempSprite.GetComponent <Parma>().m_type = 1; } } }
void UpdateInfo() { //设置卡牌晋级前卡牌头像 if (null == m_cardBeforHead) { m_cardBeforHead = UICardHead.Create(); m_cardBeforHead.SetParent(m_cardBefor); m_cardBeforHead.SetLocalPosition(Vector3.zero); } CSItem card = CardBag.Singleton.GetCardByGuid(CardEvolution.Singleton.m_curEvolutionGuid); if (null == card) { Debug.Log("UICardEvolution card == null card:" + CardEvolution.Singleton.m_curEvolutionGuid); return; } HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == info) { Debug.Log("UICardEvolution HeroInfo == null card.m_id:" + card.IDInTable); return; } m_cardBeforHead.SetCardInfo(card); m_cardBeforHead.RegisterCallBack(null, PressCardHead); m_cardBeforHead.ShowCard(); m_cardBeforHead.SetCardInfoShow(false); m_cardBeforHead.SetCardLoveShow(false); //设置卡牌晋级后卡牌头像 if (null == m_cardAfterHead) { m_cardAfterHead = UICardHead.Create(); m_cardAfterHead.SetParent(m_cardAfter); m_cardAfterHead.SetLocalPosition(Vector3.zero); } CSItem tempCard = new CSItem(); tempCard.m_id = (short)info.EvolveChangeID; m_cardAfterHead.SetCardInfo(tempCard); m_cardAfterHead.RegisterCallBack(null, PressCardHead); m_cardAfterHead.ShowCard(); m_cardAfterHead.SetCardInfoShow(false); m_cardAfterHead.SetCardLoveShow(false); int costMoneny = info.EvolveNeedLevel * info.Rarity; //设置素材卡牌 SetMaterial(card); //设置金钱数量 SetCostMoney(costMoneny); //设置属性面板显示 SetCardPropPanel(card); //设置卡牌的3D模型 SetCard3DHead(card); //检查素材是否齐全 CheckMaterialEnough(card); }
// IEnumerator CoroutinePrizeCard() { yield return(new WaitForSeconds(0)); // BattleArena.Singleton.DropCardsIdList.Add(2); // BattleArena.Singleton.DropCardsIdList.Add(4); // BattleArena.Singleton.DropCardsIdList.Add(5); // BattleArena.Singleton.DropCardsIdList.Add(5); // // BattleSummary.Singleton.SummaryGetNewCard(2); // BattleSummary.Singleton.SummaryGetNewCard(4); // BattleSummary.Singleton.SummaryGetNewCard(5); // BattleSummary.Singleton.SummaryGetNewCard(5); foreach (int cardId in BattleArena.Singleton.DropCardsIdList) { GameObject item = GameObject.Instantiate(m_prizeCard) as GameObject; item.transform.parent = m_cardGrid.transform; item.transform.localPosition = Vector3.zero; item.transform.localScale = Vector3.one; int id = cardId; // 容错卡牌ID if (GameTable.HeroInfoTableAsset.Lookup(id) == null) { id = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enDefaultCardId).IntTypeValue; } bool bNew = BattleSummary.Singleton.IsNewCard(id); // 如果是新的 item.transform.Find("New").gameObject.SetActive(bNew); Debug.Log(bNew); UICardHead tempHead = UICardHead.Create(); tempHead.SetParent(item.transform); tempHead.SetLocalPosition(Vector3.zero); tempHead.RegisterCallBack(PressCardHead, null); CSItem tempCard = new CSItem(); tempCard.m_id = (short)id; tempCard.Level = 1; tempHead.SetCardInfo(tempCard); tempHead.SetCardLoveShow(false); tempHead.SetCardInfoShow(false); tempHead.SetCardNew(bNew); tempHead.HideWindow(); item.SetActive(false); m_prizeCardList.Add(item, tempHead); m_prizeCardDataList.Add(item, tempHead); } m_cardGrid.GetComponent <UIGrid>().Reposition(); // 先显示 foreach (KeyValuePair <GameObject, UICardHead> item in m_prizeCardList) { item.Key.SetActive(true); // 如果快速 if (BattleSummary.Singleton.m_fastPrizeCard) { yield return(new WaitForSeconds(0f)); } else { yield return(new WaitForSeconds(0.5f)); } } // 再一个一个播动画 MainGame.Singleton.StartCoroutine(CoroutinePlayAnmiationPrizeCard()); }
//更新段位升级界面上所有信息 void UpdateInfo() { //设置段位升级前卡牌头像 if (null == m_cardBeforHead) { m_cardBeforHead = UICardHead.Create(); m_cardBeforHead.SetParent(m_cardBefor); m_cardBeforHead.SetLocalPosition(Vector3.zero); } CSItem card = CardBag.Singleton.GetCardByGuid(CardDivisionUpdateProp.Singleton.m_curDivisionCardGuid); if (null == card) { return; } m_cardBeforHead.SetCardInfo(card); m_cardBeforHead.RegisterCallBack(null, PressCardHead); m_cardBeforHead.ShowCard(); m_cardBeforHead.SetCardInfoShow(false); m_cardBeforHead.SetCardLoveShow(false); //设置段位升级后卡牌头像 if (null == m_cardAfterHead) { m_cardAfterHead = UICardHead.Create(); m_cardAfterHead.SetParent(m_cardAfter); m_cardAfterHead.SetLocalPosition(Vector3.zero); } m_cardAfterHead.SetCardInfo(card); m_cardAfterHead.RegisterCallBack(null, PressCardHead); m_cardAfterHead.ShowCard(); m_cardAfterHead.SetCardInfoShow(false); m_cardAfterHead.SetCardLoveShow(false); //设置素材卡牌 GradeUpRequireInfo gradeInfo = GameTable.gradeUpRequireAsset.Lookup(card.m_id); if (null == gradeInfo) { return; } int curtFormula = CardDivisionUpdateProp.Singleton.m_curtFormula; //根据当前选择公式 显示素材卡牌 switch (curtFormula) { case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaOne: SetFormulaOneMaterial(gradeInfo, card); break; case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaTwo: SetFormulaMaterial(gradeInfo, card, curtFormula); break; case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaThree: SetFormulaMaterial(gradeInfo, card, curtFormula); break; case (int)CardDivisionUpdateProp.CardDivisionFormula.FormulaFour: SetFormulaMaterial(gradeInfo, card, curtFormula); break; default: break; } //设置属性面板显示 SetCardPropPanel(card); //设置公式按钮 SetFormulaButton(gradeInfo); //设置3D动态头像 SetCard3DHead(card); //检查素材是否齐全 CheckMaterialEnough(gradeInfo); }