Resolve merge conflicts

This commit is contained in:
TocoToucan
2018-01-21 18:11:43 +03:00
94 changed files with 854 additions and 337 deletions

View File

@ -566,7 +566,6 @@ namespace osu.Game.Beatmaps
using (var stream = new StreamReader(reader.GetStream(mapName)))
metadata = Decoder.GetDecoder(stream).DecodeBeatmap(stream).Metadata;
// check if a set already exists with the same online id.
if (metadata.OnlineBeatmapSetID != null)
beatmapSet = beatmaps.BeatmapSets.FirstOrDefault(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID);
@ -581,7 +580,6 @@ namespace osu.Game.Beatmaps
Metadata = metadata
};
var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));
foreach (var name in mapNames)
@ -693,7 +691,6 @@ namespace osu.Game.Beatmaps
{
try
{
using (var beatmap = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
{
Decoder decoder = Decoder.GetDecoder(beatmap);

View File

@ -156,6 +156,7 @@ namespace osu.Game.Beatmaps
public IQueryable<BeatmapInfo> Beatmaps => GetContext().BeatmapInfo
.Include(b => b.BeatmapSet).ThenInclude(s => s.Metadata)
.Include(b => b.BeatmapSet).ThenInclude(s => s.Files).ThenInclude(f => f.FileInfo)
.Include(b => b.Metadata)
.Include(b => b.Ruleset)
.Include(b => b.BaseDifficulty);

View File

@ -27,7 +27,6 @@ namespace osu.Game.Beatmaps
Beatmap = CreateBeatmapConverter(beatmap).Convert(beatmap);
Mods = mods ?? new Mod[0];
ApplyMods(Mods);
PreprocessHitObjects();

View File

@ -137,7 +137,7 @@ namespace osu.Game.Beatmaps.Formats
CentreRight,
BottomLeft,
BottomRight
};
}
internal enum StoryLayer
{

View File

@ -30,7 +30,9 @@ namespace osu.Game.Graphics.Backgrounds
/// </summary>
private const float edge_smoothness = 1;
public override bool HandleInput => false;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
public Color4 ColourLight = Color4.White;
public Color4 ColourDark = Color4.Black;

View File

@ -0,0 +1,67 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
namespace osu.Game.Graphics.Cursor
{
/// <summary>
/// A container which provides a <see cref="MenuCursor"/> which can be overridden by hovered <see cref="Drawable"/>s.
/// </summary>
public class CursorOverrideContainer : Container, IProvideCursor
{
protected override Container<Drawable> Content => content;
private readonly Container content;
/// <summary>
/// Whether any cursors can be displayed.
/// </summary>
public bool CanShowCursor = true;
public CursorContainer Cursor { get; }
public bool ProvidingUserCursor => true;
public CursorOverrideContainer()
{
AddRangeInternal(new Drawable[]
{
Cursor = new MenuCursor { State = Visibility.Hidden },
content = new Container { RelativeSizeAxes = Axes.Both }
});
}
private InputManager inputManager;
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
}
private IProvideCursor currentTarget;
protected override void Update()
{
base.Update();
if (!CanShowCursor)
{
currentTarget?.Cursor?.Hide();
return;
}
var newTarget = inputManager.HoveredDrawables.OfType<IProvideCursor>().FirstOrDefault(t => t.ProvidingUserCursor) ?? this;
if (currentTarget == newTarget)
return;
currentTarget?.Cursor?.Hide();
newTarget.Cursor?.Show();
currentTarget = newTarget;
}
}
}

View File

@ -0,0 +1,26 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Graphics.Cursor
{
/// <summary>
/// Interface for <see cref="IDrawable"/>s that display cursors which can replace the user's cursor.
/// </summary>
public interface IProvideCursor : IDrawable
{
/// <summary>
/// The cursor provided by this <see cref="IDrawable"/>.
/// May be null if no cursor should be visible.
/// </summary>
CursorContainer Cursor { get; }
/// <summary>
/// Whether <see cref="Cursor"/> should be displayed as the singular user cursor. This will temporarily hide any other user cursor.
/// This value is checked every frame and may be used to control whether multiple cursors are displayed (e.g. watching replays).
/// </summary>
bool ProvidingUserCursor { get; }
}
}

View File

@ -99,8 +99,8 @@ namespace osu.Game.Graphics.Cursor
protected override void PopOut()
{
ActiveCursor.FadeTo(0, 900, Easing.OutQuint);
ActiveCursor.ScaleTo(0, 500, Easing.In);
ActiveCursor.FadeTo(0, 250, Easing.OutQuint);
ActiveCursor.ScaleTo(0.6f, 250, Easing.In);
}
[BackgroundDependencyLoader]

View File

@ -42,7 +42,9 @@ namespace osu.Game.Graphics.UserInterface
//don't allow clicking between transitions and don't make the chevron clickable
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos);
public override bool HandleInput => State == Visibility.Visible;
public override bool HandleKeyboardInput => State == Visibility.Visible;
public override bool HandleMouseInput => State == Visibility.Visible;
private Visibility state;

View File

@ -180,7 +180,6 @@ namespace osu.Game.Graphics.UserInterface
}
}
protected class OsuTabDropdownHeader : OsuDropdownHeader
{
public override Color4 AccentColour

View File

@ -56,7 +56,6 @@ namespace osu.Game.Online.API
}
catch
{
}
return null;
}

View File

