/// <summary> /// Coroutine, which unloads profile after a period of time /// </summary> /// <param name="username"></param> /// <param name="delay"></param> /// <returns></returns> private IEnumerator UnloadProfile(string username, float delay) { // Wait for the delay yield return(new WaitForSecondsRealtime(delay)); // If user is not actually logged in, remove the profile if (_auth.IsUserLoggedIn(username)) { yield break; } ObservableServerProfile profile; _profiles.TryGetValue(username, out profile); if (profile == null) { yield break; } // Remove profile _profiles.Remove(username); // Remove listeners profile.ModifiedInServer -= OnProfileChanged; }
/// <summary> /// Coroutine, which unloads profile after a period of time /// </summary> /// <param name="username"></param> /// <param name="delay"></param> /// <returns></returns> private IEnumerator UnloadProfile(string username, float delay) { // Wait for the delay yield return(new WaitForSecondsRealtime(delay)); // If user is not actually logged in, remove the profile if (authModule.IsUserLoggedIn(username)) { yield break; } ProfilesList.TryGetValue(username, out ObservableServerProfile profile); if (profile == null) { yield break; } // Remove profile ProfilesList.Remove(username); // Remove listeners profile.OnModifiedInServerEvent -= OnProfileChangedEventHandler; }