private static void _FinishScreenFading() { if (_Fading == null) { return; } Debug.Assert(NextScreen != null); CurrentScreen.OnClose(); CurrentScreen = NextScreen; NextScreen = null; CurrentScreen.OnShowFinish(); CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType)); if (CurrentScreen.CurrentMusicType == EMusicType.Background || CurrentScreen.CurrentMusicType == EMusicType.Preview || CurrentScreen.CurrentMusicType == EMusicType.BackgroundPreview) { CBackgroundMusic.Disabled = false; CBackgroundMusic.IsPlayingPreview = CurrentScreen.CurrentMusicType == EMusicType.Preview || CurrentScreen.CurrentMusicType == EMusicType.BackgroundPreview; } _Fading = null; }
public int GetMusicVolume(EMusicType type) { return(CConfig.GetVolumeByType(type)); }
public static bool Draw() { if (NextScreen != null && _Fading == null) { _Fading = new CFading(0f, 1f, CConfig.Config.Graphics.FadeTime); if (NextScreen.PartyModeID != -1) { CFonts.PartyModeID = NextScreen.PartyModeID; NextScreen.OnShow(); CFonts.PartyModeID = -1; } else { NextScreen.OnShow(); } if (_Cursor.IsActive) { NextScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y); } HidePopup(EPopupScreens.PopupPlayerControl); if (NextScreen.CurrentMusicType != EMusicType.Background && NextScreen.CurrentMusicType != EMusicType.Preview && NextScreen.CurrentMusicType != EMusicType.BackgroundPreview) { CBackgroundMusic.Disabled = true; } } if (_Fading != null) { Debug.Assert(NextScreen != null); bool finished; float newAlpha = _Fading.GetValue(out finished); if (!finished) { ZOffset = CSettings.ZFar / 2; _DrawScreen(CurrentScreen); GlobalAlpha = newAlpha; ZOffset = 0f; _DrawScreen(NextScreen); GlobalAlpha = 1f; int oldVol = CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType); int newVol = CConfig.GetVolumeByType(NextScreen.CurrentMusicType); CSound.SetGlobalVolume((int)((newVol - oldVol) * newAlpha + oldVol)); } else { _FinishScreenFading(); if (_Cursor.IsActive) { CurrentScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y); } _DrawScreen(CurrentScreen); } } else { _DrawScreen(CurrentScreen); } foreach (IMenu popup in _PopupScreens) { popup.Draw(); } _Cursor.Draw(); _DrawDebugInfos(); return(true); }