mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 11:27:24 +08:00
Merge remote-tracking branch 'origin/master' into ruleset-configs
This commit is contained in:
commit
5742e61e68
@ -11,13 +11,14 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class Column : ScrollingPlayfield, IHasAccentColour
|
public class Column : ScrollingPlayfield, IKeyBindingHandler<ManiaAction>, IHasAccentColour
|
||||||
{
|
{
|
||||||
private const float key_icon_size = 10;
|
private const float key_icon_size = 10;
|
||||||
private const float key_icon_corner_radius = 3;
|
private const float key_icon_corner_radius = 3;
|
||||||
@ -259,5 +260,26 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
public bool OnPressed(ManiaAction action) => Pressed?.Invoke(action) ?? false;
|
public bool OnPressed(ManiaAction action) => Pressed?.Invoke(action) ?? false;
|
||||||
public bool OnReleased(ManiaAction action) => Released?.Invoke(action) ?? false;
|
public bool OnReleased(ManiaAction action) => Released?.Invoke(action) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(ManiaAction action)
|
||||||
|
{
|
||||||
|
// Play the sounds of the next hitobject
|
||||||
|
if (HitObjects.AliveObjects.Any())
|
||||||
|
{
|
||||||
|
// If there are alive hitobjects, we can abuse the fact that AliveObjects are sorted by time (see: Add())
|
||||||
|
HitObjects.AliveObjects.First().PlaySamples();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If not, we do a slow search - we might want to do a BinarySearch here if this becomes problematic
|
||||||
|
// We fallback to LastOrDefault() if we're beyond the last note in the map
|
||||||
|
var hitObject = HitObjects.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ?? HitObjects.Objects.LastOrDefault();
|
||||||
|
hitObject?.PlaySamples();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(ManiaAction action) => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ namespace osu.Game.Online.API
|
|||||||
userReq.Success += u =>
|
userReq.Success += u =>
|
||||||
{
|
{
|
||||||
LocalUser.Value = u;
|
LocalUser.Value = u;
|
||||||
|
Username = LocalUser.Value.Username;
|
||||||
failureCount = 0;
|
failureCount = 0;
|
||||||
|
|
||||||
//we're connected!
|
//we're connected!
|
||||||
|
@ -5,8 +5,6 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -20,10 +18,12 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Overlays.Music;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Overlays.Music;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -65,6 +65,12 @@ namespace osu.Game.Overlays
|
|||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(InputState state)
|
||||||
|
{
|
||||||
|
base.OnDragStart(state);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnDrag(InputState state)
|
protected override bool OnDrag(InputState state)
|
||||||
{
|
{
|
||||||
if (base.OnDrag(state)) return true;
|
if (base.OnDrag(state)) return true;
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(SettingsOverlay settings)
|
private void load(MainSettings settings)
|
||||||
{
|
{
|
||||||
StateContainer = settings;
|
StateContainer = settings;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
|
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
|
||||||
|
|
||||||
protected void PlaySamples() => Samples.ForEach(s => s?.Play());
|
/// <summary>
|
||||||
|
/// Plays all the hitsounds for this <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
public void PlaySamples() => Samples.ForEach(s => s?.Play());
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,12 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
private readonly InfoContainer info;
|
private readonly InfoContainer info;
|
||||||
private readonly ArrowsOverlay arrowsOverlay;
|
private readonly ArrowsOverlay arrowsOverlay;
|
||||||
|
|
||||||
|
public BreakOverlay(bool letterboxing, ScoreProcessor scoreProcessor)
|
||||||
|
: this(letterboxing)
|
||||||
|
{
|
||||||
|
bindProcessor(scoreProcessor);
|
||||||
|
}
|
||||||
|
|
||||||
public BreakOverlay(bool letterboxing)
|
public BreakOverlay(bool letterboxing)
|
||||||
{
|
{
|
||||||
this.letterboxing = letterboxing;
|
this.letterboxing = letterboxing;
|
||||||
@ -148,7 +154,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
arrowsOverlay.Hide();
|
arrowsOverlay.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindProcessor(ScoreProcessor processor)
|
private void bindProcessor(ScoreProcessor processor)
|
||||||
{
|
{
|
||||||
info.AccuracyDisplay.Current.BindTo(processor.Accuracy);
|
info.AccuracyDisplay.Current.BindTo(processor.Accuracy);
|
||||||
info.GradeDisplay.Current.BindTo(processor.Rank);
|
info.GradeDisplay.Current.BindTo(processor.Rank);
|
||||||
|
@ -6,6 +6,8 @@ using osu.Framework.Configuration;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -39,7 +41,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private static bool hasShownNotificationOnce;
|
private static bool hasShownNotificationOnce;
|
||||||
|
|
||||||
public HUDOverlay()
|
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, DecoupleableInterpolatingFramedClock decoupledClock, WorkingBeatmap working, IAdjustableClock adjustableSourceClock)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -59,6 +61,18 @@ namespace osu.Game.Screens.Play
|
|||||||
ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
|
ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
BindProcessor(scoreProcessor);
|
||||||
|
BindRulesetContainer(rulesetContainer);
|
||||||
|
|
||||||
|
Progress.Objects = rulesetContainer.Objects;
|
||||||
|
Progress.AudioClock = decoupledClock;
|
||||||
|
Progress.AllowSeeking = rulesetContainer.HasReplayLoaded;
|
||||||
|
Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
||||||
|
|
||||||
|
ModDisplay.Current.BindTo(working.Mods);
|
||||||
|
|
||||||
|
ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
@ -115,7 +129,7 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
|
protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
|
||||||
{
|
{
|
||||||
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
|
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
|
||||||
|
|
||||||
@ -201,7 +215,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay();
|
protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay();
|
||||||
|
|
||||||
public virtual void BindProcessor(ScoreProcessor processor)
|
protected virtual void BindProcessor(ScoreProcessor processor)
|
||||||
{
|
{
|
||||||
ScoreCounter?.Current.BindTo(processor.TotalScore);
|
ScoreCounter?.Current.BindTo(processor.TotalScore);
|
||||||
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Framework.Logging;
|
|
||||||
using osu.Framework.Screens;
|
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Framework.Audio;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
using osu.Game.Screens.Ranking;
|
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Threading;
|
||||||
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osu.Game.Screens.Play.BreaksOverlay;
|
using osu.Game.Screens.Play.BreaksOverlay;
|
||||||
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -79,7 +79,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private BreakOverlay breakOverlay;
|
|
||||||
private Container storyboardContainer;
|
private Container storyboardContainer;
|
||||||
private DrawableStoryboard storyboard;
|
private DrawableStoryboard storyboard;
|
||||||
|
|
||||||
@ -155,6 +154,8 @@ namespace osu.Game.Screens.Play
|
|||||||
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
||||||
userAudioOffset.TriggerChange();
|
userAudioOffset.TriggerChange();
|
||||||
|
|
||||||
|
scoreProcessor = RulesetContainer.CreateScoreProcessor();
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
storyboardContainer = new Container
|
storyboardContainer = new Container
|
||||||
@ -170,13 +171,12 @@ namespace osu.Game.Screens.Play
|
|||||||
OnRetry = Restart,
|
OnRetry = Restart,
|
||||||
OnQuit = Exit,
|
OnQuit = Exit,
|
||||||
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
|
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
|
||||||
OnPause = () => {
|
OnPause = () =>
|
||||||
|
{
|
||||||
pauseContainer.Retries = RestartCount;
|
pauseContainer.Retries = RestartCount;
|
||||||
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
|
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
|
||||||
},
|
},
|
||||||
OnResume = () => {
|
OnResume = () => hudOverlay.KeyCounter.IsCounting = true,
|
||||||
hudOverlay.KeyCounter.IsCounting = true;
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -186,12 +186,12 @@ namespace osu.Game.Screens.Play
|
|||||||
Child = RulesetContainer,
|
Child = RulesetContainer,
|
||||||
},
|
},
|
||||||
new SkipButton(firstObjectTime) { AudioClock = decoupledClock },
|
new SkipButton(firstObjectTime) { AudioClock = decoupledClock },
|
||||||
hudOverlay = new HUDOverlay
|
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, decoupledClock, working, adjustableSourceClock)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
},
|
},
|
||||||
breakOverlay = new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks)
|
new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, scoreProcessor)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -207,7 +207,8 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
new HotkeyRetryOverlay
|
new HotkeyRetryOverlay
|
||||||
{
|
{
|
||||||
Action = () => {
|
Action = () =>
|
||||||
|
{
|
||||||
//we want to hide the hitrenderer immediately (looks better).
|
//we want to hide the hitrenderer immediately (looks better).
|
||||||
//we may be able to remove this once the mouse cursor trail is improved.
|
//we may be able to remove this once the mouse cursor trail is improved.
|
||||||
RulesetContainer?.Hide();
|
RulesetContainer?.Hide();
|
||||||
@ -216,24 +217,9 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
scoreProcessor = RulesetContainer.CreateScoreProcessor();
|
|
||||||
|
|
||||||
if (showStoryboard)
|
if (showStoryboard)
|
||||||
initializeStoryboard(false);
|
initializeStoryboard(false);
|
||||||
|
|
||||||
hudOverlay.BindProcessor(scoreProcessor);
|
|
||||||
hudOverlay.BindRulesetContainer(RulesetContainer);
|
|
||||||
|
|
||||||
hudOverlay.Progress.Objects = RulesetContainer.Objects;
|
|
||||||
hudOverlay.Progress.AudioClock = decoupledClock;
|
|
||||||
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
|
||||||
|
|
||||||
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
|
|
||||||
|
|
||||||
breakOverlay.BindProcessor(scoreProcessor);
|
|
||||||
|
|
||||||
hudOverlay.ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock;
|
|
||||||
|
|
||||||
// Bind ScoreProcessor to ourselves
|
// Bind ScoreProcessor to ourselves
|
||||||
scoreProcessor.AllJudged += onCompletion;
|
scoreProcessor.AllJudged += onCompletion;
|
||||||
scoreProcessor.Failed += onFail;
|
scoreProcessor.Failed += onFail;
|
||||||
|
Loading…
Reference in New Issue
Block a user