/// <summary> /// 角色登录的响应 /// </summary> private static void OnClientLoginResponse(JsonNode rRequestMsg, JsonNode rProtocolMsg) { var rMsgCode = NetworkClient.Instance.GetMessageCode(rProtocolMsg); JsonNode rActorsNode = rProtocolMsg["actors"]; List <NetActor> rNetActors = new List <NetActor>(); if (rActorsNode != null) { for (int i = 0; i < rActorsNode.Count; i++) { JsonNode rActorNode = rActorsNode[i]; NetActor rActor = new NetActor() { ActorID = rActorNode["actorID"].AsLong, ActorName = rActorNode["actorName"].AsString, Level = rActorNode["level"].AsInt, ServerID = rActorNode["serverID"].AsInt }; rActor.Professional = GameConfig.Instance.GetActorProfessional(rActorNode["professionalID"].AsInt); rNetActors.Add(rActor); } } long rAccountID = rProtocolMsg["uid"].AsLong; Login.Instance.OnClientLoginResponse(rMsgCode, rAccountID, rNetActors); }
public void Set(NetActor rNetActor) { this.mNetActor = rNetActor; this.ActorProfession.Set(rNetActor.Professional.Name); this.ActorLevel.Set(rNetActor.Level); this.ActorName.text = rNetActor.ActorName; }
public static ActorCreateRequest CreateActor(NetActor rNetActor, System.Action <Actor> rLoadCompleted = null) { if (rNetActor == null) { UtilTool.SafeExecute(rLoadCompleted, null); return(null); } return(CreateActor(rNetActor.ActorID, rNetActor.Professional.HeroID, rLoadCompleted)); }
/// <summary> /// 新建一个角色 /// </summary> public void CreateActor(string rActorName, int rProfessionalID, long rActorID) { this.ActiveActor = new NetActor() { ActorID = rActorID, ActorName = rActorName, Level = 1, ServerID = this.ServerID }; this.ActiveActor.Professional = GameConfig.Instance.GetActorProfessional(rProfessionalID); this.NetActors.Add(this.ActiveActor); }