Merge remote-tracking branch 'upstream/master' into tournament-tools

This commit is contained in:
Dean Herbert
2019-03-02 13:11:34 +09:00
614 changed files with 7332 additions and 3325 deletions

View File

@ -2,10 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Backgrounds
{
@ -13,9 +15,20 @@ namespace osu.Game.Screens.Backgrounds
{
private WorkingBeatmap beatmap;
public WorkingBeatmap Beatmap
/// <summary>
/// Whether or not user dim settings should be applied to this Background.
/// </summary>
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>();
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
private readonly UserDimContainer fadeContainer;
protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both };
public virtual WorkingBeatmap Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (beatmap == value && beatmap != null)
@ -37,8 +50,9 @@ namespace osu.Game.Screens.Backgrounds
}
b.Depth = newDepth;
AddInternal(Background = b);
fadeContainer.Add(Background = b);
Background.BlurSigma = BlurTarget;
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
}));
});
}
@ -47,6 +61,8 @@ namespace osu.Game.Screens.Backgrounds
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
{
Beatmap = beatmap;
InternalChild = fadeContainer = CreateFadeContainer();
fadeContainer.EnableUserDim.BindTo(EnableUserDim);
}
public override bool Equals(BackgroundScreen other)
@ -57,7 +73,7 @@ namespace osu.Game.Screens.Backgrounds
return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap;
}
private class BeatmapBackground : Background
protected class BeatmapBackground : Background
{
private readonly WorkingBeatmap beatmap;

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Threading;
@ -70,7 +70,8 @@ namespace osu.Game.Screens.Backgrounds
{
private readonly Skin skin;
public SkinnedBackground(Skin skin, string fallbackTextureName) : base(fallbackTextureName)
public SkinnedBackground(Skin skin, string fallbackTextureName)
: base(fallbackTextureName)
{
this.skin = skin;
}

View File

@ -15,6 +15,9 @@ namespace osu.Game.Screens
protected Vector2 BlurTarget;
public TransformSequence<Background> BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None)
=> Background?.BlurTo(BlurTarget = sigma, duration, easing);
{
BlurTarget = sigma;
return Background?.BlurTo(BlurTarget, duration, easing);
}
}
}

View File

@ -8,8 +8,9 @@ namespace osu.Game.Screens.Charts
{
public class ChartListing : ScreenWhiteBox
{
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(ChartInfo)
protected override IEnumerable<Type> PossibleChildren => new[]
{
typeof(ChartInfo)
};
}
}

View File

@ -3,7 +3,7 @@
using System;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Edit
{
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Edit
public override int Value
{
get { return base.Value; }
get => base.Value;
set
{
if (!VALID_DIVISORS.Contains(value))

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -110,7 +110,8 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
public TextContainer()
{
NormalText.TextSize = BoldText.TextSize = 14;
NormalText.Font = NormalText.Font.With(size: 14);
BoldText.Font = BoldText.Font.With(size: 14);
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
}
}
@ -174,6 +175,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
if (Item is EditorMenuItemSpacer)
return true;
return base.OnHover(e);
}
@ -181,6 +183,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
if (Item is EditorMenuItemSpacer)
return true;
return base.OnClick(e);
}
}

View File

@ -61,7 +61,7 @@ namespace osu.Game.Screens.Edit.Components
}
};
tabs.Current.ValueChanged += newValue => Beatmap.Value.Track.Tempo.Value = newValue;
tabs.Current.ValueChanged += tempo => Beatmap.Value.Track.Tempo.Value = tempo.NewValue;
}
protected override bool OnKeyDown(KeyDownEvent e)
@ -114,7 +114,8 @@ namespace osu.Game.Screens.Edit.Components
private readonly OsuSpriteText text;
private readonly OsuSpriteText textBold;
public PlaybackTabItem(double value) : base(value)
public PlaybackTabItem(double value)
: base(value)
{
RelativeSizeAxes = Axes.Both;
@ -127,15 +128,14 @@ namespace osu.Game.Screens.Edit.Components
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = $"{value:0%}",
TextSize = 14,
Font = OsuFont.GetFont(size: 14)
},
textBold = new OsuSpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Text = $"{value:0%}",
TextSize = 14,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
Alpha = 0,
},
};
@ -163,9 +163,9 @@ namespace osu.Game.Screens.Edit.Components
private void updateState()
{
text.FadeColour(Active || IsHovered ? hoveredColour : normalColour, fade_duration, Easing.OutQuint);
text.FadeTo(Active ? 0 : 1, fade_duration, Easing.OutQuint);
textBold.FadeTo(Active ? 1 : 0, fade_duration, Easing.OutQuint);
text.FadeColour(Active.Value || IsHovered ? hoveredColour : normalColour, fade_duration, Easing.OutQuint);
text.FadeTo(Active.Value ? 0 : 1, fade_duration, Easing.OutQuint);
textBold.FadeTo(Active.Value ? 1 : 0, fade_duration, Easing.OutQuint);
}
}
}

View File

@ -80,10 +80,10 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
{
base.LoadComplete();
button.Selected.ValueChanged += v =>
button.Selected.ValueChanged += selected =>
{
updateSelectionState();
if (v)
if (selected.NewValue)
Selected?.Invoke(button);
};
@ -95,16 +95,16 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
if (!IsLoaded)
return;
BackgroundColour = button.Selected ? selectedBackgroundColour : defaultBackgroundColour;
bubble.Colour = button.Selected ? selectedBubbleColour : defaultBubbleColour;
BackgroundColour = button.Selected.Value ? selectedBackgroundColour : defaultBackgroundColour;
bubble.Colour = button.Selected.Value ? selectedBubbleColour : defaultBubbleColour;
}
protected override bool OnClick(ClickEvent e)
{
if (button.Selected)
if (button.Selected.Value)
return true;
if (!Enabled)
if (!Enabled.Value)
return true;
button.Selected.Value = true;

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Edit.Components.RadioButtons
{

View File

@ -12,13 +12,15 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
public class RadioButtonCollection : CompositeDrawable
{
private IReadOnlyList<RadioButton> items;
public IReadOnlyList<RadioButton> Items
{
get { return items; }
get => items;
set
{
if (ReferenceEquals(items, value))
return;
items = value;
buttonContainer.Clear();
@ -42,11 +44,12 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
}
private RadioButton currentlySelected;
private void addButton(RadioButton button)
{
button.Selected.ValueChanged += v =>
button.Selected.ValueChanged += selected =>
{
if (v)
if (selected.NewValue)
{
currentlySelected?.Deselect();
currentlySelected = button;

View File

@ -6,6 +6,7 @@ using osu.Game.Graphics.Sprites;
using System;
using osu.Framework.Allocation;
using osu.Framework.Timing;
using osu.Game.Graphics;
namespace osu.Game.Screens.Edit.Components
{
@ -23,8 +24,7 @@ namespace osu.Game.Screens.Edit.Components
{
Origin = Anchor.BottomLeft,
RelativePositionAxes = Axes.Y,
TextSize = 22,
FixedWidth = true,
Font = OsuFont.GetFont(size: 22, fixedWidth: true),
Y = 0.5f,
}
};

View File

@ -26,12 +26,12 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
// Consider all non-timing points as the same type
cpi.SamplePoints.Select(c => (ControlPoint)c)
.Concat(cpi.EffectPoints)
.Concat(cpi.DifficultyPoints)
.Distinct()
// Non-timing points should not be added where there are timing points
.Where(c => cpi.TimingPointAt(c.Time).Time != c.Time)
.ForEach(addNonTimingPoint);
.Concat(cpi.EffectPoints)
.Concat(cpi.DifficultyPoints)
.Distinct()
// Non-timing points should not be added where there are timing points
.Where(c => cpi.TimingPointAt(c.Time).Time != c.Time)
.ForEach(addNonTimingPoint);
}
private void addTimingPoint(ControlPoint controlPoint) => Add(new TimingPointVisualisation(controlPoint));

View File

@ -32,6 +32,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
protected override bool OnDragStart(DragStartEvent e) => true;
protected override bool OnDragEnd(DragEndEvent e) => true;
protected override bool OnDrag(DragEvent e)
{
seekToPosition(e.ScreenSpaceMousePosition);

View File

@ -3,8 +3,8 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osuTK;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
Beatmap.ValueChanged += b =>
{
updateRelativeChildSize();
LoadBeatmap(b);
LoadBeatmap(b.NewValue);
};
}

View File

@ -4,7 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@ -118,7 +118,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
},
new Drawable[]
{
new TextFlowContainer(s => s.TextSize = 14)
new TextFlowContainer(s => s.Font = s.Font.With(size: 14))
{
Padding = new MarginPadding { Horizontal = 15 },
Text = "beat snap divisor",
@ -157,12 +157,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override void LoadComplete()
{
base.LoadComplete();
beatDivisor.ValueChanged += v => updateText();
updateText();
beatDivisor.BindValueChanged(val => Text = $"1/{val.NewValue}", true);
}
private void updateText() => Text = $"1/{beatDivisor.Value}";
}
private class DivisorButton : IconButton
@ -219,9 +215,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
AddInternal(marker = new Marker());
CurrentNumber.ValueChanged += v =>
CurrentNumber.ValueChanged += div =>
{
marker.MoveToX(getMappedPosition(v), 100, Easing.OutQuint);
marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint);
marker.Flash();
};
}
@ -238,11 +234,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
case Key.Right:
beatDivisor.Next();
OnUserChange(Current);
OnUserChange(Current.Value);
return true;
case Key.Left:
beatDivisor.Previous();
OnUserChange(Current);
OnUserChange(Current.Value);
return true;
default:
return false;
@ -279,7 +275,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth;
CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First();
OnUserChange(Current);
OnUserChange(Current.Value);
}
private float getMappedPosition(float divisor) => (float)Math.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f);

View File

@ -68,6 +68,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
if (currentTool == value)
return;
currentTool = value;
refreshTool();
@ -188,6 +189,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
if (!(x is SelectionBlueprint xBlueprint) || !(y is SelectionBlueprint yBlueprint))
return base.Compare(x, y);
return Compare(xBlueprint, yBlueprint);
}

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
@ -49,13 +49,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// We don't want the centre marker to scroll
AddInternal(new CentreMarker());
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint);
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
Beatmap.BindTo(beatmap);
Beatmap.BindValueChanged(b =>
{
waveform.Waveform = b.Waveform;
track = b.Track;
waveform.Waveform = b.NewValue.Waveform;
track = b.NewValue.Track;
}, true);
}

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
@ -19,8 +19,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public FontAwesome Icon
{
get { return button.Icon; }
set { button.Icon = value; }
get => button.Icon;
set => button.Icon = value;
}
private readonly IconButton button;

