Exemplo n.º 1
0
 private bool IsMatrixFull(int matrixID)
 {
     if (BelleMatrixWindow.Instance() != null && BelleMatrixWindow.Instance().m_curMatrixBand != null)
     {
         BelleMatrix bellematrix;
         if (BelleData.OwnedMatrixMap.TryGetValue(matrixID, out bellematrix) && bellematrix != null)
         {
             Tab_BelleMatrix curBelleMatrix = TableManager.GetBelleMatrixByID(bellematrix.id, 0);
             System.Collections.Generic.List <int> matrixLayout;
             //BelleMatrixBand belleMatrixBand = BelleMatrixWindow.Instance().m_curMatrixBand.GetComponent<BelleMatrixBand>();
             if (/*belleMatrixBand != null &&*/ null != curBelleMatrix)
             {
                 matrixLayout = BelleMatrixBand.GetLayOutByMatrixLayout(curBelleMatrix.Layout);
                 int count = bellematrix.belleIDs.Length;
                 if (matrixLayout != null && count == matrixLayout.Count)
                 {
                     for (int i = 0; i < count; ++i)
                     {
                         if (matrixLayout[i] == 1 && bellematrix.belleIDs[i] == -1)
                         {
                             return(false);
                         }
                     }
                 }
             }
         }
     }
     return(true);
 }
Exemplo n.º 2
0
    //     public void SelectRoleToMatrix(string strBelleID)
    //     {
    //         m_MyBelleWindow.Hide();
    //         //BelleData.delBattle = Ret_MatrixSelectBelle;
    //         int belleID;
    //         if (!int.TryParse(strBelleID, out belleID))
    //         {
    //             LogModule.ErrorLog("id is invalid " + strBelleID);
    //             return;
    //         }
    //
    //         CG_BELLE_BATTLE battleRequest = (CG_BELLE_BATTLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_BELLE_BATTLE);
    //         battleRequest.SetBelleID(belleID);
    //         battleRequest.SetMatrixID(m_curShowMatrixID);
    //         battleRequest.SetMatrixIndex(m_curSelectMatrixIndex);
    //         battleRequest.SendPacket();
    //        // 根据ID显示当前矩阵
    void ShowMatrixByItem()
    {
        if (null == m_curSelectMatrix)
        {
            return;
        }
        int matrixID;

        if (!int.TryParse(m_curSelectMatrix.gameObject.name, out matrixID))
        {
            return;
        }

        Tab_BelleMatrix curTabMatrix = TableManager.GetBelleMatrixByID(matrixID, 0);

        if (null == curTabMatrix)
        {
            LogModule.ErrorLog("can not find cur matrix id :" + matrixID.ToString());
            return;
        }

        Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;

        if (!BelleData.OwnedMatrixMap.ContainsKey(matrixID) || null == mainPlayer || mainPlayer.BaseAttr.Level < curTabMatrix.OpenLevel)
        {
            m_LabelBtnActive.text = Utils.GetDicByID(3408);
            btnActive.isEnabled   = false;
        }
        else
        {
            if (BelleData.OwnedMatrixMap[matrixID].isActive)
            {
                //如果已经激活,则可以取消激活
                btnActive.isEnabled   = true;
                m_LabelBtnActive.text = Utils.GetDicByID(4772);
            }
            else
            {
                m_LabelBtnActive.text = Utils.GetDicByID(3408);
                m_activeCount         = 0;
                foreach (KeyValuePair <int, BelleMatrix> curMatrixPair in BelleData.OwnedMatrixMap)
                {
                    if (curMatrixPair.Value.isActive)
                    {
                        m_activeCount++;
                    }
                }
                // 如果未激活,并且激活数量小于2,可以点激活
                // 如果未激活,并且激活数量大于1,不能激活

                //btnActive.isEnabled = m_activeCount < 2;
                BelleMatrix bellematrix;
                bool        sign = true;
                if (BelleData.OwnedMatrixMap.TryGetValue(matrixID, out bellematrix) && bellematrix != null)
                {
                    Tab_BelleMatrix curBelleMatrix = TableManager.GetBelleMatrixByID(bellematrix.id, 0);
                    List <int>      matrixLayout;
                    //BelleMatrixBand belleMatrixBand = m_curMatrixBand.GetComponent<BelleMatrixBand>();
                    if (/*belleMatrixBand != null &&*/ null != curBelleMatrix)
                    {
                        matrixLayout = BelleMatrixBand.GetLayOutByMatrixLayout(curBelleMatrix.Layout);
                        int count = bellematrix.belleIDs.Length;
                        if (matrixLayout != null && count == matrixLayout.Count)
                        {
                            for (int i = 0; i < count; ++i)
                            {
                                if (matrixLayout[i] == 1 && bellematrix.belleIDs[i] == -1)
                                {
                                    sign = false;
                                    break;
                                }
                            }
                        }
                    }
                }
                btnActive.isEnabled = (sign && (m_activeCount < 2));
            }
        }

        m_curShowMatrixID = matrixID;
        BelleMatrixBand belleMatrixBandScript = m_curMatrixBand.GetComponent <BelleMatrixBand>();

        if (belleMatrixBandScript != null)
        {
            belleMatrixBandScript.SetMatrixInfo(matrixID);
            m_curMatrixBand.SetActive(true);
            if (belleMatrixBandScript.m_myBelleWindow.gameObject.activeInHierarchy)
            {
                belleMatrixBandScript.m_myBelleWindow.GetComponent <SelectMyBelleTOMatrixWindow>().FillMyBelleList();
            }
        }
        //详细属性信息界面
        matrixDetailBand.SetMatrix(matrixID);
    }