@ -157,6 +157,11 @@ namespace osu.Game
{
base.LoadComplete();
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
// in the cursor being shown for a few frames during the intro.
// This prevents the cursor from showing until we have a screen with CursorVisible = true
CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
// hook up notifications to components.
BeatmapManager.PostNotification = n => notifications?.Post(n);
BeatmapManager.GetStableStorage = GetStorageForStableInstall;
@ -297,8 +302,6 @@ namespace osu.Game
else
Toolbar.State = Visibility.Visible;
};
Cursor.State = Visibility.Hidden;
}
private void forwardLoggedErrorsToNotifications()
@ -447,7 +450,7 @@ namespace osu.Game
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden;
CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
}
private void screenAdded(Screen newScreen)

View File

@ -44,6 +44,8 @@ namespace osu.Game
protected KeyBindingStore KeyBindingStore;
protected CursorOverrideContainer CursorOverrideContainer;
protected override string MainResourceFile => @"osu.Game.Resources.dll";
public APIAccess API;
@ -52,8 +54,6 @@ namespace osu.Game
protected override Container<Drawable> Content => content;
protected MenuCursor Cursor;
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
private Bindable<bool> fpsDisplayVisible;
@ -211,21 +211,14 @@ namespace osu.Game
GlobalKeyBindingInputManager globalBinding;
base.Content.Add(new DrawSizePreservingFillContainer
CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both };
CursorOverrideContainer.Child = globalBinding = new GlobalKeyBindingInputManager(this)
{
Children = new Drawable[]
{
Cursor = new MenuCursor(),
globalBinding = new GlobalKeyBindingInputManager(this)
{
RelativeSizeAxes = Axes.Both,
Child = content = new OsuTooltipContainer(Cursor)
{
RelativeSizeAxes = Axes.Both,
}
}
}
});
RelativeSizeAxes = Axes.Both,
Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both }
};
base.Content.Add(new DrawSizePreservingFillContainer { Child = CursorOverrideContainer });
KeyBindingStore.Register(globalBinding);
dependencies.Cache(globalBinding);

View File

@ -82,7 +82,8 @@ namespace osu.Game.Overlays.BeatmapSet
if (Playing.Value && preview != null)
{
progress.Width = (float)(preview.CurrentTime / preview.Length);
// prevent negative (potential infinite) width if a track without length was loaded
progress.Width = preview.Length > 0 ? (float)(preview.CurrentTime / preview.Length) : 0f;
}
}

View File

@ -219,7 +219,6 @@ namespace osu.Game.Overlays.Chat
}
else
contentFlow.Text = message.Content;
}
private class MessageSender : OsuClickableContainer, IHasContextMenu

View File

@ -65,7 +65,6 @@ namespace osu.Game.Overlays.Direct
Colour = Color4.Black.Opacity(0.3f),
};
[BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapManager beatmaps, OsuColour colours, BeatmapSetOverlay beatmapSetOverlay)
{

View File

@ -9,6 +9,7 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
@ -39,6 +40,8 @@ namespace osu.Game.Overlays.Direct
private readonly SpriteIcon icon;
private readonly LoadingAnimation loadingAnimation;
private readonly BindableDouble muteBindable = new BindableDouble();
private const float transition_duration = 500;
private bool loading
@ -83,9 +86,10 @@ namespace osu.Game.Overlays.Direct
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
private void load(OsuColour colour, AudioManager audio)
{
hoverColour = colour.Yellow;
this.audio = audio;
}
protected override bool OnClick(InputState state)
@ -128,21 +132,30 @@ namespace osu.Game.Overlays.Direct
return;
}
Preview.Seek(0);
Preview.Start();
Preview.Restart();
audio.Track.AddAdjustment(AdjustableProperty.Volume, muteBindable);
}
else
{
audio.Track.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
Preview?.Stop();
loading = false;
}
}
private TrackLoader trackLoader;
private AudioManager audio;
private void beginAudioLoad()
{
if (trackLoader != null) return;
if (trackLoader != null)
{
Preview = trackLoader.Preview;
Playing.TriggerChange();
return;
}
loading = true;
@ -164,6 +177,7 @@ namespace osu.Game.Overlays.Direct
private readonly string preview;
public Track Preview;
private TrackManager trackManager;
public TrackLoader(string preview)
{
@ -171,10 +185,22 @@ namespace osu.Game.Overlays.Direct
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
private void load(AudioManager audio, FrameworkConfigManager config)
{
// create a local trackManager to bypass the mute we are applying above.
audio.AddItem(trackManager = new TrackManager(new OnlineStore()));
// add back the user's music volume setting (since we are no longer in the global TrackManager's hierarchy).
config.BindWith(FrameworkSetting.VolumeMusic, trackManager.Volume);
if (!string.IsNullOrEmpty(preview))
Preview = audio.Track.Get(preview);
Preview = trackManager.Get(preview);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
trackManager?.Dispose();
}
}
}

View File

@ -313,6 +313,14 @@ namespace osu.Game.Overlays
api.Queue(getSetsRequest);
}
protected override void PopOut()
{
base.PopOut();
if (playing != null)
playing.PreviewPlaying.Value = false;
}
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
public class ResultCounts

View File

@ -183,8 +183,6 @@ namespace osu.Game.Overlays.MedalSplash
description.FadeInFromZero(duration * 2);
break;
}
}
}

View File

