public void EntityOutMap(EntityOutMapRsp rsp) { if (dictEntity_.ContainsKey(rsp.Entityid)) { dictEntity_[rsp.Entityid].Destroy(); } }
public void EntityOutMapRsp(EntityOutMapRsp rsp) { TestManager.Instance.EntityOutMap(rsp); }
public void Recv(List <MessagePackObject> recvObject) { if (recvObject.Count < 1) { Debug.Log("Why the recv object lenght less than 1?"); return; } int proto = recvObject[0].AsInt32(); switch (proto) { case PROTO_ID.REGISTERRSP: RegisterRsp oRegisterRsp = new RegisterRsp(); oRegisterRsp.OK = recvObject[1].AsBoolean(); NetCallBack.Instance.RegisterRsp(oRegisterRsp); break; case PROTO_ID.LOGINRSP: LoginRsp oLoginRsp = new LoginRsp(); oLoginRsp.Userid = recvObject[2].AsInt32(); oLoginRsp.OK = recvObject[1].AsBoolean(); NetCallBack.Instance.LoginRsp(oLoginRsp); break; case PROTO_ID.FRIENDRSP: FriendRsp oFriendRsp = new FriendRsp(); List <FriendInfo> lsoFriendRspFriendInfo = new List <FriendInfo>(); foreach (MessagePackObject mix1 in recvObject[3].AsList()) { IList <MessagePackObject> lsMix1 = mix1.AsList(); FriendInfo oFriendRspFriendInfo = new FriendInfo(); oFriendRspFriendInfo.Userid = lsMix1[0].AsInt32(); oFriendRspFriendInfo.Name = lsMix1[1].AsString(); lsoFriendRspFriendInfo.Add(oFriendRspFriendInfo); } oFriendRsp.FriendList = lsoFriendRspFriendInfo; oFriendRsp.Ok = recvObject[1].AsBoolean(); List <int> lsoFriendRspint = new List <int>(); foreach (MessagePackObject mix1 in recvObject[2].AsList()) { lsoFriendRspint.Add(mix1.AsInt32()); } oFriendRsp.IdList = lsoFriendRspint; NetCallBack.Instance.FriendRsp(oFriendRsp); break; case PROTO_ID.RUOKRSP: RUOKRsp oRUOKRsp = new RUOKRsp(); oRUOKRsp.OK = recvObject[1].AsBoolean(); NetCallBack.Instance.RUOKRsp(oRUOKRsp); break; case PROTO_ID.USERINTOMAPRSP: UserIntoMapRsp oUserIntoMapRsp = new UserIntoMapRsp(); oUserIntoMapRsp.Y = recvObject[3].AsInt32(); oUserIntoMapRsp.X = recvObject[2].AsInt32(); List <EntityInfo> lsoUserIntoMapRspEntityInfo = new List <EntityInfo>(); foreach (MessagePackObject mix1 in recvObject[4].AsList()) { IList <MessagePackObject> lsMix1 = mix1.AsList(); EntityInfo oUserIntoMapRspEntityInfo = new EntityInfo(); oUserIntoMapRspEntityInfo.Y = lsMix1[3].AsInt32(); oUserIntoMapRspEntityInfo.X = lsMix1[2].AsInt32(); oUserIntoMapRspEntityInfo.Entityid = lsMix1[0].AsInt32(); oUserIntoMapRspEntityInfo.EntityType = lsMix1[1].AsInt32(); lsoUserIntoMapRspEntityInfo.Add(oUserIntoMapRspEntityInfo); } oUserIntoMapRsp.EntityList = lsoUserIntoMapRspEntityInfo; oUserIntoMapRsp.Mapid = recvObject[1].AsInt32(); NetCallBack.Instance.UserIntoMapRsp(oUserIntoMapRsp); break; case PROTO_ID.ENTITYINTOMAPRSP: EntityIntoMapRsp oEntityIntoMapRsp = new EntityIntoMapRsp(); EntityInfo oEntityIntoMapRspEntityInfo = new EntityInfo(); foreach (MessagePackObject mix1 in recvObject[1].AsList()) { IList <MessagePackObject> lsMix1 = mix1.AsList(); oEntityIntoMapRspEntityInfo.Y = lsMix1[3].AsInt32(); oEntityIntoMapRspEntityInfo.X = lsMix1[2].AsInt32(); oEntityIntoMapRspEntityInfo.Entityid = lsMix1[0].AsInt32(); oEntityIntoMapRspEntityInfo.EntityType = lsMix1[1].AsInt32(); } oEntityIntoMapRsp.Entity = oEntityIntoMapRspEntityInfo; NetCallBack.Instance.EntityIntoMapRsp(oEntityIntoMapRsp); break; case PROTO_ID.ENTITYOUTMAPRSP: EntityOutMapRsp oEntityOutMapRsp = new EntityOutMapRsp(); oEntityOutMapRsp.Entityid = recvObject[1].AsInt32(); NetCallBack.Instance.EntityOutMapRsp(oEntityOutMapRsp); break; case PROTO_ID.ENTITYPOSRSP: EntityPosRsp oEntityPosRsp = new EntityPosRsp(); List <EntityInfo> lsoEntityPosRspEntityInfo = new List <EntityInfo>(); foreach (MessagePackObject mix1 in recvObject[1].AsList()) { IList <MessagePackObject> lsMix1 = mix1.AsList(); EntityInfo oEntityPosRspEntityInfo = new EntityInfo(); oEntityPosRspEntityInfo.Y = lsMix1[3].AsInt32(); oEntityPosRspEntityInfo.X = lsMix1[2].AsInt32(); oEntityPosRspEntityInfo.Entityid = lsMix1[0].AsInt32(); oEntityPosRspEntityInfo.EntityType = lsMix1[1].AsInt32(); lsoEntityPosRspEntityInfo.Add(oEntityPosRspEntityInfo); } oEntityPosRsp.EntityList = lsoEntityPosRspEntityInfo; NetCallBack.Instance.EntityPosRsp(oEntityPosRsp); break; case PROTO_ID.ENTITYHPRSP: EntityHpRsp oEntityHpRsp = new EntityHpRsp(); oEntityHpRsp.Entityid = recvObject[1].AsInt32(); oEntityHpRsp.Hp = recvObject[2].AsInt32(); NetCallBack.Instance.EntityHpRsp(oEntityHpRsp); break; case PROTO_ID.BOMBINRSP: BombInRsp oBombInRsp = new BombInRsp(); oBombInRsp.Y = recvObject[3].AsInt32(); oBombInRsp.Bombid = recvObject[1].AsInt32(); oBombInRsp.X = recvObject[2].AsInt32(); NetCallBack.Instance.BombInRsp(oBombInRsp); break; case PROTO_ID.BOMBBLASTRSP: BombBlastRsp oBombBlastRsp = new BombBlastRsp(); oBombBlastRsp.Bombid = recvObject[1].AsInt32(); NetCallBack.Instance.BombBlastRsp(oBombBlastRsp); break; default: Debug.Log("Unknow proto id: " + proto); break; } }