internal FloorController(ILoggerProvider loggerProvider, Settings settings, BeatSaberUtilities beatSaberUtilities, GameScenesManager gameScenesManager) { _logger = loggerProvider.CreateLogger <FloorController>(); _settings = settings; _beatSaberUtilities = beatSaberUtilities; _gameScenesManager = gameScenesManager; }
public void OnSceneLoaded(Scene newScene, LoadSceneMode mode) { if (_scenesManager == null) { _scenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_scenesManager != null) { _scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish; _scenesManager.transitionDidFinishEvent += (setupData, container) => sceneTransitioned?.Invoke(SceneManager.GetActiveScene()); } } if (newScene.name == "HealthWarning" && SettingsManager.settings.calibrateFullBodyTrackingOnStart) { AvatarManager.instance.avatarTailor.CalibrateFullBodyTracking(); } if (newScene.name == "MenuCore") { MenuButtons.instance.RegisterButton(new MenuButton("Avatars", () => { var mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); var flowCoordinator = new GameObject("AvatarListFlowCoordinator").AddComponent <AvatarListFlowCoordinator>(); mainFlowCoordinator.InvokePrivateMethod("PresentFlowCoordinator", flowCoordinator, null, true, false); })); } }
public CamerasController(ILoggerProvider loggerProvider, Settings settings, GameScenesManager gameScenesManager, MainSettingsModelSO mainSettingsModel) { _logger = loggerProvider.CreateLogger <CamerasController>(); _settings = settings; _gameScenesManager = gameScenesManager; _mainSettingsModel = mainSettingsModel; }
public void Construct([Inject(Id = "FPFCEnabled")] bool fpfcEnabled, [Inject(Id = "ToggleCode")] KeyCode toggleCode, [Inject(Id = "CameraFOV")] float cameraFOV, [Inject(Id = "MoveSensitivity")] float moveSensitivity, GameScenesManager gameScenesManager, MenuScenesTransitionSetupDataSO menuScenesTransitionSetupDataSO) { Enabled = fpfcEnabled; _cameraFOV = cameraFOV; _toggleCode = toggleCode; _moveSensitivity = moveSensitivity; _gameScenesManager = gameScenesManager; _menuScenesTransitionSetupDataSO = menuScenesTransitionSetupDataSO; }
private PlayerAvatarManager(DiContainer container, AvatarTailor avatarTailor, ILoggerProvider loggerProvider, AvatarLoader avatarLoader, Settings settings, AvatarSpawner spawner, GameScenesManager gameScenesManager) { _container = container; _logger = loggerProvider.CreateLogger <PlayerAvatarManager>(); _avatarLoader = avatarLoader; _avatarTailor = avatarTailor; _settings = settings; _spawner = spawner; _gameScenesManager = gameScenesManager; }
private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode) { if (scenesManager == null) { scenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (scenesManager != null) { scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish; } } }
public PlatformSpawner(SiraLog siraLog, System.Random random, MaterialSwapper materialSwapper, AssetLoader assetLoader, EnvironmentHider environmentHider, PlatformManager platformManager, GameScenesManager gameScenesManager, LobbyGameStateModel lobbyGameStateModel) { _siraLog = siraLog; _random = random; _materialSwapper = materialSwapper; _assetLoader = assetLoader; _environmentHider = environmentHider; _platformManager = platformManager; _gameScenesManager = gameScenesManager; _lobbyGameStateModel = lobbyGameStateModel; }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { if (_scenesManager == null) { _scenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_scenesManager != null) { _scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish; } } }
private void OnMenuSceneLoadedFresh() { if (!init) { gsm = SceneManager.GetSceneByName("PCInit").GetRootGameObjects().First <GameObject>(x => x.name == "AppCoreSceneContext")?.GetComponent <MarkSceneAsPersistent>().GetPrivateField <GameScenesManager>("_gameScenesManager"); init = true; PlatformManager.OnLoad(); EnvironmentHider.showFeetOverride = Plugin.config.GetBool("Settings", "AlwaysShowFeet", false, true); EnvironmentArranger.arrangement = (EnvironmentArranger.Arrangement)Plugin.config.GetInt("Settings", "EnvironmentArrangement", 0, true); EnvironmentSceneOverrider.overrideMode = (EnvironmentSceneOverrider.EnvOverrideMode)Plugin.config.GetInt("Settings", "EnvironmentOverrideMode", 0, true); PlatformManager.showHeart = Plugin.config.GetBool("Settings", "ShowHeart", true, true); } }
private void SceneManagerOnActiveSceneChanged(Scene oldScene, Scene newScene) { if (_gameScenesManager == null) { _gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_gameScenesManager == null) { return; } _gameScenesManager.transitionDidFinishEvent += GameScenesManagerOnTransitionDidFinishEvent; } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1) { // Utilities.Logger.log.Info(arg1.name); try { if (arg1.name == SceneNames.Game) { InvokeAll(gameSceneActive); gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (gameScenesManager != null) { gameScenesManager.transitionDidFinishEvent -= GameSceneLoadedCallback; gameScenesManager.transitionDidFinishEvent += GameSceneLoadedCallback; } } else if (arg1.name == SceneNames.Menu) { gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); InvokeAll(menuSceneActive); if (gameScenesManager != null) { if (arg0.name == SceneNames.EmptyTransition && !lastMainSceneWasNotMenu) { // Utilities.Logger.log.Info("Fresh"); gameScenesManager.transitionDidFinishEvent -= OnMenuSceneWasLoadedFresh; gameScenesManager.transitionDidFinishEvent += OnMenuSceneWasLoadedFresh; } else { gameScenesManager.transitionDidFinishEvent -= OnMenuSceneWasLoaded; gameScenesManager.transitionDidFinishEvent += OnMenuSceneWasLoaded; } } lastMainSceneWasNotMenu = false; } if (MainSceneNames.Contains(arg1.name)) { lastMainSceneWasNotMenu = true; } } catch (Exception e) { Logger.log.Error(e); } }
public static bool IsSceneInStackAndActive(this GameScenesManager gameScenesManager, string sceneName) { if (!gameScenesManager.IsSceneInStack(sceneName)) { return(false); } Scene scene = SceneManager.GetSceneByName(sceneName); if (!scene.IsValid()) { return(false); } return(scene.GetRootGameObjects().First().activeInHierarchy); }
void Awake() { if (_instance == null) { _instance = this; } else { Destroy(gameObject); } if (tryCalling) { StartCoroutine(InitialTransition(.5f)); } }
public PlatformSpawner(SiraLog siraLog, PluginConfig config, AssetLoader assetLoader, EnvironmentHider environmentHider, PlatformManager platformManager, GameScenesManager gameScenesManager, LobbyGameStateModel lobbyGameStateModel) { _siraLog = siraLog; _config = config; _assetLoader = assetLoader; _environmentHider = environmentHider; _platformManager = platformManager; _gameScenesManager = gameScenesManager; _lobbyGameStateModel = lobbyGameStateModel; _random = new Random(); }
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { if (prevScene.name == "PCInit") { hasInited = true; } if (hasInited && nextScene.name.Contains("Menu") && prevScene.name == "EmptyTransition") { hasInited = false; BSMLParser.instance.MenuSceneLoaded(); if (gameScenesManager == null) { gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); } gameScenesManager.transitionDidFinishEvent += MenuLoadFresh; } }
private void SceneManagerOnActiveSceneChanged(Scene oldScene, Scene newScene) { // Console.WriteLine(oldScene.name); // Console.WriteLine("Destroying Color Setter"); GameObject.Destroy(GameObject.Find("SongLoader Color Setter")); if (_gameScenesManager == null) { _gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_gameScenesManager == null) { return; } _gameScenesManager.transitionDidFinishEvent += GameScenesManagerOnTransitionDidFinishEvent; } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1) { try { if (arg1.name == Game) { InvokeAll(gameSceneActive); gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (gameScenesManager != null) { gameScenesManager.transitionDidFinishEvent -= GameSceneSceneWasLoaded; gameScenesManager.transitionDidFinishEvent += GameSceneSceneWasLoaded; } } else if (arg1.name == Menu) { gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); InvokeAll(menuSceneActive); if (gameScenesManager != null) { if (arg0.name == EmptyTransition) { gameScenesManager.transitionDidFinishEvent -= OnMenuSceneWasLoadedFresh; gameScenesManager.transitionDidFinishEvent += OnMenuSceneWasLoadedFresh; } else { gameScenesManager.transitionDidFinishEvent -= OnMenuSceneWasLoaded; gameScenesManager.transitionDidFinishEvent += OnMenuSceneWasLoaded; } } } } catch (Exception e) { Console.WriteLine("[BSEvents] " + e); } }
public void OnActiveSceneChanged(Scene _, Scene scene) { if (gameScenesManager == null) { gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); } if (scene.name == "MenuViewControllers") { if (_.name == "EmptyTransition") { BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "PerfectionDisplay.results.bsml"), Resources.FindObjectsOfTypeAll <ResultsViewController>().FirstOrDefault().gameObject, ResultsScreenText.instance); } BSMLSettings.instance.AddSettingsMenu("Perfection Display", "PerfectionDisplay.settings.bsml", Settings.instance); MenuSceneActive(); } if (scene.name == "GameCore") { GameSceneActive(); } }
public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { if (isMenuScene(scene)) { try { flowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().FirstOrDefault(); mainMenuViewController = flowCoordinator.GetPrivateField <MainMenuViewController>("_mainMenuViewController"); //soloModeSelectionViewController = flowCoordinator.GetPrivateField<SoloModeSelectionViewController>("_soloFreePlayFlowCoordinator"); soloFreePlayFlowCoordinator = flowCoordinator.GetPrivateField <SoloFreePlayFlowCoordinator>("_soloFreePlayFlowCoordinator"); detailViewController = soloFreePlayFlowCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); gameplaySetupViewController = soloFreePlayFlowCoordinator.GetPrivateField <GameplaySetupViewController>("_gameplaySetupViewController"); practiceController = soloFreePlayFlowCoordinator.GetPrivateField <PracticeViewController>("_practiceViewController"); beatmapDifficultyViewController = soloFreePlayFlowCoordinator.GetPrivateField <BeatmapDifficultyViewController>("_beatmapDifficultyViewControllerViewController"); listViewController = soloFreePlayFlowCoordinator.GetPrivateField <LevelListViewController>("_levelListViewController"); levelListView = listViewController.GetPrivateField <LevelListTableView>("_levelListTableView"); tableView = levelListView.GetPrivateField <TableView>("_tableView"); gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); standardLevelReturnToMenu = Resources.FindObjectsOfTypeAll <StandardLevelReturnToMenuController>().FirstOrDefault(); } catch (Exception e) { Console.WriteLine(e); } } if (isGameScene(scene)) { if (autoPlay) { } } Console.WriteLine(scene.name); }
public void OnSceneLoaded(Scene newScene, LoadSceneMode mode) { if (_scenesManager == null) { _scenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_scenesManager != null) { _scenesManager.transitionDidFinishEvent += sceneTransitionDidFinish; _scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish; } } if (newScene.name == "MenuCore") { MenuButtons.instance.RegisterButton(new MenuButton("Avatars", () => { var mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); var flowCoordinator = new GameObject("AvatarListFlowCoordinator").AddComponent <AvatarListFlowCoordinator>(); mainFlowCoordinator.InvokePrivateMethod("PresentFlowCoordinator", flowCoordinator, null, true, false); })); } }
public void OnActiveSceneChanged(Scene _, Scene scene) { if (gameScenesManager == null) { gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (gameScenesManager != null) { gameScenesManager.transitionDidFinishEvent += OnTransition; } } if (init) { init = false; if (PerfectDisplay.shouldHitscore && IPA.Loader.PluginManager.Plugins.Any(x => x.Name == "HitScoreVisualizer")) { LoadHitScore(); } else { PerfectDisplay.shouldHitscore = false; } } }
public void OnSceneLoaded(Scene newScene, LoadSceneMode mode) { if (_scenesManager == null) { _scenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (_scenesManager != null) { _scenesManager.transitionDidFinishEvent += sceneTransitionDidFinish; _scenesManager.transitionDidFinishEvent += SceneTransitionDidFinish; } } if (newScene.name == "MenuCore") { try { MenuButtons.instance.RegisterButton(new MenuButton("Avatars", () => { var mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); var flowCoordinator = new GameObject("AvatarListFlowCoordinator") .AddComponent <AvatarListFlowCoordinator>(); mainFlowCoordinator.InvokePrivateMethod("PresentFlowCoordinator", flowCoordinator, null, true, false); })); } catch (Exception) { logger.Warn("Failed to add menu button, spawning mirror instead"); _mirrorContainer = new GameObject(); GameObject.DontDestroyOnLoad(_mirrorContainer); SharedCoroutineStarter.instance.StartCoroutine(MirrorHelper.SpawnMirror(new Vector3(0, 0, -1.5f), Quaternion.Euler(-90f, 180f, 0), new Vector3(0.50f, 1f, 0.25f), _mirrorContainer.transform)); } } }
public GameScenesHelper(GameScenesManager gameScenesManager) { _gameScenesManager = gameScenesManager; _gameScenesManager.transitionDidFinishEvent += OnTransitionDidFinish; }
internal FontLoader(GameScenesManager gameScenesManager) { _gameScenesManager = gameScenesManager; }
public Notifier(TimerSettings settings, ITimerController timerController, GameScenesManager gameScenesManager) { _settings = settings; _timerController = timerController; _gameScenesManager = gameScenesManager; }
internal CanvasContainer(GameScenesManager gameScenesManager) { _gameScenesManager = gameScenesManager; }
public MainCameraController(ILoggerProvider loggerProvider, Settings settings, GameScenesManager gameScenesManager) { _logger = loggerProvider.CreateLogger <MainCameraController>(); _settings = settings; _gameScenesManager = gameScenesManager; }
private CustomLevelStaticData LoadNewSong(CustomSongInfo song, GameScenesManager gameScenesManager) { CustomLevelStaticData newLevel = null; try { newLevel = ScriptableObject.CreateInstance <CustomLevelStaticData>(); newLevel.jsonPath = song.path; } catch (NullReferenceException) { //LevelStaticData.OnEnable throws null reference exception because we don't have time to set _difficultyLevels } ReflectionUtil.SetPrivateField(newLevel, "_levelId", song.levelId); ReflectionUtil.SetPrivateField(newLevel, "_authorName", song.authorName); ReflectionUtil.SetPrivateField(newLevel, "_songName", song.songName); ReflectionUtil.SetPrivateField(newLevel, "_songSubName", song.songSubName); ReflectionUtil.SetPrivateField(newLevel, "_previewStartTime", song.previewStartTime); ReflectionUtil.SetPrivateField(newLevel, "_previewDuration", song.previewDuration); ReflectionUtil.SetPrivateField(newLevel, "_beatsPerMinute", song.beatsPerMinute); StartCoroutine(LoadSprite("file://" + song.path + "/" + song.coverImagePath, newLevel, "_coverImage")); SceneInfo newSceneInfo = ScriptableObject.CreateInstance <SceneInfo>(); ReflectionUtil.SetPrivateField(newSceneInfo, "_gameScenesManager", gameScenesManager); ReflectionUtil.SetPrivateField(newSceneInfo, "_sceneName", song.environmentName); ReflectionUtil.SetPrivateField(newLevel, "_environmetSceneInfo", newSceneInfo); List <CustomLevelStaticData.CustomDifficultyLevel> difficultyLevels = new List <CustomLevelStaticData.CustomDifficultyLevel>(); foreach (CustomSongInfo.DifficultyLevel diffLevel in song.difficultyLevels) { CustomLevelStaticData.CustomDifficultyLevel newDiffLevel = new CustomLevelStaticData.CustomDifficultyLevel(); try { LevelStaticData.Difficulty difficulty = diffLevel.difficulty.ToEnum(LevelStaticData.Difficulty.Normal); ReflectionUtil.SetPrivateField(newDiffLevel, "_difficulty", difficulty); ReflectionUtil.SetPrivateField(newDiffLevel, "_difficultyRank", diffLevel.difficultyRank); if (!File.Exists(song.path + "/" + diffLevel.jsonPath)) { Logger.Log("Couldn't find difficulty json " + song.path + "/" + diffLevel.jsonPath); continue; } newDiffLevel.jsonPath = song.path + "/" + diffLevel.jsonPath; newDiffLevel.audioPath = song.path + "/" + diffLevel.audioPath; difficultyLevels.Add(newDiffLevel); } catch (Exception e) { Logger.Log("Error parsing difficulty level in song: " + song.path); Logger.Log(e.Message); continue; } } if (difficultyLevels.Count == 0) { return(null); } ReflectionUtil.SetPrivateField(newLevel, "_difficultyLevels", difficultyLevels.ToArray()); return(newLevel); }
private void OnSceneChanged(Scene _, Scene scene) { if (gameScenesManager == null) { gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); if (gameScenesManager != null) { gameScenesManager.transitionDidFinishEvent += OnTransition; } } if (init) { init = false; Console.WriteLine(PluginManager.Plugins); if (PerfectDisplay.shouldHitscore && PluginManager.Plugins.Any(x => x.Name == "HitScoreVisualizer")) { LoadHitScore(); } else { PerfectDisplay.shouldHitscore = false; } } if (scene.name.Equals("Menu")) { foreach (var rootGameObject in scene.GetRootGameObjects()) { if (rootGameObject.name.Equals("ViewControllers")) { int extraOffset = 25; Console.WriteLine(rootGameObject.transform.childCount); text = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <TextMeshProUGUI>().Last(x => (x.name == "Title")), rootGameObject.transform.Find("LevelSelection").Find("StandardLevelResultsViewController"), false); text.fontSize = 5; text.color = Color.white; text.paragraphSpacing = -15f; text.text = lastText; text.alignment = TextAlignmentOptions.TopLeft; text.rectTransform.localPosition = new Vector3(-20 + extraOffset, 40, 0); percent = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <TextMeshProUGUI>().Last(x => (x.name == "Title")), rootGameObject.transform.Find("LevelSelection").Find("StandardLevelResultsViewController"), false); percent.fontSize = 5; percent.color = Color.white; percent.paragraphSpacing = -15f; percent.text = lastCount; percent.alignment = TextAlignmentOptions.TopLeft; percent.rectTransform.localPosition = new Vector3(0 + extraOffset, 40, 0); count = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <TextMeshProUGUI>().Last(x => (x.name == "Title")), rootGameObject.transform.Find("LevelSelection").Find("StandardLevelResultsViewController"), false); count.fontSize = 5; count.color = Color.white; count.paragraphSpacing = -15f; count.text = lastPercent; count.alignment = TextAlignmentOptions.TopLeft; count.rectTransform.localPosition = new Vector3(15 + extraOffset, 40, 0); return; } } } if (scene.name.Equals("GameCore")) { new GameObject("PerfectDisplay").AddComponent <PerfectDisplay>(); } }
public void RefreshSongs(bool fullRefresh) { if (SceneManager.GetActiveScene().buildIndex != MenuIndex) { return; } List <CustomSongInfo> songs = _database.GetSongs(); List <string> playlist = GetPlaylist(); // TODO: Put this in DB List <LevelStaticData> newLevelData; GameScenesManager gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); GameDataModel gameDataModel = PersistentSingleton <GameDataModel> .instance; if (OriginalLevelStaticDatas.Count == 0) { foreach (LevelStaticData level in gameDataModel.gameStaticData.worldsData[0].levelsData .ToList()) { OriginalLevelStaticDatas.Add(level); } } if (playlist == null || !_playlistEnabled) { newLevelData = new List <LevelStaticData>(OriginalLevelStaticDatas); } else { songs = FilterByPlaylist(songs, playlist); newLevelData = new List <LevelStaticData>(); } if (fullRefresh) { CustomLevelStaticDatas.Clear(); CustomSongInfos.Clear(); } else { int beforeCount = CustomLevelStaticDatas.Count; CustomSongInfos.RemoveAll(x => !songs.Contains(x)); CustomLevelStaticDatas.RemoveAll(x => !songs.Any(y => y.levelId == x.levelId)); // Check why info and data are not the same if (CustomSongInfos.Count != CustomLevelStaticDatas.Count) { foreach (CustomSongInfo song in CustomSongInfos) { if (!CustomLevelStaticDatas.Any(x => x.levelId == song.levelId)) { Logger.Log("Song at " + song.path + " has some issue"); } } } } Resources.UnloadUnusedAssets(); foreach (CustomSongInfo song in songs) { // Add existing copy of song if (CustomSongInfos.Contains(song)) { foreach (CustomLevelStaticData level in CustomLevelStaticDatas) { if (level.levelId == song.levelId) { //Logger.Log("Readded: " + song.songName); newLevelData.Add(level); break; } } continue; } // Add new songs //Logger.Log("New song found: " + song.songName); CustomLevelStaticData newLevel = LoadNewSong(song, gameScenesManager); if (newLevel != null) { CustomSongInfos.Add(song); newLevel.OnEnable(); newLevelData.Add(newLevel); CustomLevelStaticDatas.Add(newLevel); } } _levels = newLevelData.ToArray(); ReflectionUtil.SetPrivateField(gameDataModel.gameStaticData.worldsData[0], "_levelsData", _levels); SongsLoaded.Invoke(); }