mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge https://github.com/ppy/osu into multiplayer-room-settings
This commit is contained in:
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
private const float corner_radius = 5;
|
||||
private const float contents_padding = 15;
|
||||
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
protected Track Track => Beatmap.Value.Track;
|
||||
|
||||
private readonly Drawable background;
|
||||
@ -42,8 +42,9 @@ namespace osu.Game.Screens.Edit.Components
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(IBindableBeatmap beatmap, OsuColour colours)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
background.Colour = colours.Gray1;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using OpenTK;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -15,7 +16,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
/// </summary>
|
||||
public abstract class TimelinePart : CompositeDrawable
|
||||
{
|
||||
public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private readonly Container timeline;
|
||||
|
||||
@ -30,6 +31,12 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
}
|
||||
|
||||
private void updateRelativeChildSize()
|
||||
{
|
||||
// the track may not be loaded completely (only has a length once it is).
|
||||
|
@ -20,19 +20,17 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, IAdjustableClock adjustableClock)
|
||||
{
|
||||
TimelinePart markerPart, controlPointPart, bookmarkPart, breakPart;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
markerPart = new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
|
||||
controlPointPart = new ControlPointPart
|
||||
new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
|
||||
new ControlPointPart
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.35f
|
||||
},
|
||||
bookmarkPart = new BookmarkPart
|
||||
new BookmarkPart
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
@ -67,7 +65,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
||||
},
|
||||
}
|
||||
},
|
||||
breakPart = new BreakPart
|
||||
new BreakPart
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -75,11 +73,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
||||
Height = 0.25f
|
||||
}
|
||||
};
|
||||
|
||||
markerPart.Beatmap.BindTo(Beatmap);
|
||||
controlPointPart.Beatmap.BindTo(Beatmap);
|
||||
bookmarkPart.Beatmap.BindTo(Beatmap);
|
||||
breakPart.Beatmap.BindTo(Beatmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ namespace osu.Game.Screens.Edit
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(parent);
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
// TODO: should probably be done at a RulesetContainer level to share logic with Player.
|
||||
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||
clock = new EditorClock(Beatmap, beatDivisor) { IsCoupled = false };
|
||||
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
||||
clock.ChangeSource(sourceClock);
|
||||
|
||||
dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||
@ -128,9 +128,9 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 10 },
|
||||
Child = timeInfo = new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
|
||||
Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
|
||||
},
|
||||
timeline = new SummaryTimeline
|
||||
new SummaryTimeline
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = 10 },
|
||||
Child = playback = new PlaybackControl { RelativeSizeAxes = Axes.Both },
|
||||
Child = new PlaybackControl { RelativeSizeAxes = Axes.Both },
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -148,9 +148,6 @@ namespace osu.Game.Screens.Edit
|
||||
},
|
||||
};
|
||||
|
||||
timeInfo.Beatmap.BindTo(Beatmap);
|
||||
timeline.Beatmap.BindTo(Beatmap);
|
||||
playback.Beatmap.BindTo(Beatmap);
|
||||
menuBar.Mode.ValueChanged += onModeChanged;
|
||||
|
||||
bottomBackground.Colour = colours.Gray2;
|
||||
@ -178,7 +175,6 @@ namespace osu.Game.Screens.Edit
|
||||
break;
|
||||
}
|
||||
|
||||
currentScreen.Beatmap.BindTo(Beatmap);
|
||||
LoadComponentAsync(currentScreen, screenContainer.Add);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -24,12 +23,12 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private readonly BindableBeatDivisor beatDivisor;
|
||||
|
||||
public EditorClock(Bindable<WorkingBeatmap> beatmap, BindableBeatDivisor beatDivisor)
|
||||
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.beatDivisor = beatDivisor;
|
||||
|
||||
ControlPointInfo = beatmap.Value.Beatmap.ControlPointInfo;
|
||||
TrackLength = beatmap.Value.Track.Length;
|
||||
ControlPointInfo = beatmap.Beatmap.ControlPointInfo;
|
||||
TrackLength = beatmap.Track.Length;
|
||||
}
|
||||
|
||||
public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor)
|
||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
if (beatDivisor != null)
|
||||
this.beatDivisor.BindTo(beatDivisor);
|
||||
|
||||
ScrollableTimeline timeline;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new GridContainer
|
||||
@ -65,7 +64,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = 5 },
|
||||
Child = timeline = new ScrollableTimeline { RelativeSizeAxes = Axes.Both }
|
||||
Child = new ScrollableTimeline { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
@ -94,8 +93,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
||||
},
|
||||
};
|
||||
|
||||
timeline.Beatmap.BindTo(Beatmap);
|
||||
|
||||
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
|
||||
if (ruleset == null)
|
||||
{
|
||||
|
@ -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 osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Audio;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -11,14 +10,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
{
|
||||
public class BeatmapWaveformGraph : CompositeDrawable
|
||||
{
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
public WorkingBeatmap Beatmap { set => graph.Waveform = value.Waveform; }
|
||||
|
||||
private readonly WaveformGraph graph;
|
||||
|
||||
public BeatmapWaveformGraph()
|
||||
{
|
||||
InternalChild = graph = new WaveformGraph { RelativeSizeAxes = Axes.Both };
|
||||
Beatmap.ValueChanged += b => graph.Waveform = b.Waveform;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2,11 +2,9 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
@ -14,8 +12,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
{
|
||||
public class ScrollableTimeline : CompositeDrawable
|
||||
{
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private readonly ScrollingTimelineContainer timelineContainer;
|
||||
|
||||
public ScrollableTimeline()
|
||||
@ -117,7 +113,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
hitSoundsCheckbox.Current.Value = true;
|
||||
waveformCheckbox.Current.Value = true;
|
||||
|
||||
timelineContainer.Beatmap.BindTo(Beatmap);
|
||||
timelineContainer.WaveformVisible.BindTo(waveformCheckbox.Current);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using OpenTK;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -17,7 +18,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
public readonly Bindable<bool> HitObjectsVisible = new Bindable<bool>();
|
||||
public readonly Bindable<bool> HitSoundsVisible = new Bindable<bool>();
|
||||
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private readonly BeatmapWaveformGraph waveform;
|
||||
|
||||
@ -36,12 +38,20 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
||||
Content.AutoSizeAxes = Axes.None;
|
||||
Content.RelativeSizeAxes = Axes.Both;
|
||||
|
||||
waveform.Beatmap.BindTo(Beatmap);
|
||||
WaveformVisible.ValueChanged += waveformVisibilityChanged;
|
||||
|
||||
Zoom = 10;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
this.beatmap.BindValueChanged(beatmapChanged, true);
|
||||
}
|
||||
|
||||
private void beatmapChanged(WorkingBeatmap beatmap) => waveform.Beatmap = beatmap;
|
||||
|
||||
private float minZoom = 1;
|
||||
/// <summary>
|
||||
/// The minimum zoom level allowed.
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -13,7 +14,7 @@ namespace osu.Game.Screens.Edit.Screens
|
||||
/// </summary>
|
||||
public class EditorScreen : Container
|
||||
{
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container content;
|
||||
@ -27,6 +28,12 @@ namespace osu.Game.Screens.Edit.Screens
|
||||
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework;
|
||||
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.Shapes;
|
||||
@ -17,6 +16,7 @@ using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
@ -27,9 +27,6 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public event Action<MenuState> StateChanged;
|
||||
|
||||
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
||||
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
||||
|
||||
public Action OnEdit;
|
||||
public Action OnExit;
|
||||
public Action OnDirect;
|
||||
@ -133,15 +130,12 @@ namespace osu.Game.Screens.Menu
|
||||
buttonFlow.AddRange(buttonsTopLevel);
|
||||
}
|
||||
|
||||
private OsuGame game;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, OsuGame game)
|
||||
{
|
||||
if (game != null)
|
||||
{
|
||||
hideOverlaysOnEnter.BindTo(game.HideOverlaysOnEnter);
|
||||
allowOpeningOverlays.BindTo(game.AllowOpeningOverlays);
|
||||
}
|
||||
|
||||
this.game = game;
|
||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||
}
|
||||
|
||||
@ -328,18 +322,21 @@ namespace osu.Game.Screens.Menu
|
||||
case MenuState.Initial:
|
||||
logoDelayedAction?.Cancel();
|
||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
logoTracking = false;
|
||||
{
|
||||
logoTracking = false;
|
||||
|
||||
hideOverlaysOnEnter.Value = true;
|
||||
allowOpeningOverlays.Value = false;
|
||||
if (game != null)
|
||||
{
|
||||
game.OverlayActivationMode.Value = state == MenuState.Exit ? OverlayActivation.Disabled : OverlayActivation.All;
|
||||
game.Toolbar.Hide();
|
||||
}
|
||||
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logo.RelativePositionAxes = Axes.Both;
|
||||
logo.ClearTransforms(targetMember: nameof(Position));
|
||||
logo.RelativePositionAxes = Axes.Both;
|
||||
|
||||
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
|
||||
logo.ScaleTo(1, 800, Easing.OutExpo);
|
||||
}, buttonArea.Alpha * 150);
|
||||
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
|
||||
logo.ScaleTo(1, 800, Easing.OutExpo);
|
||||
}, buttonArea.Alpha * 150);
|
||||
break;
|
||||
case MenuState.TopLevel:
|
||||
case MenuState.Play:
|
||||
@ -366,8 +363,11 @@ namespace osu.Game.Screens.Menu
|
||||
if (impact)
|
||||
logo.Impact();
|
||||
|
||||
hideOverlaysOnEnter.Value = false;
|
||||
allowOpeningOverlays.Value = true;
|
||||
if (game != null)
|
||||
{
|
||||
game.OverlayActivationMode.Value = OverlayActivation.All;
|
||||
game.Toolbar.State = Visibility.Visible;
|
||||
}
|
||||
}, 200);
|
||||
break;
|
||||
default:
|
||||
|
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@ -19,7 +20,7 @@ namespace osu.Game.Screens.Menu
|
||||
private Color4 iconColour;
|
||||
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
protected override bool AllowOpeningOverlays => false;
|
||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
|
@ -15,6 +15,7 @@ using osu.Game.IO.Archives;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@ -27,12 +28,14 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
public bool DidLoadMenu;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private MainMenu mainMenu;
|
||||
private SampleChannel welcome;
|
||||
private SampleChannel seeya;
|
||||
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
protected override bool AllowOpeningOverlays => false;
|
||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
@ -41,11 +44,13 @@ namespace osu.Game.Screens.Menu
|
||||
private Bindable<bool> menuVoice;
|
||||
private Bindable<bool> menuMusic;
|
||||
private Track track;
|
||||
private WorkingBeatmap beatmap;
|
||||
private WorkingBeatmap introBeatmap;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
|
||||
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||
|
||||
@ -72,8 +77,8 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
}
|
||||
|
||||
beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||
track = beatmap.Track;
|
||||
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||
track = introBeatmap.Track;
|
||||
|
||||
welcome = audio.Sample.Get(@"welcome");
|
||||
seeya = audio.Sample.Get(@"seeya");
|
||||
@ -90,7 +95,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
if (!resuming)
|
||||
{
|
||||
Game.Beatmap.Value = beatmap;
|
||||
beatmap.Value = introBeatmap;
|
||||
|
||||
if (menuVoice)
|
||||
welcome.Play();
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class LogoVisualisation : Drawable, IHasAccentColour
|
||||
{
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
/// <summary>
|
||||
/// The number of bars to jump each update iteration.
|
||||
@ -78,9 +78,9 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, OsuGameBase game)
|
||||
private void load(ShaderManager shaders, IBindableBeatmap beatmap)
|
||||
{
|
||||
beatmap.BindTo(game.Beatmap);
|
||||
this.beatmap.BindTo(beatmap);
|
||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Screens.Menu
|
||||
private readonly ButtonSystem buttons;
|
||||
|
||||
protected override bool HideOverlaysOnEnter => buttons.State == MenuState.Initial;
|
||||
protected override bool AllowOpeningOverlays => buttons.State != MenuState.Initial;
|
||||
|
||||
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu
|
||||
public override bool HandleKeyboardInput => false;
|
||||
public override bool HandleMouseInput => false;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private Box leftBox;
|
||||
private Box rightBox;
|
||||
@ -45,9 +45,9 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game, OsuColour colours)
|
||||
private void load(IBindableBeatmap beatmap, OsuColour colours)
|
||||
{
|
||||
beatmap.BindTo(game.Beatmap);
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
// linear colour looks better in this case, so let's use it for now.
|
||||
Color4 gradientDark = colours.Blue.Opacity(0).ToLinear();
|
||||
|
@ -18,6 +18,8 @@ using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Menu;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
@ -40,19 +42,19 @@ namespace osu.Game.Screens
|
||||
/// </summary>
|
||||
protected virtual BackgroundScreen CreateBackground() => null;
|
||||
|
||||
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
||||
private Action updateOverlayStates;
|
||||
|
||||
/// <summary>
|
||||
/// Whether overlays should be hidden when this screen is entered or resumed.
|
||||
/// Whether all overlays should be hidden when this screen is entered or resumed.
|
||||
/// </summary>
|
||||
protected virtual bool HideOverlaysOnEnter => false;
|
||||
|
||||
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
||||
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether overlays should be able to be opened while this screen is active.
|
||||
/// Whether overlays should be able to be opened once this screen is entered or resumed.
|
||||
/// </summary>
|
||||
protected virtual bool AllowOpeningOverlays => true;
|
||||
protected virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
||||
@ -75,36 +77,28 @@ namespace osu.Game.Screens
|
||||
|
||||
private ParallaxContainer backgroundParallaxContainer;
|
||||
|
||||
public WorkingBeatmap InitialBeatmap
|
||||
{
|
||||
set
|
||||
{
|
||||
if (IsLoaded) throw new InvalidOperationException($"Cannot set {nameof(InitialBeatmap)} post-load.");
|
||||
Beatmap.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private SampleChannel sampleExit;
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio)
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BindableBeatmap beatmap, OsuGame osuGame, AudioManager audio)
|
||||
{
|
||||
if (game != null)
|
||||
{
|
||||
//if we were given a beatmap at ctor time, we want to pass this on to the game-wide beatmap.
|
||||
var localMap = Beatmap.Value;
|
||||
Beatmap.BindTo(game.Beatmap);
|
||||
if (localMap != null)
|
||||
Beatmap.Value = localMap;
|
||||
}
|
||||
if (beatmap != null)
|
||||
Beatmap.BindTo(beatmap);
|
||||
|
||||
if (osuGame != null)
|
||||
{
|
||||
Ruleset.BindTo(osuGame.Ruleset);
|
||||
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
|
||||
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
||||
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
||||
|
||||
updateOverlayStates = () =>
|
||||
{
|
||||
if (HideOverlaysOnEnter)
|
||||
osuGame.CloseAllOverlays();
|
||||
else
|
||||
osuGame.Toolbar.State = Visibility.Visible;
|
||||
};
|
||||
}
|
||||
|
||||
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
||||
@ -240,8 +234,9 @@ namespace osu.Game.Screens
|
||||
if (backgroundParallaxContainer != null)
|
||||
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
||||
|
||||
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
|
||||
allowOpeningOverlays.Value = AllowOpeningOverlays;
|
||||
OverlayActivationMode.Value = InitialOverlayActivationMode;
|
||||
|
||||
updateOverlayStates?.Invoke();
|
||||
}
|
||||
|
||||
private void onExitingLogo()
|
||||
|
@ -44,13 +44,18 @@ namespace osu.Game.Screens.Play
|
||||
public Action OnResume;
|
||||
public Action OnPause;
|
||||
|
||||
private readonly IAdjustableClock adjustableClock;
|
||||
private readonly FramedClock framedClock;
|
||||
private readonly DecoupleableInterpolatingFramedClock decoupledClock;
|
||||
|
||||
public PauseContainer(FramedClock framedClock, IAdjustableClock adjustableClock)
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="PauseContainer"/>.
|
||||
/// </summary>
|
||||
/// <param name="framedClock">The gameplay clock. This is the clock that will process frames.</param>
|
||||
/// <param name="decoupledClock">The seekable clock. This is the clock that will be paused and resumed.</param>
|
||||
public PauseContainer(FramedClock framedClock, DecoupleableInterpolatingFramedClock decoupledClock)
|
||||
{
|
||||
this.framedClock = framedClock;
|
||||
this.adjustableClock = adjustableClock;
|
||||
this.decoupledClock = decoupledClock;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -80,7 +85,7 @@ namespace osu.Game.Screens.Play
|
||||
if (IsPaused) return;
|
||||
|
||||
// stop the seekable clock (stops the audio eventually)
|
||||
adjustableClock.Stop();
|
||||
decoupledClock.Stop();
|
||||
IsPaused = true;
|
||||
|
||||
OnPause?.Invoke();
|
||||
@ -97,10 +102,10 @@ namespace osu.Game.Screens.Play
|
||||
IsResuming = false;
|
||||
lastPauseActionTime = Time.Current;
|
||||
|
||||
// seek back to the time of the framed clock.
|
||||
// this accounts for the audio clock potentially taking time to enter a completely stopped state.
|
||||
adjustableClock.Seek(framedClock.CurrentTime);
|
||||
adjustableClock.Start();
|
||||
// Seeking the decoupled clock to its current time ensures that its source clock will be seeked to the same time
|
||||
// This accounts for the audio clock source potentially taking time to enter a completely stopped state
|
||||
decoupledClock.Seek(decoupledClock.CurrentTime);
|
||||
decoupledClock.Start();
|
||||
|
||||
OnResume?.Invoke();
|
||||
pauseOverlay.Hide();
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -21,6 +22,7 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -37,6 +39,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
|
||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
||||
|
||||
public Action RestartRequested;
|
||||
|
||||
public bool HasFailed { get; private set; }
|
||||
@ -117,7 +121,7 @@ namespace osu.Game.Screens.Play
|
||||
// let's try again forcing the beatmap's ruleset.
|
||||
ruleset = beatmap.BeatmapInfo.Ruleset;
|
||||
rulesetInstance = ruleset.CreateInstance();
|
||||
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap);
|
||||
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap.Value);
|
||||
}
|
||||
|
||||
if (!RulesetContainer.Objects.Any())
|
||||
@ -143,8 +147,12 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
adjustableClock.ProcessFrame();
|
||||
|
||||
// Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
|
||||
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
|
||||
var platformOffsetClock = new FramedOffsetClock(adjustableClock) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 22 : 0 };
|
||||
|
||||
// the final usable gameplay clock with user-set offsets applied.
|
||||
var offsetClock = new FramedOffsetClock(adjustableClock);
|
||||
var offsetClock = new FramedOffsetClock(platformOffsetClock);
|
||||
|
||||
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
||||
userAudioOffset.TriggerChange();
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Add(info = new BeatmapMetadataDisplay(Beatmap)
|
||||
Add(info = new BeatmapMetadataDisplay(Beatmap.Value)
|
||||
{
|
||||
Alpha = 0,
|
||||
Anchor = Anchor.Centre,
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public abstract class ScreenWithBeatmapBackground : OsuScreen
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
private const float overscan = 1.3f;
|
||||
|
||||
@ -274,10 +274,10 @@ namespace osu.Game.Screens.Ranking
|
||||
switch (mode)
|
||||
{
|
||||
case ResultMode.Summary:
|
||||
currentPage = new ResultsPageScore(score, Beatmap);
|
||||
currentPage = new ResultsPageScore(score, Beatmap.Value);
|
||||
break;
|
||||
case ResultMode.Ranking:
|
||||
currentPage = new ResultsPageRanking(score, Beatmap);
|
||||
currentPage = new ResultsPageRanking(score, Beatmap.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,8 @@ namespace osu.Game.Screens.Select
|
||||
private SampleChannel sampleChangeBeatmap;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
||||
|
||||
protected SongSelect()
|
||||
{
|
||||
@ -175,7 +176,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
|
||||
{
|
||||
dependencies.CacheAs(this);
|
||||
@ -206,15 +207,13 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable();
|
||||
|
||||
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
||||
Beatmap.TriggerChange();
|
||||
|
||||
Beatmap.ValueChanged += workingBeatmapChanged;
|
||||
Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);
|
||||
Beatmap.BindValueChanged(workingBeatmapChanged);
|
||||
}
|
||||
|
||||
public void Edit(BeatmapInfo beatmap)
|
||||
{
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||
Push(new Editor());
|
||||
}
|
||||
|
||||
@ -280,7 +279,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||
ensurePlayingSelected(preview);
|
||||
}
|
||||
|
||||
@ -367,7 +366,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
||||
{
|
||||
UpdateBeatmap(Beatmap);
|
||||
UpdateBeatmap(Beatmap.Value);
|
||||
ensurePlayingSelected();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user