//设置公式一升段素材
    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);
    }
Exemple #2
0
 //清空素材列表
 void ResetMaterialList()
 {
     foreach (UICardHead item in m_materialList)
     {
         item.Destroy();
     }
     m_materialList.Clear();
     if (null != m_cardBeforHead)
     {
         m_cardBeforHead.Destroy();
         m_cardBeforHead = null;
     }
     if (null != m_cardAfterHead)
     {
         m_cardAfterHead.Destroy();
         m_cardAfterHead = null;
     }
     foreach (var item in m_modelDataList)
     {
         UIManager.Singleton.HideModel(item.m_obj as GameObject);
     }
     m_modelDataList.Clear();
     foreach (UISprite item in m_materialSpritList)
     {
         Transform labelTransform = item.transform.Find("MateriaLabel");
         labelTransform.gameObject.SetActive(false);
         Transform      texure    = item.transform.Find("Sprite");
         WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enCardDivisionNullMaterialIcon);
         IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(worldInfo.IntTypeValue);
         texure.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);
         Transform Startexure = item.transform.Find("Texture");
         Startexure.gameObject.SetActive(false);
         item.GetComponent <Parma>().m_type = 0;
     }
 }
 //更新选择的素材卡牌的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;
         }
     }
 }
Exemple #4
0
    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);
    }
Exemple #5
0
    //设置卡牌晋级的素材卡牌
    void SetMaterial(CSItem card)
    {
        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == info)
        {
            Debug.Log("UICardEvolution HeroInfo == null card.m_id:" + card.IDInTable);
            return;
        }

        Dictionary <int, int> evolveCardList = new Dictionary <int, int>();

        foreach (var cardID in info.EvolveCardList)
        {
            if (evolveCardList.ContainsKey(cardID))
            {
                ++evolveCardList[cardID];
            }
            else
            {
                evolveCardList.Add(cardID, 1);
            }
        }
        int spritIndex = 0;

        foreach (KeyValuePair <int, int> item in evolveCardList)
        {
            //设置添加素材卡牌头像
            UICardHead tempHead = UICardHead.Create();
            m_materialList.Add(tempHead);//加入到素材列表
            tempHead.SetParent(m_materialSpritList[spritIndex].transform);
            tempHead.SetLocalPosition(Vector3.zero);
            tempHead.RegisterCallBack(null, PressCardHead);
            CSItem tempCard = new CSItem();
            tempCard.m_id = (short)item.Key;
            tempHead.SetCardInfo(tempCard);
            tempHead.ShowCard();
            tempHead.SetCardLoveShow(false);
            //根据需要素材个数显示文字颜色
            int cardCount = User.Singleton.ItemBag.GetCardNumById(item.Key);
            tempHead.m_cardInfo.text = string.Format(Localization.Get("WithTheMaterial"), cardCount);
            if (cardCount >= item.Value)
            {
                tempHead.m_cardInfo.color = Color.green;//显示 绿色文字
            }
            else
            {
                tempHead.m_cardInfo.color = Color.red;//显示红色文字 显示 透明遮罩
                tempHead.SetCardMask(true);
            }
            spritIndex++;
        }
    }
    //添加指定卡牌素材
    void AddAppointCard(UISprite sprite, FormulaParam param, int index)
    {
        UICardHead tempHead = UICardHead.Create();

        m_materialList.Add(tempHead);//加入到素材列表
        tempHead.SetParent(sprite.transform);
        tempHead.SetLocalPosition(Vector3.zero);
        tempHead.RegisterCallBack(null, PressCardHead);
        CSItem tempCard = new CSItem();

        tempCard.m_id = (short)param.paramId;
        tempHead.SetCardInfo(tempCard);

        tempHead.ShowCard();
        tempHead.SetCardLoveShow(false);

        //获得这张ID的卡牌在背包中有多少张
        int cardCount = User.Singleton.ItemBag.GetCardNumById(param.paramId);

        tempHead.m_cardInfo.text = string.Format(Localization.Get("WithTheMaterial"), cardCount);
        int tempCardCount = cardCount;

        foreach (UICardHead item in m_materialList)
        {
            if (item != tempHead && tempHead.m_showCard.m_id == param.paramId)
            {
                tempCardCount--;
            }
            if (item == tempHead)
            {
                if (tempCardCount > 0)
                {
                    tempHead.m_cardInfo.color = Color.green;
                }
                else
                {
                    tempHead.m_cardInfo.color = Color.red;
                    tempHead.SetCardMask(true);
                }
            }
        }
    }
    //
    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());
    }
Exemple #8
0
    public bool m_bNew = false;    // 是否要显示NEW
    static public UICardHead Create()
    {
        UICardHead self = UIManager.Singleton.LoadUI <UICardHead>("UI/UICardHead", UIManager.Anchor.Center);

        return(self);
    }
    //更新段位升级界面上所有信息
    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);
    }