mirror of
https://github.com/ppy/osu
synced 2024-12-27 01:12:45 +00:00
Merge branch 'master' into beatmap-length-calcualtions
This commit is contained in:
commit
6425a33b45
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -13,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Scoring;
|
||||
using osuTK;
|
||||
@ -36,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
|
||||
private const float rotation = 45;
|
||||
|
||||
private BufferedContainer bufferedGrid;
|
||||
private GridContainer pointGrid;
|
||||
private BufferedContainer bufferedGrid = null!;
|
||||
private GridContainer pointGrid = null!;
|
||||
|
||||
private readonly ScoreInfo score;
|
||||
private readonly IBeatmap playableBeatmap;
|
||||
@ -58,6 +57,8 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
const float line_extension = 0.2f;
|
||||
|
||||
InternalChild = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -66,76 +67,99 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
FillMode = FillMode.Fit,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(inner_portion),
|
||||
Masking = true,
|
||||
BorderThickness = line_thickness,
|
||||
BorderColour = Color4.White,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex("#202624")
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(inner_portion),
|
||||
Masking = true,
|
||||
BorderThickness = line_thickness,
|
||||
BorderColour = Color4.White,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex("#202624")
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(1),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Rotation = rotation,
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Height = 2, // We're rotating along a diagonal - we don't really care how big this is.
|
||||
Width = line_thickness / 2,
|
||||
Rotation = -rotation,
|
||||
Alpha = 0.3f,
|
||||
Width = line_thickness,
|
||||
Height = inner_portion + line_extension,
|
||||
Rotation = -rotation * 2,
|
||||
Alpha = 0.6f,
|
||||
},
|
||||
new Box
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Height = 2, // We're rotating along a diagonal - we don't really care how big this is.
|
||||
Width = line_thickness / 2, // adjust for edgesmoothness
|
||||
Rotation = rotation
|
||||
Width = line_thickness,
|
||||
Height = inner_portion + line_extension,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Overshoot",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Padding = new MarginPadding(3),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + line_extension) / 2,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Undershoot",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding(3),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = (inner_portion + line_extension) / 2,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + line_extension) / 2,
|
||||
Margin = new MarginPadding(-line_thickness / 2),
|
||||
Width = line_thickness,
|
||||
Height = 10,
|
||||
Rotation = 45,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + line_extension) / 2,
|
||||
Margin = new MarginPadding(-line_thickness / 2),
|
||||
Width = line_thickness,
|
||||
Height = 10,
|
||||
Rotation = -45,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Width = 10,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
Height = line_thickness / 2, // adjust for edgesmoothness
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
Width = line_thickness / 2, // adjust for edgesmoothness
|
||||
Height = 10,
|
||||
}
|
||||
}
|
||||
},
|
||||
bufferedGrid = new BufferedContainer(cachedFrameBuffer: true)
|
||||
|
@ -92,7 +92,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
};
|
||||
|
||||
SelectionHandler = CreateSelectionHandler();
|
||||
SelectionHandler.DeselectAll = DeselectAll;
|
||||
SelectionHandler.SelectedItems.BindTo(SelectedItems);
|
||||
|
||||
AddRangeInternal(new[]
|
||||
|
@ -197,9 +197,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
#region Selection Handling
|
||||
|
||||
/// <summary>
|
||||
/// Bind an action to deselect all selected blueprints.
|
||||
/// Deselect all selected items.
|
||||
/// </summary>
|
||||
internal Action DeselectAll { private get; set; }
|
||||
protected void DeselectAll() => SelectedItems.Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Handle a blueprint becoming selected.
|
||||
@ -303,7 +303,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (blueprint.IsSelected)
|
||||
return false;
|
||||
|
||||
DeselectAll?.Invoke();
|
||||
DeselectAll();
|
||||
blueprint.Select();
|
||||
return true;
|
||||
}
|
||||
@ -311,6 +311,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
protected void DeleteSelected()
|
||||
{
|
||||
DeleteItems(SelectedItems.ToArray());
|
||||
DeselectAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -3,39 +3,14 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Rooms;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public partial class MatchTypePill : OnlinePlayComposite
|
||||
public partial class MatchTypePill : OnlinePlayPill
|
||||
{
|
||||
private OsuTextFlowContainer textFlow;
|
||||
|
||||
public MatchTypePill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new PillContainer
|
||||
{
|
||||
Child = textFlow = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12))
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -45,8 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
|
||||
private void onMatchTypeChanged(ValueChangedEvent<MatchType> type)
|
||||
{
|
||||
textFlow.Clear();
|
||||
textFlow.AddText(type.NewValue.GetLocalisableDescription());
|
||||
TextFlow.Text = type.NewValue.GetLocalisableDescription();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public abstract partial class OnlinePlayPill : OnlinePlayComposite
|
||||
{
|
||||
protected PillContainer Pill { get; private set; } = null!;
|
||||
protected OsuTextFlowContainer TextFlow { get; private set; } = null!;
|
||||
protected virtual FontUsage Font => OsuFont.GetFont(size: 12);
|
||||
|
||||
protected OnlinePlayPill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = Pill = new PillContainer
|
||||
{
|
||||
Child = TextFlow = new OsuTextFlowContainer(s => s.Font = Font)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -5,40 +5,16 @@
|
||||
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// A pill that displays the playlist item count.
|
||||
/// </summary>
|
||||
public partial class PlaylistCountPill : OnlinePlayComposite
|
||||
public partial class PlaylistCountPill : OnlinePlayPill
|
||||
{
|
||||
private OsuTextFlowContainer count;
|
||||
|
||||
public PlaylistCountPill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new PillContainer
|
||||
{
|
||||
Child = count = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12))
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -55,10 +31,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
? Playlist.Count(i => !i.Expired)
|
||||
: PlaylistItemStats.Value.CountActive;
|
||||
|
||||
count.Clear();
|
||||
count.AddText(activeItems.ToLocalisableString(), s => s.Font = s.Font.With(weight: FontWeight.Bold));
|
||||
count.AddText(" ");
|
||||
count.AddText("Beatmap".ToQuantity(activeItems, ShowQuantityAs.None));
|
||||
TextFlow.Clear();
|
||||
TextFlow.AddText(activeItems.ToLocalisableString(), s => s.Font = s.Font.With(weight: FontWeight.Bold));
|
||||
TextFlow.AddText(" ");
|
||||
TextFlow.AddText("Beatmap".ToQuantity(activeItems, ShowQuantityAs.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,39 +3,14 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public partial class QueueModePill : OnlinePlayComposite
|
||||
public partial class QueueModePill : OnlinePlayPill
|
||||
{
|
||||
private OsuTextFlowContainer textFlow;
|
||||
|
||||
public QueueModePill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new PillContainer
|
||||
{
|
||||
Child = textFlow = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12))
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -45,8 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
|
||||
private void onQueueModeChanged(ValueChangedEvent<QueueMode> mode)
|
||||
{
|
||||
textFlow.Clear();
|
||||
textFlow.AddText(mode.NewValue.GetLocalisableDescription());
|
||||
TextFlow.Text = mode.NewValue.GetLocalisableDescription();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,58 +5,30 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public partial class RoomSpecialCategoryPill : OnlinePlayComposite
|
||||
public partial class RoomSpecialCategoryPill : OnlinePlayPill
|
||||
{
|
||||
private SpriteText text;
|
||||
private PillContainer pill;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public RoomSpecialCategoryPill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = pill = new PillContainer
|
||||
{
|
||||
Background =
|
||||
{
|
||||
Colour = colours.Pink,
|
||||
Alpha = 1
|
||||
},
|
||||
Child = text = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
|
||||
Colour = Color4.Black
|
||||
}
|
||||
};
|
||||
}
|
||||
protected override FontUsage Font => base.Font.With(weight: FontWeight.SemiBold);
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Pill.Background.Alpha = 1;
|
||||
TextFlow.Colour = Color4.Black;
|
||||
|
||||
Category.BindValueChanged(c =>
|
||||
{
|
||||
text.Text = c.NewValue.GetLocalisableDescription();
|
||||
|
||||
var backgroundColour = colours.ForRoomCategory(Category.Value);
|
||||
if (backgroundColour != null)
|
||||
pill.Background.Colour = backgroundColour.Value;
|
||||
TextFlow.Text = c.NewValue.GetLocalisableDescription();
|
||||
Pill.Background.Colour = colours.ForRoomCategory(c.NewValue) ?? colours.Pink;
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
@ -8,43 +8,20 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Online.Rooms.RoomStatuses;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// A pill that displays the room's current status.
|
||||
/// </summary>
|
||||
public partial class RoomStatusPill : OnlinePlayComposite
|
||||
public partial class RoomStatusPill : OnlinePlayPill
|
||||
{
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private PillContainer pill;
|
||||
private SpriteText statusText;
|
||||
|
||||
public RoomStatusPill()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = pill = new PillContainer
|
||||
{
|
||||
Child = statusText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 12),
|
||||
Colour = Color4.Black
|
||||
}
|
||||
};
|
||||
}
|
||||
protected override FontUsage Font => base.Font.With(weight: FontWeight.SemiBold);
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
@ -54,15 +31,17 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
Status.BindValueChanged(_ => updateDisplay(), true);
|
||||
|
||||
FinishTransforms(true);
|
||||
|
||||
TextFlow.Colour = Colour4.Black;
|
||||
Pill.Background.Alpha = 1;
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
RoomStatus status = getDisplayStatus();
|
||||
|
||||
pill.Background.Alpha = 1;
|
||||
pill.Background.FadeColour(status.GetAppropriateColour(colours), 100);
|
||||
statusText.Text = status.Message;
|
||||
Pill.Background.FadeColour(status.GetAppropriateColour(colours), 100);
|
||||
TextFlow.Text = status.Message;
|
||||
}
|
||||
|
||||
private RoomStatus getDisplayStatus()
|
||||
|
Loading…
Reference in New Issue
Block a user