// Update is called once per frame void Update() { if (!init) { return; } // Wait until the scene is fully loaded if (!transitionFinished) { return; } GameSettingsScreen.Draw(); Util.TranslateRawImage(ref backgroundImage, Globals.BackgroundOffset); float ratio; switch (GameState.TransitionState) { case TransitionState.LeavingLoadScreen: ratio = DrawLoadingScreenTransition(false); if (ratio >= 1.0f) { GameState.TransitionState = TransitionState.ScreenActive; GameState.GameMode = Mode.GameSettings; } break; case TransitionState.ScreenActive: transitionStartTime = -1; break; case TransitionState.EnteringLoadingScreen: ratio = DrawLoadingScreenTransition(true); if (ratio <= 0.0f) { GameState.TransitionState = TransitionState.SwitchingScreens; loadStarted = false; } break; case TransitionState.SwitchingScreens: if (!loadStarted) { Globals.CurrentNoteCollection = new NoteCollection(SongSelection.GetSelectedMetadata()); Globals.CurrentSongMetadata = Globals.CurrentNoteCollection.ParseFile(); Globals.MusicManager.LoadSong(Globals.CurrentSongMetadata.FilePath + Globals.CurrentSongMetadata.SongFilename, Globals.CurrentSongMetadata.BpmEvents); Globals.MusicManager.Offset = Globals.CurrentSongMetadata.PlaybackOffset * 1000; StartCoroutine(Util.SwitchSceneAsync()); loadStarted = true; } break; default: break; } }
// Update is called once per frame void Update() { if (!init) { return; } // Wait until the scene is fully loaded if (!transitionFinished) { return; } // Always draw cards (this has to happen before the loading screen slides open) if (SongSelection.Songlist.Count > 0) { Util.TranslateRawImage(ref backgroundImage, Globals.BackgroundOffset); if (SongSelection.SelectedFolderIndex == -1) { folderCards.SetActive(true); levelCards.SetActive(false); songCards.SetActive(false); UpdateMetadata(false); UpdateLoopedSong(true); for (int i = 0; i < folderCards.Count; i++) { folderCards[i].Shift(i, SongSelection.CurrentFolderIndex, SongSelectionMovement.IsAnimating(), SongSelectionMovement.AnimationMovement.x, SongSelectionMovement.AnimationMovement.y); } } else { if (SongSelection.FolderParams[SongSelection.SelectedFolderIndex].Type == SortType.Level && SongSelection.SelectedLevelIndex == -1) { folderCards.SetActive(false); levelCards.SetActive(true); songCards.SetActive(false); UpdateMetadata(false); UpdateLoopedSong(true); for (int i = 0; i < levelCards.Count; i++) { levelCards[i].Shift(i, SongSelection.CurrentLevelIndex, SongSelectionMovement.IsAnimating(), SongSelectionMovement.AnimationMovement.x, SongSelectionMovement.AnimationMovement.y); } } else { folderCards.SetActive(false); levelCards.SetActive(false); songCards.SetActive(true); UpdateMetadata(true); UpdateLoopedSong(false); for (int i = 0; i < SongSelection.Songlist.Count; i++) { var card = songCards.FirstOrDefault(x => ((SongCard)x).SongID == SongSelection.Songlist[i].SongID); card.Shift(i, SongSelection.CurrentSongIndex, SongSelectionMovement.IsAnimating(), SongSelectionMovement.AnimationMovement.x, SongSelectionMovement.AnimationMovement.y); int diff = i == SongSelection.CurrentSongIndex ? SongSelection.CurrentSongLevelIndex : -1; ((SongCard)card).SetDifficulty(diff); } } } } this.transform.Find("AutoModeText").gameObject.SetActive(GameState.CurrentSettings.AutoSetting != Settings.AutoMode.Off); float ratio; switch (GameState.TransitionState) { case TransitionState.LeavingLoadScreen: ratio = DrawLoadingScreenTransition(false); if (ratio >= 1.0f) { GameState.TransitionState = TransitionState.ScreenActive; GameState.GameMode = Mode.SongSelect; } break; case TransitionState.ScreenActive: transitionStartTime = -1; break; case TransitionState.EnteringLoadingScreen: ratio = DrawLoadingScreenTransition(true); if (ratio <= 0.0f) { GameState.TransitionState = TransitionState.SwitchingScreens; loadStarted = false; } break; case TransitionState.SwitchingScreens: if (!loadStarted) { Globals.CurrentNoteCollection = new NoteCollection(SongSelection.GetSelectedMetadata()); Globals.CurrentSongMetadata = Globals.CurrentNoteCollection.ParseFile(); // If music is currently looping, cease it now. Globals.MusicManager.EndSongLoop(this); Globals.MusicManager.LoadSong(Globals.CurrentSongMetadata.FilePath + Globals.CurrentSongMetadata.SongFilename, Globals.CurrentSongMetadata.BpmEvents); Globals.MusicManager.Offset = Globals.CurrentSongMetadata.PlaybackOffset * 1000; StartCoroutine(Util.SwitchSceneAsync()); loadStarted = true; } break; default: break; } }