void LoggedIn(NetConnection connection, LoginServer.Account account) { if (!database.HasKey(account.Id + "_chars")) socket.Send("OpenCreator", connection); else { string[] charNames; if (!TryGetCharacterNames(account.Id, out charNames)) { Debug.Log("Get char names failed."); return; } socket.Send("OpenCharacterList", connection, (string[])charNames, true); } }
void Awake() { socket = GetComponent<NetSocket>(); database = GetComponent<StreamDatabaseServer>(); loginServer = GetComponent<LoginServer>(); viewManager = GetComponent<NetViewManager>(); loginServer.OnLoginSuccess += LoggedIn; socket.RegisterRpcListener(this); socket.Events.OnClientDisconnected += ClientDisconnected; }