mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:12:54 +08:00
Merge pull request #1025 from huoyaoyuan/fixes
Implement Ctrl+Enter for Auto in song select.
This commit is contained in:
commit
5cf8121d29
@ -84,6 +84,8 @@ namespace osu.Game.Rulesets.Catch
|
||||
}
|
||||
}
|
||||
|
||||
public override Mod GetAutoplayMod() => new ModAutoplay();
|
||||
|
||||
public override string Description => "osu!catch";
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o };
|
||||
|
@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Mania
|
||||
}
|
||||
}
|
||||
|
||||
public override Mod GetAutoplayMod() => new ModAutoplay();
|
||||
|
||||
public override string Description => "osu!mania";
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o };
|
||||
|
@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Osu
|
||||
}
|
||||
}
|
||||
|
||||
public override Mod GetAutoplayMod() => new OsuModAutoplay();
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap);
|
||||
|
@ -84,6 +84,8 @@ namespace osu.Game.Rulesets.Taiko
|
||||
}
|
||||
}
|
||||
|
||||
public override Mod GetAutoplayMod() => new TaikoModAutoplay();
|
||||
|
||||
public override string Description => "osu!taiko";
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o };
|
||||
|
@ -60,6 +60,8 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };
|
||||
|
||||
public override Mod GetAutoplayMod() => new ModAutoplay();
|
||||
|
||||
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -10,6 +10,9 @@ using System.Linq;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// A textbox which holds focus eagerly.
|
||||
/// </summary>
|
||||
public class FocusedTextBox : OsuTextBox
|
||||
{
|
||||
protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
|
||||
|
@ -8,9 +8,6 @@ using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// A textbox which holds focus eagerly.
|
||||
/// </summary>
|
||||
public class SearchTextBox : FocusedTextBox
|
||||
{
|
||||
protected virtual bool AllowCommit => false;
|
||||
@ -46,10 +43,16 @@ namespace osu.Game.Graphics.UserInterface
|
||||
case Key.Up:
|
||||
case Key.Down:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AllowCommit)
|
||||
{
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.KeypadEnter:
|
||||
case Key.Enter:
|
||||
if (!AllowCommit) return false;
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||
|
||||
public abstract Mod GetAutoplayMod();
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to create a hit renderer for a beatmap
|
||||
/// </summary>
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Screens
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private SampleChannel sampleExit;
|
||||
|
||||
@ -64,7 +64,7 @@ namespace osu.Game.Screens
|
||||
}
|
||||
|
||||
if (osuGame != null)
|
||||
ruleset.BindTo(osuGame.Ruleset);
|
||||
Ruleset.BindTo(osuGame.Ruleset);
|
||||
|
||||
sampleExit = audio.Sample.Get(@"UI/melodic-1");
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Screens
|
||||
{
|
||||
// we only want to apply these restrictions when we are inside a screen stack.
|
||||
// the use case for not applying is in visual/unit tests.
|
||||
ruleset.Disabled = !AllowBeatmapRulesetChange;
|
||||
Ruleset.Disabled = !AllowBeatmapRulesetChange;
|
||||
Beatmap.Disabled = !AllowBeatmapRulesetChange;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -111,13 +110,7 @@ namespace osu.Game.Screens.Play
|
||||
return;
|
||||
}
|
||||
|
||||
Track track = Beatmap.Value.Track;
|
||||
|
||||
if (track != null)
|
||||
adjustableSourceClock = track;
|
||||
|
||||
adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock();
|
||||
|
||||
adjustableSourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||
|
||||
var firstObjectTime = HitRenderer.Objects.First().StartTime;
|
||||
|
@ -1,12 +1,14 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class EditSongSelect : SongSelect
|
||||
{
|
||||
protected override bool ShowFooter => false;
|
||||
|
||||
protected override void OnSelected() => Exit();
|
||||
protected override void OnSelected(InputState state) => Exit();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class MatchSongSelect : SongSelect
|
||||
{
|
||||
protected override void OnSelected() => Exit();
|
||||
protected override void OnSelected(InputState state) => Exit();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
@ -20,6 +22,7 @@ namespace osu.Game.Screens.Select
|
||||
private OsuScreen player;
|
||||
private readonly ModSelectOverlay modSelect;
|
||||
private readonly BeatmapDetailArea beatmapDetails;
|
||||
private bool removeAutoModOnResume;
|
||||
|
||||
public PlaySongSelect()
|
||||
{
|
||||
@ -71,6 +74,13 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
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);
|
||||
@ -100,10 +110,23 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnSelected()
|
||||
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;
|
||||
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
@ -19,7 +18,6 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
|
||||
@ -27,7 +25,6 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen
|
||||
{
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
private BeatmapManager manager;
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
||||
|
||||
@ -109,7 +106,7 @@ namespace osu.Game.Screens.Select
|
||||
Origin = Anchor.CentreRight,
|
||||
SelectionChanged = carouselSelectionChanged,
|
||||
BeatmapsChanged = carouselBeatmapsLoaded,
|
||||
StartRequested = carouselRaisedStart,
|
||||
StartRequested = () => carouselRaisedStart(),
|
||||
});
|
||||
Add(FilterControl = new FilterControl
|
||||
{
|
||||
@ -151,7 +148,7 @@ namespace osu.Game.Screens.Select
|
||||
Add(Footer = new Footer
|
||||
{
|
||||
OnBack = Exit,
|
||||
OnStart = carouselRaisedStart,
|
||||
OnStart = () => carouselRaisedStart(),
|
||||
});
|
||||
|
||||
FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
|
||||
@ -173,7 +170,7 @@ namespace osu.Game.Screens.Select
|
||||
manager = beatmaps;
|
||||
|
||||
if (osu != null)
|
||||
ruleset.BindTo(osu.Ruleset);
|
||||
Ruleset.BindTo(osu.Ruleset);
|
||||
|
||||
manager.BeatmapSetAdded += onBeatmapSetAdded;
|
||||
manager.BeatmapSetRemoved += onBeatmapSetRemoved;
|
||||
@ -201,7 +198,7 @@ namespace osu.Game.Screens.Select
|
||||
carousel.SelectNext();
|
||||
}
|
||||
|
||||
private void carouselRaisedStart()
|
||||
private void carouselRaisedStart(InputState state = null)
|
||||
{
|
||||
// if we have a pending filter operation, we want to run it now.
|
||||
// it could change selection (ie. if the ruleset has been changed).
|
||||
@ -214,7 +211,7 @@ namespace osu.Game.Screens.Select
|
||||
selectionChangedDebounce = null;
|
||||
}
|
||||
|
||||
OnSelected();
|
||||
OnSelected(state);
|
||||
}
|
||||
|
||||
private ScheduledDelegate selectionChangedDebounce;
|
||||
@ -256,7 +253,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
else
|
||||
{
|
||||
ruleset.Value = beatmap.Ruleset;
|
||||
Ruleset.Value = beatmap.Ruleset;
|
||||
|
||||
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
|
||||
sampleChangeDifficulty.Play();
|
||||
@ -278,7 +275,7 @@ namespace osu.Game.Screens.Select
|
||||
carousel.SelectNextRandom();
|
||||
}
|
||||
|
||||
protected abstract void OnSelected();
|
||||
protected abstract void OnSelected(InputState state);
|
||||
|
||||
private void filterChanged(FilterCriteria criteria, bool debounce = true)
|
||||
{
|
||||
@ -406,7 +403,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
case Key.KeypadEnter:
|
||||
case Key.Enter:
|
||||
carouselRaisedStart();
|
||||
carouselRaisedStart(state);
|
||||
return true;
|
||||
case Key.Delete:
|
||||
if (state.Keyboard.ShiftPressed)
|
||||
|
Loading…
Reference in New Issue
Block a user