@ -148,7 +148,6 @@ namespace osu.Game.Overlays.Music
private class PlaylistItemHandle : SpriteIcon
{
public PlaylistItemHandle()
{
Anchor = Anchor.TopLeft;

View File

@ -230,7 +230,6 @@ namespace osu.Game.Overlays.Music
items.ChangeChildDepth(draggedItem, dstIndex);
}
private class ItemSearchContainer : FillFlowContainer<PlaylistItem>, IHasFilterableChildren
{
public IEnumerable<string> FilterTerms => new string[] { };

View File

@ -168,5 +168,4 @@ namespace osu.Game.Overlays.Notifications
// the layout portion of this is being tracked as a framework issue (https://github.com/ppy/osu-framework/issues/1297).
protected override bool RequiresChildrenUpdate => true;
}
}

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Framework.Graphics.Colour;
namespace osu.Game.Overlays.Notifications
{
public class ProgressCompletionNotification : SimpleNotification

View File

@ -217,7 +217,6 @@ namespace osu.Game.Overlays.Notifications
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{

View File

@ -22,7 +22,8 @@ namespace osu.Game.Overlays
{
private readonly Container box;
public override bool HandleInput => false;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
private readonly SpriteText textLine1;
private readonly SpriteText textLine2;
@ -121,7 +122,7 @@ namespace osu.Game.Overlays
trackSetting(frameworkConfig.GetBindable<string>(FrameworkSetting.AudioDevice), v => display(v, "Audio Device", string.IsNullOrEmpty(v) ? "Default" : v, v));
trackSetting(frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay), v => display(v, "Debug Logs", v ? "visible" : "hidden", "Ctrl+F10"));
Action displayResolution = delegate { display(null, "Screen Resolution", frameworkConfig.Get<int>(FrameworkSetting.Width) + "x" + frameworkConfig.Get<int>(FrameworkSetting.Height)); };
void displayResolution() => display(null, "Screen Resolution", frameworkConfig.Get<int>(FrameworkSetting.Width) + "x" + frameworkConfig.Get<int>(FrameworkSetting.Height));
trackSetting(frameworkConfig.GetBindable<int>(FrameworkSetting.Width), v => displayResolution());
trackSetting(frameworkConfig.GetBindable<int>(FrameworkSetting.Height), v => displayResolution());

View File

@ -319,11 +319,11 @@ namespace osu.Game.Overlays.Profile
colourBar.Show();
}
Action<SpriteText> boldItalic = t =>
void boldItalic(SpriteText t)
{
t.Font = @"Exo2.0-BoldItalic";
t.Alpha = 1;
};
}
if (user.Age != null)
{
@ -474,7 +474,8 @@ namespace osu.Game.Overlays.Profile
private class LinkFlowContainer : OsuTextFlowContainer
{
public override bool HandleInput => true;
public override bool HandleKeyboardInput => true;
public override bool HandleMouseInput => true;
public LinkFlowContainer(Action<SpriteText> defaultCreationParameters = null) : base(defaultCreationParameters)
{
@ -488,7 +489,8 @@ namespace osu.Game.Overlays.Profile
{
private readonly OsuHoverContainer content;
public override bool HandleInput => content.Action != null;
public override bool HandleKeyboardInput => content.Action != null;
public override bool HandleMouseInput => content.Action != null;
protected override Container<Drawable> Content => content ?? (Container<Drawable>)this;

View File

@ -87,7 +87,8 @@ namespace osu.Game.Overlays.Toolbar
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
}
public override bool HandleInput => !ruleset.Disabled;
public override bool HandleKeyboardInput => !ruleset.Disabled;
public override bool HandleMouseInput => !ruleset.Disabled;
private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300);

View File

@ -165,7 +165,8 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
}
private bool isActive = true;
public override bool HandleInput => isActive;
public override bool HandleKeyboardInput => isActive;
public override bool HandleMouseInput => isActive;
public override void Hide()
{

View File

@ -40,7 +40,8 @@ namespace osu.Game.Rulesets.Judgements
Anchor = Anchor.Centre,
Text = judgement.Result.GetDescription().ToUpper(),
Font = @"Venera",
TextSize = 16
Scale = new Vector2(0.85f, 1),
TextSize = 12
}
};
}

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mods
{
const float ratio = 1.4f;
difficulty.CircleSize *= 1.3f; // CS uses a custom 1.3 ratio.
difficulty.ApproachRate *= ratio;
difficulty.ApproachRate = Math.Min(difficulty.ApproachRate * ratio, 10.0f);
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
}

View File

