Ejemplo n.º 1
0
    public void AnalyzeMessage(SCID messageId, byte[] bodyData)
    {
        switch (messageId)
        {
        case SCID.TCP_RESPONSE_LOGIN:
        {
            TcpResponseLogin pb_ReceiveMes = CSData.DeserializeData <TcpResponseLogin>(bodyData);
            NetGlobal.Instance().AddAction(() => {
                    mes_login_result(pb_ReceiveMes);
                });
        }
        break;

        case SCID.TCP_RESPONSE_REQUEST_MATCH:
        {
            TcpResponseRequestMatch pb_ReceiveMes = CSData.DeserializeData <TcpResponseRequestMatch>(bodyData);
            NetGlobal.Instance().AddAction(() => {
                    mes_request_match_result(pb_ReceiveMes);
                });
        }
        break;

        case SCID.TCP_RESPONSE_CANCEL_MATCH:
        {
            TcpResponseCancelMatch pb_ReceiveMes = CSData.DeserializeData <TcpResponseCancelMatch>(bodyData);
            NetGlobal.Instance().AddAction(() => {
                    mes_cancel_match_result(pb_ReceiveMes);
                });
        }
        break;

        case SCID.TCP_ENTER_BATTLE:
        {
            TcpEnterBattle pb_ReceiveMes = CSData.DeserializeData <TcpEnterBattle>(bodyData);
            NetGlobal.Instance().AddAction(() => {
                    mes_enter_battle(pb_ReceiveMes);
                });
        }
        break;

        default:
            break;
        }
    }
Ejemplo n.º 2
0
    public void AnalyzeMessage(PBCommon.CSID messageId, byte[] bodyData, string _socketIp)
    {
        switch (messageId)
        {
        case CSID.TCP_LOGIN:
        {
            TcpLogin _info = CSData.DeserializeData <TcpLogin> (bodyData);


            int _uid = UserManage.Instance.UserLogin(_info.token, _socketIp);
            TcpResponseLogin _result = new TcpResponseLogin();
            _result.result  = true;
            _result.uid     = _uid;
            _result.udpPort = UdpManager.Instance.recvPort;

            ServerTcp.Instance.SendMessage(_socketIp, CSData.GetSendMessage <TcpResponseLogin>(_result, SCID.TCP_RESPONSE_LOGIN));
        }
        break;

        case CSID.TCP_REQUEST_MATCH:
        {
            TcpRequestMatch _mes = CSData.DeserializeData <TcpRequestMatch> (bodyData);
            MatchManage.Instance.NewMatchUser(_mes.uid, _mes.roleID);

            TcpResponseRequestMatch rmRes = new TcpResponseRequestMatch();
            ServerTcp.Instance.SendMessage(_socketIp, CSData.GetSendMessage <TcpResponseRequestMatch>(rmRes, SCID.TCP_RESPONSE_REQUEST_MATCH));
        }
        break;

        case CSID.TCP_CANCEL_MATCH:
        {
            TcpCancelMatch _mes = CSData.DeserializeData <TcpCancelMatch> (bodyData);
            MatchManage.Instance.CancleMatch(_mes.uid);

            TcpResponseCancelMatch cmRes = new TcpResponseCancelMatch();
            ServerTcp.Instance.SendMessage(_socketIp, CSData.GetSendMessage <TcpResponseCancelMatch>(cmRes, SCID.TCP_RESPONSE_CANCEL_MATCH));
        }
        break;

        default:
            break;
        }
    }
Ejemplo n.º 3
0
 void Message_Reauest_Match_Result(TcpResponseRequestMatch _result)
 {
     waitMatchObj.SetActive(true);
 }