View File

@ -47,6 +47,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
if (value < 1)
throw new ArgumentException($"{nameof(MinZoom)} must be >= 1.", nameof(value));
minZoom = value;
if (Zoom < value)
@ -66,6 +67,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
if (value < 1)
throw new ArgumentException($"{nameof(MaxZoom)} must be >= 1.", nameof(value));
maxZoom = value;
if (Zoom > value)
@ -108,6 +110,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
private float zoomTarget = 1;
private void setZoomTarget(float newZoom, float focusPoint)
{
zoomTarget = MathHelper.Clamp(newZoom, MinZoom, MaxZoom);

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Platform;
@ -21,6 +22,8 @@ using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Design;
using osuTK.Input;
using System.Collections.Generic;
using osu.Framework;
namespace osu.Game.Screens.Edit
{
@ -66,6 +69,15 @@ namespace osu.Game.Screens.Edit
SummaryTimeline timeline;
PlaybackControl playback;
var fileMenuItems = new List<MenuItem>();
if (RuntimeInfo.IsDesktop)
{
fileMenuItems.Add(new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap));
fileMenuItems.Add(new EditorMenuItemSpacer());
}
fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit));
InternalChildren = new[]
{
new Container
@ -93,12 +105,7 @@ namespace osu.Game.Screens.Edit
{
new MenuItem("File")
{
Items = new[]
{
new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap),
new EditorMenuItemSpacer(),
new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit)
}
Items = fileMenuItems
}
}
}
@ -222,11 +229,11 @@ namespace osu.Game.Screens.Edit
private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save());
private void onModeChanged(EditorScreenMode mode)
private void onModeChanged(ValueChangedEvent<EditorScreenMode> e)
{
currentScreen?.Exit();
switch (mode)
switch (e.NewValue)
{
case EditorScreenMode.Compose:
currentScreen = new ComposeScreen();

View File

@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit
public bool SeekSnapped(double position)
{
var timingPoint = ControlPointInfo.TimingPointAt(position);
double beatSnapLength = timingPoint.BeatLength / beatDivisor;
double beatSnapLength = timingPoint.BeatLength / beatDivisor.Value;
// We will be snapping to beats within the timing point
position -= timingPoint.Time;
@ -91,7 +91,7 @@ namespace osu.Game.Screens.Edit
timingPoint = ControlPointInfo.TimingPoints[--activeIndex];
}
double seekAmount = timingPoint.BeatLength / beatDivisor * amount;
double seekAmount = timingPoint.BeatLength / beatDivisor.Value * amount;
double seekTime = CurrentTime + seekAmount * direction;
if (!snapped || ControlPointInfo.TimingPoints.Count == 0)

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;

View File

@ -9,10 +9,13 @@ namespace osu.Game.Screens.Edit
{
[Description("setup")]
SongSetup,
[Description("compose")]
Compose,
[Description("design")]
Design,
[Description("timing")]
Timing,
}

View File

@ -38,8 +38,8 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
public float LabelTextSize
{
get => label.TextSize;
set => label.TextSize = value;
get => label.Font.Size;
set => label.Font = label.Font.With(size: value);
}
public string PlaceholderText
@ -103,8 +103,7 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
Origin = Anchor.TopLeft,
Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding },
Colour = Color4.White,
TextSize = default_label_text_size,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(size: default_label_text_size, weight: FontWeight.Bold),
},
textBox = new OsuTextBox
{

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Overlays;

View File

@ -118,7 +118,6 @@ namespace osu.Game.Screens.Menu
AllowMultiline = false,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 16,
Position = new Vector2(0, 35),
Text = text
}
@ -243,7 +242,7 @@ namespace osu.Game.Screens.Menu
public ButtonState State
{
get { return state; }
get => state;
set
{

View File

@ -8,11 +8,12 @@ using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Input;
@ -90,19 +91,6 @@ namespace osu.Game.Screens.Menu
});
buttonArea.Flow.CentreTarget = iconFacade;
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P));
buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q));
buttonArea.AddRange(buttonsPlay);
buttonArea.AddRange(buttonsTopLevel);
}
[Resolved(CanBeNull = true)]
@ -115,9 +103,24 @@ namespace osu.Game.Screens.Menu
private NotificationOverlay notifications { get; set; }
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, IdleTracker idleTracker)
private void load(AudioManager audio, IdleTracker idleTracker, GameHost host)
{
isIdle.ValueChanged += updateIdleState;
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P));
buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
if (host.CanExit)
buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q));
buttonArea.AddRange(buttonsPlay);
buttonArea.AddRange(buttonsTopLevel);
isIdle.ValueChanged += idle => updateIdleState(idle.NewValue);
if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle);
@ -203,7 +206,7 @@ namespace osu.Game.Screens.Menu
public ButtonSystemState State
{
get { return state; }
get => state;
set
{

View File

@ -64,31 +64,19 @@ namespace osu.Game.Screens.Menu
}
};
textFlow.AddText("This is an ", t =>
{
t.TextSize = 30;
t.Font = @"Exo2.0-Light";
});
textFlow.AddText("early development build", t =>
{
t.TextSize = 30;
t.Font = @"Exo2.0-SemiBold";
});
textFlow.AddText("This is an ", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
textFlow.AddText("early development build", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));
textFlow.AddParagraph("Things may not work as expected", t => t.TextSize = 20);
textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
textFlow.NewParagraph();
Action<SpriteText> format = t =>
{
t.TextSize = 15;
t.Font = @"Exo2.0-SemiBold";
};
Action<SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold);
textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format);
textFlow.NewParagraph();
textFlow.AddText("Visit ", format);
textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters:format);
textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format);
textFlow.AddText(" to help out or follow progress!", format);
textFlow.NewParagraph();
@ -102,7 +90,7 @@ namespace osu.Game.Screens.Menu
supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t =>
{
t.Padding = new MarginPadding { Left = 5 };
t.TextSize = 12;
t.Font = t.Font.With(size: 12);
t.Colour = colours.Pink;
t.Origin = Anchor.Centre;
}).First());

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
@ -52,7 +52,7 @@ namespace osu.Game.Screens.Menu
BeatmapSetInfo setInfo = null;
if (!menuMusic)
if (!menuMusic.Value)
{
var sets = beatmaps.GetAllUsableBeatmapSets();
if (sets.Count > 0)
@ -93,13 +93,13 @@ namespace osu.Game.Screens.Menu
{
Beatmap.Value = introBeatmap;
if (menuVoice)
if (menuVoice.Value)
welcome.Play();
Scheduler.AddDelayed(delegate
{
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu.
if (menuMusic)
if (menuMusic.Value)
track.Start();
LoadComponentAsync(mainMenu = new MainMenu());
@ -112,7 +112,6 @@ namespace osu.Game.Screens.Menu
}, delay_step_two);
}
logo.RelativePositionAxes = Axes.Both;
logo.Colour = Color4.White;
logo.Ripple = false;
@ -159,7 +158,7 @@ namespace osu.Game.Screens.Menu
double fadeOutTime = EXIT_DELAY;
//we also handle the exit transition.
if (menuVoice)
if (menuVoice.Value)
seeya.Play();
else
fadeOutTime = 500;

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Children = new []
Children = new[]
{
lineTopLeft = new Box
{
@ -102,9 +102,8 @@ namespace osu.Game.Screens.Menu
Origin = Anchor.Centre,
Text = "welcome",
Padding = new MarginPadding { Bottom = 10 },
Font = @"Exo2.0-Light",
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42),
Alpha = 0,
TextSize = 42,
Spacing = new Vector2(5),
},
new CircularContainer

View File

@ -3,7 +3,6 @@
using osuTK;
using osuTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Batches;
using osu.Framework.Graphics.Colour;
@ -15,6 +14,7 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Menu
{
@ -156,7 +156,9 @@ namespace osu.Game.Screens.Menu
{
public Shader Shader;
public Texture Texture;
public VisualiserSharedData Shared;
//Asuming the logo is a circle, we don't need a second dimension.
public float Size;
@ -213,6 +215,7 @@ namespace osu.Game.Screens.Menu
}
}
}
Shader.Unbind();
}
}

