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