예제 #1
0
    public void SetData(BelleMatrixWindow belleMatrixWindow, int id, Tab_BelleMatrix tabMatrix)
    {
        if (null == tabMatrix)
        {
            return;
        }

        parentWindow    = belleMatrixWindow;
        gameObject.name = id.ToString();

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

        if (null != mainPlayer && tabMatrix.OpenLevel <= mainPlayer.BaseAttr.Level)
        {
            labelName.text = tabMatrix.Name;
            openFlag.SetActive(false);
            UpdateActiveRedTip();
        }
        else
        {
            labelName.text = tabMatrix.OpenLevel + GCGame.Utils.GetDicByID(5057);
            openFlag.SetActive(true);
        }
        matrixPic.spriteName = tabMatrix.Icon;

        EnableHightLight(false);
        UpdateData();
    }
예제 #2
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);
 }
예제 #3
0
    // 阵型按钮点击
    public void OnMatrixButtonClick(int matrixIndex)
    {
        if (BelleController.Instance() == null || BelleMatrixWindow.Instance() == null)
        {
            LogModule.ErrorLog("BelleController.Instance() == null || BelleMatrixWindow.Instance() == null");
            return;
        }

        if (null == BelleMatrixWindow.Instance().CurSelectMatrix)
        {
            return;
        }

        if (matrixIndex < 0)
        {
            return;
        }

        int curMatrixID = Int32.Parse(BelleMatrixWindow.Instance().CurSelectMatrix.gameObject.name);


        if (!BelleData.OwnedMatrixMap.ContainsKey(curMatrixID))
        {
            LogModule.ErrorLog("can not find matrixid in data" + curMatrixID);
            return;
        }

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

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

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

        if (!BelleData.OwnedMatrixMap.ContainsKey(curMatrixID) || null == mainPlayer || mainPlayer.BaseAttr.Level < curTabMatrix.OpenLevel)
        {
            return;
        }
        this.m_curMatrixIndex = matrixIndex;
        if (matrixIndex >= 0 && matrixIndex < m_MatrixBelleInfos.Length)
        {
            m_selectBelleData.CleanUp();
            m_selectBelleData.belleID       = m_MatrixBelleInfos[matrixIndex].belleID;
            m_selectBelleData.matrixId      = curMatrixID;
            m_selectBelleData.isInCurMatrix = true;
            if (BelleData.OwnedBelleMap.ContainsKey(m_MatrixBelleInfos[matrixIndex].belleID))
            {
                Belle belle = BelleData.OwnedBelleMap[m_MatrixBelleInfos[matrixIndex].belleID];
                if (null != belle)
                {
                    m_selectBelleData.combatValue = BelleData.GetPowerNum(belle.attrMap);
                }
            }
        }
        m_myBelleWindow.SetActive(true);
    }
 //上阵触发按钮
 public void OnClickItem()
 {
     LogModule.DebugLog("the Item is click ----------------------------------------------------------------------------");
     if (null != BelleMatrixBand.Instance() && null != BelleMatrixWindow.Instance() && myBelle != null)
     {
         BelleMatrixBand.Instance().SelectRoleToMatrix(this.m_RecommonBelleData.belleID, this.m_RecommonBelleData.isInCurMatrix);
     }
 }
예제 #5
0
    public void SelectRoleToMatrix(int belleID, bool isMatrix)
    {
        m_myBelleWindow.gameObject.SetActive(false);
        int curMatrixID = -1;

        if (null != BelleMatrixWindow.Instance())
        {
            curMatrixID = Int32.Parse(BelleMatrixWindow.Instance().CurSelectMatrix.gameObject.name);
        }
        #region//此段逻辑暂时只在客户端有,提醒服务器添加
        Belle belle; BelleMatrix bellematrix;
        if (BelleData.OwnedBelleMap.TryGetValue(belleID, out belle) && BelleData.OwnedMatrixMap.TryGetValue(belle.matrixID, out bellematrix) && bellematrix.isActive)
        {
            Tab_BelleMatrix tbm = TableManager.GetBelleMatrixByID(bellematrix.id, 0);
            if (tbm != null)
            {
                if (isMatrix)
                {
                    GUIData.AddNotifyData2Client(false, "#{11328}", tbm.Name);
                }
                else
                {
                    GUIData.AddNotifyData2Client(false, "#{11327}", tbm.Name);
                }
            }
            return;
        }
        #endregion
        //如果在当前阵上阵上,就下阵,不在当前阵上就上阵
        if (isMatrix)
        {
            CG_BELLE_REST restRequest = (CG_BELLE_REST)PacketDistributed.CreatePacket(MessageID.PACKET_CG_BELLE_REST);
            restRequest.SetBelleID(belleID);
            restRequest.SendPacket();
        }
        else
        {
            CG_BELLE_BATTLE battleRequest = (CG_BELLE_BATTLE)PacketDistributed.CreatePacket(MessageID.PACKET_CG_BELLE_BATTLE);
            battleRequest.SetBelleID(belleID);
            battleRequest.SetMatrixID(curMatrixID);
            battleRequest.SetMatrixIndex(this.m_curMatrixIndex);
            battleRequest.SendPacket();
        }
    }
예제 #6
0
 void Start()
 {
     m_instance = this;
     UpdateBelleMatrixItems();
 }