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); }
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; }
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()); } }
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()); } }
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 (autoType == null) { notifications?.Post(new SimpleNotification { Text = "The current ruleset doesn't have an autoplay mod avalaible!" }); return(false); } if (mods.All(m => m.GetType() != autoType)) { Mods.Value = mods.Append(auto).ToArray(); removeAutoModOnResume = true; } } SampleConfirm?.Play(); this.Push(player = new PlayerLoader(() => new Player())); return(true); }