protected override void OnSelected(InputState state) { if (player != null) { return; } if (state?.Keyboard.ControlPressed == true) { var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var autoType = auto.GetType(); var mods = modSelect.SelectedMods.Value; if (mods.All(m => m.GetType() != autoType)) { modSelect.SelectedMods.Value = mods.Concat(new[] { auto }); removeAutoModOnResume = true; } } Beatmap.Value.Track.Looping = false; Beatmap.Disabled = true; LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); }
protected override bool OnStart() { if (player != null) { return(false); } // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var autoType = auto.GetType(); var mods = Mods.Value; if (mods.All(m => m.GetType() != autoType)) { Mods.Value = mods.Append(auto).ToArray(); removeAutoModOnResume = true; } } Beatmap.Value.Track.Looping = false; SampleConfirm?.Play(); this.Push(player = new PlayerLoader(() => new Player())); return(true); }
private void setTarget(OsuScreen target) { if (target == null) { return; } Debug.Assert(skinEditor != null); if (!target.IsLoaded) { Scheduler.AddOnce(setTarget, target); return; } if (skinEditor.State.Value == Visibility.Visible) { skinEditor.UpdateTargetScreen(target); } else { skinEditor.Hide(); skinEditor.Expire(); skinEditor = null; } }
private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; if (currentScreen == null) { Exit(); return; } //central game mode change logic. if (!currentScreen.ShowOverlays) { options.State = Visibility.Hidden; Toolbar.State = Visibility.Hidden; musicController.State = Visibility.Hidden; chat.State = Visibility.Hidden; } else { Toolbar.State = Visibility.Visible; } ScreenChanged?.Invoke(newScreen); }
private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; if (currentScreen == null) { Exit(); return; } //central game screen change logic. if (!currentScreen.ShowOverlays) { foreach (var container in overlayContainers(true)) { container.State = Visibility.Hidden; } } else { Toolbar.State = Visibility.Visible; } ScreenChanged?.Invoke(newScreen); }
private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; if (currentScreen == null) { Exit(); return; } //central game screen change logic. if (!currentScreen.ShowOverlays) { settings.State = Visibility.Hidden; Toolbar.State = Visibility.Hidden; musicController.State = Visibility.Hidden; chat.State = Visibility.Hidden; direct.State = Visibility.Hidden; social.State = Visibility.Hidden; userProfile.State = Visibility.Hidden; } else { Toolbar.State = Visibility.Visible; } ScreenChanged?.Invoke(newScreen); }
private void screenAdded(Screen newScreen) { currentScreen = (OsuScreen)newScreen; newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; }
protected override void Start() { if (player != null) { return; } // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var autoType = auto.GetType(); var mods = modSelect.SelectedMods.Value; if (mods.All(m => m.GetType() != autoType)) { modSelect.SelectedMods.Value = mods.Concat(new[] { auto }); removeAutoModOnResume = true; } } Beatmap.Value.Track.Looping = false; Beatmap.Disabled = true; sampleConfirm?.Play(); LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); }
protected override bool OnStart() { if (player != null) return false; // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var autoType = auto.GetType(); var mods = SelectedMods.Value; if (mods.All(m => m.GetType() != autoType)) { SelectedMods.Value = mods.Append(auto); removeAutoModOnResume = true; } } Beatmap.Value.Track.Looping = false; Beatmap.Disabled = true; SampleConfirm?.Play(); LoadComponentAsync(player = new PlayerLoader(() => new Player()), l => { if (this.IsCurrentScreen())this.Push(player); }); return true; }
private void screenAdded(Screen newScreen) { currentScreen = (OsuScreen)newScreen; Logger.Log($"Screen changed → {currentScreen}"); newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; }
protected void LoadScreen(OsuScreen screen) { if (stack.CurrentScreen != null) { stack.Exit(); } stack.Push(screen); }
private void screenAdded(Screen newScreen) { currentSubScreen = (OsuScreen)newScreen; updatePollingRate(isIdle.Value); newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; }
protected override void OnResuming(Screen last) { player = null; Beatmap.Value.Track.Looping = true; base.OnResuming(last); }
public void OnResuming(IScreen last) { this.FadeIn(250); this.ScaleTo(1, 250, Easing.OutSine); logo?.AppendAnimatingAction(() => OsuScreen.ApplyLogoArrivingDefaults(logo), true); updatePollingRate(isIdle.Value); }
private void screenRemoved(Screen newScreen) { currentScreen = (OsuScreen)newScreen; if (newScreen == null) { Exit(); } }
protected void PrepareMenuLoad() { nextScreen = createNextScreen?.Invoke(); if (nextScreen != null) { LoadComponentAsync(nextScreen); } }
public override void OnResuming(ScreenTransitionEvent e) { base.OnResuming(e); if (playerLoader != null) { Mods.Value = modsAtGameplayStart; playerLoader = null; } }
public override void OnResuming(IScreen last) { base.OnResuming(last); if (playerLoader != null) { Mods.Value = modsAtGameplayStart; playerLoader = null; } }
private void screenRemoved(Screen newScreen) { if (currentSubScreen is MatchSubScreen) { cancelLooping(); } currentSubScreen = (OsuScreen)newScreen; updatePollingRate(isIdle.Value); }
private void screenRemoved(Screen newScreen) { currentScreen = (OsuScreen)newScreen; Logger.Log($"Screen changed ← {currentScreen}"); if (newScreen == null) { Exit(); } }
protected override void OnSelected() { if (player != null) { return; } Beatmap.Value.Track.Looping = false; LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); }
protected override void OnSelected() { if (player != null) { return; } (player = new PlayerLoader(new Player { Beatmap = Beatmap, //eagerly set this so it's present before push. })).LoadAsync(Game, l => Push(player)); }
protected override void OnResuming(Screen last) { player = null; if (removeAutoModOnResume) { var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType(); ModSelect.DeselectTypes(new[] { autoType }, true); removeAutoModOnResume = false; } base.OnResuming(last); }
protected override void OnResuming(Screen last) { player = null; changeBackground(Beatmap); ensurePlayingSelected(); base.OnResuming(last); Content.FadeIn(250); Content.ScaleTo(1, 250, EasingTypes.OutSine); filter.Activate(); }
protected override bool OnStart() { if (playerLoader != null) { return(false); } modsAtGameplayStart = Mods.Value; // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { var autoInstance = getAutoplayMod(); if (autoInstance == null) { notifications?.Post(new SimpleNotification { Text = "The current ruleset doesn't have an autoplay mod avalaible!" }); return(false); } var mods = Mods.Value.Append(autoInstance).ToArray(); if (!ModUtils.CheckCompatibleSet(mods, out var invalid)) { mods = mods.Except(invalid).Append(autoInstance).ToArray(); } Mods.Value = mods; } SampleConfirm?.Play(); this.Push(playerLoader = new PlayerLoader(createPlayer)); return(true); Player createPlayer() { var replayGeneratingMod = Mods.Value.OfType <ICreateReplayData>().FirstOrDefault(); if (replayGeneratingMod != null) { return(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateScoreFromReplayData(beatmap, mods))); } return(new SoloPlayer()); } }
public void LoadScreen(OsuScreen screen) => Schedule(() => { nextScreen = screen; if (IsCurrentScreen) { Push(screen); nextScreen = null; } else { MakeCurrent(); } });
protected override void OnResuming(Screen last) { player = null; if (removeAutoModOnResume) { var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType(); modSelect.SelectedMods.Value = modSelect.SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray(); removeAutoModOnResume = false; } Beatmap.Value.Track.Looping = true; base.OnResuming(last); }
protected override bool OnStart() { if (playerLoader != null) { return(false); } // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { var autoInstance = getAutoplayMod(); if (autoInstance == null) { notifications?.Post(new SimpleNotification { Text = "The current ruleset doesn't have an autoplay mod avalaible!" }); return(false); } var mods = Mods.Value; if (mods.All(m => m.GetType() != autoInstance.GetType())) { Mods.Value = mods.Append(autoInstance).ToArray(); removeAutoModOnResume = true; } } SampleConfirm?.Play(); this.Push(playerLoader = new PlayerLoader(createPlayer)); return(true); Player createPlayer() { var replayGeneratingMod = Mods.Value.OfType <ICreateReplay>().FirstOrDefault(); if (replayGeneratingMod != null) { return(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods))); } return(new SoloPlayer()); } }
/// <summary> /// Set a new target screen which will be used to find skinnable components. /// </summary> public void SetTarget(OsuScreen screen) { lastTargetScreen = screen; if (skinEditor == null) { return; } skinEditor.Save(); // ensure the toolbar is re-hidden even if a new screen decides to try and show it. updateComponentVisibility(); // AddOnce with parameter will ensure the newest target is loaded if there is any overlap. Scheduler.AddOnce(setTarget, screen); }