View File

@ -4,7 +4,9 @@
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
@ -20,28 +22,31 @@ namespace osu.Game.Screens.Menu
{
public class MainMenu : OsuScreen
{
private readonly ButtonSystem buttons;
private ButtonSystem buttons;
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
public override bool AllowExternalScreenChange => true;
private Screen songSelect;
private readonly MenuSideFlashes sideFlashes;
private MenuSideFlashes sideFlashes;
[Resolved]
private GameHost host { get; set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
public MainMenu()
[BackgroundDependencyLoader(true)]
private void load(OsuGame game = null)
{
InternalChildren = new Drawable[]
if (host.CanExit)
AddInternal(new ExitConfirmOverlay { Action = this.Exit });
AddRangeInternal(new Drawable[]
{
new ExitConfirmOverlay
{
Action = this.Exit,
},
new ParallaxContainer
{
ParallaxAmount = 0.01f,
@ -50,16 +55,16 @@ namespace osu.Game.Screens.Menu
buttons = new ButtonSystem
{
OnChart = delegate { this.Push(new ChartListing()); },
OnDirect = delegate {this.Push(new OnlineListing()); },
OnEdit = delegate {this.Push(new Editor()); },
OnDirect = delegate { this.Push(new OnlineListing()); },
OnEdit = delegate { this.Push(new Editor()); },
OnSolo = onSolo,
OnMulti = delegate {this.Push(new Multiplayer()); },
OnMulti = delegate { this.Push(new Multiplayer()); },
OnExit = this.Exit,
}
}
},
sideFlashes = new MenuSideFlashes(),
};
});
buttons.StateChanged += state =>
{
@ -74,11 +79,7 @@ namespace osu.Game.Screens.Menu
break;
}
};
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame game = null)
{
if (game != null)
{
buttons.OnSettings = game.ToggleSettings;
@ -96,7 +97,7 @@ namespace osu.Game.Screens.Menu
public void LoadToSolo() => Schedule(onSolo);
private void onSolo() =>this.Push(consumeSongSelect());
private void onSolo() => this.Push(consumeSongSelect());
private Screen consumeSongSelect()
{
@ -154,7 +155,7 @@ namespace osu.Game.Screens.Menu
.OnComplete(l => buttons.SetOsuLogo(null));
}
private void beatmap_ValueChanged(WorkingBeatmap newValue)
private void beatmap_ValueChanged(ValueChangedEvent<WorkingBeatmap> e)
{
if (!this.IsCurrentScreen())
return;
@ -180,7 +181,7 @@ namespace osu.Game.Screens.Menu
{
base.OnResuming(last);
((BackgroundScreenDefault)Background).Next();
(Background as BackgroundScreenDefault)?.Next();
//we may have consumed our preloaded instance, so let's make another.
preloadSongSelect();

View File

@ -4,7 +4,6 @@
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@ -14,6 +13,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using System;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Menu
{

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu
public bool Triangles
{
set { colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); }
set => colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint);
}
public bool BeatMatching = true;
@ -71,8 +71,8 @@ namespace osu.Game.Screens.Menu
public bool Ripple
{
get { return rippleContainer.Alpha > 0; }
set { rippleContainer.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); }
get => rippleContainer.Alpha > 0;
set => rippleContainer.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint);
}
private readonly Box flashLayer;

View File

@ -25,10 +25,10 @@ namespace osu.Game.Screens.Multi.Components
[BackgroundDependencyLoader]
private void load()
{
CurrentItem.BindValueChanged(v => updateText(), true);
CurrentItem.BindValueChanged(_ => updateText(), true);
}
private float textSize = OsuSpriteText.FONT_SIZE;
private float textSize = OsuFont.DEFAULT_FONT_SIZE;
public float TextSize
{
@ -37,6 +37,7 @@ namespace osu.Game.Screens.Multi.Components
{
if (textSize == value)
return;
textSize = value;
updateText();
@ -58,7 +59,7 @@ namespace osu.Game.Screens.Multi.Components
if (beatmap == null)
textFlow.AddText("No beatmap selected", s =>
{
s.TextSize = TextSize;
s.Font = s.Font.With(size: TextSize);
s.Colour = colours.PinkLight;
});
else
@ -68,17 +69,17 @@ namespace osu.Game.Screens.Multi.Components
new OsuSpriteText
{
Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
TextSize = TextSize,
Font = OsuFont.GetFont(size: TextSize),
},
new OsuSpriteText
{
Text = " - ",
TextSize = TextSize,
Font = OsuFont.GetFont(size: TextSize),
},
new OsuSpriteText
{
Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)),
TextSize = TextSize,
Font = OsuFont.GetFont(size: TextSize),
}
}, null, LinkAction.OpenBeatmap, beatmap.OnlineBeatmapID.ToString(), "Open beatmap");
}

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Components
Children = new Drawable[]
{
new BeatmapTitle(),
beatmapAuthor = new LinkFlowContainer(s => s.TextSize = 14)
beatmapAuthor = new LinkFlowContainer(s => s.Font = s.Font.With(size: 14))
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Multi.Components
{
beatmapAuthor.Clear();
var beatmap = item?.Beatmap;
var beatmap = item.NewValue?.Beatmap;
if (beatmap != null)
{

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
@ -29,8 +29,9 @@ namespace osu.Game.Screens.Multi.Components
protected override bool OnClick(ClickEvent e)
{
if (!Enabled)
if (!Enabled.Value)
return true;
return base.OnClick(e);
}
}

View File

@ -46,9 +46,9 @@ namespace osu.Game.Screens.Multi.Components
},
};
CurrentItem.BindValueChanged(updateBeatmap, true);
CurrentItem.BindValueChanged(item => updateBeatmap(item.NewValue), true);
Type.BindValueChanged(v => gameTypeContainer.Child = new DrawableGameType(v) { Size = new Vector2(height) }, true);
Type.BindValueChanged(type => gameTypeContainer.Child = new DrawableGameType(type.NewValue) { Size = new Vector2(height) }, true);
}
private void updateBeatmap(PlaylistItem item)

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Multi.Components
InternalChild = sprite = CreateBackgroundSprite();
CurrentItem.BindValueChanged(i => sprite.Beatmap.Value = i?.Beatmap, true);
CurrentItem.BindValueChanged(item => sprite.Beatmap.Value = item.NewValue?.Beatmap, true);
}
protected virtual UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Multi.Components
@ -34,25 +35,22 @@ namespace osu.Game.Screens.Multi.Components
{
count = new OsuSpriteText
{
TextSize = text_size,
Font = @"Exo2.0-Bold"
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: text_size)
},
slash = new OsuSpriteText
{
Text = @"/",
TextSize = text_size,
Font = @"Exo2.0-Light"
Font = OsuFont.GetFont(weight: FontWeight.Light, size: text_size)
},
maxText = new OsuSpriteText
{
TextSize = text_size,
Font = @"Exo2.0-Light"
Font = OsuFont.GetFont(weight: FontWeight.Light, size: text_size)
},
}
};
MaxParticipants.BindValueChanged(_ => updateMax(), true);
ParticipantCount.BindValueChanged(v => count.Text = v.ToString("#,0"), true);
ParticipantCount.BindValueChanged(c => count.Text = c.NewValue.ToString("#,0"), true);
}
private void updateMax()

View File

@ -3,7 +3,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -34,10 +34,9 @@ namespace osu.Game.Screens.Multi.Components
{
statusPart = new StatusPart
{
TextSize = 14,
Font = "Exo2.0-Bold"
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14)
},
endDatePart = new EndDatePart { TextSize = 14 }
endDatePart = new EndDatePart { Font = OsuFont.GetFont(size: 14) }
}
};
@ -54,7 +53,7 @@ namespace osu.Game.Screens.Multi.Components
public EndDatePart()
: base(DateTimeOffset.UtcNow)
{
EndDate.BindValueChanged(d => Date = d);
EndDate.BindValueChanged(date => Date = date.NewValue);
}
protected override string Format()

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi.Components
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
status.BindValueChanged(s => this.FadeColour(s.GetAppropriateColour(colours), transitionDuration), true);
status.BindValueChanged(s => this.FadeColour(s.NewValue.GetAppropriateColour(colours), transitionDuration), true);
}
}
}

View File

