public void Connect(int id, Action <Session> onConnect = null) { var info = ServerConfigInfo.Get(id); if (info == null) { Logger.LogWarning("<b><color=#FFFFFF>[{0}]</color></b> Could not find server [{1}] from config.", m_typeName, id); return; } UpdateServer(info); Connect(onConnect); }
public static void UpdateServerInfo() { if (m_server == null) { m_server = new ServerConfigInfo(); } var si = ServerConfigInfo.Get(m_defaultServer); m_server.CopyFrom(si ?? ServerConfigInfo.defaultServer); m_server.ID = m_defaultServer; Logger.LogDetail("Set default server to <color=#00DDFF><b>[{0}]</b></color>", m_server); }
private void OnSetCommand(string[] subcommands, CommandInfo info) { if (subcommands.Length < 3) { m_sb.Append(info.usage); return; } var t = subcommands[1]; var v = subcommands[2]; switch (t) { case "server": { var vi = Util.Parse <int>(v); if (vi != 0) { var si = ServerConfigInfo.Get(vi); if (si != null) { Root.defaultServer = vi; } else { m_sb.AppendFormat("Could not find server [{0}] from config", vi); return; } } var p = subcommands.Length > 3 ? Util.Parse <int>(subcommands[3]) : 12345; if (p == 0) { p = 12345; } session.UpdateServer(v, p); break; } case "log": Logger.enabled = v == "on"; break; default: m_sb.Append(info.usage); break; } }
public void UpdateServer(int id) { UpdateServer(ServerConfigInfo.Get(id)); }