mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Highlight spotlight rooms with a different colour
This commit is contained in:
@ -34,7 +34,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
RoomID = { Value = i },
|
RoomID = { Value = i },
|
||||||
Name = { Value = $"Room {i}" },
|
Name = { Value = $"Room {i}" },
|
||||||
Host = { Value = new User { Username = "Host" } },
|
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)
|
if (ruleset != null)
|
||||||
|
@ -34,6 +34,10 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[JsonProperty("channel_id")]
|
[JsonProperty("channel_id")]
|
||||||
public readonly Bindable<int> ChannelId = new Bindable<int>();
|
public readonly Bindable<int> ChannelId = new Bindable<int>();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
[JsonProperty("category")]
|
||||||
|
public readonly Bindable<RoomCategory> Category = new Bindable<RoomCategory>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public readonly Bindable<TimeSpan> Duration = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));
|
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))]
|
[Resolved(typeof(Room), nameof(Room.Status))]
|
||||||
private Bindable<RoomStatus> status { get; set; }
|
private Bindable<RoomStatus> status { get; set; }
|
||||||
|
|
||||||
|
[Resolved(typeof(Room), nameof(Room.Category))]
|
||||||
|
private Bindable<RoomCategory> category { get; set; }
|
||||||
|
|
||||||
public StatusColouredContainer(double transitionDuration = 100)
|
public StatusColouredContainer(double transitionDuration = 100)
|
||||||
{
|
{
|
||||||
this.transitionDuration = transitionDuration;
|
this.transitionDuration = transitionDuration;
|
||||||
@ -25,7 +28,11 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
float stripWidth = side_strip_width * (Room.Category.Value == RoomCategory.Spotlight ? 2 : 1);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new StatusColouredContainer(transition_duration)
|
new StatusColouredContainer(transition_duration)
|
||||||
@ -139,7 +141,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
new StatusColouredContainer(transition_duration)
|
new StatusColouredContainer(transition_duration)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = side_strip_width,
|
Width = stripWidth,
|
||||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
@ -147,7 +149,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = cover_width,
|
Width = cover_width,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Margin = new MarginPadding { Left = side_strip_width },
|
Margin = new MarginPadding { Left = stripWidth },
|
||||||
Child = new MultiplayerBackgroundSprite(BeatmapSetCoverType.List) { RelativeSizeAxes = Axes.Both }
|
Child = new MultiplayerBackgroundSprite(BeatmapSetCoverType.List) { RelativeSizeAxes = Axes.Both }
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
@ -156,7 +158,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Vertical = content_padding,
|
Vertical = content_padding,
|
||||||
Left = side_strip_width + cover_width + content_padding,
|
Left = stripWidth + cover_width + content_padding,
|
||||||
Right = content_padding,
|
Right = content_padding,
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
Reference in New Issue
Block a user