mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Highlight spotlight rooms with a different colour
This commit is contained in:
parent
cf3251a950
commit
64e8dce1ad
@ -34,7 +34,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
RoomID = { Value = i },
|
||||
Name = { Value = $"Room {i}" },
|
||||
Host = { Value = new User { Username = "Host" } },
|
||||
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) }
|
||||
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) },
|
||||
Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal }
|
||||
};
|
||||
|
||||
if (ruleset != null)
|
||||
|
@ -34,6 +34,10 @@ namespace osu.Game.Online.Multiplayer
|
||||
[JsonProperty("channel_id")]
|
||||
public readonly Bindable<int> ChannelId = new Bindable<int>();
|
||||
|
||||
[Cached]
|
||||
[JsonProperty("category")]
|
||||
public readonly Bindable<RoomCategory> Category = new Bindable<RoomCategory>();
|
||||
|
||||
[Cached]
|
||||
[JsonIgnore]
|
||||
public readonly Bindable<TimeSpan> Duration = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));
|
||||
|
11
osu.Game/Online/Multiplayer/RoomCategory.cs
Normal file
11
osu.Game/Online/Multiplayer/RoomCategory.cs
Normal file
@ -0,0 +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.
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
public enum RoomCategory
|
||||
{
|
||||
Normal,
|
||||
Spotlight
|
||||
}
|
||||
}
|
@ -17,6 +17,9 @@ namespace osu.Game.Screens.Multi.Components
|
||||
[Resolved(typeof(Room), nameof(Room.Status))]
|
||||
private Bindable<RoomStatus> status { get; set; }
|
||||
|
||||
[Resolved(typeof(Room), nameof(Room.Category))]
|
||||
private Bindable<RoomCategory> category { get; set; }
|
||||
|
||||
public StatusColouredContainer(double transitionDuration = 100)
|
||||
{
|
||||
this.transitionDuration = transitionDuration;
|
||||
@ -25,7 +28,11 @@ namespace osu.Game.Screens.Multi.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
status.BindValueChanged(s => this.FadeColour(s.NewValue.GetAppropriateColour(colours), transitionDuration), true);
|
||||
status.BindValueChanged(s =>
|
||||
{
|
||||
this.FadeColour(category.Value == RoomCategory.Spotlight ? colours.Pink : s.NewValue.GetAppropriateColour(colours)
|
||||
, transitionDuration);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
float stripWidth = side_strip_width * (Room.Category.Value == RoomCategory.Spotlight ? 2 : 1);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new StatusColouredContainer(transition_duration)
|
||||
@ -139,7 +141,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
new StatusColouredContainer(transition_duration)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = side_strip_width,
|
||||
Width = stripWidth,
|
||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Container
|
||||
@ -147,7 +149,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = cover_width,
|
||||
Masking = true,
|
||||
Margin = new MarginPadding { Left = side_strip_width },
|
||||
Margin = new MarginPadding { Left = stripWidth },
|
||||
Child = new MultiplayerBackgroundSprite(BeatmapSetCoverType.List) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Container
|
||||
@ -156,7 +158,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Vertical = content_padding,
|
||||
Left = side_strip_width + cover_width + content_padding,
|
||||
Left = stripWidth + cover_width + content_padding,
|
||||
Right = content_padding,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
|
Loading…
Reference in New Issue
Block a user