@ -64,12 +64,11 @@ namespace osu.Game.Screens.Multi
new OsuSpriteText
{
Text = "multiplayer ",
TextSize = 25,
Font = OsuFont.GetFont(size: 25)
},
screenType = new OsuSpriteText
{
TextSize = 25,
Font = @"Exo2.0-Light",
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 25)
},
},
},
@ -85,10 +84,10 @@ namespace osu.Game.Screens.Multi
},
};
breadcrumbs.Current.ValueChanged += s =>
breadcrumbs.Current.ValueChanged += scren =>
{
if (s is IMultiplayerSubScreen mpScreen)
screenType.Text = mpScreen.ShortTitle.ToLowerInvariant();
if (scren.NewValue is IMultiplayerSubScreen multiScreen)
screenType.Text = multiScreen.ShortTitle.ToLowerInvariant();
};
breadcrumbs.Current.TriggerChange();

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -43,12 +43,14 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public readonly Room Room;
private SelectionState state;
public SelectionState State
{
get { return state; }
get => state;
set
{
if (value == state) return;
state = value;
if (state == SelectionState.Selected)
@ -63,9 +65,10 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public IEnumerable<string> FilterTerms => new[] { Room.Name.Value };
private bool matchingFilter;
public bool MatchingFilter
{
get { return matchingFilter; }
get => matchingFilter;
set
{
matchingFilter = value;
@ -155,7 +158,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
Spacing = new Vector2(5f),
Children = new Drawable[]
{
new RoomName { TextSize = 18 },
new RoomName { Font = OsuFont.GetFont(size: 18) },
new ParticipantInfo(),
},
},

View File

@ -3,7 +3,7 @@
using System.ComponentModel;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Game.Graphics;
using osu.Game.Overlays.SearchableList;
using osuTK.Graphics;
@ -45,8 +45,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
filter.Value = new FilterCriteria
{
SearchString = Search.Current.Value ?? string.Empty,
PrimaryFilter = Tabs.Current,
SecondaryFilter = DisplayStyleControl.Dropdown.Current
PrimaryFilter = Tabs.Current.Value,
SecondaryFilter = DisplayStyleControl.Dropdown.Current.Value
};
}
}
@ -54,6 +54,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public enum PrimaryFilter
{
Open,
[Description("Recently Ended")]
RecentlyEnded,
Participated,

View File

@ -81,28 +81,29 @@ namespace osu.Game.Screens.Multi.Lounge.Components
summary = new OsuSpriteText
{
Text = "0 participants",
TextSize = 14,
Font = OsuFont.GetFont(size: 14)
}
},
},
};
Host.BindValueChanged(v =>
Host.BindValueChanged(host =>
{
hostText.Clear();
flagContainer.Clear();
if (v != null)
if (host.NewValue != null)
{
hostText.AddText("hosted by ");
hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic");
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
hostText.AddLink(host.NewValue.Username, null, LinkAction.OpenUserProfile, host.NewValue.Id.ToString(), "Open profile",
s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
flagContainer.Child = new DrawableFlag(host.NewValue.Country) { RelativeSizeAxes = Axes.Both };
}
}, true);
ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}", true);
ParticipantCount.BindValueChanged(count => summary.Text = "participant".ToQuantity(count.NewValue), true);
/*Participants.BindValueChanged(v =>
/*Participants.BindValueChanged(e =>
{
var ranks = v.Select(u => u.Statistics.Ranks.Global);
levelRangeLower.Text = ranks.Min().ToString();

View File

@ -3,7 +3,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
TextSize = 30,
Font = OsuFont.GetFont(size: 30),
Current = Name
},
},
@ -135,8 +135,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
AutoSizeAxes = Axes.Both,
Child = new StatusText
{
TextSize = 14,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14),
}
},
beatmapTypeInfo = new BeatmapTypeInfo(),
@ -192,7 +191,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
}
else
{
status.Value = Status;
status.Value = Status.Value;
participantCount.FadeIn(transition_duration);
beatmapTypeInfo.FadeIn(transition_duration);
@ -215,7 +214,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
[BackgroundDependencyLoader]
private void load()
{
status.BindValueChanged(s => Text = s.Message, true);
status.BindValueChanged(s => Text = s.NewValue.Message, true);
}
}

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -109,7 +109,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
private void updateSorting()
{
foreach (var room in roomFlow)
roomFlow.SetLayoutPosition(room, room.Room.Position);
roomFlow.SetLayoutPosition(room, room.Room.Position.Value);
}
private void selectRoom(Room room)

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;

View File

@ -3,7 +3,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
@ -108,7 +108,7 @@ namespace osu.Game.Screens.Multi.Match.Components
},
};
CurrentItem.BindValueChanged(i => modDisplay.Current.Value = i?.RequiredMods, true);
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods, true);
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
}
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Multi.Match.Components
[BackgroundDependencyLoader]
private void load()
{
roomId.BindValueChanged(v => this.FadeTo(v.HasValue ? 0 : 1), true);
roomId.BindValueChanged(id => this.FadeTo(id.NewValue.HasValue ? 0 : 1), true);
}
}

View File

@ -41,8 +41,7 @@ namespace osu.Game.Screens.Multi.Match.Components
Depth = -1,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Font = @"Exo2.0-Light",
TextSize = 30,
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30),
};
}
}

View File

@ -1,9 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.Chat;
using osu.Game.Users;
@ -42,7 +43,7 @@ namespace osu.Game.Screens.Multi.Match.Components
}
};
Host.BindValueChanged(updateHost);
Host.BindValueChanged(host => updateHost(host.NewValue));
}
private void updateHost(User host)
@ -53,7 +54,8 @@ namespace osu.Game.Screens.Multi.Match.Components
{
linkContainer.AddText("hosted by");
linkContainer.NewLine();
linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", s => s.Font = "Exo2.0-BoldItalic");
linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile",
s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
}
}
}

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
new OsuSpriteText
{
TextSize = 30,
Font = OsuFont.GetFont(size: 30),
Current = Name
},
new RoomStatusInfo(),
@ -94,8 +94,8 @@ namespace osu.Game.Screens.Multi.Match.Components
CurrentItem.BindValueChanged(item =>
{
viewBeatmapButton.Beatmap.Value = item?.Beatmap;
readyButton.Beatmap.Value = item?.Beatmap;
viewBeatmapButton.Beatmap.Value = item.NewValue?.Beatmap;
readyButton.Beatmap.Value = item.NewValue?.Beatmap;
}, true);
hostInfo.Host.BindTo(Host);

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Game.Online.Chat;
using osu.Game.Online.Multiplayer;
@ -28,13 +28,13 @@ namespace osu.Game.Screens.Multi.Match.Components
{
base.LoadComplete();
roomId.BindValueChanged(v => updateChannel(), true);
roomId.BindValueChanged(_ => updateChannel(), true);
}
private void updateChannel()
{
if (roomId.Value != null)
Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId, Type = ChannelType.Multiplayer, Name = $"#mp_{roomId.Value}" });
Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId.Value, Type = ChannelType.Multiplayer, Name = $"#mp_{roomId.Value}" });
}
}
}

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
roomId.BindValueChanged(id =>
{
if (id == null)
if (id.NewValue == null)
return;
Scores = null;

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
namespace osu.Game.Screens.Multi.Match.Components
{

View File

@ -4,7 +4,7 @@
using System;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Multi.Match.Components
},
typeLabel = new OsuSpriteText
{
TextSize = 14,
Font = OsuFont.GetFont(size: 14),
Colour = colours.Yellow
},
},
@ -264,12 +264,12 @@ namespace osu.Game.Screens.Multi.Match.Components
processingOverlay = new ProcessingOverlay { Alpha = 0 }
};
TypePicker.Current.BindValueChanged(t => typeLabel.Text = t?.Name ?? string.Empty, true);
Name.BindValueChanged(n => NameField.Text = n, true);
Availability.BindValueChanged(a => AvailabilityPicker.Current.Value = a, true);
Type.BindValueChanged(t => TypePicker.Current.Value = t, true);
MaxParticipants.BindValueChanged(m => MaxParticipantsField.Text = m?.ToString(), true);
Duration.BindValueChanged(d => DurationField.Current.Value = d, true);
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
Name.BindValueChanged(name => NameField.Text = name.NewValue, true);
Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
Duration.BindValueChanged(duration => DurationField.Current.Value = duration.NewValue, true);
}
protected override void Update()
@ -296,7 +296,7 @@ namespace osu.Game.Screens.Multi.Match.Components
Duration.Value = DurationField.Current.Value;
manager?.CreateRoom(currentRoom, onSuccess, onError);
manager?.CreateRoom(currentRoom.Value, onSuccess, onError);
processingOverlay.Show();
}
@ -364,8 +364,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
new OsuSpriteText
{
TextSize = 12,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12),
Text = title.ToUpper(),
},
content = new Container

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
@ -26,9 +26,9 @@ namespace osu.Game.Screens.Multi.Match.Components
[BackgroundDependencyLoader]
private void load()
{
roomId.BindValueChanged(v =>
roomId.BindValueChanged(id =>
{
if (v.HasValue)
if (id.NewValue.HasValue)
{
Items.ForEach(t => t.Enabled.Value = !(t is SettingsMatchPage));
Current.Value = new RoomMatchPage();
@ -51,13 +51,14 @@ namespace osu.Game.Screens.Multi.Match.Components
: base(value)
{
enabled.BindTo(value.Enabled);
enabled.BindValueChanged(v => Colour = v ? Color4.White : Color4.Gray);
enabled.BindValueChanged(enabled => Colour = enabled.NewValue ? Color4.White : Color4.Gray, true);
}
protected override bool OnClick(ClickEvent e)
{
if (!enabled.Value)
return true;
return base.OnClick(e);
}
}

View File

@ -50,9 +50,9 @@ namespace osu.Game.Screens.Multi.Match.Components
},
};
Participants.BindValueChanged(v =>
Participants.BindValueChanged(participants =>
{
usersFlow.Children = v.Select(u => new UserPanel(u)
usersFlow.Children = participants.NewValue.Select(u => new UserPanel(u)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,

View File

@ -4,7 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
@ -39,8 +39,9 @@ namespace osu.Game.Screens.Multi.Match.Components
private void load()
{
beatmaps.ItemAdded += beatmapAdded;
beatmaps.ItemRemoved += beatmapRemoved;
Beatmap.BindValueChanged(updateBeatmap, true);
Beatmap.BindValueChanged(b => updateBeatmap(b.NewValue), true);
}
private void updateBeatmap(BeatmapInfo beatmap)
@ -62,6 +63,15 @@ namespace osu.Game.Screens.Multi.Match.Components
Schedule(() => hasBeatmap = true);
}
private void beatmapRemoved(BeatmapSetInfo model)
{
if (Beatmap.Value == null)
return;
if (model.OnlineBeatmapSetID == Beatmap.Value.BeatmapSet.OnlineBeatmapSetID)
Schedule(() => hasBeatmap = false);
}
protected override void Update()
{
base.Update();
@ -77,7 +87,7 @@ namespace osu.Game.Screens.Multi.Match.Components
return;
}
bool hasEnoughTime = DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate;
bool hasEnoughTime = DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate.Value;
Enabled.Value = hasBeatmap && hasEnoughTime;
}

View File

@ -39,7 +39,8 @@ namespace osu.Game.Screens.Multi.Match.Components
private readonly Box hover, selection;
public RoomAvailabilityPickerItem(RoomAvailability value) : base(value)
public RoomAvailabilityPickerItem(RoomAvailability value)
: base(value)
{
RelativeSizeAxes = Axes.Y;
Width = 102;
@ -68,7 +69,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = value.GetDescription(),
},
};

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osuTK;
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Match.Components
private void load()
{
if (osuGame != null)
Beatmap.BindValueChanged(updateAction, true);
Beatmap.BindValueChanged(beatmap => updateAction(beatmap.NewValue), true);
}
private void updateAction(BeatmapInfo beatmap)

View File

@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
@ -43,7 +43,7 @@ namespace osu.Game.Screens.Multi.Match
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
[Resolved]
protected Bindable<IEnumerable<Mod>> CurrentMods { get; private set; }
protected Bindable<IEnumerable<Mod>> SelectedMods { get; private set; }
[Resolved]
private BeatmapManager beatmapManager { get; set; }
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Multi.Match
public MatchSubScreen(Room room)
{
Title = room.RoomID.Value == null ? "New room" : room.Name;
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
}
[BackgroundDependencyLoader]
@ -146,10 +146,10 @@ namespace osu.Game.Screens.Multi.Match
},
};
header.Tabs.Current.BindValueChanged(t =>
header.Tabs.Current.BindValueChanged(tab =>
{
const float fade_duration = 500;
if (t is SettingsMatchPage)
if (tab.NewValue is SettingsMatchPage)
{
settings.Show();
info.FadeOut(fade_duration, Easing.OutQuint);
@ -188,15 +188,15 @@ namespace osu.Game.Screens.Multi.Match
/// <summary>
/// Handles propagation of the current playlist item's content to game-wide mechanisms.
/// </summary>
private void currentItemChanged(PlaylistItem item)
private void currentItemChanged(ValueChangedEvent<PlaylistItem> e)
{
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
var localBeatmap = item?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == item.Beatmap.OnlineBeatmapID);
var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID);
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
CurrentMods.Value = item?.RequiredMods ?? Enumerable.Empty<Mod>();
if (item?.Ruleset != null)
Ruleset.Value = item.Ruleset;
SelectedMods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty<Mod>();
if (e.NewValue?.Ruleset != null)
Ruleset.Value = e.NewValue.Ruleset;
}
/// <summary>
@ -222,13 +222,13 @@ namespace osu.Game.Screens.Multi.Match
private void onStart()
{
Beatmap.Value.Mods.Value = CurrentMods.Value.ToArray();
Beatmap.Value.Mods.Value = SelectedMods.Value.ToArray();
switch (type.Value)
{
default:
case GameTypeTimeshift _:
multiplayer?.Start(() => new TimeshiftPlayer(CurrentItem)
multiplayer?.Start(() => new TimeshiftPlayer(CurrentItem.Value)
{
Exited = () => leaderboard.RefreshScores()
});

View File

@ -3,7 +3,7 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -135,7 +135,7 @@ namespace osu.Game.Screens.Multi
protected override void LoadComplete()
{
base.LoadComplete();
isIdle.BindValueChanged(updatePollingRate, true);
isIdle.BindValueChanged(idle => updatePollingRate(idle.NewValue), true);
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.Multiplayer;
using osu.Game.Users;

View File

@ -2,15 +2,19 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Multi.Ranking;
using osu.Game.Screens.Play;
@ -30,6 +34,12 @@ namespace osu.Game.Screens.Multi.Play
[Resolved]
private APIAccess api { get; set; }
[Resolved]
private IBindable<RulesetInfo> ruleset { get; set; }
[Resolved]
private Bindable<IEnumerable<Mod>> selectedMods { get; set; }
public TimeshiftPlayer(PlaylistItem playlistItem)
{
this.playlistItem = playlistItem;
@ -44,6 +54,16 @@ namespace osu.Game.Screens.Multi.Play
bool failed = false;
// Sanity checks to ensure that TimeshiftPlayer matches the settings for the current PlaylistItem
if (Beatmap.Value.BeatmapInfo.OnlineBeatmapID != playlistItem.Beatmap.OnlineBeatmapID)
throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
if (ruleset.Value.ID != playlistItem.Ruleset.ID)
throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
if (!playlistItem.RequiredMods.All(m => selectedMods.Value.Contains(m)))
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);
req.Success += r => token = r.ID;
req.Failure += e =>

View File

@ -18,9 +18,9 @@ namespace osu.Game.Screens.Multi.Ranking
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new IResultPageInfo[]
{
new ScoreOverviewPageInfo(Score, Beatmap),
new LocalLeaderboardPageInfo(Score, Beatmap),
new RoomLeaderboardPageInfo(Score, Beatmap),
new ScoreOverviewPageInfo(Score, Beatmap.Value),
new LocalLeaderboardPageInfo(Score, Beatmap.Value),
new RoomLeaderboardPageInfo(Score, Beatmap.Value),
};
}
}

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Internal;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -80,7 +80,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
Action<SpriteText> gray = s => s.Colour = colours.GrayC;
Action<SpriteText> white = s =>
{
s.TextSize *= 1.4f;
s.Font = s.Font.With(size: s.Font.Size * 1.4f);
s.Colour = colours.GrayF;
};
@ -91,7 +91,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
rankText.AddText($"#{index + 1} ", s =>
{
s.Font = "Exo2.0-Bold";
s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold);
s.Colour = colours.YellowDark;
});

View File

@ -5,7 +5,7 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Online;
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi
public void CreateRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
{
room.Host.Value = api.LocalUser;
room.Host.Value = api.LocalUser.Value;
var req = new CreateRoomRequest(room);

View File

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Internal;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Framework.Screens;
@ -174,7 +174,7 @@ namespace osu.Game.Screens
logo.FadeOut(300, Easing.OutQuint);
logo.Anchor = Anchor.TopLeft;
logo.Origin = Anchor.Centre;
logo.RelativePositionAxes = Axes.None;
logo.RelativePositionAxes = Axes.Both;
logo.BeatMatching = true;
logo.Triangles = true;
logo.Ripple = true;

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;

View File

@ -15,8 +15,8 @@ namespace osu.Game.Screens.Play.Break
public FontAwesome Icon
{
set { icon.Icon = value; }
get { return icon.Icon; }
set => icon.Icon = value;
get => icon.Icon;
}
public override Vector2 Size
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.Break
base.Size = value + BlurSigma * 2.5f;
ForceRedraw();
}
get { return base.Size; }
get => base.Size;
}
public BlurredIcon()

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
using osuTK;
@ -29,8 +30,7 @@ namespace osu.Game.Screens.Play.Break
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "current progress".ToUpperInvariant(),
TextSize = 15,
Font = "Exo2.0-Black",
Font = OsuFont.GetFont(weight: FontWeight.Black, size: 15),
},
new FillFlowContainer
{

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play.Break
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
Text = name,
TextSize = 17,
Font = OsuFont.GetFont(size: 17),
Margin = new MarginPadding { Right = margin }
},
valueText = new OsuSpriteText
@ -42,8 +42,7 @@ namespace osu.Game.Screens.Play.Break
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
Text = prefix + @"-",
TextSize = 17,
Font = "Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
Margin = new MarginPadding { Left = margin }
}
};
@ -51,9 +50,9 @@ namespace osu.Game.Screens.Play.Break
Current.ValueChanged += currentValueChanged;
}
private void currentValueChanged(T newValue)
private void currentValueChanged(ValueChangedEvent<T> e)
{
var newText = prefix + Format(newValue);
var newText = prefix + Format(e.NewValue);
if (valueText.Text == newText)
return;
@ -73,7 +72,8 @@ namespace osu.Game.Screens.Play.Break
public class PercentageBreakInfoLine : BreakInfoLine<double>
{
public PercentageBreakInfoLine(string name, string prefix = "") : base(name, prefix)
public PercentageBreakInfoLine(string name, string prefix = "")
: base(name, prefix)
{
}

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.Break
public override Vector2 Size
{
get { return base.Size; }
get => base.Size;
set
{
blurredIcon.Size = spriteIcon.Size = value;
@ -26,14 +26,14 @@ namespace osu.Game.Screens.Play.Break
public Vector2 BlurSigma
{
get { return blurredIcon.BlurSigma; }
set { blurredIcon.BlurSigma = value; }
get => blurredIcon.BlurSigma;
set => blurredIcon.BlurSigma = value;
}
public FontAwesome Icon
{
get { return spriteIcon.Icon; }
set { spriteIcon.Icon = blurredIcon.Icon = value; }
get => spriteIcon.Icon;
set => spriteIcon.Icon = blurredIcon.Icon = value;
}
public GlowIcon()

View File

@ -4,6 +4,7 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play.Break
@ -19,8 +20,7 @@ namespace osu.Game.Screens.Play.Break
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 33,
Font = "Venera",
Font = OsuFont.Numeric.With(size: 33),
};
}

View File

@ -18,6 +18,7 @@ using System.Linq;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
using Humanizer;
namespace osu.Game.Screens.Play
{
@ -88,11 +89,10 @@ namespace osu.Game.Screens.Play
new OsuSpriteText
{
Text = Header,
Font = @"Exo2.0-Medium",
Font = OsuFont.GetFont(size: 30),
Spacing = new Vector2(5, 0),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
TextSize = 30,
Colour = colours.Yellow,
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f)
@ -176,7 +176,7 @@ namespace osu.Game.Screens.Play
}
};
button.Selected.ValueChanged += s => buttonSelectionChanged(button, s);
button.Selected.ValueChanged += selected => buttonSelectionChanged(button, selected.NewValue);
InternalButtons.Add(button);
}
@ -185,7 +185,7 @@ namespace osu.Game.Screens.Play
private int selectionIndex
{
get { return _selectionIndex; }
get => _selectionIndex;
set
{
if (_selectionIndex == value)
@ -260,22 +260,21 @@ namespace osu.Game.Screens.Play
Text = "You've retried ",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
Font = OsuFont.GetFont(size: 18),
},
new OsuSpriteText
{
Text = $"{retries:n0}",
Font = @"Exo2.0-Bold",
Text = "time".ToQuantity(retries),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $" time{(retries == 1 ? "" : "s")} in this session",
Text = " in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
Font = OsuFont.GetFont(size: 18),
}
};
}
@ -292,7 +291,7 @@ namespace osu.Game.Screens.Play
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Repeat || e.Key != Key.Enter || !Selected)
if (e.Repeat || e.Key != Key.Enter || !Selected.Value)
return false;
Click();

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -63,14 +63,14 @@ namespace osu.Game.Screens.Play.HUD
TextSize = 80;
Current.ValueChanged += newValue => updateCount(newValue == 0);
Current.ValueChanged += combo => updateCount(combo.NewValue == 0);
}
protected override void LoadComplete()
{
base.LoadComplete();
DisplayedCountSpriteText.Text = FormatCount(Current);
DisplayedCountSpriteText.Text = FormatCount(Current.Value);
DisplayedCountSpriteText.Anchor = Anchor;
DisplayedCountSpriteText.Origin = Origin;
@ -78,29 +78,33 @@ namespace osu.Game.Screens.Play.HUD
}
private int displayedCount;
/// <summary>
/// Value shown at the current moment.
/// </summary>
public virtual int DisplayedCount
{
get { return displayedCount; }
get => displayedCount;
protected set
{
if (displayedCount.Equals(value))
return;
updateDisplayedCount(displayedCount, value, IsRolling);
}
}
private float textSize;
public float TextSize
{
get { return textSize; }
get => textSize;
set
{
textSize = value;
DisplayedCountSpriteText.TextSize = TextSize;
PopOutCount.TextSize = TextSize;
DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: TextSize);
PopOutCount.Font = PopOutCount.Font.With(size: TextSize);
}
}
@ -110,7 +114,7 @@ namespace osu.Game.Screens.Play.HUD
/// <param name="amount"></param>
public void Increment(int amount = 1)
{
Current.Value = Current + amount;
Current.Value = Current.Value + amount;
}
/// <summary>
@ -161,7 +165,7 @@ namespace osu.Game.Screens.Play.HUD
private void updateCount(bool rolling)
{
int prev = previousValue;
previousValue = Current;
previousValue = Current.Value;
if (!IsLoaded)
return;
@ -172,14 +176,14 @@ namespace osu.Game.Screens.Play.HUD
IsRolling = false;
DisplayedCount = prev;
if (prev + 1 == Current)
OnCountIncrement(prev, Current);
if (prev + 1 == Current.Value)
OnCountIncrement(prev, Current.Value);
else
OnCountChange(prev, Current);
OnCountChange(prev, Current.Value);
}
else
{
OnCountRolling(displayedCount, Current);
OnCountRolling(displayedCount, Current.Value);
IsRolling = true;
}
}

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play.HUD
public override void Increment(long amount)
{
Current.Value = Current + amount;
Current.Value = Current.Value + amount;
}
}
}

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Play.HUD
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.HUD
protected HealthDisplay()
{
Current.ValueChanged += newValue => SetHealth((float)newValue);
Current.ValueChanged += health => SetHealth((float)health.NewValue);
}
protected abstract void SetHealth(float value);

View File

@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play.HUD
text = new OsuSpriteText
{
Text = "hold for menu",
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft
},
@ -163,7 +163,7 @@ namespace osu.Game.Screens.Play.HUD
private void bind()
{
circularProgress.Current.BindTo(Progress);
Progress.ValueChanged += v => icon.Scale = new Vector2(1 + (float)v * 0.2f);
Progress.ValueChanged += progress => icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f);
}
private bool pendingAnimation;

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
@ -14,6 +14,7 @@ using osu.Game.Rulesets.UI;
using osuTK;
using osu.Game.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
namespace osu.Game.Screens.Play.HUD
{
@ -60,15 +61,14 @@ namespace osu.Game.Screens.Play.HUD
Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre,
Text = @"/ UNRANKED /",
Font = @"Venera",
TextSize = 12,
Font = OsuFont.Numeric.With(size: 12)
}
};
Current.ValueChanged += mods =>
{
iconsContainer.Clear();
foreach (Mod mod in mods)
foreach (Mod mod in mods.NewValue)
{
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
}

View File

@ -17,6 +17,7 @@ namespace osu.Game.Screens.Play.HUD
public bool ReplayLoaded;
public readonly PlaybackSettings PlaybackSettings;
public readonly VisualSettings VisualSettings;
//public readonly CollectionSettings CollectionSettings;
//public readonly DiscussionSettings DiscussionSettings;

View File

@ -44,18 +44,20 @@ namespace osu.Game.Screens.Play.HUD
public Color4 AccentColour
{
get { return fill.Colour; }
set { fill.Colour = value; }
get => fill.Colour;
set => fill.Colour = value;
}
private Color4 glowColour;
public Color4 GlowColour
{
get { return glowColour; }
get => glowColour;
set
{
if (glowColour == value)
return;
glowColour = value;
fill.EdgeEffect = new EdgeEffectParameters

View File

@ -2,7 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play
Progress.Objects = rulesetContainer.Objects;
Progress.AudioClock = offsetClock;
Progress.AllowSeeking = rulesetContainer.HasReplayLoaded;
Progress.AllowSeeking = rulesetContainer.HasReplayLoaded.Value;
Progress.OnSeek = pos => adjustableClock.Seek(pos);
ModDisplay.Current.BindTo(working.Mods);
@ -104,10 +104,10 @@ namespace osu.Game.Screens.Play
private void load(OsuConfigManager config, NotificationOverlay notificationOverlay)
{
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
showHud.ValueChanged += hudVisibility => visibilityContainer.FadeTo(hudVisibility ? 1 : 0, duration);
showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
showHud.TriggerChange();
if (!showHud && !hasShownNotificationOnce)
if (!showHud.Value && !hasShownNotificationOnce)
{
hasShownNotificationOnce = true;
@ -126,11 +126,11 @@ namespace osu.Game.Screens.Play
replayLoaded.TriggerChange();
}
private void replayLoadedValueChanged(bool loaded)
private void replayLoadedValueChanged(ValueChangedEvent<bool> e)
{
PlayerSettingsOverlay.ReplayLoaded = loaded;
PlayerSettingsOverlay.ReplayLoaded = e.NewValue;
if (loaded)
if (e.NewValue)
{
PlayerSettingsOverlay.Show();
ModDisplay.FadeIn(200);
@ -241,8 +241,7 @@ namespace osu.Game.Screens.Play
ComboCounter?.Current.BindTo(processor.Combo);
HealthDisplay?.Current.BindTo(processor.Health);
var shd = HealthDisplay as StandardHealthDisplay;
if (shd != null)
if (HealthDisplay is StandardHealthDisplay shd)
processor.NewJudgement += shd.Flash;
}
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;
@ -26,9 +27,10 @@ namespace osu.Game.Screens.Play
public bool IsCounting { get; set; } = true;
private int countPresses;
public int CountPresses
{
get { return countPresses; }
get => countPresses;
private set
{
if (countPresses != value)
@ -40,9 +42,10 @@ namespace osu.Game.Screens.Play
}
private bool isLit;
public bool IsLit
{
get { return isLit; }
get => isLit;
protected set
{
if (isLit != value)
@ -96,8 +99,7 @@ namespace osu.Game.Screens.Play
new OsuSpriteText
{
Text = Name,
Font = @"Venera",
TextSize = 12,
Font = OsuFont.Numeric.With(size: 12),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Both,

View File

@ -10,7 +10,8 @@ namespace osu.Game.Screens.Play
{
public T Action { get; }
public KeyCounterAction(T action) : base($"B{(int)(object)action + 1}")
public KeyCounterAction(T action)
: base($"B{(int)(object)action + 1}")
{
Action = action;
}

View File

@ -4,7 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
@ -58,9 +58,10 @@ namespace osu.Game.Screens.Play
}
private bool isCounting = true;
public bool IsCounting
{
get { return isCounting; }
get => isCounting;
set
{
if (value == isCounting) return;
@ -72,9 +73,10 @@ namespace osu.Game.Screens.Play
}
private int fadeTime;
public int FadeTime
{
get { return fadeTime; }
get => fadeTime;
set
{
if (value != fadeTime)
@ -87,9 +89,10 @@ namespace osu.Game.Screens.Play
}
private Color4 keyDownTextColor = Color4.DarkGray;
public Color4 KeyDownTextColor
{
get { return keyDownTextColor; }
get => keyDownTextColor;
set
{
if (value != keyDownTextColor)
@ -102,9 +105,10 @@ namespace osu.Game.Screens.Play
}
private Color4 keyUpTextColor = Color4.White;
public Color4 KeyUpTextColor
{
get { return keyUpTextColor; }
get => keyUpTextColor;
set
{
if (value != keyUpTextColor)
@ -161,6 +165,7 @@ namespace osu.Game.Screens.Play
case MouseUpEvent _:
return Target.Children.Any(c => c.TriggerEvent(e));
}
return base.Handle(e);
}
}

View File

@ -9,7 +9,9 @@ namespace osu.Game.Screens.Play
public class KeyCounterKeyboard : KeyCounter
{
public Key Key { get; }
public KeyCounterKeyboard(Key key) : base(key.ToString())
public KeyCounterKeyboard(Key key)
: base(key.ToString())
{
Key = key;
}

View File

@ -11,7 +11,8 @@ namespace osu.Game.Screens.Play
{
public MouseButton Button { get; }
public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button))
public KeyCounterMouse(MouseButton button)
: base(getStringRepresentation(button))
{
Button = button;
}

View File

@ -4,7 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
@ -32,7 +32,10 @@ namespace osu.Game.Screens.Play
protected override Container<Drawable> Content => content;
public int Retries { set { pauseOverlay.Retries = value; } }
public int Retries
{
set => pauseOverlay.Retries = value;
}
public bool CanPause => (CheckCanPause?.Invoke() ?? true) && Time.Current >= lastPauseActionTime + pause_cooldown;
public bool IsResuming { get; private set; }
@ -78,7 +81,7 @@ namespace osu.Game.Screens.Play
{
if (!CanPause && !force) return;
if (IsPaused) return;
if (IsPaused.Value) return;
// stop the seekable clock (stops the audio eventually)
decoupledClock.Stop();
@ -91,7 +94,7 @@ namespace osu.Game.Screens.Play
public void Resume()
{
if (!IsPaused) return;
if (!IsPaused.Value) return;
IsPaused.Value = false;
IsResuming = false;
@ -116,10 +119,10 @@ namespace osu.Game.Screens.Play
protected override void Update()
{
// eagerly pause when we lose window focus (if we are locally playing).
if (!game.IsActive && CanPause)
if (!game.IsActive.Value && CanPause)
Pause();
if (!IsPaused)
if (!IsPaused.Value)
framedClock.ProcessFrame();
base.Update();

View File

@ -8,7 +8,7 @@ using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
@ -19,7 +19,6 @@ using osu.Framework.Threading;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
using osu.Game.Online.API;
@ -32,7 +31,6 @@ using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Skinning;
using osu.Game.Storyboards.Drawables;
using osuTK.Graphics;
namespace osu.Game.Screens.Play
{
@ -57,6 +55,8 @@ namespace osu.Game.Screens.Play
private Bindable<bool> mouseWheelDisabled;
private Bindable<double> userAudioOffset;
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
public int RestartCount;
public CursorContainer Cursor => RulesetContainer.Cursor;
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play
[Resolved]
private ScoreManager scoreManager { get; set; }
private PauseContainer pauseContainer;
protected PauseContainer PauseContainer { get; private set; }
private RulesetInfo ruleset;
@ -80,14 +80,21 @@ namespace osu.Game.Screens.Play
private SampleChannel sampleRestart;
protected ScoreProcessor ScoreProcessor;
protected RulesetContainer RulesetContainer;
protected ScoreProcessor ScoreProcessor { get; private set; }
protected RulesetContainer RulesetContainer { get; private set; }
protected HUDOverlay HUDOverlay;
protected HUDOverlay HUDOverlay { get; private set; }
private FailOverlay failOverlay;
private DrawableStoryboard storyboard;
private Container storyboardContainer;
protected UserDimContainer StoryboardContainer { get; private set; }
protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true)
{
RelativeSizeAxes = Axes.Both,
Alpha = 1,
EnableUserDim = { Value = true }
};
public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true;
@ -159,7 +166,7 @@ namespace osu.Game.Screens.Play
// the final usable gameplay clock with user-set offsets applied.
var offsetClock = new FramedOffsetClock(platformOffsetClock);
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
userAudioOffset.ValueChanged += offset => offsetClock.Offset = offset.NewValue;
userAudioOffset.TriggerChange();
ScoreProcessor = RulesetContainer.CreateScoreProcessor();
@ -168,19 +175,15 @@ namespace osu.Game.Screens.Play
InternalChildren = new Drawable[]
{
pauseContainer = new PauseContainer(offsetClock, adjustableClock)
PauseContainer = new PauseContainer(offsetClock, adjustableClock)
{
Retries = RestartCount,
OnRetry = Restart,
OnQuit = performUserRequestedExit,
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
Children = new[]
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value,
Children = new Container[]
{
storyboardContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
},
StoryboardContainer = CreateStoryboardContainer(),
new ScalingContainer(ScalingMode.Gameplay)
{
Child = new LocalSkinOverrideContainer(working.Skin)
@ -236,9 +239,9 @@ namespace osu.Game.Screens.Play
HUDOverlay.HoldToQuit.Action = performUserRequestedExit;
HUDOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);
RulesetContainer.IsPaused.BindTo(PauseContainer.IsPaused);
if (ShowStoryboard)
if (ShowStoryboard.Value)
initializeStoryboard(false);
// Bind ScoreProcessor to ourselves
@ -261,6 +264,7 @@ namespace osu.Game.Screens.Play
private void performUserRequestedExit()
{
if (!this.IsCurrentScreen()) return;
this.Exit();
}
@ -296,7 +300,7 @@ namespace osu.Game.Screens.Play
if (RulesetContainer.ReplayScore == null)
scoreManager.Import(score, true);
this.Push(CreateResults(score));
this.Push(CreateResults(score));
onCompletionEvent = null;
});
@ -345,6 +349,18 @@ namespace osu.Game.Screens.Play
.Delay(250)
.FadeIn(250);
ShowStoryboard.ValueChanged += enabled =>
{
if (enabled.NewValue) initializeStoryboard(true);
};
Background.EnableUserDim.Value = true;
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
Task.Run(() =>
{
sourceClock.Reset();
@ -356,7 +372,7 @@ namespace osu.Game.Screens.Play
this.Delay(750).Schedule(() =>
{
if (!pauseContainer.IsPaused)
if (!PauseContainer.IsPaused.Value)
{
adjustableClock.Start();
}
@ -364,8 +380,8 @@ namespace osu.Game.Screens.Play
});
});
pauseContainer.Alpha = 0;
pauseContainer.FadeIn(750, Easing.OutQuint);
PauseContainer.Alpha = 0;
PauseContainer.FadeIn(750, Easing.OutQuint);
}
public override void OnSuspending(IScreen next)
@ -383,17 +399,16 @@ namespace osu.Game.Screens.Play
return true;
}
if ((!AllowPause || HasFailed || !ValidForResume || pauseContainer?.IsPaused.Value != false || RulesetContainer?.HasReplayLoaded.Value != false) && (!pauseContainer?.IsResuming ?? true))
if ((!AllowPause || HasFailed || !ValidForResume || PauseContainer?.IsPaused.Value != false || RulesetContainer?.HasReplayLoaded.Value != false) && (!PauseContainer?.IsResuming ?? true))
{
// In the case of replays, we may have changed the playback rate.
applyRateFromMods();
fadeOut();
return base.OnExiting(next);
}
if (LoadedBeatmapSuccessfully)
pauseContainer?.Pause();
PauseContainer?.Pause();
return true;
}
@ -402,14 +417,16 @@ namespace osu.Game.Screens.Play
{
float fadeOutDuration = instant ? 0 : 250;
this.FadeOut(fadeOutDuration);
Background?.FadeColour(Color4.White, fadeOutDuration, Easing.OutQuint);
Background.EnableUserDim.Value = false;
storyboardReplacesBackground.Value = false;
}
protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused;
protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !PauseContainer.IsPaused.Value;
private void initializeStoryboard(bool asyncLoad)
{
if (storyboardContainer == null)
if (StoryboardContainer == null || storyboard != null)
return;
var beatmap = Beatmap.Value;
@ -418,29 +435,9 @@ namespace osu.Game.Screens.Play
storyboard.Masking = true;
if (asyncLoad)
LoadComponentAsync(storyboard, storyboardContainer.Add);
LoadComponentAsync(storyboard, StoryboardContainer.Add);
else
storyboardContainer.Add(storyboard);
}
protected override void UpdateBackgroundElements()
{
if (!this.IsCurrentScreen()) return;
base.UpdateBackgroundElements();
if (ShowStoryboard && storyboard == null)
initializeStoryboard(true);
var beatmap = Beatmap.Value;
var storyboardVisible = ShowStoryboard && beatmap.Storyboard.HasDrawable;
storyboardContainer?
.FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint)
.FadeTo(storyboardVisible && BackgroundOpacity > 0 ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint);
if (storyboardVisible && beatmap.Storyboard.ReplacesBackground)
Background?.FadeColour(Color4.Black, BACKGROUND_FADE_DURATION, Easing.OutQuint);
StoryboardContainer.Add(storyboard);
}
protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score);

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play
Margin = new MarginPadding(25),
Children = new PlayerSettingsGroup[]
{
visualSettings = new VisualSettings(),
VisualSettings = new VisualSettings(),
new InputSettings()
}
}
@ -143,8 +143,6 @@ namespace osu.Game.Screens.Play
{
base.LogoArriving(logo, resuming);
logo.RelativePositionAxes = Axes.Both;
logo.ScaleTo(new Vector2(0.15f), 300, Easing.In);
logo.MoveTo(new Vector2(0.5f), 300, Easing.In);
logo.FadeIn(350);
@ -153,23 +151,31 @@ namespace osu.Game.Screens.Play
}
private ScheduledDelegate pushDebounce;
private VisualSettings visualSettings;
protected VisualSettings VisualSettings;
private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null;
protected override bool OnHover(HoverEvent e)
{
// restore our screen defaults
InitializeBackgroundElements();
if (this.IsCurrentScreen())
{
InitializeBackgroundElements();
Background.EnableUserDim.Value = false;
}
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
if (GetContainingInputManager()?.HoveredDrawables.Contains(visualSettings) == true)
if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true)
{
// show user setting preview
// Update background elements is only being called here because blur logic still exists in Player.
// Will need to be removed when resolving https://github.com/ppy/osu/issues/4322
UpdateBackgroundElements();
if (this.IsCurrentScreen())
Background.EnableUserDim.Value = true;
}
base.OnHoverLost(e);
@ -243,6 +249,8 @@ namespace osu.Game.Screens.Play
this.FadeOut(150);
cancelLoad();
Background.EnableUserDim.Value = false;
return base.OnExiting(next);
}
@ -330,16 +338,14 @@ namespace osu.Game.Screens.Play
new OsuSpriteText
{
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
TextSize = 36,
Font = @"Exo2.0-MediumItalic",
Font = OsuFont.GetFont(size: 36, italics: true),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
new OsuSpriteText
{
Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)),
TextSize = 26,
Font = @"Exo2.0-MediumItalic",
Font = OsuFont.GetFont(size: 26, italics: true),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
@ -367,8 +373,7 @@ namespace osu.Game.Screens.Play
new OsuSpriteText
{
Text = beatmap?.BeatmapInfo?.Version,
TextSize = 26,
Font = @"Exo2.0-MediumItalic",
Font = OsuFont.GetFont(size: 26, italics: true),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Margin = new MarginPadding

View File

@ -1,10 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play.PlayerSettings
@ -17,7 +18,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
public IAdjustableClock AdjustableClock { set; get; }
private readonly PlayerSliderBar<double> sliderbar;
private readonly PlayerSliderBar<double> rateSlider;
private readonly OsuSpriteText multiplierText;
@ -42,11 +43,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
}
},
},
sliderbar = new PlayerSliderBar<double>
rateSlider = new PlayerSliderBar<double>
{
Bindable = new BindableDouble(1)
{
@ -69,9 +70,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
var clockRate = AdjustableClock.Rate;
// can't trigger this line instantly as the underlying clock may not be ready to accept adjustments yet.
sliderbar.Bindable.ValueChanged += multiplier => AdjustableClock.Rate = clockRate * multiplier;
rateSlider.Bindable.ValueChanged += multiplier => AdjustableClock.Rate = clockRate * multiplier.NewValue;
sliderbar.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true);
rateSlider.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true);
}
}
}

View File

@ -34,10 +34,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
public bool Expanded
{
get { return expanded; }
get => expanded;
set
{
if (expanded == value) return;
expanded = value;
content.ClearTransforms();
@ -94,8 +95,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Text = Title.ToUpperInvariant(),
TextSize = 17,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
Margin = new MarginPadding { Left = 10 },
},
button = new IconButton

View File

@ -2,11 +2,10 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Screens.Backgrounds;
using osuTK;
@ -16,15 +15,12 @@ namespace osu.Game.Screens.Play
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
protected new BackgroundScreenBeatmap Background => base.Background as BackgroundScreenBeatmap;
protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
protected const float BACKGROUND_FADE_DURATION = 800;
protected float BackgroundOpacity => 1 - (float)DimLevel;
#region User Settings
protected Bindable<double> DimLevel;
protected Bindable<double> BlurLevel;
protected Bindable<bool> ShowStoryboard;
@ -33,7 +29,6 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
}
@ -41,9 +36,7 @@ namespace osu.Game.Screens.Play
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
DimLevel.ValueChanged += _ => UpdateBackgroundElements();
BlurLevel.ValueChanged += _ => UpdateBackgroundElements();
ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements();
InitializeBackgroundElements();
}
@ -66,7 +59,6 @@ namespace osu.Game.Screens.Play
{
if (!this.IsCurrentScreen()) return;
Background?.FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint);
Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
}
}

View File

@ -158,7 +158,7 @@ namespace osu.Game.Screens.Play
public Visibility State
{
get { return state; }
get => state;
set
{
bool stateChanged = value != state;
@ -273,8 +273,7 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.TopCentre,
RelativePositionAxes = Axes.Y,
Y = 0.7f,
TextSize = 12,
Font = @"Exo2.0-Bold",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12),
Origin = Anchor.Centre,
Text = @"SKIP",
},
@ -313,7 +312,7 @@ namespace osu.Game.Screens.Play
protected override bool OnClick(ClickEvent e)
{
if (!Enabled)
if (!Enabled.Value)
return false;
sampleConfirm.Play();

View File

@ -9,7 +9,7 @@ using System.Collections.Generic;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Bindables;
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@ -35,7 +35,11 @@ namespace osu.Game.Screens.Play
public override bool HandlePositionalInput => AllowSeeking;
private IClock audioClock;
public IClock AudioClock { set { audioClock = info.AudioClock = value; } }
public IClock AudioClock
{
set => audioClock = info.AudioClock = value;
}
private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1;
@ -94,7 +98,7 @@ namespace osu.Game.Screens.Play
{
Alpha = 0,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
OnSeek = position => OnSeek?.Invoke(position),
},
};
@ -104,7 +108,7 @@ namespace osu.Game.Screens.Play
{
State = Visibility.Visible;
replayLoaded.ValueChanged += v => AllowSeeking = v;
replayLoaded.ValueChanged += loaded => AllowSeeking = loaded.NewValue;
replayLoaded.TriggerChange();
}
@ -117,11 +121,7 @@ namespace osu.Game.Screens.Play
public bool AllowSeeking
{
get
{
return allowSeeking;
}
get => allowSeeking;
set
{
if (allowSeeking == value) return;

Some files were not shown because too many files have changed in this diff Show More