Ejemplo n.º 1
0
 public void JoinApply(int teamId)//传过来的是队长的mainPlayerID,以及申请的队的teamId
 {
     if (-1 != teamId && PlayerNetwork.mainPlayerId == GroupNetwork.GetLeaderId(teamId))
     {
         RefreshTeamGrid(teamId);
     }
 }
Ejemplo n.º 2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            //mTestDataPlayers();
        }

        if (null == PlayerNetwork.mainPlayer)
        {
            return;
        }

        if (PeGameMgr.gameType == PeGameMgr.EGameType.Survive)//生存模式
        {
            if (!mTroopsBtn.activeSelf)
            {
                mTroopsBtn.SetActive(true);
            }

            if (_creatTeam.gameObject.activeSelf)
            {
                _creatTeam.gameObject.SetActive(false);
            }

            if (PlayerNetwork.mainPlayer.isOriginTeam)
            {
                if (GroupNetwork.IsEmpty(PlayerNetwork.mainPlayer.TeamId))
                {
                    if (!_joinTeam.gameObject.activeSelf)
                    {
                        _joinTeam.gameObject.SetActive(true);
                    }
                    if (!_invitation.gameObject.activeSelf)
                    {
                        _invitation.gameObject.SetActive(true);
                    }
                    if (mKickBtn.gameObject.activeSelf)
                    {
                        mKickBtn.gameObject.SetActive(false);
                    }
                    if (mReferredBtn.gameObject.activeSelf)
                    {
                        mReferredBtn.gameObject.SetActive(false);
                    }
                    if (mBreakBtn.gameObject.activeSelf)
                    {
                        mBreakBtn.gameObject.SetActive(false);
                    }
                    if (mQuitBtn.gameObject.activeSelf)
                    {
                        mQuitBtn.gameObject.SetActive(false);
                    }
                }
                else
                {
                    if (_joinTeam.gameObject.activeSelf)
                    {
                        _joinTeam.gameObject.SetActive(false);
                    }
                    if (!_invitation.gameObject.activeSelf)
                    {
                        _invitation.gameObject.SetActive(true);
                    }
                    if (!mKickBtn.gameObject.activeSelf)
                    {
                        mKickBtn.gameObject.SetActive(true);
                    }
                    if (!mReferredBtn.gameObject.activeSelf)
                    {
                        mReferredBtn.gameObject.SetActive(true);
                    }
                    if (!mBreakBtn.gameObject.activeSelf)
                    {
                        mBreakBtn.gameObject.SetActive(true);
                    }
                    if (mQuitBtn.gameObject.activeSelf)
                    {
                        mQuitBtn.gameObject.SetActive(false);
                    }
                }
            }
            else
            {
                if (_joinTeam.gameObject.activeSelf)
                {
                    _joinTeam.gameObject.SetActive(false);
                }
                if (_invitation.gameObject.activeSelf)
                {
                    _invitation.gameObject.SetActive(false);
                }
                if (mKickBtn.gameObject.activeSelf)
                {
                    mKickBtn.gameObject.SetActive(false);
                }
                if (mReferredBtn.gameObject.activeSelf)
                {
                    mReferredBtn.gameObject.SetActive(false);
                }
                if (mBreakBtn.gameObject.activeSelf)
                {
                    mBreakBtn.gameObject.SetActive(false);
                }
                if (!mQuitBtn.gameObject.activeSelf)
                {
                    mQuitBtn.gameObject.SetActive(true);
                }
            }
        }
        else//其他模式
        {
            if (mTroopsBtn.activeSelf)
            {
                mTroopsBtn.SetActive(false);
            }

            if (_creatTeam.gameObject.activeSelf)
            {
                _creatTeam.gameObject.SetActive(false);
            }
            if (_joinTeam.gameObject.activeSelf)
            {
                _joinTeam.gameObject.SetActive(false);
            }
            if (_invitation.gameObject.activeSelf)
            {
                _invitation.gameObject.SetActive(false);
            }

            if (PlayerNetwork.mainPlayer.TeamId == -1)            //没有队伍
            {
                if (mKickBtn.gameObject.activeSelf)
                {
                    mKickBtn.gameObject.SetActive(false);
                }
                if (mReferredBtn.gameObject.activeSelf)
                {
                    mReferredBtn.gameObject.SetActive(false);
                }
                if (mBreakBtn.gameObject.activeSelf)
                {
                    mBreakBtn.gameObject.SetActive(false);
                }
                if (mQuitBtn.gameObject.activeSelf)
                {
                    mQuitBtn.gameObject.SetActive(false);
                }

                if (_creatTeam.disable)
                {
                    _creatTeam.disable = false;
                }

                if (_joinTeam.disable)
                {
                    _joinTeam.disable = false;
                }

                if (!_invitation.disable)
                {
                    _invitation.disable = true;
                }
            }
            else if (GroupNetwork.TeamExists(PlayerNetwork.mainPlayer.TeamId)) //先判断是否存在
            {
                if (!PlayerNetwork.mainPlayer.isOriginTeam)                    //有队伍,不是队长
                {
                    if (mKickBtn.gameObject.activeSelf)
                    {
                        mKickBtn.gameObject.SetActive(false);
                    }
                    if (mReferredBtn.gameObject.activeSelf)
                    {
                        mReferredBtn.gameObject.SetActive(false);
                    }
                    if (mBreakBtn.gameObject.activeSelf)
                    {
                        mBreakBtn.gameObject.SetActive(false);
                    }
                    if (!mQuitBtn.gameObject.activeSelf)
                    {
                        mQuitBtn.gameObject.SetActive(true);
                    }

                    if (!_creatTeam.disable)
                    {
                        _creatTeam.disable = true;
                    }

                    if (!_joinTeam.disable)
                    {
                        _joinTeam.disable = true;
                    }

                    if (!_invitation.disable)
                    {
                        _invitation.disable = true;
                    }
                }
                else if (GroupNetwork.GetLeaderId(PlayerNetwork.mainPlayer.TeamId) == PlayerNetwork.mainPlayerId)                //有队伍是队长
                {
                    if (!mKickBtn.gameObject.activeSelf)
                    {
                        mKickBtn.gameObject.SetActive(true);
                    }
                    //if (!mKickBtn.disable)
                    //    mKickBtn.disable = true;

                    if (!mReferredBtn.gameObject.activeSelf)
                    {
                        mReferredBtn.gameObject.SetActive(true);
                    }
                    //if (!mReferredBtn.disable)
                    //    mReferredBtn.disable = true;

                    if (!mBreakBtn.gameObject.activeSelf)
                    {
                        mBreakBtn.gameObject.SetActive(true);
                    }
                    //if (!mBreakBtn.disable)
                    //    mBreakBtn.disable = true;

                    if (!mQuitBtn.gameObject.activeSelf)
                    {
                        mQuitBtn.gameObject.SetActive(true);
                    }
                    //if (!mQuitBtn.disable)
                    //    mQuitBtn.disable = true;

                    if (!_creatTeam.disable)
                    {
                        _creatTeam.disable = true;
                    }

                    if (!_joinTeam.disable)
                    {
                        _joinTeam.disable = true;
                    }

                    if (_invitation.disable)
                    {
                        _invitation.disable = false;
                    }
                }
            }
        }
    }