/// <summary> /// 朝朝角色信息 /// </summary> /// <param name="role"></param> private void SelectRoleInfoReturn(Role role) { RoleOperation_SelectRoleInfoReturnProto proto = new RoleOperation_SelectRoleInfoReturnProto(); RoleEntity entity = RoleCacheModel.Instance.GetEntity(role.CurRoleId); if (entity != null) { proto.IsSucess = true; proto.RoleId = entity.Id.Value; proto.RoleNickName = entity.NickName; proto.Level = entity.Level; proto.JobId = entity.JobId; proto.Money = entity.Money; proto.Gold = entity.Gold; proto.Exp = entity.Exp; proto.MaxHP = entity.MaxHP; proto.MaxMP = entity.MaxMP; proto.CurrentHP = entity.CurrentHP; proto.CurrentMP = entity.CurrentMP; proto.Attack = entity.Attack; proto.Defense = entity.Defense; proto.Hit = entity.Hit; proto.Dodge = entity.Dodge; proto.Cri = entity.Cri; proto.Res = entity.Res; proto.Fighting = entity.Fighting; proto.LastSceneId = entity.LastWorldMapSceneId; } else { proto.IsSucess = false; proto.MessageId = 1000; } role.Client_Socket.SendMsg(proto.ToArray()); }
public static void OnRoleOperation_SelectRoleInfoReturn(byte[] buffer) { RoleOperation_SelectRoleInfoReturnProto proto = RoleOperation_SelectRoleInfoReturnProto.GetProto(buffer); #if DEBUG_LOG_PROTO Debug.Log("<color=#00eaff>接收消息:</color><color=#00ff9c>" + proto.ProtoEnName + " " + proto.ProtoCode + "</color>"); Debug.Log("<color=#c5e1dc>==>>" + JsonUtility.ToJson(proto) + "</color>"); #endif Debug.Log("设置角色信息"); if (proto.IsSuccess) { //todo GameEntry.Data.CacheData.LastInWorldMapId = proto.LastInWorldMapId; GameEntry.Data.CacheData.LastInWorldMapPos = proto.LastInWorldMapPos; if (string.IsNullOrEmpty(proto.LastInWorldMapPos)) { GameEntry.Data.CacheData.NextWorldMapPos = GameEntry.DataTable.GetDataTable <SceneDBModel>().Get(proto.LastInWorldMapId).RoleBirthPos; } GameEntry.Data.UserData.RoleInfo = new RoleInfo(proto); GameEntry.Procedure.SetData <VarInt>(Constant.ProcedureData.NextSceneId, proto.LastInWorldMapId); GameEntry.UI.OpenUIForm(UIFormId.Loading); } else { //todo } }
public static RoleOperation_SelectRoleInfoReturnProto ToProto(byte[] buffer) { using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { RoleOperation_SelectRoleInfoReturnProto proto = new RoleOperation_SelectRoleInfoReturnProto(); proto.IsSucess = ms.ReadBool(); if (proto.IsSucess) { proto.RoleNickName = ms.ReadUTF8String(); proto.Level = ms.ReadInt(); proto.RoleId = ms.ReadInt(); proto.JobId = ms.ReadInt(); proto.Money = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.Exp = ms.ReadInt(); proto.MaxHP = ms.ReadInt(); proto.CurrentHP = ms.ReadInt(); proto.MaxMP = ms.ReadInt(); proto.CurrentMP = ms.ReadInt(); proto.Attack = ms.ReadInt(); proto.Defense = ms.ReadInt(); proto.Hit = ms.ReadInt(); proto.Dodge = ms.ReadInt(); proto.Cri = ms.ReadInt(); proto.Fighting = ms.ReadInt(); proto.Res = ms.ReadInt(); proto.LastSceneId = ms.ReadInt(); } else { proto.MessageId = ms.ReadInt(); } return(proto); } }
public static RoleOperation_SelectRoleInfoReturnProto GetProto(MMO_MemoryStream ms, byte[] buffer) { RoleOperation_SelectRoleInfoReturnProto proto = new RoleOperation_SelectRoleInfoReturnProto(); ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.IsSuccess = ms.ReadBool(); if (proto.IsSuccess) { proto.RoldId = ms.ReadInt(); proto.RoleNickName = ms.ReadUTF8String(); proto.JobId = (byte)ms.ReadByte(); proto.Level = ms.ReadInt(); proto.TotalRechargeMoney = ms.ReadInt(); proto.Money = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.Exp = ms.ReadInt(); proto.MaxHP = ms.ReadInt(); proto.MaxMP = ms.ReadInt(); proto.CurrHP = ms.ReadInt(); proto.CurrMP = ms.ReadInt(); proto.ToSpeed = ms.ReadInt(); proto.WeaponDamageMin = ms.ReadInt(); proto.WeaponDamageMax = ms.ReadInt(); proto.AttackNumber = ms.ReadInt(); proto.StrikePower = ms.ReadInt(); proto.PiercingPower = ms.ReadInt(); proto.MagicPower = ms.ReadInt(); proto.LastInWorldMapId = ms.ReadInt(); proto.LastInWorldMapPos = ms.ReadUTF8String(); proto.Equip_Weapon = ms.ReadInt(); proto.Equip_Pants = ms.ReadInt(); proto.Equip_Clothes = ms.ReadInt(); proto.Equip_Belt = ms.ReadInt(); proto.Equip_Cuff = ms.ReadInt(); proto.Equip_Necklace = ms.ReadInt(); proto.Equip_Shoe = ms.ReadInt(); proto.Equip_Ring = ms.ReadInt(); proto.Equip_WeaponTableId = ms.ReadInt(); proto.Equip_PantsTableId = ms.ReadInt(); proto.Equip_ClothesTableId = ms.ReadInt(); proto.Equip_BeltTableId = ms.ReadInt(); proto.Equip_CuffTableId = ms.ReadInt(); proto.Equip_NecklaceTableId = ms.ReadInt(); proto.Equip_ShoeTableId = ms.ReadInt(); proto.Equip_RingTableId = ms.ReadInt(); proto.ChoppingDefense = ms.ReadInt(); proto.PuncturDefense = ms.ReadInt(); proto.MagicDefense = ms.ReadInt(); } else { proto.MsgCode = ms.ReadInt(); } return(proto); }
public static RoleOperation_SelectRoleInfoReturnProto GetProto(byte[] buffer) { RoleOperation_SelectRoleInfoReturnProto proto = new RoleOperation_SelectRoleInfoReturnProto(); MMO_MemoryStream ms = GameEntry.Socket.SocketReceiveMS; ms.SetLength(0); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; proto.IsSuccess = ms.ReadBool(); if (proto.IsSuccess) { proto.RoldId = ms.ReadInt(); proto.RoleNickName = ms.ReadUTF8String(); proto.JobId = (byte)ms.ReadByte(); proto.Level = ms.ReadInt(); proto.TotalRechargeMoney = ms.ReadInt(); proto.Money = ms.ReadInt(); proto.Gold = ms.ReadInt(); proto.Exp = ms.ReadInt(); proto.MaxHP = ms.ReadInt(); proto.MaxMP = ms.ReadInt(); proto.CurrHP = ms.ReadInt(); proto.CurrMP = ms.ReadInt(); proto.Attack = ms.ReadInt(); proto.Defense = ms.ReadInt(); proto.Hit = ms.ReadInt(); proto.Dodge = ms.ReadInt(); proto.Cri = ms.ReadInt(); proto.Res = ms.ReadInt(); proto.Fighting = ms.ReadInt(); proto.LastInWorldMapId = ms.ReadInt(); proto.LastInWorldMapPos = ms.ReadUTF8String(); proto.Equip_Weapon = ms.ReadInt(); proto.Equip_Pants = ms.ReadInt(); proto.Equip_Clothes = ms.ReadInt(); proto.Equip_Belt = ms.ReadInt(); proto.Equip_Cuff = ms.ReadInt(); proto.Equip_Necklace = ms.ReadInt(); proto.Equip_Shoe = ms.ReadInt(); proto.Equip_Ring = ms.ReadInt(); proto.Equip_WeaponTableId = ms.ReadInt(); proto.Equip_PantsTableId = ms.ReadInt(); proto.Equip_ClothesTableId = ms.ReadInt(); proto.Equip_BeltTableId = ms.ReadInt(); proto.Equip_CuffTableId = ms.ReadInt(); proto.Equip_NecklaceTableId = ms.ReadInt(); proto.Equip_ShoeTableId = ms.ReadInt(); proto.Equip_RingTableId = ms.ReadInt(); } else { proto.MsgCode = ms.ReadInt(); } return(proto); }
public static void OnRoleOperation_SelectRoleInfoReturn(byte[] buffer) { RoleOperation_SelectRoleInfoReturnProto proto = RoleOperation_SelectRoleInfoReturnProto.GetProto(buffer); #if DEBUG_LOG_PROTO Debug.Log("<color=#00eaff>接收消息:</color><color=#00ff9c>" + proto.ProtoEnName + " " + proto.ProtoCode + "</color>"); Debug.Log("<color=#c5e1dc>==>>" + JsonUtility.ToJson(proto) + "</color>"); #endif }
/// <summary> /// 服务器返回角色信息 /// </summary> /// <param name="p"></param> private void OnSelectRoleInfoReturn(byte[] p) { RoleOperation_SelectRoleInfoReturnProto proto = RoleOperation_SelectRoleInfoReturnProto.GetProto(p); if (proto.IsSucess) { GlobalInit.Instance.MainPlayerInfo = new RoleInfoMainPlayer(proto); //需要跳转场景 SceneMgr.Instance.LoadToWorldMap(proto.LastInWorldMapId); } else { } }
/// <summary> /// 选择的角色的信息 协议回调 /// </summary> /// <param name="p"></param> private void OnSelectRoleInfoReturnProto(byte[] p) { RoleOperation_SelectRoleInfoReturnProto proto = RoleOperation_SelectRoleInfoReturnProto.ToProto(p); m_GetSelectRoleInfoOK = proto.IsSucess; if (proto.IsSucess) { PlayerCtrl.Instance.LastWorldMapId = proto.LastSceneId; Global.Instance.CurRoleInfo.LoadRoleInfo(proto); } else { } }
public int Fighting; //综合战斗力 public RoleInfo(RoleOperation_SelectRoleInfoReturnProto RoleInfoProto) { RoleId = RoleInfoProto.RoldId; RoleNickName = RoleInfoProto.RoleNickName; JobId = RoleInfoProto.JobId; Level = RoleInfoProto.Level; Exp = RoleInfoProto.Exp; MaxHP = RoleInfoProto.MaxHP; MaxMP = RoleInfoProto.MaxMP; CurrHP = RoleInfoProto.CurrHP; CurrMP = RoleInfoProto.CurrMP; Attack = RoleInfoProto.Attack; Defense = RoleInfoProto.Defense; Hit = RoleInfoProto.Hit; Dodge = RoleInfoProto.Dodge; Cri = RoleInfoProto.Cri; Res = RoleInfoProto.Res; Fighting = RoleInfoProto.Fighting; }
public RoleInfoMainPlayer(RoleOperation_SelectRoleInfoReturnProto roleProto) { this.RoldId = roleProto.RoldId; //角色编号 this.RoleNickName = roleProto.RoleNickName; //角色昵称 this.JobId = roleProto.JobId; //职业编号 this.Level = roleProto.Level; //等级 this.Money = roleProto.Money; //元宝 this.Gold = roleProto.Gold; //金币 this.Exp = roleProto.Exp; //经验 this.MaxHP = roleProto.MaxHP; //最大HP this.MaxMP = roleProto.MaxMP; //最大MP this.CurrHP = roleProto.CurrHP; //当前HP this.CurrMP = roleProto.CurrMP; //当前MP this.Attack = roleProto.Attack; //攻击力 this.Defense = roleProto.Defense; //防御 this.Hit = roleProto.Hit; //命中 this.Dodge = roleProto.Dodge; //闪避 this.Cri = roleProto.Cri; //暴击 this.Res = roleProto.Res; //抗性 this.Fighting = roleProto.Fighting; //综合战斗力 }
/// <summary> /// 加载角色信息 /// </summary> /// <param name="proto"></param> public void LoadRoleInfo(RoleOperation_SelectRoleInfoReturnProto proto) { RoleId = proto.RoleId; RoleNickName = proto.RoleNickName; Level = proto.Level; JobId = proto.JobId; Money = proto.Money; Gold = proto.Gold; Exp = proto.Exp; MaxHP = proto.MaxHP; CurrentHP = proto.CurrentHP; MaxMP = proto.MaxMP; CurrentMP = proto.CurrentMP; Attack = proto.Attack; Defense = proto.Defense; Hit = proto.Hit; Dodge = proto.Dodge; Res = proto.Res; Cri = proto.Cri; Fighting = proto.Fighting; }