@ -29,79 +29,55 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
public virtual Color4 AccentColour { get; set; } = Color4.Gray;
// Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first
protected virtual string SampleNamespace => null;
protected List<SampleChannel> Samples = new List<SampleChannel>();
protected virtual IEnumerable<SampleInfo> GetSamples() => HitObject.Samples;
private List<DrawableHitObject> nestedHitObjects;
public IReadOnlyList<DrawableHitObject> NestedHitObjects => nestedHitObjects;
public event Action<DrawableHitObject, Judgement> OnJudgement;
public event Action<DrawableHitObject, Judgement> OnJudgementRemoved;
public IReadOnlyList<Judgement> Judgements => judgements;
private readonly List<Judgement> judgements = new List<Judgement>();
/// <summary>
/// Whether a visible judgement should be displayed when this representation is hit.
/// </summary>
public virtual bool DisplayJudgement => true;
public override bool RemoveCompletedTransforms => false;
public override bool RemoveWhenNotAlive => false;
protected override bool RequiresChildrenUpdate => true;
public virtual bool AllJudged => false;
protected DrawableHitObject(HitObject hitObject)
{
HitObject = hitObject;
}
/// <summary>
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been hit.
/// </summary>
public bool IsHit => Judgements.Any(j => j.Final && j.IsHit) && (NestedHitObjects?.All(n => n.IsHit) ?? true);
/// <summary>
/// Processes this <see cref="DrawableHitObject"/>, checking if any judgements have occurred.
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been judged.
/// </summary>
/// <param name="userTriggered">Whether the user triggered this process.</param>
/// <returns>Whether a judgement has occurred from this <see cref="DrawableHitObject"/> or any nested <see cref="DrawableHitObject"/>s.</returns>
protected internal virtual bool UpdateJudgement(bool userTriggered) => false;
private List<DrawableHitObject> nestedHitObjects;
public IReadOnlyList<DrawableHitObject> NestedHitObjects => nestedHitObjects;
protected virtual void AddNested(DrawableHitObject h)
{
if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject>();
nestedHitObjects.Add(h);
}
/// <summary>
/// The screen-space point that causes this <see cref="DrawableHitObject"/> to be selected in the Editor.
/// </summary>
public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre;
/// <summary>
/// The screen-space quad that outlines this <see cref="DrawableHitObject"/> for selections in the Editor.
/// </summary>
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
}
public abstract class DrawableHitObject<TObject> : DrawableHitObject
where TObject : HitObject
{
public event Action<DrawableHitObject, Judgement> OnJudgement;
public event Action<DrawableHitObject, Judgement> OnJudgementRemoved;
public new readonly TObject HitObject;
public override bool HandleInput => Interactive;
public bool Interactive = true;
public bool AllJudged => (!ProvidesJudgement || judgementFinalized) && (NestedHitObjects?.All(h => h.AllJudged) ?? true);
/// <summary>
/// Whether this <see cref="DrawableHitObject"/> can be judged.
/// </summary>
protected virtual bool ProvidesJudgement => true;
private readonly List<Judgement> judgements = new List<Judgement>();
public IReadOnlyList<Judgement> Judgements => judgements;
private bool judgementOccurred;
private bool judgementFinalized => judgements.LastOrDefault()?.Final == true;
protected List<SampleChannel> Samples = new List<SampleChannel>();
protected virtual IEnumerable<SampleInfo> GetSamples() => HitObject.Samples;
public bool Interactive = true;
public override bool HandleKeyboardInput => Interactive;
public override bool HandleMouseInput => Interactive;
// Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first
protected virtual string SampleNamespace => null;
public override bool RemoveWhenNotAlive => false;
public override bool RemoveCompletedTransforms => false;
protected override bool RequiresChildrenUpdate => true;
public readonly Bindable<ArmedState> State = new Bindable<ArmedState>();
protected DrawableHitObject(TObject hitObject)
: base(hitObject)
protected DrawableHitObject(HitObject hitObject)
{
HitObject = hitObject;
}
@ -153,18 +129,52 @@ namespace osu.Game.Rulesets.Objects.Drawables
State.TriggerChange();
}
protected void PlaySamples()
{
Samples.ForEach(s => s?.Play());
}
private bool judgementOccurred;
private bool judgementFinalized => judgements.LastOrDefault()?.Final == true;
protected abstract void UpdateState(ArmedState state);
/// <summary>
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been judged.
/// Bind to apply a custom state which can override the default implementation.
/// </summary>
public sealed override bool AllJudged => (!ProvidesJudgement || judgementFinalized) && (NestedHitObjects?.All(h => h.AllJudged) ?? true);
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
protected void PlaySamples() => Samples.ForEach(s => s?.Play());
protected override void Update()
{
base.Update();
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
while (judgements.Count > 0)
{
var lastJudgement = judgements[judgements.Count - 1];
if (lastJudgement.TimeOffset + endTime <= Time.Current)
break;
judgements.RemoveAt(judgements.Count - 1);
State.Value = ArmedState.Idle;
OnJudgementRemoved?.Invoke(this, lastJudgement);
}
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
UpdateJudgement(false);
}
protected virtual void AddNested(DrawableHitObject h)
{
if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject>();
h.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j);
h.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(d, j);
h.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j);
nestedHitObjects.Add(h);
}
/// <summary>
/// Notifies that a new judgement has occurred for this <see cref="DrawableHitObject"/>.
@ -200,7 +210,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary>
/// <param name="userTriggered">Whether the user triggered this process.</param>
/// <returns>Whether a judgement has occurred from this <see cref="DrawableHitObject"/> or any nested <see cref="DrawableHitObject"/>s.</returns>
protected internal sealed override bool UpdateJudgement(bool userTriggered)
protected bool UpdateJudgement(bool userTriggered)
{
judgementOccurred = false;
@ -229,51 +239,30 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <param name="userTriggered">Whether the user triggered this check.</param>
/// <param name="timeOffset">The offset from the <see cref="HitObject"/> end time at which this check occurred. A <paramref name="timeOffset"/> &gt; 0
/// implies that this check occurred after the end time of <see cref="HitObject"/>. </param>
protected virtual void CheckForJudgements(bool userTriggered, double timeOffset) { }
protected override void Update()
protected virtual void CheckForJudgements(bool userTriggered, double timeOffset)
{
base.Update();
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
while (judgements.Count > 0)
{
var lastJudgement = judgements[judgements.Count - 1];
if (lastJudgement.TimeOffset + endTime <= Time.Current)
break;
judgements.RemoveAt(judgements.Count - 1);
State.Value = ArmedState.Idle;
OnJudgementRemoved?.Invoke(this, lastJudgement);
}
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
UpdateJudgement(false);
}
protected override void AddNested(DrawableHitObject h)
{
base.AddNested(h);
if (!(h is DrawableHitObject<TObject> hWithJudgement))
return;
hWithJudgement.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j);
hWithJudgement.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(d, j);
hWithJudgement.ApplyCustomUpdateState += (d, s) => ApplyCustomUpdateState?.Invoke(d, s);
}
/// <summary>
/// Bind to apply a custom state which can override the default implementation.
/// The screen-space point that causes this <see cref="DrawableHitObject"/> to be selected in the Editor.
/// </summary>
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre;
protected abstract void UpdateState(ArmedState state);
/// <summary>
/// The screen-space quad that outlines this <see cref="DrawableHitObject"/> for selections in the Editor.
/// </summary>
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
}
public abstract class DrawableHitObject<TObject> : DrawableHitObject
where TObject : HitObject
{
public new readonly TObject HitObject;
protected DrawableHitObject(TObject hitObject)
: base(hitObject)
{
HitObject = hitObject;
}
}
}

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Objects.Types
{
/// <summary>

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Objects.Types
{
/// <summary>

View File

@ -52,7 +52,6 @@ namespace osu.Game.Rulesets.Replays
protected ReplayFrame()
{
}
public ReplayFrame(double time, float? mouseX, float? mouseY, ReplayButtonState buttonState)

View File

@ -10,6 +10,7 @@ using osu.Game.Database;
using osu.Game.IO.Legacy;
using osu.Game.IPC;
using osu.Game.Rulesets.Replays;
using osu.Game.Users;
using SharpCompress.Compressors.LZMA;
namespace osu.Game.Rulesets.Scoring
@ -54,7 +55,7 @@ namespace osu.Game.Rulesets.Scoring
var beatmapHash = sr.ReadString();
score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash);
/* score.PlayerName = */
sr.ReadString();
score.User = new User { Username = sr.ReadString() };
/* var localScoreChecksum = */
sr.ReadString();
/* score.Count300 = */
@ -107,7 +108,10 @@ namespace osu.Game.Rulesets.Scoring
using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize))
using (var reader = new StreamReader(lzma))
{
score.Replay = createLegacyReplay(reader);
score.Replay.User = score.User;
}
}
}
@ -129,9 +133,22 @@ namespace osu.Game.Rulesets.Scoring
{
var split = l.Split('|');
if (split.Length < 4 || float.Parse(split[0]) < 0) continue;
if (split.Length < 4)
continue;
lastTime += float.Parse(split[0]);
if (split[0] == "-12345")
{
// Todo: The seed is provided in split[3], which we'll need to use at some point
continue;
}
var diff = float.Parse(split[0]);
lastTime += diff;
// Todo: At some point we probably want to rewind and play back the negative-time frames
// but for now we'll achieve equal playback to stable by skipping negative frames
if (diff < 0)
continue;
frames.Add(new ReplayFrame(
lastTime,

View File

@ -2,11 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using OpenTK;
using osu.Game.Rulesets.Judgements;
using osu.Framework.Allocation;
namespace osu.Game.Rulesets.UI
@ -20,14 +20,16 @@ namespace osu.Game.Rulesets.UI
public Container<Drawable> ScaledContent;
/// <summary>
/// Whether we are currently providing the local user a gameplay cursor.
/// </summary>
public virtual bool ProvidingUserCursor => false;
protected override Container<Drawable> Content => content;
private readonly Container<Drawable> content;
private List<Playfield> nestedPlayfields;
/// <summary>
/// All the <see cref="Playfield"/>s nested inside this playfield.
/// </summary>
public IReadOnlyList<Playfield> NestedPlayfields => nestedPlayfields;
/// <summary>
/// A container for keeping track of DrawableHitObjects.
/// </summary>
@ -69,7 +71,7 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield.
/// </summary>
public virtual void PostProcess() { }
public virtual void PostProcess() => nestedPlayfields?.ForEach(p => p.PostProcess());
/// <summary>
/// Adds a DrawableHitObject to this Playfield.
@ -84,11 +86,17 @@ namespace osu.Game.Rulesets.UI
public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h);
/// <summary>
/// Triggered when a new <see cref="Judgement"/> occurs on a <see cref="DrawableHitObject"/>.
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
/// </summary>
/// <param name="judgedObject">The object that <paramref name="judgement"/> occured for.</param>
/// <param name="judgement">The <see cref="Judgement"/> that occurred.</param>
public virtual void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { }
/// <param name="otherPlayfield">The <see cref="Playfield"/> to add.</param>
protected void AddNested(Playfield otherPlayfield)
{
if (nestedPlayfields == null)
nestedPlayfields = new List<Playfield>();
nestedPlayfields.Add(otherPlayfield);
}
/// <summary>
/// Creates the container that will be used to contain the <see cref="DrawableHitObject"/>s.

View File

@ -13,6 +13,8 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
@ -44,14 +46,9 @@ namespace osu.Game.Rulesets.UI
public PassThroughInputManager KeyBindingInputManager;
/// <summary>
/// Whether we are currently providing the local user a gameplay cursor.
/// Whether a replay is currently loaded.
/// </summary>
public virtual bool ProvidingUserCursor => false;
/// <summary>
/// Whether we have a replay loaded currently.
/// </summary>
public bool HasReplayLoaded => ReplayInputManager?.ReplayInputHandler != null;
public readonly BindableBool HasReplayLoaded = new BindableBool();
public abstract IEnumerable<HitObject> Objects { get; }
@ -61,6 +58,11 @@ namespace osu.Game.Rulesets.UI
/// </summary>
public Playfield Playfield => playfield.Value;
/// <summary>
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
/// </summary>
public readonly CursorContainer Cursor;
protected readonly Ruleset Ruleset;
/// <summary>
@ -71,6 +73,8 @@ namespace osu.Game.Rulesets.UI
{
Ruleset = ruleset;
playfield = new Lazy<Playfield>(CreatePlayfield);
Cursor = CreateCursor();
}
public abstract ScoreProcessor CreateScoreProcessor();
@ -96,8 +100,16 @@ namespace osu.Game.Rulesets.UI
Replay = replay;
ReplayInputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null;
}
/// <summary>
/// Creates the cursor. May be null if the <see cref="RulesetContainer"/> doesn't provide a custom cursor.
/// </summary>
protected virtual CursorContainer CreateCursor() => null;
/// <summary>
/// Creates a Playfield.
/// </summary>
@ -144,8 +156,6 @@ namespace osu.Game.Rulesets.UI
/// </summary>
protected readonly bool IsForCurrentRuleset;
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor<TObject>(this);
protected override Container<Drawable> Content => content;
@ -212,6 +222,9 @@ namespace osu.Game.Rulesets.UI
AddInternal(KeyBindingInputManager);
KeyBindingInputManager.Add(Playfield);
if (Cursor != null)
KeyBindingInputManager.Add(Cursor);
loadObjects();
}
@ -252,12 +265,7 @@ namespace osu.Game.Rulesets.UI
if (drawableObject == null)
continue;
drawableObject.OnJudgement += (d, j) =>
{
Playfield.OnJudgement(d, j);
OnJudgement?.Invoke(j);
};
drawableObject.OnJudgement += (d, j) => OnJudgement?.Invoke(j);
drawableObject.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(j);
Playfield.Add(drawableObject);

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -76,25 +75,6 @@ namespace osu.Game.Rulesets.UI.Scrolling
HitObjects.TimeRange.BindTo(VisibleTimeRange);
}
private List<ScrollingPlayfield> nestedPlayfields;
/// <summary>
/// All the <see cref="ScrollingPlayfield"/>s nested inside this playfield.
/// </summary>
public IEnumerable<ScrollingPlayfield> NestedPlayfields => nestedPlayfields;
/// <summary>
/// Adds a <see cref="ScrollingPlayfield"/> to this playfield. The nested <see cref="ScrollingPlayfield"/>
/// will be given all of the same speed adjustments as this playfield.
/// </summary>
/// <param name="otherPlayfield">The <see cref="ScrollingPlayfield"/> to add.</param>
protected void AddNested(ScrollingPlayfield otherPlayfield)
{
if (nestedPlayfields == null)
nestedPlayfields = new List<ScrollingPlayfield>();
nestedPlayfields.Add(otherPlayfield);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (!UserScrollSpeedAdjustment)

View File

@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield playfield)
{
playfield.HitObjects.AddControlPoint(controlPoint);
playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p));
playfield.NestedPlayfields?.OfType<ScrollingPlayfield>().ForEach(p => applySpeedAdjustment(controlPoint, p));
}
/// <summary>

