Ejemplo n.º 1
0
    void OnAllPlanRsp(object msg, int app_type, int app_id)
    {
        Debug.LogFormat("收到了all plan回复");
        bs.hallclient.AllPlanRsp rsp = (bs.hallclient.AllPlanRsp)msg;

        //先查找对应的group_id是否存在
        if (UserData.hall_info.ContainsKey(rsp.group_id))
        {
            //再查找list_id是否存在
            if (UserData.hall_info[rsp.group_id].own_lists.ContainsKey(rsp.list_id))
            {
                for (int i = 0; i < rsp.plan_ids.Count; i++)   //game_kind
                {
                    UserData.PlanInfo info = new UserData.PlanInfo();
                    info.page_id  = rsp.page_id;
                    info.group_id = rsp.group_id;
                    info.ver_code = rsp.ver_code;
                    info.list_id  = rsp.list_id;

                    info.plan_id        = rsp.plan_ids[i];
                    info.plan_orders    = rsp.plan_orders[i];
                    info.plan_show_nums = rsp.plan_show_nums[i];
                    info.game_kind      = rsp.game_kind;
                }
            }
        }
    }
Ejemplo n.º 2
0
    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);
    }