mirror of
https://github.com/ppy/osu.git
synced 2024-11-18 00:12:54 +08:00
d7c09e7dbd
# Conflicts: # osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs # osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs # osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs # osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs # osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs # osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs # osu.Game/Graphics/OsuFont.cs # osu.Game/Online/API/Requests/Responses/APILegacyScoreInfo.cs # osu.Game/Overlays/Profile/Header/BadgeContainer.cs # osu.Game/Overlays/Profile/ProfileHeader.cs # osu.Game/Screens/Select/PlaySongSelect.cs # osu.Game/Skinning/LegacySkinDecoder.cs
77 lines
2.2 KiB
C#
77 lines
2.2 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Linq;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Framework.Screens;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Screens.Play;
|
|
using osuTK.Input;
|
|
|
|
namespace osu.Game.Screens.Select
|
|
{
|
|
public class PlaySongSelect : SongSelect
|
|
{
|
|
private bool removeAutoModOnResume;
|
|
private OsuScreen player;
|
|
|
|
public override bool AllowExternalScreenChange => true;
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(OsuColour colours)
|
|
{
|
|
BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () =>
|
|
{
|
|
ValidForResume = false;
|
|
Edit();
|
|
}, Key.Number3);
|
|
}
|
|
|
|
public override void OnResuming(IScreen last)
|
|
{
|
|
player = null;
|
|
|
|
if (removeAutoModOnResume)
|
|
{
|
|
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
|
ModSelect.DeselectTypes(new[] { autoType }, true);
|
|
removeAutoModOnResume = false;
|
|
}
|
|
|
|
base.OnResuming(last);
|
|
}
|
|
|
|
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();
|
|
|
|
LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
|
|
{
|
|
if (this.IsCurrentScreen()) this.Push(player);
|
|
});
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|