Ejemplo n.º 1
0
    void MakeCombinePacket()
    {
        if (m_CombineCD)
        {
            return;
        }

        CG_QIANKUNDAI_COMBINE packet = (CG_QIANKUNDAI_COMBINE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_QIANKUNDAI_COMBINE);

        for (int i = 0; i < m_ChooseStuffGuid.Count; i++)
        {
            GameItem item = GameManager.gameManager.PlayerDataPool.BackPack.GetItemByGuid(m_ChooseStuffGuid[i]);
            if (item != null && item.IsValid())
            {
                packet.AddStuffGUID(item.Guid);
            }
        }

        if (m_CurCombineNum > 1)
        {
            packet.MakeCount = m_CurCombineNum;
        }
        packet.SendPacket();

        m_RightFormula = null;
        ClearNumChoose();

        m_CombineCD = true;
        InvokeRepeating("CombineCDWait", 1, 999);

        m_ProductPanel.SetActive(true);
    }
Ejemplo n.º 2
0
    //根据当前选取的合成材料,显示说明过滤标签页
    //标签页显示规则类似搜索引擎,逐步添加关键字,定位配方
    private void ShowTabFilter()
    {
        List <int> matchFilterTypeList = new List <int>();

        foreach (KeyValuePair <int, List <Tab_QianKunDaiFormula> > pair in TableManager.GetQianKunDaiFormula())
        {
            Tab_QianKunDaiFormula tabFormula = pair.Value[0];
            if (tabFormula == null)
            {
                continue;
            }

            if (IsAllStuffInFormula(tabFormula))
            {
                if (!matchFilterTypeList.Contains(tabFormula.FilterType))
                {
                    matchFilterTypeList.Add(tabFormula.FilterType);
                }
            }
        }

        int nShowTab = GlobeVar.INVALID_ID;

        for (int ii = 1; ii <= MAX_FILTER_TYPE_COUNT; ++ii)
        {
            Transform filterTransform = m_TabFilter.transform.FindChild(ii.ToString());
            if (null != filterTransform)
            {
                if (matchFilterTypeList.Contains(ii))
                {
                    filterTransform.gameObject.SetActive(true);
                    if (GlobeVar.INVALID_ID == nShowTab)
                    {
                        nShowTab = ii;
                    }
                }
                else
                {
                    filterTransform.gameObject.SetActive(false);
                }
            }
        }
        m_TabFilter.GetComponent <UIGrid>().sorted        = true;
        m_TabFilter.GetComponent <UIGrid>().repositionNow = true;
        if (GlobeVar.INVALID_ID == nShowTab)
        {
            m_NullIntroduction.SetActive(true);
            CloseFilter();
        }
        else
        {
            if (null != m_RightFormula && matchFilterTypeList.Contains(m_RightFormula.FilterType))
            {
                nShowTab = m_RightFormula.FilterType;
            }
            m_TabFilter.ChangeTab(nShowTab.ToString());
            m_NullIntroduction.SetActive(false);
        }
        matchFilterTypeList.Clear();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 配方列中是否包含物品
    /// </summary>
    /// <param name="tabFormula">配方列</param>
    /// <param name="nItemDataID">物品</param>
    /// <returns>是否包含</returns>
    /// 1、配方为空,则不包含;
    /// 2、物品ID无效,则包含;
    private bool IsStuffInFormula(Tab_QianKunDaiFormula tabFormula, int nItemDataID)
    {
        if (null == tabFormula)
        {
            return(false);
        }

        if (GlobeVar.INVALID_ID == nItemDataID)
        {
            return(true);
        }

        for (int ii = 0; ii < tabFormula.getStuffIDCount(); ++ii)
        {
            int nStuffID = tabFormula.GetStuffIDbyIndex(ii);
            if (GlobeVar.INVALID_ID == nStuffID)
            {
                return(false);
            }
            if (nStuffID == nItemDataID)
            {
                return(true);
            }
        }
        return(false);
    }
Ejemplo n.º 4
0
 void ClearData()
 {
     m_ChooseStuffKinds.Clear();
     m_ChooseStuffGuid.Clear();
     m_CurCombineNum       = 0;
     m_RightFormula        = null;
     m_MaxCombineCount     = 1;
     m_CombineCD           = false;
     m_bOopenFromChristmas = false;
 }
Ejemplo n.º 5
0
    /*void BeginChoose()
     * {
     *  m_ChooseButton.SetActive(false);
     *  m_CancelChooseButton.SetActive(true);
     * }
     *
     * void CancelChoose()
     * {
     *  m_ChooseButton.SetActive(true);
     *  m_CancelChooseButton.SetActive(false);
     * }*/

    void CombineFormula()
    {
        if (m_ChooseStuffGuid.Count <= 0)
        {
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{2079}");

            return;
        }

        bool bAllGem = IsAllGem();

        foreach (KeyValuePair <int, List <Tab_QianKunDaiFormula> > pair in TableManager.GetQianKunDaiFormula())
        {
            Tab_QianKunDaiFormula tabFormula = pair.Value[0];
            if (tabFormula == null)
            {
                continue;
            }

            if (IsAllStuffRight(tabFormula, bAllGem))
            {
                m_RightFormula = tabFormula;
                break;
            }
        }

        if (m_RightFormula == null)
        {
            // 不满足任何配方
            Singleton <ObjManager> .Instance.MainPlayer.SendNoticMsg(false, "#{2083}");
        }
        else
        {
            for (int i = 0; i < m_ChooseStuffGuid.Count; i++)
            {
                GameItem item = GameManager.gameManager.PlayerDataPool.BackPack.GetItemByGuid(m_ChooseStuffGuid[i]);
                if (item != null && item.IsValid())
                {
                    if (item.BindFlag)
                    {
                        MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{2070}"), "", CombineFormulaOK, CombineFormulaCancel);
                        break;
                    }
                    if (i == m_ChooseStuffGuid.Count - 1)
                    {
                        CombineFormulaOK();
                    }
                }
            }
        }
    }
Ejemplo n.º 6
0
    bool IsGemFormulaSameLevel(Tab_QianKunDaiFormula tabFormula)
    {
        if (tabFormula == null)
        {
            return(false);
        }

        int nStuffLevel = tabFormula.GetStuffIDbyIndex(0);

        if (nStuffLevel == GlobeVar.INVALID_ID)
        {
            return(false);
        }

        if (GetChooseGemLevelCount() != 1)
        {
            return(false);
        }

        if (m_ChooseStuffGuid.Count <= 0)
        {
            return(false);
        }

        GameItem item = GameManager.gameManager.PlayerDataPool.BackPack.GetItemByGuid(m_ChooseStuffGuid[0]);

        if (item == null || !item.IsValid())
        {
            return(false);
        }

        Tab_GemAttr tabGem = TableManager.GetGemAttrByID(item.DataID, 0);

        if (tabGem == null)
        {
            return(false);
        }

        if (nStuffLevel != tabGem.Level)
        {
            return(false);
        }

        return(true);
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 配方列中是否包含全部选取的物品
    /// </summary>
    /// <param name="tabFormula">配方列</param>
    /// <returns>是否包含</returns>
    private bool IsAllStuffInFormula(Tab_QianKunDaiFormula tabFormula)
    {
        if (null == tabFormula)
        {
            return(false);
        }

        if ((int)FORMULA_TYPE.TYPE_GEMLEVELUP == tabFormula.Type)
        {
            // 只可能3个同级 同属性宝石
            if (!IsAllGem())
            {
                return(false);
            }

            // 先判断同等级 选择宝石等级数量为1 且需要等于配方填的等级
            if (false == IsGemFormulaSameLevel(tabFormula))
            {
                return(false);
            }

            // 判断同属性
            if (GetChooseGemClassCount() != 1)
            {
                return(false);
            }

            return(true);
        }
        else
        {
            foreach (KeyValuePair <int, int> pair in m_ChooseStuffKinds)
            {
                if (!IsStuffInFormula(tabFormula, pair.Key))
                {
                    return(false);
                }
            }
            return(true);
        }
    }
Ejemplo n.º 8
0
    bool IsAllStuffRight(Tab_QianKunDaiFormula tabFormula, bool bAllGem)
    {
        // 暂时宝石参与的乾坤袋配方 只有升级和洗宝石两种 全宝石不考虑普通合成
        if (tabFormula.Type == (int)FORMULA_TYPE.TYPE_GEMLEVELUP)
        {
            // 只可能3个同级 同属性宝石
            if (!bAllGem)
            {
                return(false);
            }

            // 先判断同等级 选择宝石等级数量为1 且需要等于配方填的等级
            if (false == IsGemFormulaSameLevel(tabFormula))
            {
                return(false);
            }

            // 判断同属性
            if (GetChooseGemClassCount() != 1)
            {
                return(false);
            }

            return(true);
        }
        else if (tabFormula.Type == (int)FORMULA_TYPE.TYPE_GEMREFRESH)
        {
            // 只可能3个同级 属性互不相同宝石
            if (!bAllGem)
            {
                return(false);
            }

            // 先判断同等级 选择宝石等级数量为1 且需要等于配方填的等级
            if (false == IsGemFormulaSameLevel(tabFormula))
            {
                return(false);
            }

            // 判断属性互不相同
            if (GetChooseGemClassCount() != tabFormula.GetStuffCountbyIndex(0))
            {
                return(false);
            }

            return(true);
        }
        else
        {
            int nStuffKinds = 0;
            for (int i = 0; i < tabFormula.getStuffIDCount(); i++)
            {
                if (tabFormula.GetStuffIDbyIndex(i) != GlobeVar.INVALID_ID)
                {
                    nStuffKinds += 1;
                }
            }

            if (nStuffKinds != m_ChooseStuffKinds.Count || nStuffKinds <= 0)
            {
                return(false);
            }

            for (int i = 0; i < tabFormula.getStuffIDCount(); i++)
            {
                if (!m_ChooseStuffKinds.ContainsKey(tabFormula.GetStuffIDbyIndex(i)) &&
                    tabFormula.GetStuffIDbyIndex(i) != GlobeVar.INVALID_ID)
                {
                    return(false);
                }
            }

            return(true);
        }
    }
Ejemplo n.º 9
0
 void NumChooseCancel()
 {
     m_RightFormula = null;
     ClearNumChoose();
 }
Ejemplo n.º 10
0
 void CombineFormulaCancel()
 {
     m_RightFormula = null;
 }