View File

@ -5,6 +5,5 @@ namespace osu.Game.Screens.Backgrounds
{
public class BackgroundScreenEmpty : BackgroundScreen
{
}
}

View File

@ -222,7 +222,8 @@ namespace osu.Game.Screens.Menu
boxHoverLayer.FadeOut(800, Easing.OutExpo);
}
public override bool HandleInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
public override bool HandleKeyboardInput => state != ButtonState.Exploded;
public override bool HandleMouseInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f;
protected override void Update()
{

View File

@ -157,7 +157,6 @@ namespace osu.Game.Screens.Menu
return true;
}
return false;
}
@ -200,7 +199,8 @@ namespace osu.Game.Screens.Menu
private MenuState state;
public override bool HandleInput => state != MenuState.Exit;
public override bool HandleKeyboardInput => state != MenuState.Exit;
public override bool HandleMouseInput => state != MenuState.Exit;
public MenuState State
{

View File

@ -19,8 +19,7 @@ namespace osu.Game.Screens.Menu
private Color4 iconColour;
public override bool ShowOverlaysOnEnter => false;
public override bool HasLocalCursorDisplayed => true;
public override bool CursorVisible => false;
public Disclaimer()
{

View File

@ -31,9 +31,8 @@ namespace osu.Game.Screens.Menu
private SampleChannel welcome;
private SampleChannel seeya;
public override bool HasLocalCursorDisplayed => true;
public override bool ShowOverlaysOnEnter => false;
public override bool CursorVisible => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using OpenTK;
using OpenTK.Graphics;
@ -188,7 +187,7 @@ namespace osu.Game.Screens.Menu
mediumRing.ResizeTo(130, 340, Easing.OutQuad);
mediumRing.Foreground.ResizeTo(1, 880, Easing.Out);
Func<double> remainingTime = () => length - TransformDelay;
double remainingTime() => length - TransformDelay;
using (BeginDelayedSequence(250, true))
{

View File

@ -64,7 +64,8 @@ namespace osu.Game.Screens.Menu
private readonly float[] frequencyAmplitudes = new float[256];
public override bool HandleInput => false;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
private Shader shader;
private readonly Texture texture;

View File

@ -19,7 +19,8 @@ namespace osu.Game.Screens.Menu
{
public class MenuSideFlashes : BeatSyncedContainer
{
public override bool HandleInput => false;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();

View File

@ -231,7 +231,7 @@ namespace osu.Game.Screens.Menu
/// <param name="waitForPrevious">If true, the new animation is delayed until all previous transforms finish. If false, existing transformed are cleared.</param>
public void AppendAnimatingAction(Action action, bool waitForPrevious)
{
Action runnableAction = () =>
void runnableAction()
{
if (waitForPrevious)
this.DelayUntilTransformsFinished().Schedule(action);
@ -240,12 +240,12 @@ namespace osu.Game.Screens.Menu
ClearTransforms();
action();
}
};
}
if (IsLoaded)
runnableAction();
else
Schedule(() => runnableAction());
Schedule(runnableAction);
}
[BackgroundDependencyLoader]

View File

@ -229,7 +229,6 @@ namespace osu.Game.Screens.Multiplayer
{
coverContainer.FadeIn(transition_duration);
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
{
Anchor = Anchor.Centre,

View File

@ -35,9 +35,12 @@ namespace osu.Game.Screens
/// </summary>
public virtual bool ShowOverlaysOnEnter => true;
protected new OsuGameBase Game => base.Game as OsuGameBase;
/// <summary>
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
/// </summary>
public virtual bool CursorVisible => true;
public virtual bool HasLocalCursorDisplayed => false;
protected new OsuGameBase Game => base.Game as OsuGameBase;
private OsuLogo logo;

View File

@ -142,8 +142,6 @@ namespace osu.Game.Screens.Play
}
}
public override bool HandleInput => State == Visibility.Visible;
protected override void PopIn() => this.FadeIn(transition_duration, Easing.In);
protected override void PopOut() => this.FadeOut(transition_duration, Easing.In);

View File

@ -37,11 +37,12 @@ namespace osu.Game.Screens.Play
public readonly ReplaySettingsOverlay ReplaySettingsOverlay;
private Bindable<bool> showHud;
private bool replayLoaded;
private readonly BindableBool replayLoaded = new BindableBool();
private static bool hasShownNotificationOnce;
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, DecoupleableInterpolatingFramedClock decoupledClock, WorkingBeatmap working, IAdjustableClock adjustableSourceClock)
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, DecoupleableInterpolatingFramedClock decoupledClock, WorkingBeatmap working,
IAdjustableClock adjustableSourceClock)
{
RelativeSizeAxes = Axes.Both;
@ -105,22 +106,39 @@ namespace osu.Game.Screens.Play
}
}
protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
protected override void LoadComplete()
{
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
base.LoadComplete();
replayLoaded = rulesetContainer.HasReplayLoaded;
replayLoaded.ValueChanged += replayLoadedValueChanged;
replayLoaded.TriggerChange();
}
ReplaySettingsOverlay.ReplayLoaded = replayLoaded;
private void replayLoadedValueChanged(bool loaded)
{
ReplaySettingsOverlay.ReplayLoaded = loaded;
// in the case a replay isn't loaded, we want some elements to only appear briefly.
if (!replayLoaded)
if (loaded)
{
ReplaySettingsOverlay.Show();
ModDisplay.FadeIn(200);
}
else
{
ReplaySettingsOverlay.Hide();
ModDisplay.Delay(2000).FadeOut(200);
}
}
protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
{
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
Progress.BindRulestContainer(rulesetContainer);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;

View File

@ -111,7 +111,8 @@ namespace osu.Game.Screens.Play
}
}
public override bool HandleInput => receptor == null;
public override bool HandleKeyboardInput => receptor == null;
public override bool HandleMouseInput => receptor == null;
private Receptor receptor;

