예제 #1
0
    public void OnCliclCancelMatch()
    {
        //取消匹配
        TcpCancelMatch _mes = new TcpCancelMatch();

        _mes.uid = NetGlobal.Instance().userUid;
        MarsTcp.Instance.SendMessage(CSData.GetSendMessage <TcpCancelMatch>(_mes, CSID.TCP_CANCEL_MATCH));
    }
예제 #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;
        }
    }