/// <summary> 服务器返回创建角色 </summary> /// <param name="role"></param> /// <param name="retValue"></param> private void OnRoleCreateResponse(Role role, MFReturnValue <object> retValue) { RoleCreateResponseProto proto = new RoleCreateResponseProto(); if (!retValue.HasError) { proto.IsSuccess = true; //初始化角色技能 RoleSkillEntity entity1 = new RoleSkillEntity(); entity1.Status = EnumEntityStatus.Released; entity1.RoleId = (int)retValue.OutputValues["Id"]; entity1.SkillId = 106; entity1.SkillLevel = 1; entity1.SlotsNode = 1; entity1.CreateTime = DateTime.Now; entity1.UpdateTime = DateTime.Now; RoleSkillDBModel.Instance.Create(entity1); RoleSkillEntity entity2 = new RoleSkillEntity(); entity2.Status = EnumEntityStatus.Released; entity2.RoleId = (int)retValue.OutputValues["Id"]; entity2.SkillId = 107; entity2.SkillLevel = 1; entity2.SlotsNode = 2; entity2.CreateTime = DateTime.Now; entity2.UpdateTime = DateTime.Now; RoleSkillDBModel.Instance.Create(entity2); } else { proto.IsSuccess = false; proto.MsgCode = 1000305; } role.ClientSocket.SendMsg(proto.ToArray()); }
private void OnRoleCreateResponse(byte[] buffer) { RoleCreateResponseProto proto = RoleCreateResponseProto.GetProto(buffer); if (proto.IsSuccess) { Debuger.Log("创建成功"); LogOnGameServer(); } else { TipsUtil.ShowTextTips(proto.MsgCode); } }
public static RoleCreateResponseProto GetProto(byte[] buffer) { RoleCreateResponseProto proto = new RoleCreateResponseProto(); using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer)) { proto.IsSuccess = ms.ReadBool(); if (!proto.IsSuccess) { proto.MsgCode = ms.ReadInt(); } } return(proto); }