internal void Start(uint key, string ip, int port, int campId, int sceneId) { if (m_IsConnected) { Disconnect("bye for restart"); } StartNetClient(); m_Key = key; m_Ip = ip; m_Port = port; m_RoomSceneId = sceneId; m_IsWaitStart = false; m_IsConnected = false; m_CanSendMessage = false; m_ReconnectCount = 0; LogSystem.Info("NetworkSystem.Start key {0} ip {1} port {2} camp {3} scene {4}", key, ip, port, campId, sceneId); m_SendMessageCounts.Clear(); m_ReceiveMessageCounts.Clear(); }
internal void SendMessage(RoomMessageDefine id, object msg) { try { if (!m_IsConnected) { return; } NetOutgoingMessage om = m_NetClient.CreateMessage(); byte[] bt = Serialize.Encode(msg, (int)id); IncSendMessageCount((int)id, bt.Length); om.Write(bt); NetSendResult result = m_NetClient.SendMessage(om, NetDeliveryMethod.ReliableOrdered); if (result == NetSendResult.FailedNotConnected) { m_IsConnected = false; m_CanSendMessage = false; LogSystem.Info("SendMessage FailedNotConnected"); } else if (result == NetSendResult.Dropped) { LogSystem.Error("SendMessage {0} Dropped", msg.ToString()); } m_NetClient.FlushSendQueue(); } catch (Exception ex) { LogSystem.Error("NetworkSystem.SendMessage throw Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
private void HandleCreateRoleResult(JsonMessage msg) { JsonData jsonData = msg.m_JsonData; int ret = jsonData.GetInt("m_Result"); if (ret == (int)CreateRoleResult.Success) { JsonData userInfo = jsonData["m_UserInfo"]; ulong userGuid = userInfo.GetUlong("m_UserGuid"); JsonMessage sendMsg = new JsonMessage(JsonMessageID.RoleEnter); sendMsg.m_JsonData["m_Account"] = m_User; DashFireMessage.Msg_CL_RoleEnter protoData = new DashFireMessage.Msg_CL_RoleEnter(); protoData.m_Guid = userGuid; sendMsg.m_ProtoData = protoData; SendMessage(sendMsg); LogSystem.Info("Role Enter {0} {1}", m_User, userGuid); } else { LogSystem.Info("Role {0} HandleCreateRoleResult failed !", m_User); } }
private void LogMessageCount() { StringBuilder sb = new StringBuilder(); sb.AppendLine("[Message Count]:"); sb.AppendLine("[Send]:"); foreach (KeyValuePair <int, MessageCountInfo> pair in m_SendMessageCounts) { Type t = RoomMessageDefine2Type.Query(pair.Key); if (null != t) { sb.AppendFormat("=>{0}:{1} {2} {3}", pair.Key, pair.Value.m_MsgCount, pair.Value.m_TotalMsgSize, t.ToString()); } else { sb.AppendFormat("=>{0}:{1} {2}", pair.Key, pair.Value.m_MsgCount, pair.Value.m_TotalMsgSize); } sb.AppendLine(); } sb.AppendLine("[Receive]:"); foreach (KeyValuePair <int, MessageCountInfo> pair in m_ReceiveMessageCounts) { Type t = RoomMessageDefine2Type.Query(pair.Key); if (null != t) { sb.AppendFormat("=>{0}:{1} {2} {3}", pair.Key, pair.Value.m_MsgCount, pair.Value.m_TotalMsgSize, t.ToString()); } else { sb.AppendFormat("=>{0}:{1} {2}", pair.Key, pair.Value.m_MsgCount, pair.Value.m_TotalMsgSize); } sb.AppendLine(); } LogSystem.Info("{0}", sb.ToString()); }
private void HandleAccountLoginResult(JsonMessage msg) { JsonData jsonData = msg.m_JsonData; int ret = jsonData.GetInt("m_Result"); if (ret == (int)AccountLoginResult.Success) { LogSystem.Info("Login success."); //登录成功,向服务器请求玩家角色 JsonMessage sendMsg = new JsonMessage(JsonMessageID.RoleList); sendMsg.m_JsonData["m_Account"] = m_User; SendMessage(sendMsg); LogSystem.Info("HandleAccountLoginResult, success."); } else if (ret == (int)AccountLoginResult.FirstLogin) { //账号首次登录,需要验证激活码 LogSystem.Info("HandleAccountLoginResult, need activate code."); } else { //账号登录失败 Thread.Sleep(1000); JsonMessage loginMsg = new JsonMessage(JsonMessageID.DirectLogin); loginMsg.m_JsonData["m_Account"] = m_User; SendMessage(loginMsg); LogSystem.Info("HandleAccountLoginResult, failed, Relogin..."); } }
internal static void Execute(object msg, NetConnection conn) { Msg_RC_DestroyNpc destroyMsg = msg as Msg_RC_DestroyNpc; if (destroyMsg == null) { return; } EntityInfo info = PluginFramework.Instance.GetEntityById(destroyMsg.npc_id); if (null == info) { LogSystem.Info("NpcDestroy can't find obj:" + destroyMsg.npc_id); return; } LogSystem.Info("NpcDestroy:" + destroyMsg.npc_id); EntityInfo npc = info; if (null != npc) { EntityViewModelManager.Instance.DestroyEntityView(npc.GetId()); PluginFramework.Instance.DestroyEntityById(npc.GetId()); } }
internal void ConnectIfNotOpen() { if (!IsConnected) { m_LastHeartbeatTime = 0; m_LastReceiveHeartbeatTime = 0; m_LastQueueingTime = 0; m_LastShowQueueingTime = 0; m_LastConnectTime = TimeUtility.GetLocalMilliseconds(); TimeUtility.LobbyLastResponseTime = 0; LogSystem.Info("ConnectIfNotOpen at time:{0} ServerAddress:{1}", m_LastConnectTime, m_Url); m_IsLogining = true; m_IsQueueing = false; try { m_WebSocket.Open(); } catch (Exception ex) { LogSystem.Warn("m_WebSocket.Open throw exception {0}\n{1}", ex.Message, ex.StackTrace); BuildWebSocket(); //下次tick立即重连 m_LastConnectTime = 0; } } }
private bool UpdateAttachTargetPos(AttachTargetInfo ati) { if (ati.AttachNode == null) { return(false); } ati.TargetObj.transform.rotation = ati.ParentObj.transform.rotation; ati.TargetObj.transform.Rotate(ati.Rotate); UnityEngine.Vector3 relative_motion = (ati.TargetObj.transform.position - ati.AttachNode.position); UnityEngine.Vector3 target_pos = ati.ParentObj.transform.TransformPoint(ati.ParentPos) + relative_motion; UnityEngine.CollisionFlags flag; if (ati.MoveControler != null) { flag = ati.MoveControler.Move(target_pos - ati.TargetObj.transform.position); } else { return(false); } UnityEngine.Vector3 cur_pos = ati.TargetObj.transform.position; //if (/*Math.Abs(cur_pos.x - target_pos.x) <= 0.5 && Math.Abs(cur_pos.z - target_pos.z) <= 0.5*/) { if ((flag & UnityEngine.CollisionFlags.CollidedSides) <= 0) { ati.TargetObj.transform.position = target_pos; return(true); } else { LogSystem.Info("----can't move to " + target_pos + " just move to " + cur_pos); return(false); } }
private void webSocketClient_MessageReceived(object sender, MessageReceivedEventArgs e) { //收到消息后进行处理 string rawMsgString = e.Message; GfxSystem.GfxLog("==> Websocket Recived Message: {0}", rawMsgString); LogSystem.Info("==> Websocket Recived Message: {0}", rawMsgString); try { WebSocketMessageTypes websocketMsgType = GetWebSocketMessageType(rawMsgString); if (websocketMsgType == WebSocketMessageTypes.Event) { //处理事件消息 JsonMessage msg = null; string jsonMsgString = ""; string eventName = HandleRawMsg(rawMsgString, out jsonMsgString); int msgId = int.Parse(eventName); Type type = m_JsonMsgDispatcher.GetMessageType(msgId); msg = JsonConvert.DeserializeObject(jsonMsgString, type) as JsonMessage; if (msg != null) { msg.m_ID = msgId; m_JsonMsgDispatcher.HandleJsonMessage(msg); } } else if (websocketMsgType == WebSocketMessageTypes.Message) { GfxSystem.GfxLog("!!!!!! Text Message: {0}", rawMsgString); int msgId = 0; JsonMessage msg = null; string[] rawArgs = rawMsgString.Split(SPLITTER_VERTICAL, 2); if (rawArgs.Length == 2) { int id; if (int.TryParse(rawArgs[0], out id)) { msgId = id; } GfxSystem.GfxLog("!!!!!! Client recive message id : {0}", msgId); Type type = m_JsonMsgDispatcher.GetMessageType(msgId); msg = JsonConvert.DeserializeObject(rawArgs[1], type) as JsonMessage; if (msg != null) { GfxSystem.GfxLog("!!!!!! Client recive message: {0}", msg); } } } else if (websocketMsgType == WebSocketMessageTypes.Heartbeat) { //向node.js回复心跳消息 AnswerHeartbeat(); } } catch (System.Exception ex) { GfxSystem.GfxLog("Recived Message Error:{0} ", ex); } }
protected void Logging(string message, LogType en) { try { try { if (String.IsNullOrEmpty(MethodName)) { MethodName = string.Format("{0}", new System.Diagnostics.StackTrace().GetFrame(1).GetMethod().Name); } } catch (Exception ex) { LogSystem.Error(ex); } string threadInfo = GetThreadId(); message = new StringBuilder().Append("- ClassName: ").Append(ClassName) .Append("\n- MethodName: ").Append(MethodName). Append("\n- UserName: "******"\n- ThreadInfo: ").Append(threadInfo) .Append(message).ToString(); switch (en) { case LogType.Debug: LogSystem.Debug(message); break; case LogType.Info: LogSystem.Info(message); break; case LogType.Warn: LogSystem.Warn(message); break; case LogType.Error: LogSystem.Error(message); break; case LogType.Fatal: LogSystem.Fatal(message); break; default: break; } } catch (Exception ex) { try { LogSystem.Error("EntityBase.Logging.Exception.", ex); } catch (Exception) { } } }
internal static void Execute(object msg, NetConnection conn) { Msg_RC_NpcSkill targetmsg = msg as Msg_RC_NpcSkill; if (null == targetmsg) { return; } EntityInfo npc = PluginFramework.Instance.GetEntityById(targetmsg.npc_id); if (null == npc) { return; } float x = 0.0f; float z = 0.0f; ProtoHelper.DecodePosition2D(targetmsg.stand_pos, out x, out z); float faceDir = ProtoHelper.DecodeFloat(targetmsg.face_direction); int skillId = targetmsg.skill_id; LogSystem.Info("Receive Msg_RC_NpcSkill, EntityId={0}, SkillId={1}", targetmsg.npc_id, skillId); MovementStateInfo msi = npc.GetMovementStateInfo(); if (targetmsg.target_id <= 0) { msi.SetPosition2D(x, z); msi.SetFaceDir(faceDir); npc.GetAiStateInfo().Target = 0; UnityEngine.GameObject actor = EntityController.Instance.GetGameObject(npc.GetId()); GameFramework.Skill.Trigers.TriggerUtil.MoveObjTo(actor, new UnityEngine.Vector3(x, actor.transform.position.y, z)); actor.transform.localRotation = UnityEngine.Quaternion.Euler(0, Utility.RadianToDegree(faceDir), 0); } else { npc.GetAiStateInfo().Target = targetmsg.target_id; } SkillInfo skillInfo = npc.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { if (skillInfo.ConfigData.skillData.canmove == 0) { EntityViewModel viewModel = EntityViewModelManager.Instance.GetEntityViewById(targetmsg.npc_id); if (null != viewModel) { viewModel.StopMove(); } } if (GfxSkillSystem.Instance.StartSkill(npc.GetId(), skillInfo.ConfigData, 0)) { Utility.EventSystem.Publish("ui_skill_cooldown", "ui", npc.GetId(), skillId, skillInfo.ConfigData.skillData.cooldown / 1000.0f); } } }
private void OnOpened(object sender, EventArgs e) { JsonMessage loginMsg = new JsonMessage(JsonMessageID.DirectLogin); loginMsg.m_JsonData["m_Account"] = m_User; SendMessage(loginMsg); LogSystem.Info("LobbyConnect opened."); }
private void OnOpened() { JsonMessage loginMsg = new JsonMessage(JsonMessageID.DirectLogin); loginMsg.m_JsonData["m_Account"] = m_User; SendMessage(loginMsg); LogSystem.Info("LobbyConnect opened, DirectLogin {0}. {1}", m_User, LobbyRobot.Robot.GetDateTime()); }
private void OnMessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e) { string msg = e.Message; if (null != msg) { LogSystem.Info("Receive Lobby Message:{0}", msg); JsonMessageDispatcher.HandleNodeMessage(msg); } }
internal bool SendMessage(string msgStr) { bool ret = false; if (IsConnected) { m_WebSocket.Send(msgStr); LogSystem.Info("SendToLobby {0}", msgStr); ret = true; } return(ret); }
public void StartStory(string storyId, string _namespace, params string[] overloadFiles) { StoryInstance inst = NewStoryInstance(storyId, _namespace, true, overloadFiles); if (null != inst) { m_StoryLogicInfos.Add(inst); inst.Context = null; inst.GlobalVariables = m_GlobalVariables; inst.Start(); LogSystem.Info("StartStory {0}", storyId); } }
public void StartStory(string storyId) { StoryInstance inst = NewStoryInstance(storyId); if (null != inst) { m_StoryLogicInfos.Add(inst); inst.Context = m_CurScene; inst.GlobalVariables = m_GlobalVariables; inst.Start(); LogSystem.Info("StartStory {0}", storyId); } }
internal void StartStory(int storyId) { StoryInstanceInfo inst = NewStoryInstance(storyId); if (null != inst) { m_StoryLogicInfos.Add(inst); inst.m_StoryInstance.Context = m_CurScene; inst.m_StoryInstance.GlobalVariables = m_GlobalVariables; inst.m_StoryInstance.Start(); LogSystem.Info("StartStory {0}", storyId); } }
internal void Start(uint key, string ip, int port) { StartNetClient(); m_Key = key; m_Ip = ip; m_Port = port; m_IsWaitStart = false; m_IsConnected = false; m_WaitDisconnect = false; m_CanSendMessage = false; LogSystem.Info("{0} NetworkSystem.Start key {1} ip {2} port {3} {4}", Robot.LobbyNetworkSystem.User, key, ip, port, LobbyRobot.Robot.GetDateTime()); }
internal void StartStory(string storyId) { StoryInstance inst = NewStoryInstance(storyId); if (null != inst) { StopStory(storyId); m_StoryLogicInfos.Add(inst); inst.Context = m_CurUserThread; inst.GlobalVariables = m_GlobalVariables; inst.Start(); LogSystem.Info("StartStory {0}", storyId); } }
private void HandleStartGameResult(JsonMessage msg) { JsonData jsonData = msg.m_JsonData; DashFireMessage.Msg_LC_StartGameResult protoData = msg.m_ProtoData as DashFireMessage.Msg_LC_StartGameResult; if (null != protoData) { uint key = protoData.key; string ip = protoData.server_ip; uint port = protoData.server_port; int heroId = protoData.hero_id; int campId = protoData.camp_id; int sceneId = protoData.scene_type; } LogSystem.Info("HandleStartGameResult"); }
public void BtnEdit_Click(object parameters) { try { if (this.CurrentUser == null || this.CurrentUser.Id <= 0) { LogSystem.Info("CurrentUser null or id > 0"); return; } WaitingManager.Show(); CommonParam commonParam = new CommonParam(); bool success = false; if (this.ValidData(this.CurrentUser, false)) { User rs = new BackendAdapter(commonParam).Post <User>(AasUser.UPDATE, ApiConsumerStore.AasConsumer, commonParam, this.CurrentUser, null); if (rs != null) { success = true; CommonParam param = new CommonParam(); param.Start = this._start; param.Limit = this._limit; this.LoadPaging(param); } } else { MessageUtil.SetMessage(commonParam, Message.Enum.Common_ThieuTruongThongTinBatBuoc); } WaitingManager.Close(); if (success) { MessageManager.ShowAlert(commonParam, success); CloseWindow = true; } else { MessageManager.Show(commonParam, success); } } catch (Exception ex) { WaitingManager.Close(); LogSystem.Error(ex); } }
internal void LoginLobby(string url, string user, string pass) { if (IsConnected) { m_WebSocket.Close(); } m_IsWaitStart = false; m_HasLoggedOn = false; m_Url = url; m_User = user; m_Pass = pass; ConnectIfNotOpen(); LogSystem.Info("LoginLobby {0} {1} {2} {3}", url, user, pass, LobbyRobot.Robot.GetDateTime()); }
internal static NodeMessage DecodeNodeMessage(string msgStr) { NodeMessage msg = null; if (s_Inited) { try { byte[] msgData = Convert.FromBase64String(msgStr); if (msgData.Length >= 4) { int first = msgData[0]; int second = msgData[1]; int headerFirst = msgData[2]; int headerSecond = msgData[3]; int id = first + (second << 8); int headerSize = headerFirst + (headerSecond << 8); LogSystem.Info("DecodeNodeMessage:{0} {1}", id, msgStr); msg = new NodeMessage(id); Type type = GetMessageType(id); if (null != type) { msg.m_NodeHeader = Encoding.Decode(type, msgData, 4, headerSize); } Type proto = GetMessageProtoType(id); if (null != proto) { msg.m_ProtoData = Encoding.Decode(proto, msgData, 4 + headerSize); } } } catch (Exception ex) { if (null == msgStr) { LogSystem.Error("[Exception] DecodeJsonMessage:{0}\n{1}", ex.Message, ex.StackTrace); } else { LogSystem.Error("[Exception] DecodeJsonMessage:{0} {1}\n{2}", msgStr, ex.Message, ex.StackTrace); } } } return(msg); }
protected override bool ExecCommand(StoryInstance instance, long delta) { Scene scene = instance.Context as Scene; if (null != scene) { if (0 == m_ParamNum) { for (LinkedListNode <UserInfo> linkNode = scene.UserManager.Users.FirstValue; null != linkNode; linkNode = linkNode.Next) { UserInfo info = linkNode.Value; User user = info.CustomData as User; if (null != info && null != user) { MovementStateInfo msi = info.GetMovementStateInfo(); LogSystem.Info("CameraFollowImmediately:{0}", info.GetId()); ArkCrossEngineMessage.Msg_RC_CameraFollow msg = new ArkCrossEngineMessage.Msg_RC_CameraFollow(); msg.obj_id = info.GetId(); msg.is_immediately = true; user.SendMessage(msg); } } } else { int unitId = m_UnitId.Value; NpcInfo npc = scene.SceneContext.GetCharacterInfoByUnitId(unitId) as NpcInfo; if (null != npc) { LogSystem.Info("CameraFollowImmediately:{0}", npc.GetId()); ArkCrossEngineMessage.Msg_RC_CameraFollow msg = new ArkCrossEngineMessage.Msg_RC_CameraFollow(); msg.obj_id = npc.GetId(); msg.is_immediately = true; scene.NotifyAllUser(msg); } } } return(false); }
internal static void Execute(object msg, NetConnection conn) { Msg_RC_AddImpact message = msg as Msg_RC_AddImpact; if (null == message) { return; } int skillId = message.skill_id; int impactId = message.impact_id; EntityInfo target = PluginFramework.Instance.SceneContext.GetEntityById(message.target_id); if (null == target) { LogSystem.Info("Receive Msg_RC_AddImpact, message.target_id={0} is not available", message.target_id); return; } else { LogSystem.Info("Receive Msg_RC_AddImpact, TargetId={0}, ImpactId={1}, SenderId={2}, SkillId={3}", message.target_id, impactId, message.sender_id, skillId); } Vector3 senderPos = Vector3.Zero; EntityInfo sender = PluginFramework.Instance.GetEntityById(message.sender_id); senderPos = sender.GetMovementStateInfo().GetPosition3D(); ImpactInfo impactInfo = new ImpactInfo(impactId); impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.SkillId = skillId; impactInfo.DurationTime = message.duration; impactInfo.SenderPosition = senderPos; impactInfo.ImpactSenderId = message.sender_id; if (null != impactInfo.ConfigData) { target.GetSkillStateInfo().AddImpact(impactInfo); int seq = impactInfo.Seq; if (GfxSkillSystem.Instance.StartSkill(target.GetId(), impactInfo.ConfigData, seq)) { } } }
private void HandleRoleEnterResult(NodeMessage lobbyMsg) { GameFrameworkMessage.NodeMessageWithAccountAndGuid headerData = lobbyMsg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithAccountAndGuid; GameFrameworkMessage.RoleEnterResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.RoleEnterResult; if (null != protoData) { RoleEnterResult.RoleEnterResultEnum ret = protoData.Result; m_Guid = headerData.m_Guid; ClientInfo.Instance.Guid = m_Guid; ClientInfo.Instance.RoleData = protoData; if (ret == RoleEnterResult.RoleEnterResultEnum.Wait) { PluginFramework.Instance.HighlightPrompt("Tip_WaitOffline"); Thread.Sleep(2000); NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId); GameFrameworkMessage.RoleEnter data = new GameFrameworkMessage.RoleEnter(); msg.m_ProtoData = data; SendMessage(msg); LogSystem.Info("Retry RoleEnter {0} {1}", m_AccountId, m_Guid); return; } else if (ret == RoleEnterResult.RoleEnterResultEnum.Success) { //客户端接收服务器传来的数据,创建玩家对象 m_WorldId = protoData.WorldId; /// m_IsLogining = false; m_HasLoggedOn = true; GfxStorySystem.Instance.SendMessage("start_game"); } else if (ret == RoleEnterResult.RoleEnterResultEnum.Reconnect) { //重连用户,等待服务器处理重连过程后返回进场景消息,这种情形不用做任何处理 PluginFramework.Instance.HighlightPrompt("Tip_Reconnecting"); } else { //进入游戏失败 PluginFramework.Instance.HighlightPrompt("Tip_RoleEnterFailed"); } } }
public void SendConcurrentMessage(string msgId, params object[] args) { MessageInfo msgInfo = new MessageInfo(); msgInfo.m_MsgId = msgId; msgInfo.m_Args = args; Queue <MessageInfo> queue; if (m_ConcurrentMessageQueues.TryGetValue(msgId, out queue)) { LogSystem.Info("StoryInstance queue message {0}", msgId); queue.Enqueue(msgInfo); } else { //忽略没有处理的消息 LogSystem.Info("StoryInstance ignore message {0}", msgId); } }
private void NetworkThread() { while (!m_IsQuited) { try { if (m_IsWaitStart) { Thread.Sleep(1000); } else { while (!m_IsQuited && !m_IsConnected && !m_IsWaitStart) { LogSystem.Info("Connect ip:{0} port:{1} key:{2}\nNetPeer Statistic:{3}", m_Ip, m_Port, Key, m_NetClient.Statistics.ToString()); try { m_LastPingTime = 0; m_LastReceivePongTime = 0; m_PingPongNumber = 0; m_WaitShakeHands = false; m_LastShakeHandsTime = 0; ++m_ReconnectCount; TimeUtility.LastResponseTime = 0; m_NetClient.Connect(m_Ip, m_Port); } catch { } for (int ct = 0; ct < c_ConnectionTimeout / 1000 && !m_IsConnected; ++ct) { OnRecvMessage(); LogSystem.Info("Wait NetConnectionStatus.Connected ..."); } if (!m_IsConnected) { m_NetClient.Disconnect("bye for reconnect"); PluginFramework.Instance.QueueAction(PluginFramework.Instance.OnRoomServerDisconnected); } } OnRecvMessage(); } } catch (Exception e) { LogSystem.Error("Exception:{0}\n{1}", e.Message, e.StackTrace); } } }
private void HandleRoleListResult(JsonMessage msg) { JsonData jsonData = msg.m_JsonData; DashFireMessage.Msg_LC_RoleListResult protoData = msg.m_ProtoData as DashFireMessage.Msg_LC_RoleListResult; if (null != protoData) { int ret = protoData.m_Result; if (ret == (int)RoleListResult.Success) { //获取玩家角色数据列表 int userinfoCount = protoData.m_UserInfoCount; List <DashFireMessage.Msg_LC_RoleListResult.UserInfoForMessage> userInfos = protoData.m_UserInfos; if (userInfos.Count > 0) { for (int i = 0; i < userInfos.Count; ++i) { DashFireMessage.Msg_LC_RoleListResult.UserInfoForMessage ui = userInfos[i]; ulong guid = ui.m_UserGuid; JsonMessage sendMsg = new JsonMessage(JsonMessageID.RoleEnter); sendMsg.m_JsonData["m_Account"] = m_User; DashFireMessage.Msg_CL_RoleEnter protoMsg = new DashFireMessage.Msg_CL_RoleEnter(); protoMsg.m_Guid = guid; sendMsg.m_ProtoData = protoMsg; SendMessage(sendMsg); } } else { JsonMessage sendMsg = new JsonMessage(JsonMessageID.CreateRole); sendMsg.m_JsonData["m_Account"] = m_User; sendMsg.m_JsonData["m_HeroId"] = 1; sendMsg.m_JsonData["m_Nickname"] = "Nick_" + m_User; SendMessage(sendMsg); LogSystem.Info("Create Role {0}", m_User); } } } LogSystem.Info("HandleRoleListResult"); }