예제 #1
0
    void MakeItem()
    {
        NewPlayerGuidLogic.CloseWindow();
        Tab_LivingSkill tabLivingSkill = TableManager.GetLivingSkillByID(m_CurFormulaID, 0);

        if (tabLivingSkill == null)
        {
            return;
        }

        if (Singleton <ObjManager> .Instance.MainPlayer.BaseAttr.Level < tabLivingSkill.OpenLevel)
        {
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{1900}", tabLivingSkill.OpenLevel);

            return;
        }

        bool isBind = false;
        bool isMakeShenQiMoreEquip = false;//神器打造总材料装备是否有多

        m_bIsMakeShenQi = false;
        m_bIsMakeSuit   = false;
        Tab_CommonItem _ShenQiline = TableManager.GetCommonItemByID(tabLivingSkill.StaticProductItemId, 0);

        if (_ShenQiline != null)
        {
            if (_ShenQiline.ClassID == (int)ItemClass.EQUIP && tabLivingSkill.Type == (int)FORMULA_TYPE.TYPE_SUIT)
            {
                m_bIsMakeSuit = true;
            }
            else if (_ShenQiline.ClassID == (int)ItemClass.EQUIP && _ShenQiline.ThirdClassID == (int)EquipThirdClass.SHENQI)
            {
                m_bIsMakeShenQi = true;
            }
        }
        for (int i = 0; i < tabLivingSkill.getStuffIDCount(); i++)
        {
            int nStuffID    = tabLivingSkill.GetStuffIDbyIndex(i);
            int nStuffCount = tabLivingSkill.GetStuffCountbyIndex(i);
            if (nStuffID != GlobeVar.INVALID_ID)
            {
                if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(nStuffID) < nStuffCount)
                {
                    Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{1901}");

                    return;
                }
                if (!isBind)
                {
                    if (GameManager.gameManager.PlayerDataPool.BackPack.GetBindItemCountByDataId(nStuffID) > 0)
                    {
                        isBind = true;
                        //m_bisMakeShenUseBind = true;
                    }
                }
                if (m_bIsMakeShenQi)
                {
                    Tab_CommonItem line = TableManager.GetCommonItemByID(nStuffID, 0);
                    if (line != null)
                    {
                        if (line.ClassID == (int)ItemClass.EQUIP && line.ThirdClassID == (int)EquipThirdClass.SHENQI)
                        {
                            m_bIsMakeShenQiByChuanCheng = true; //有材料是神器 则是传承 不是打造
                        }
                        if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(nStuffID) > nStuffCount)
                        {
                            if (line.ClassID == (int)ItemClass.EQUIP)
                            {
                                isMakeShenQiMoreEquip = true;
                            }
                        }
                    }
                }

                if (m_bIsMakeSuit)
                {
                    Tab_CommonItem line = TableManager.GetCommonItemByID(nStuffID, 0);
                    if (line != null)
                    {
                        if (GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(nStuffID) > nStuffCount)
                        {
                            if (line.ClassID == (int)ItemClass.EQUIP)
                            {
                                isMakeShenQiMoreEquip = true;
                            }
                        }
                    }
                }
            }
        }

        if (Singleton <ObjManager> .Instance.MainPlayer.BaseAttr.CurStamina < tabLivingSkill.Stamina)
        {
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{2139}");

            return;
        }

        if (GameManager.gameManager.PlayerDataPool.BackPack.GetCanContainerSize() <= 0)
        {
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{1903}");

            return;
        }

        if (GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin() < tabLivingSkill.Money)
        {
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{1902}");

            return;
        }
        if (m_bIsMakeShenQi || m_bIsMakeSuit)
        {
            if (isMakeShenQiMoreEquip) // 提示有多余的装备 是否确定用当前的装备打造神器
            {
                MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{5068}"), "", MakeShenQi_CurEquip_Ok);
            }
            else if (IsNeedWaringHaveLowShenQiEquip())
            {
                MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{5220}"), "", MakeItemOK, MakeItemCancel);
            }
            else
            {
                MakeItemOK();
            }
        }
        else
        {
            if (isBind)
            {
                MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{2659}"), "", MakeItemOK, MakeItemCancel);
            }
            else
            {
                MakeItemOK();
            }
        }
    }
예제 #2
0
    public void OnFormulaChoose(int nFormulaID)
    {
        Tab_LivingSkill tabLivingSkill = TableManager.GetLivingSkillByID(nFormulaID, 0);

        if (tabLivingSkill == null)
        {
            return;
        }

        Utils.CleanGrid(m_StuffGrid);
        int i = 0;

        if (tabLivingSkill.Type == (int)FORMULA_TYPE.TYPE_SHENQI ||
            tabLivingSkill.Type == (int)FORMULA_TYPE.TYPE_SHENJIE ||
            tabLivingSkill.Type == (int)FORMULA_TYPE.TYPE_SUIT)
        {
            for (; i < tabLivingSkill.getStuffIDCount(); i++)
            {
                int        nStuffID  = tabLivingSkill.GetStuffIDbyIndex(i);
                GameObject StuffItem = Utils.BindObjToParent(m_ShenQiStuffItem, m_StuffGrid, i.ToString());
                if (StuffItem != null)
                {
                    if (nStuffID != GlobeVar.INVALID_ID)
                    {
                        UInt64 itemGuid = GameManager.gameManager.PlayerDataPool.BackPack.GetItemGuidByDataID(tabLivingSkill.GetStuffIDbyIndex(i));
                        StuffItem.GetComponent <LivingSkillShenQiStuffLogic>().InitInfo(tabLivingSkill.GetStuffIDbyIndex(i), itemGuid, tabLivingSkill.GetStuffCountbyIndex(i));
                    }
                    else
                    {
                        // init empty
                    }
                }
            }
        }
        else
        {
            for (; i < tabLivingSkill.getStuffIDCount(); i++)
            {
                int        nStuffID  = tabLivingSkill.GetStuffIDbyIndex(i);
                GameObject StuffItem = Utils.BindObjToParent(m_StuffItem, m_StuffGrid, i.ToString());
                if (StuffItem != null)
                {
                    if (nStuffID != GlobeVar.INVALID_ID)
                    {
                        StuffItem.GetComponent <LivingSkillStuffLogic>().InitInfo(tabLivingSkill.GetStuffIDbyIndex(i), tabLivingSkill.GetStuffCountbyIndex(i));
                    }
                    else
                    {
                        // init empty
                        StuffItem.GetComponent <LivingSkillStuffLogic>().InitEmpty();
                    }
                }
            }
        }

        m_StuffGrid.GetComponent <UIGrid>().Reposition();
        //m_StuffGrid.GetComponent<UITopGrid>().Recenter(true);
        m_CurFormulaID = nFormulaID;

        m_PayMoneyLabel.text    = tabLivingSkill.Money.ToString();
        m_PayStaminaLabel.text  = tabLivingSkill.Stamina.ToString();
        m_OutputIcon.spriteName = tabLivingSkill.Icon;

        foreach (LivingSkillFormulaLogic formula in m_FormulaGrid.GetComponentsInChildren <LivingSkillFormulaLogic>())
        {
            if (formula.FormulaID != nFormulaID)
            {
                formula.ChooseCancel();
            }
        }
    }