Merge branch 'master' into UserDimLogic

This commit is contained in:
Dean Herbert
2019-02-28 17:18:04 +09:00
committed by GitHub
328 changed files with 1437 additions and 807 deletions

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Backgrounds
public virtual WorkingBeatmap Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (beatmap == value && beatmap != null)

View File

@ -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

@ -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

@ -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

@ -175,6 +175,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
if (Item is EditorMenuItemSpacer)
return true;
return base.OnHover(e);
}
@ -182,6 +183,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
if (Item is EditorMenuItemSpacer)
return true;
return base.OnClick(e);
}
}

View File

@ -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;

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,6 +44,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
}
private RadioButton currentlySelected;
private void addButton(RadioButton button)
{
button.Selected.ValueChanged += selected =>

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

@ -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

@ -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

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

View File

@ -242,7 +242,7 @@ namespace osu.Game.Screens.Menu
public ButtonState State
{
get { return state; }
get => state;
set
{

View File

@ -13,6 +13,7 @@ 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,8 +103,23 @@ 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)
{
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

@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu
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();

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
{

View File

@ -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

@ -19,33 +19,37 @@ using osu.Game.Screens.Edit;
using osu.Game.Screens.Multi;
using osu.Game.Screens.Select;
using osu.Game.Screens.Tournament;
using osu.Framework.Platform;
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,
@ -63,7 +67,7 @@ namespace osu.Game.Screens.Menu
}
},
sideFlashes = new MenuSideFlashes(),
};
});
buttons.StateChanged += state =>
{
@ -78,11 +82,7 @@ namespace osu.Game.Screens.Menu
break;
}
};
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame game = null)
{
if (game != null)
{
buttons.OnSettings = game.ToggleSettings;

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

@ -37,6 +37,7 @@ namespace osu.Game.Screens.Multi.Components
{
if (textSize == value)
return;
textSize = value;
updateText();

View File

@ -31,6 +31,7 @@ namespace osu.Game.Screens.Multi.Components
{
if (!Enabled.Value)
return true;
return base.OnClick(e);
}
}

View File

@ -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;

View File

@ -54,6 +54,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
public enum PrimaryFilter
{
Open,
[Description("Recently Ended")]
RecentlyEnded,
Participated,

View File

@ -101,7 +101,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
}
}, true);
ParticipantCount.BindValueChanged(count => summary.Text = $"{count.NewValue:#,0}{" participant".Pluralize(count.NewValue == 1)}", true);
ParticipantCount.BindValueChanged(count => summary.Text = "participant".ToQuantity(count.NewValue), true);
/*Participants.BindValueChanged(e =>
{

View File

@ -58,6 +58,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
if (!enabled.Value)
return true;
return base.OnClick(e);
}
}

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;

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

@ -72,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

@ -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
{
@ -184,7 +185,7 @@ namespace osu.Game.Screens.Play
private int selectionIndex
{
get { return _selectionIndex; }
get => _selectionIndex;
set
{
if (_selectionIndex == value)
@ -263,14 +264,14 @@ namespace osu.Game.Screens.Play
},
new OsuSpriteText
{
Text = $"{retries:n0}",
Text = "time".ToQuantity(retries),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
},
new OsuSpriteText
{
Text = $" time{(retries == 1 ? "" : "s")} in this session",
Text = " in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
Font = OsuFont.GetFont(size: 18),

View File

@ -78,24 +78,27 @@ 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;

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

@ -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

@ -27,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)
@ -41,9 +42,10 @@ namespace osu.Game.Screens.Play
}
private bool isLit;
public bool IsLit
{
get { return isLit; }
get => isLit;
protected set
{
if (isLit != value)

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

@ -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

@ -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; }

View File

@ -264,6 +264,7 @@ namespace osu.Game.Screens.Play
private void performUserRequestedExit()
{
if (!this.IsCurrentScreen()) return;
this.Exit();
}

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();

View File

@ -158,7 +158,7 @@ namespace osu.Game.Screens.Play
public Visibility State
{
get { return state; }
get => state;
set
{
bool stateChanged = value != state;

View File

@ -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),
},
};
@ -117,11 +121,7 @@ namespace osu.Game.Screens.Play
public bool AllowSeeking
{
get
{
return allowSeeking;
}
get => allowSeeking;
set
{
if (allowSeeking == value) return;

View File

@ -20,22 +20,22 @@ namespace osu.Game.Screens.Play
public Color4 FillColour
{
set { fill.Colour = value; }
set => fill.Colour = value;
}
public double StartTime
{
set { CurrentNumber.MinValue = value; }
set => CurrentNumber.MinValue = value;
}
public double EndTime
{
set { CurrentNumber.MaxValue = value; }
set => CurrentNumber.MaxValue = value;
}
public double CurrentTime
{
set { CurrentNumber.Value = value; }
set => CurrentNumber.Value = value;
}
public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize)

View File

@ -29,8 +29,15 @@ namespace osu.Game.Screens.Play
public IClock AudioClock;
public double StartTime { set { startTime = value; } }
public double EndTime { set { endTime = value; } }
public double StartTime
{
set => startTime = value;
}
public double EndTime
{
set => endTime = value;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using osu.Framework;
using osu.Framework.Caching;
using osu.Framework.Extensions.Color4Extensions;
@ -12,22 +13,26 @@ using osu.Framework.Graphics.Containers;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Allocation;
using osu.Framework.Threading;
namespace osu.Game.Screens.Play
{
public class SquareGraph : BufferedContainer
public class SquareGraph : Container
{
private Column[] columns = { };
private BufferedContainer<Column> columns;
public int ColumnCount => columns.Length;
public int ColumnCount => columns?.Children.Count ?? 0;
private int progress;
public int Progress
{
get { return progress; }
get => progress;
set
{
if (value == progress) return;
progress = value;
redrawProgress();
}
@ -36,36 +41,33 @@ namespace osu.Game.Screens.Play
private float[] calculatedValues = { }; // values but adjusted to fit the amount of columns
private int[] values;
public int[] Values
{
get { return values; }
get => values;
set
{
if (value == values) return;
values = value;
layout.Invalidate();
}
}
private Color4 fillColour;
public Color4 FillColour
{
get { return fillColour; }
get => fillColour;
set
{
if (value == fillColour) return;
fillColour = value;
redrawFilled();
}
}
public SquareGraph()
{
CacheDrawnFrameBuffer = true;
}
private Cached layout = new Cached();
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
if ((invalidation & Invalidation.DrawSize) > 0)
@ -73,25 +75,70 @@ namespace osu.Game.Screens.Play
return base.Invalidate(invalidation, source, shallPropagate);
}
private Cached layout = new Cached();
private ScheduledDelegate scheduledCreate;
protected override void Update()
{
base.Update();
if (!layout.IsValid)
if (values != null && !layout.IsValid)
{
recreateGraph();
columns?.FadeOut(500, Easing.OutQuint).Expire();
scheduledCreate?.Cancel();
scheduledCreate = Scheduler.AddDelayed(RecreateGraph, 500);
layout.Validate();
}
}
private CancellationTokenSource cts;
/// <summary>
/// Recreates the entire graph.
/// </summary>
protected virtual void RecreateGraph()
{
var newColumns = new BufferedContainer<Column>
{
CacheDrawnFrameBuffer = true,
RelativeSizeAxes = Axes.Both,
};
for (float x = 0; x < DrawWidth; x += Column.WIDTH)
{
newColumns.Add(new Column(DrawHeight)
{
LitColour = fillColour,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Position = new Vector2(x, 0),
State = ColumnState.Dimmed,
});
}
cts?.Cancel();
LoadComponentAsync(newColumns, c =>
{
Child = columns = c;
columns.FadeInFromZero(500, Easing.OutQuint);
recalculateValues();
redrawFilled();
redrawProgress();
}, (cts = new CancellationTokenSource()).Token);
}
/// <summary>
/// Redraws all the columns to match their lit/dimmed state.
/// </summary>
private void redrawProgress()
{
for (int i = 0; i < columns.Length; i++)
for (int i = 0; i < ColumnCount; i++)
columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed;
ForceRedraw();
columns?.ForceRedraw();
}
/// <summary>
@ -101,7 +148,7 @@ namespace osu.Game.Screens.Play
{
for (int i = 0; i < ColumnCount; i++)
columns[i].Filled = calculatedValues.ElementAtOrDefault(i);
ForceRedraw();
columns?.ForceRedraw();
}
/// <summary>
@ -130,34 +177,6 @@ namespace osu.Game.Screens.Play
calculatedValues = newValues.ToArray();
}
/// <summary>
/// Recreates the entire graph.
/// </summary>
private void recreateGraph()
{
var newColumns = new List<Column>();
for (float x = 0; x < DrawWidth; x += Column.WIDTH)
{
newColumns.Add(new Column
{
LitColour = fillColour,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Height = DrawHeight,
Position = new Vector2(x, 0),
State = ColumnState.Dimmed,
});
}
columns = newColumns.ToArray();
Children = columns;
recalculateValues();
redrawFilled();
redrawProgress();
}
public class Column : Container, IStateful<ColumnState>
{
protected readonly Color4 EmptyColour = Color4.White.Opacity(20);
@ -174,14 +193,15 @@ namespace osu.Game.Screens.Play
private readonly List<Box> drawableRows = new List<Box>();
private float filled;
public float Filled
{
get { return filled; }
get => filled;
set
{
if (value == filled) return;
filled = value;
filled = value;
fillActive();
}
}
@ -190,12 +210,12 @@ namespace osu.Game.Screens.Play
public ColumnState State
{
get { return state; }
get => state;
set
{
if (value == state) return;
state = value;
state = value;
if (IsLoaded)
fillActive();
@ -203,21 +223,20 @@ namespace osu.Game.Screens.Play
}
}
public Column()
public Column(float height)
{
Width = WIDTH;
Height = height;
}
protected override void LoadComplete()
[BackgroundDependencyLoader]
private void load()
{
for (int r = 0; r < cubeCount; r++)
drawableRows.AddRange(Enumerable.Range(0, (int)cubeCount).Select(r => new Box
{
drawableRows.Add(new Box
{
Size = new Vector2(cube_size),
Position = new Vector2(0, r * WIDTH + padding),
});
}
Size = new Vector2(cube_size),
Position = new Vector2(0, r * WIDTH + padding),
}));
Children = drawableRows;

View File

@ -213,14 +213,16 @@ namespace osu.Game.Screens.Ranking.Pages
{
Children = new Drawable[]
{
new OsuSpriteText {
new OsuSpriteText
{
Text = statistic.Value.ToString().PadLeft(4, '0'),
Colour = colours.Gray7,
Font = OsuFont.GetFont(size: 30),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new OsuSpriteText {
new OsuSpriteText
{
Text = statistic.Key.GetDescription(),
Colour = colours.Gray7,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
@ -334,7 +336,8 @@ namespace osu.Game.Screens.Ranking.Pages
versionMapper.Colour = colours.Gray8;
var creator = beatmap.Metadata.Author?.Username;
if (!string.IsNullOrEmpty(creator)) {
if (!string.IsNullOrEmpty(creator))
{
versionMapper.Text = $"mapped by {creator}";
if (!string.IsNullOrEmpty(beatmap.Version))
@ -388,7 +391,8 @@ namespace osu.Game.Screens.Ranking.Pages
protected override Easing RollingEasing => Easing.OutPow10;
public SlowScoreCounter(uint leading = 0) : base(leading)
public SlowScoreCounter(uint leading = 0)
: base(leading)
{
DisplayedCountSpriteText.Shadow = false;
DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(Typeface.Venera, weight: FontWeight.Light);

View File

@ -169,10 +169,7 @@ namespace osu.Game.Screens
Text = $@"{t.Name}",
BackgroundColour = getColourFor(t),
HoverColour = getColourFor(t).Lighten(0.2f),
Action = delegate
{
this.Push(Activator.CreateInstance(t) as Screen);
}
Action = delegate { this.Push(Activator.CreateInstance(t) as Screen); }
});
}
}

View File

@ -254,6 +254,7 @@ namespace osu.Game.Screens.Select
{
case CarouselBeatmap beatmap:
if (skipDifficulties) continue;
select(beatmap);
return;
case CarouselBeatmapSet set:
@ -327,6 +328,7 @@ namespace osu.Game.Screens.Select
private void select(CarouselItem item)
{
if (item == null) return;
item.State.Value = CarouselItemState.Selected;
}

View File

@ -20,12 +20,10 @@ namespace osu.Game.Screens.Select
public readonly BeatmapLeaderboard Leaderboard;
private WorkingBeatmap beatmap;
public WorkingBeatmap Beatmap
{
get
{
return beatmap;
}
get => beatmap;
set
{
beatmap = value;

View File

@ -41,12 +41,14 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate pendingBeatmapSwitch;
private BeatmapInfo beatmap;
public BeatmapInfo Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (value == beatmap) return;
beatmap = value;
pendingBeatmapSwitch?.Cancel();
@ -116,6 +118,7 @@ namespace osu.Game.Screens.Select
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
LayoutDuration = transition_duration,
LayoutEasing = Easing.OutQuad,
Spacing = new Vector2(spacing * 2),
Margin = new MarginPadding { Top = spacing * 2 },
Children = new[]
@ -336,10 +339,12 @@ namespace osu.Game.Screens.Select
{
if (string.IsNullOrEmpty(value))
{
textContainer.FadeOut(transition_duration);
this.FadeOut(transition_duration);
return;
}
this.FadeIn(transition_duration);
setTextAsync(value);
}
}

View File

@ -96,6 +96,7 @@ namespace osu.Game.Screens.Select.Carousel
foreach (var b in InternalChildren)
{
if (item == b) continue;
b.State.Value = CarouselItemState.NotSelected;
}

View File

@ -38,7 +38,8 @@ namespace osu.Game.Screens.Select.Carousel
private BeatmapSetOverlay beatmapOverlay;
public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel)
public DrawableCarouselBeatmap(CarouselBeatmap panel)
: base(panel)
{
beatmap = panel.Beatmap;
Height *= 0.60f;

View File

@ -49,11 +49,11 @@ namespace osu.Game.Screens.Select.Carousel
Children = new Drawable[]
{
new DelayedLoadUnloadWrapper(() =>
new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint),
}, 300, 5000
new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
{
RelativeSizeAxes = Axes.Both,
OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint),
}, 300, 5000
),
new FillFlowContainer
{

View File

@ -20,12 +20,14 @@ namespace osu.Game.Screens.Select.Details
private readonly StatisticRow firstValue, hpDrain, accuracy, approachRate, starDifficulty;
private BeatmapInfo beatmap;
public BeatmapInfo Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (value == beatmap) return;
beatmap = value;
//mania specific
@ -83,14 +85,15 @@ namespace osu.Game.Screens.Select.Details
public string Title
{
get { return name.Text; }
set { name.Text = value; }
get => name.Text;
set => name.Text = value;
}
private float difficultyValue;
public float Value
{
get { return difficultyValue; }
get => difficultyValue;
set
{
difficultyValue = value;
@ -101,8 +104,8 @@ namespace osu.Game.Screens.Select.Details
public Color4 AccentColour
{
get { return bar.AccentColour; }
set { bar.AccentColour = value; }
get => bar.AccentColour;
set => bar.AccentColour = value;
}
public StatisticRow(float maxValue = 10, bool forceDecimalPlaces = false)

View File

@ -17,12 +17,14 @@ namespace osu.Game.Screens.Select.Details
private readonly BarGraph retryGraph, failGraph;
private BeatmapMetrics metrics;
public BeatmapMetrics Metrics
{
get { return metrics; }
get => metrics;
set
{
if (value == metrics) return;
metrics = value;
var retries = Metrics?.Retries ?? new int[0];

View File

@ -24,10 +24,11 @@ namespace osu.Game.Screens.Select.Details
public BeatmapMetrics Metrics
{
get { return metrics; }
get => metrics;
set
{
if (value == metrics) return;
metrics = value;
const int rating_range = 10;

View File

@ -9,32 +9,46 @@ namespace osu.Game.Screens.Select.Filter
{
[Description("All")]
All,
[Description("Artist")]
Artist,
[Description("Author")]
Author,
[Description("BPM")]
BPM,
[Description("Collections")]
Collections,
[Description("Date Added")]
DateAdded,
[Description("Difficulty")]
Difficulty,
[Description("Favourites")]
Favourites,
[Description("Length")]
Length,
[Description("My Maps")]
MyMaps,
[Description("No Grouping")]
NoGrouping,
[Description("Rank Achieved")]
RankAchieved,
[Description("Ranked Status")]
RankedStatus,
[Description("Recently Played")]
RecentlyPlayed,
[Description("Title")]
Title
}

View File

@ -9,18 +9,25 @@ namespace osu.Game.Screens.Select.Filter
{
[Description("Artist")]
Artist,
[Description("Author")]
Author,
[Description("BPM")]
BPM,
[Description("Date Added")]
DateAdded,
[Description("Difficulty")]
Difficulty,
[Description("Length")]
Length,
[Description("Rank Achieved")]
RankAchieved,
[Description("Title")]
Title
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Select
public SortMode Sort
{
get { return sort; }
get => sort;
set
{
if (sort != value)
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select
public GroupMode Group
{
get { return group; }
get => group;
set
{
if (group != value)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select
public string SearchText
{
get { return searchText; }
get => searchText;
set
{
searchText = value;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select
public string Text
{
get { return spriteText?.Text; }
get => spriteText?.Text;
set
{
if (spriteText != null)
@ -29,9 +29,10 @@ namespace osu.Game.Screens.Select
}
private Color4 deselectedColour;
public Color4 DeselectedColour
{
get { return deselectedColour; }
get => deselectedColour;
set
{
deselectedColour = value;
@ -41,9 +42,10 @@ namespace osu.Game.Screens.Select
}
private Color4 selectedColour;
public Color4 SelectedColour
{
get { return selectedColour; }
get => selectedColour;
set
{
selectedColour = value;

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select.Leaderboards
public BeatmapInfo Beatmap
{
get { return beatmap; }
get => beatmap;
set
{
if (beatmap == value)

View File

@ -28,26 +28,26 @@ namespace osu.Game.Screens.Select.Options
public Color4 ButtonColour
{
get { return background.Colour; }
set { background.Colour = value; }
get => background.Colour;
set => background.Colour = value;
}
public FontAwesome Icon
{
get { return iconText.Icon; }
set { iconText.Icon = value; }
get => iconText.Icon;
set => iconText.Icon = value;
}
public string FirstLineText
{
get { return firstLine.Text; }
set { firstLine.Text = value; }
get => firstLine.Text;
set => firstLine.Text = value;
}
public string SecondLineText
{
get { return secondLine.Text; }
set { secondLine.Text = value; }
get => secondLine.Text;
set => secondLine.Text = value;
}
public Key? HotKey;

View File

@ -65,7 +65,7 @@ namespace osu.Game.Screens.Select
LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
{
if (this.IsCurrentScreen())this.Push(player);
if (this.IsCurrentScreen()) this.Push(player);
});
return true;

View File

@ -209,7 +209,7 @@ namespace osu.Game.Screens.Select
});
}
BeatmapDetails.Leaderboard.ScoreSelected += s =>this.Push(new SoloResults(s));
BeatmapDetails.Leaderboard.ScoreSelected += s => this.Push(new SoloResults(s));
}
[BackgroundDependencyLoader(true)]
@ -285,8 +285,8 @@ namespace osu.Game.Screens.Select
public void Edit(BeatmapInfo beatmap = null)
{
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
this.Push(new Editor());
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
this.Push(new Editor());
}
/// <summary>
@ -512,12 +512,6 @@ namespace osu.Game.Screens.Select
if (base.OnExiting(next))
return true;
if (ModSelect.State == Visibility.Visible)
{
ModSelect.Hide();
return true;
}
beatmapInfoWedge.State = Visibility.Hidden;
this.FadeOut(100);
@ -623,6 +617,7 @@ namespace osu.Game.Screens.Select
private void delete(BeatmapSetInfo beatmap)
{
if (beatmap == null || beatmap.ID <= 0) return;
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Screens.Tournament.Components
/// </summary>
public int Lines
{
get { return allLines.Count; }
get => allLines.Count;
set
{
while (value > allLines.Count)

View File

@ -84,9 +84,10 @@ namespace osu.Game.Screens.Tournament
}
private ScrollState _scrollState;
private ScrollState scrollState
{
get { return _scrollState; }
get => _scrollState;
set
{
@ -326,9 +327,10 @@ namespace osu.Game.Screens.Tournament
private readonly Box outline;
private bool selected;
public bool Selected
{
get { return selected; }
get => selected;
set
{