示例#1
0
        /// <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);
        }
示例#2
0
文件: Account.cs 项目: hgpdai/knight
 /// <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);
 }