コード例 #1
0
ファイル: Match.cs プロジェクト: Liguangxin1989/EditorTest
        public override void HandleMessage(ProtoBase proto)
        {
            base.HandleMessage(proto);

            switch (proto.MessageID)
            {
            case MessageId.SC_JoinGame:
            {
                ProtoSCJoinGame joinGame = proto as ProtoSCJoinGame;
                if (joinGame.Result == JoinGameResult.JGR_Success)
                {
                    OnJoinRoom(true, "");
                }
                else if (joinGame.Result == JoinGameResult.JGR_UserFull)
                {
                    OnJoinRoom(false, "房间已满,无法进入");
                }
                else if (joinGame.Result == JoinGameResult.JGR_BattleFull)
                {
                    OnJoinRoom(false, "服务器爆满,无法创建房间");
                }
                else if (joinGame.Result == JoinGameResult.JGR_AlreadyInBattle)
                {
                    OnJoinRoom(false, "已经在房间中");
                }
                break;
            }

            case MessageId.SC_EnterGame:
            {
                ProtoSCEnterGame enterBattle = proto as ProtoSCEnterGame;
                if (enterBattle.IsSuccess)
                {
                    GameCore.Instance.MySide = enterBattle.Side;
                }
                break;
            }

            case MessageId.SC_MatchSuccess:
            {
                GameCore.Instance.SwitchToSubgame(ESubGame.SelectLevel);
                break;
            }
            }
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: Liguangxin1989/EditorTest
        public override void HandleMessage(ProtoBase proto)
        {
            base.HandleMessage(proto);
            switch (proto.MessageID)
            {
            case MessageId.SC_EnterGame:
            {
                ProtoSCEnterGame enterBattle = proto as ProtoSCEnterGame;
                if (enterBattle.IsSuccess)
                {
                    GameCore.Instance.MySide = enterBattle.Side;
                }
                break;
            }

            case MessageId.SC_MatchSuccess:
            {
                GameCore.Instance.SwitchToSubgame(ESubGame.SelectLevel);
                break;
            }
            }
        }