View File

@ -1,44 +1,44 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Audio;
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.Input;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Cursor;
using osu.Game.Online.API;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking;
using osu.Framework.Audio.Sample;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Online.API;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Play.BreaksOverlay;
using osu.Game.Screens.Ranking;
using osu.Game.Storyboards.Drawables;
using OpenTK;
namespace osu.Game.Screens.Play
{
public class Player : OsuScreen
public class Player : OsuScreen, IProvideCursor
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
public override bool ShowOverlaysOnEnter => false;
public override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor;
public Action RestartRequested;
public override bool AllowBeatmapRulesetChange => false;
@ -51,6 +51,9 @@ namespace osu.Game.Screens.Play
public int RestartCount;
public CursorContainer Cursor => RulesetContainer.Cursor;
public bool ProvidingUserCursor => RulesetContainer?.Cursor != null && !RulesetContainer.HasReplayLoaded.Value;
private IAdjustableClock adjustableSourceClock;
private FramedOffsetClock offsetClock;
private DecoupleableInterpolatingFramedClock decoupledClock;
@ -168,22 +171,21 @@ namespace osu.Game.Screens.Play
OnRetry = Restart,
OnQuit = Exit,
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
OnPause = () => {
OnPause = () =>
{
pauseContainer.Retries = RestartCount;
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
},
OnResume = () => {
hudOverlay.KeyCounter.IsCounting = true;
},
OnResume = () => { hudOverlay.KeyCounter.IsCounting = true; },
Children = new Drawable[]
{
new SkipButton(firstObjectTime) { AudioClock = decoupledClock },
new Container
{
RelativeSizeAxes = Axes.Both,
Clock = offsetClock,
Child = RulesetContainer,
},
new SkipButton(firstObjectTime) { AudioClock = decoupledClock },
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, decoupledClock, working, adjustableSourceClock)
{
Anchor = Anchor.Centre,
@ -195,7 +197,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre,
Clock = decoupledClock,
Breaks = beatmap.Breaks
},
}
}
},
failOverlay = new FailOverlay
@ -205,7 +207,8 @@ namespace osu.Game.Screens.Play
},
new HotkeyRetryOverlay
{
Action = () => {
Action = () =>
{
//we want to hide the hitrenderer immediately (looks better).
//we may be able to remove this once the mouse cursor trail is improved.
RulesetContainer?.Hide();

View File

@ -21,7 +21,7 @@ using osu.Game.Input.Bindings;
namespace osu.Game.Screens.Play
{
public class SkipButton : Container, IKeyBindingHandler<GlobalAction>
public class SkipButton : OverlayContainer, IKeyBindingHandler<GlobalAction>
{
private readonly double startTime;
public IAdjustableClock AudioClock;
@ -36,6 +36,8 @@ namespace osu.Game.Screens.Play
{
this.startTime = startTime;
State = Visibility.Visible;
RelativePositionAxes = Axes.Both;
RelativeSizeAxes = Axes.Both;
@ -112,6 +114,16 @@ namespace osu.Game.Screens.Play
Expire();
}
protected override void PopIn()
{
this.FadeIn();
}
protected override void PopOut()
{
this.FadeOut();
}
protected override void Update()
{
base.Update();

View File

@ -9,9 +9,12 @@ using System.Collections.Generic;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.UI;
namespace osu.Game.Screens.Play
{
public class SongProgress : OverlayContainer
@ -28,7 +31,8 @@ namespace osu.Game.Screens.Play
public Action<double> OnSeek;
public override bool HandleInput => AllowSeeking;
public override bool HandleKeyboardInput => AllowSeeking;
public override bool HandleMouseInput => AllowSeeking;
private IClock audioClock;
public IClock AudioClock { set { audioClock = info.AudioClock = value; } }
@ -53,6 +57,8 @@ namespace osu.Game.Screens.Play
}
}
private readonly BindableBool replayLoaded = new BindableBool();
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -97,6 +103,14 @@ namespace osu.Game.Screens.Play
protected override void LoadComplete()
{
State = Visibility.Visible;
replayLoaded.ValueChanged += v => AllowSeeking = v;
replayLoaded.TriggerChange();
}
public void BindRulestContainer(RulesetContainer rulesetContainer)
{
replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
}
private bool allowSeeking;

View File

@ -21,7 +21,8 @@ namespace osu.Game.Screens.Play
public int ColumnCount => columns.Length;
public override bool HandleInput => false;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
private int progress;
public int Progress

View File

@ -51,7 +51,8 @@ namespace osu.Game.Screens.Select
/// </summary>
public Action<BeatmapInfo> SelectionChanged;
public override bool HandleInput => AllowSelection;
public override bool HandleKeyboardInput => AllowSelection;
public override bool HandleMouseInput => AllowSelection;
/// <summary>
/// Used to avoid firing null selections before the initial beatmaps have been loaded via <see cref="BeatmapSets"/>.

View File

@ -266,7 +266,7 @@ namespace osu.Game.Screens.Select
/// </summary>
private void carouselSelectionChanged(BeatmapInfo beatmap)
{
Action performLoad = delegate
void performLoad()
{
// We may be arriving here due to another component changing the bindable Beatmap.
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
@ -279,7 +279,7 @@ namespace osu.Game.Screens.Select
}
UpdateBeatmap(Beatmap.Value);
};
}
if (beatmap?.Equals(beatmapNoDebounce) == true)
return;

View File

@ -265,7 +265,7 @@ namespace osu.Game.Screens.Tournament
private void writeResults(string text)
{
Action writeAction = () =>
void writeAction()
{
try
{
@ -280,9 +280,9 @@ namespace osu.Game.Screens.Tournament
{
Logger.Error(ex, "Failed to write results.");
}
};
}
writeOp = writeOp?.ContinueWith(t => { writeAction(); }) ?? Task.Run(writeAction);
writeOp = writeOp?.ContinueWith(t => { writeAction(); }) ?? Task.Run((Action)writeAction);
}
private void reloadTeams()

View File

@ -26,7 +26,8 @@ namespace osu.Game.Storyboards.Drawables
protected override Container<DrawableStoryboardLayer> Content => content;
protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480);
public override bool HandleInput => false;
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
private bool passing = true;
public bool Passing

View File

@ -388,8 +388,10 @@
<Compile Include="Graphics\Containers\ParallaxContainer.cs" />
<Compile Include="Graphics\Containers\ReverseChildIDFillFlowContainer.cs" />
<Compile Include="Graphics\Containers\SectionsContainer.cs" />
<Compile Include="Graphics\Cursor\IProvideCursor.cs" />
<Compile Include="Graphics\Cursor\MenuCursor.cs" />
<Compile Include="Graphics\Cursor\OsuContextMenuContainer.cs" />
<Compile Include="Graphics\Cursor\CursorOverrideContainer.cs" />
<Compile Include="Graphics\Cursor\OsuTooltipContainer.cs" />
<Compile Include="Graphics\IHasAccentColour.cs" />
<Compile Include="Graphics\OsuColour.cs" />