Esempio n. 1
0
    void Start()
    {
        m_instance = this;
        hasInMatirxBelles.Clear();
        m_myBelleWindow.SetActive(false);
//         if(SelectBelleList == null)
//         SelectBelleList = new List<SelectBelleData>();
        if (m_selectBelleData == null)
        {
            m_selectBelleData = new SelectBelleData();
        }
    }
 // 阵型按钮点击
 void OnClickItem()
 {
     LogModule.DebugLog("matrixIndex is click !    =============================" + this.curMatrixIndex);
     if (null != BelleMatrixBand.Instance())
     {
         if (BelleController.Instance().NewPlayerGuide_Step == 2)
         {
             BelleController.Instance().NewPlayerGuide(3);
         }
         else
         {
             BelleMatrixBand.Instance().OnMatrixButtonClick(this.curMatrixIndex);
         }
     }
 }
Esempio n. 3
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);
    }
    public void FillMyBelleList()
    {
        if (BelleMatrixBand.Instance() == null)
        {
            return;
        }
        m_curScrollViwPanel.transform.localPosition = m_scrollPosition;
//        m_curMatrixObj.SetActive(BelleMatrixBand.Instance().SelectBelleData.belleID != -1);
        m_scrollViewList.transform.localPosition = m_curScrollViewListOriPositon;
        m_curScrollViwPanel.clipRange            = m_curScrollViewPanelFrom;

/*        if (m_curMatrixObj.activeSelf)
 *      {
 *          BelleSelectToMatrixItem selectBelleItem = m_curMatrixBelleItem.GetComponent<BelleSelectToMatrixItem>();
 *          if (selectBelleItem != null)
 *          {
 *              selectBelleItem.SetData(this, BelleMatrixBand.Instance().SelectBelleData, 0);
 *          }
 *          m_scrollViewList.transform.localPosition = m_curScrollViewListPosition;
 *          m_curScrollViwPanel.clipRange = m_curScrollViewPanelTo;
 *
 *      }*/

        Utils.CleanGrid(m_myBelleGrid);
        List <SelectBelleData> recommondBelleData = new List <SelectBelleData>();

        //if the clicked slot is not empty, insert bell info to the top of the list.
        m_curMatrixObj.SetActive(false);
        if (BelleMatrixBand.Instance().SelectBelleData.belleID != -1)
        {
            recommondBelleData.Add(BelleMatrixBand.Instance().SelectBelleData);
            int count = BelleMatrixBand.Instance().SelectBelleList.Count;
            for (int i = 0; i < count; i++)
            {
                recommondBelleData.Add(BelleMatrixBand.Instance().SelectBelleList[i]);
            }
        }
        else
        {
            recommondBelleData = BelleMatrixBand.Instance().SelectBelleList;
        }
        if (null == recommondBelleData || recommondBelleData.Count == 0)
        {
            return;
        }

        if (null == m_myBelleItem)
        {
            LogModule.ErrorLog("MyBelleItem is null!");
            return;
        }

        for (int i = 0; i < recommondBelleData.Count; i++)
        {
            GameObject curItem = Utils.BindObjToParent(m_myBelleItem, m_myBelleGrid) as GameObject;

            if (curItem != null)
            {
                BelleSelectToMatrixItem selectBelleItem = curItem.GetComponent <BelleSelectToMatrixItem>();
                if (selectBelleItem != null)
                {
                    selectBelleItem.SetData(this, recommondBelleData[i], i);
                }
            }
        }
        if (m_myBelleGrid != null && m_myBelleGrid.GetComponent <UIGrid>() != null)
        {
            m_myBelleGrid.GetComponent <UIGrid>().Reposition();
        }
    }