コード例 #1
0
    void OnAllListRsp(object msg, int app_type, int app_id)
    {
        Debug.LogFormat("收到了all list回复");
        bs.hallclient.AllListRsp rsp = (bs.hallclient.AllListRsp)msg;

        //先查找对应的group_id是否存在
        if (UserData.hall_info.ContainsKey(rsp.group_id))
        {
            for (int i = 0; i < rsp.items.Count; i++)
            {
                UserData.ListInfo info = new UserData.ListInfo();
                info.page_id       = rsp.page_id;
                info.group_id      = rsp.group_id;
                info.ver_code      = rsp.ver_code;
                info.list_id       = rsp.items[i].list_id;
                info.show_name     = rsp.items[i].show_name;
                info.list_order    = rsp.items[i].list_order;
                info.show_platform = rsp.items[i].show_platform;
                info.icon_index    = rsp.items[i].icon_index;
                info.own_plans     = new Dictionary <uint, UserData.PlanInfo>();

                //判断list_id是否存在
                if (UserData.hall_info[rsp.group_id].own_lists.ContainsKey(info.list_id) == false)
                {
                    UserData.hall_info[rsp.group_id].own_lists.Add(info.list_id, info);
                }
                //UserData.hall_info.Add(info);
            }
        }
    }
コード例 #2
0
ファイル: middleware.cs プロジェクト: 3zheng/chaos
    public static object RecvMessage(ref int kind_id, ref int sub_id, ref int app_type, ref int app_id)
    {
        int check_kind_id = 0;
        int size          = GetMsgBuffSize(ref check_kind_id);

        if (0 == size && 0 == check_kind_id)  //因为还有像hellorsp这样的没有报文长度但是有返回的报文,不能只靠size是否为0来判断
        {
            return(null);
        }
        byte[] buff = new byte[size];
        //int kind_id = 0;
        GetMsgBuff(buff, ref kind_id, ref sub_id);

        System.IO.Stream stream = new System.IO.MemoryStream(buff);

        switch (kind_id)
        {
        case (int)Middleware.EnumCommandKind.HallClient:
            switch (sub_id)
            {
            case (int)bs.hallclient.CMDID_HallClient.IDAllGroupRsp:
            {
                bs.hallclient.AllGroupRsp req = Serializer.Deserialize <bs.hallclient.AllGroupRsp>(stream);
                return(req);
            }

            case (int)bs.hallclient.CMDID_HallClient.IDAllListRsp:
            {
                bs.hallclient.AllListRsp req = Serializer.Deserialize <bs.hallclient.AllListRsp>(stream);
                return(req);
            }

            case (int)bs.hallclient.CMDID_HallClient.IDAllPlanRsp:
            {
                bs.hallclient.AllPlanRsp req = Serializer.Deserialize <bs.hallclient.AllPlanRsp>(stream);
                return(req);
            }

            case (int)bs.hallclient.CMDID_HallClient.IDPlanAllStartPoint:
            {
                bs.hallclient.PlanAllStartPoint req = Serializer.Deserialize <bs.hallclient.PlanAllStartPoint>(stream);
                return(req);
            }

            case (int)bs.hallclient.CMDID_HallClient.IDGetMatchDetailRsp:
            {
                bs.hallclient.GetMatchDetailRsp req = Serializer.Deserialize <bs.hallclient.GetMatchDetailRsp>(stream);
                return(req);
            }

            default:
                break;
            }
            break;

        case (int)EnumCommandKind.Client:
            switch (sub_id)
            {
            case (int)bs.client.CMDID_Client.IDLoginRsp:
            {
                bs.client.LoginRsp req = Serializer.Deserialize <bs.client.LoginRsp>(stream);
                return(req);
            }

            default:
                break;
            }
            break;

        case (int)EnumCommandKind.Gate:
            switch (sub_id)
            {
            case (int)bs.gate.CMDID_Gate.IDHelloRsp:
            {
                bs.gate.HelloRsp req = new bs.gate.HelloRsp();
                Debug.LogFormat("get hellorsp");
                return(req);
            }

            default:
                break;
            }
            break;

        case (int)Middleware.EnumCommandKind.MatchClient:
            switch (sub_id)
            {
            case (int)bs.matchclient.CMDID_MatchClient.IDJoinRsp:           //报名回复
            {
                bs.matchclient.JoinRsp req = Serializer.Deserialize <bs.matchclient.JoinRsp>(stream);
                return(req);
            }

            case (int)bs.matchclient.CMDID_MatchClient.IDMatchStart:            //开赛通知
            {
                bs.matchclient.MatchStart req = Serializer.Deserialize <bs.matchclient.MatchStart>(stream);
                return(req);
            }

            case (int)bs.matchclient.CMDID_MatchClient.IDEnterMatchRsp:         //进入比赛通知
            {
                bs.matchclient.EnterMatchRsp req = Serializer.Deserialize <bs.matchclient.EnterMatchRsp>(stream);
                return(req);
            }

            case (int)bs.matchclient.CMDID_MatchClient.IDTableStatusInd:
            {
                bs.matchclient.TableStatus req = Serializer.Deserialize <bs.matchclient.TableStatus>(stream);
                return(req);
            }

            case (int)bs.matchclient.CMDID_MatchClient.IDGameData:
            {
                bs.matchclient.GameData req = Serializer.Deserialize <bs.matchclient.GameData>(stream);
                return(req);
            }

            default:
                break;
            }
            break;

        default:
            break;
        }

        return(null);
    }