/// <summary> /// Attempts to retrieve the UserInfo. Returns null if <see cref="IPlatformUserModel"/> is unavailable. /// </summary> /// <returns></returns> /// <exception cref="InvalidOperationException">Thrown if <see cref="IPlatformUserModel"/> returns null for the <see cref="UserInfo"/>.</exception> public static async Task <UserInfo> GetUserAsync() { try { if (!isReady) { await shouldBeReadyTask.Task; } await Task.Delay(200); lock (getUserLock) { IPlatformUserModel platformUserModel = GetPlatformUserModel(); if (platformUserModel == null) { Logger.log.Error($"IPlatformUserModel not found, cannot update user info."); return(null); } if (getUserTask == null || getUserTask.Status == TaskStatus.Faulted) { getUserTask = InternalGetUserAsync(); } } return(await getUserTask); } catch (Exception ex) { Logger.log.Error($"Error retrieving UserInfo: {ex.Message}."); Logger.log.Debug(ex); throw; } }
internal static IPlatformUserModel SetPlatformUserModel() { if (_platformUserModel != null) { return(_platformUserModel); } try { // Need to check for null because there's multiple PlatformLeaderboardsModels (at least sometimes), and one has a null IPlatformUserModel with 'vrmode oculus' var leaderboardsModel = Resources.FindObjectsOfTypeAll <PlatformLeaderboardsModel>().Where(p => AccessPlatformUserModel(ref p) != null).LastOrDefault(); // Logger.log.Info(Resources.FindObjectsOfTypeAll<PlatformLeaderboardsModel>().Count().ToString()); IPlatformUserModel platformUserModel = null; if (leaderboardsModel == null) { Logger.log.Error($"Could not find a 'PlatformLeaderboardsModel', GetUserInfo unavailable."); return(null); } if (AccessPlatformUserModel == null) { Logger.log.Error($"Accessor for 'PlatformLeaderboardsModel._platformUserModel' is null, GetUserInfo unavailable."); return(null); } platformUserModel = AccessPlatformUserModel(ref leaderboardsModel); _platformUserModel = platformUserModel; } catch (Exception ex) { Logger.log.Error($"Error getting 'IPlatformUserModel', GetUserInfo unavailable: {ex.Message}"); Logger.log.Debug(ex); } return(_platformUserModel); }
public AprilFools(ScoreController scoreController, IPlatformUserModel platformUserModel, CachedMediaAsyncLoader cachedMediaAsyncLoader, AudioTimeSyncController audioTimeSyncController) { _random = new Random(); _scoreController = scoreController; _platformUserModel = platformUserModel; _cachedMediaAsyncLoader = cachedMediaAsyncLoader; _audioTimeSyncController = audioTimeSyncController; }
public DetailViewHost(SiraLog siraLog, LevelDataService levelDataService, IPlatformUserModel platformUserModel, DetailContextManager detailContextManager) { _siraLog = siraLog; _levelDataService = levelDataService; _platformUserModel = platformUserModel; _detailContextManager = detailContextManager; _cts = new CancellationTokenSource(); }
internal PlaylistUIManager(AnnotatedBeatmapLevelCollectionsViewController annotatedBeatmapLevelCollectionsViewController, SelectLevelCategoryViewController selectLevelCategoryViewController, StandardLevelDetailViewController standardLevelDetailViewController, List <ILevelCategoryUpdater> levelCategoryUpdaters, IPMRefreshable refreshable, IPlatformUserModel platformUserModel) { this.annotatedBeatmapLevelCollectionsViewController = annotatedBeatmapLevelCollectionsViewController; this.selectLevelCategoryViewController = selectLevelCategoryViewController; this.standardLevelDetailViewController = standardLevelDetailViewController; this.levelCategoryUpdaters = levelCategoryUpdaters; this.refreshable = refreshable; this.platformUserModel = platformUserModel; }
PlaylistUIManager(AnnotatedBeatmapLevelCollectionsViewController annotatedBeatmapLevelCollectionsViewController, SelectLevelCategoryViewController selectLevelCategoryViewController, LevelPackDetailViewController levelPackDetailViewController, StandardLevelDetailViewController standardLevelDetailViewController, PlaylistViewController playlistViewController, ILevelCollectionUpdater levelCollectionUpdater, List <IPreviewBeatmapLevelUpdater> previewBeatmapLevelUpdaters, List <IPlaylistManagerModal> playlistManagerModals, List <IRefreshable> refreshables, IPlatformUserModel platformUserModel) { this.annotatedBeatmapLevelCollectionsViewController = annotatedBeatmapLevelCollectionsViewController; this.selectLevelCategoryViewController = selectLevelCategoryViewController; this.levelPackDetailViewController = levelPackDetailViewController; this.standardLevelDetailViewController = standardLevelDetailViewController; this.playlistViewController = playlistViewController; this.levelCollectionUpdater = levelCollectionUpdater; this.previewBeatmapLevelUpdaters = previewBeatmapLevelUpdaters; this.playlistManagerModals = playlistManagerModals; this.refreshables = refreshables; this.platformUserModel = platformUserModel; }
internal LevelDataService(SiraLog siraLog, IPlatformUserModel platformUserModel, UBinder <Plugin, PluginMetadata> metadataBinder) { _siraLog = siraLog; _platformUserModel = platformUserModel; _beatSaver = new BeatSaver("DiTails", Version.Parse(metadataBinder.Value.HVersion.ToString())); }