mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 07:23:14 +08:00
Merge branch 'master' into judgement-pooling
This commit is contained in:
commit
ee526666ca
@ -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)
|
||||
|
@ -0,0 +1,20 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneLoungeFilterControl : OsuTestScene
|
||||
{
|
||||
public TestSceneLoungeFilterControl()
|
||||
{
|
||||
Child = new FilterControl
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -63,16 +63,19 @@ namespace osu.Game.Graphics.UserInterface
|
||||
background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
TooltipText = "Download";
|
||||
break;
|
||||
|
||||
case DownloadState.Downloading:
|
||||
background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
TooltipText = "Downloading...";
|
||||
break;
|
||||
|
||||
case DownloadState.Downloaded:
|
||||
background.FadeColour(colours.Yellow, 500, Easing.InOutExpo);
|
||||
TooltipText = "Importing";
|
||||
break;
|
||||
|
||||
case DownloadState.LocallyAvailable:
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Humanizer;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
|
||||
@ -9,39 +11,28 @@ namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetRoomsRequest : APIRequest<List<Room>>
|
||||
{
|
||||
private readonly PrimaryFilter primaryFilter;
|
||||
private readonly RoomStatusFilter statusFilter;
|
||||
private readonly RoomCategoryFilter categoryFilter;
|
||||
|
||||
public GetRoomsRequest(PrimaryFilter primaryFilter)
|
||||
public GetRoomsRequest(RoomStatusFilter statusFilter, RoomCategoryFilter categoryFilter)
|
||||
{
|
||||
this.primaryFilter = primaryFilter;
|
||||
this.statusFilter = statusFilter;
|
||||
this.categoryFilter = categoryFilter;
|
||||
}
|
||||
|
||||
protected override string Target
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
get
|
||||
{
|
||||
string target = "rooms";
|
||||
var req = base.CreateWebRequest();
|
||||
|
||||
switch (primaryFilter)
|
||||
{
|
||||
case PrimaryFilter.Open:
|
||||
break;
|
||||
if (statusFilter != RoomStatusFilter.Open)
|
||||
req.AddParameter("mode", statusFilter.ToString().Underscore().ToLowerInvariant());
|
||||
|
||||
case PrimaryFilter.Owned:
|
||||
target += "/owned";
|
||||
break;
|
||||
if (categoryFilter != RoomCategoryFilter.Any)
|
||||
req.AddParameter("category", categoryFilter.ToString().Underscore().ToLowerInvariant());
|
||||
|
||||
case PrimaryFilter.Participated:
|
||||
target += "/participated";
|
||||
break;
|
||||
|
||||
case PrimaryFilter.RecentlyEnded:
|
||||
target += "/ended";
|
||||
break;
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => "rooms";
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
@ -81,7 +81,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
||||
{
|
||||
case DownloadState.LocallyAvailable:
|
||||
button.Enabled.Value = true;
|
||||
button.TooltipText = string.Empty;
|
||||
button.TooltipText = "Go to beatmap";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1,7 +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.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osuTK;
|
||||
using osu.Framework.Graphics;
|
||||
@ -11,44 +10,23 @@ using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.SearchableList
|
||||
{
|
||||
public class DisplayStyleControl<T> : Container
|
||||
where T : struct, Enum
|
||||
public class DisplayStyleControl : CompositeDrawable
|
||||
{
|
||||
public readonly SlimEnumDropdown<T> Dropdown;
|
||||
public readonly Bindable<PanelDisplayStyle> DisplayStyle = new Bindable<PanelDisplayStyle>();
|
||||
|
||||
public DisplayStyleControl()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new[]
|
||||
InternalChild = new FillFlowContainer
|
||||
{
|
||||
new FillFlowContainer
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Spacing = new Vector2(10f, 0f),
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new DisplayStyleToggleButton(FontAwesome.Solid.ThLarge, PanelDisplayStyle.Grid, DisplayStyle),
|
||||
new DisplayStyleToggleButton(FontAwesome.Solid.ListUl, PanelDisplayStyle.List, DisplayStyle),
|
||||
},
|
||||
},
|
||||
Dropdown = new SlimEnumDropdown<T>
|
||||
{
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 160f,
|
||||
},
|
||||
},
|
||||
new DisplayStyleToggleButton(FontAwesome.Solid.ThLarge, PanelDisplayStyle.Grid, DisplayStyle),
|
||||
new DisplayStyleToggleButton(FontAwesome.Solid.ListUl, PanelDisplayStyle.List, DisplayStyle),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -19,12 +19,14 @@ namespace osu.Game.Overlays.SearchableList
|
||||
{
|
||||
private const float padding = 10;
|
||||
|
||||
private readonly Container filterContainer;
|
||||
private readonly Drawable filterContainer;
|
||||
private readonly Drawable rightFilterContainer;
|
||||
private readonly Box tabStrip;
|
||||
|
||||
public readonly SearchTextBox Search;
|
||||
public readonly PageTabControl<TTab> Tabs;
|
||||
public readonly DisplayStyleControl<TCategory> DisplayStyleControl;
|
||||
public readonly SlimEnumDropdown<TCategory> Dropdown;
|
||||
public readonly DisplayStyleControl DisplayStyleControl;
|
||||
|
||||
protected abstract Color4 BackgroundColour { get; }
|
||||
protected abstract TTab DefaultTab { get; }
|
||||
@ -42,7 +44,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
|
||||
var controls = CreateSupplementaryControls();
|
||||
Container controlsContainer;
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
filterContainer = new Container
|
||||
{
|
||||
@ -104,11 +106,27 @@ namespace osu.Game.Overlays.SearchableList
|
||||
},
|
||||
},
|
||||
},
|
||||
DisplayStyleControl = new DisplayStyleControl<TCategory>
|
||||
rightFilterContainer = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Dropdown = new SlimEnumDropdown<TCategory>
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 160f,
|
||||
},
|
||||
DisplayStyleControl = new DisplayStyleControl
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (controls != null) controlsContainer.Children = new[] { controls };
|
||||
@ -116,8 +134,8 @@ namespace osu.Game.Overlays.SearchableList
|
||||
Tabs.Current.Value = DefaultTab;
|
||||
Tabs.Current.TriggerChange();
|
||||
|
||||
DisplayStyleControl.Dropdown.Current.Value = DefaultCategory;
|
||||
DisplayStyleControl.Dropdown.Current.TriggerChange();
|
||||
Dropdown.Current.Value = DefaultCategory;
|
||||
Dropdown.Current.TriggerChange();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -131,7 +149,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
base.Update();
|
||||
|
||||
Height = filterContainer.Height;
|
||||
DisplayStyleControl.Margin = new MarginPadding { Top = filterContainer.Height - 35, Right = SearchableListOverlay.WIDTH_PADDING };
|
||||
rightFilterContainer.Margin = new MarginPadding { Top = filterContainer.Height - 30, Right = ContentHorizontalPadding };
|
||||
}
|
||||
|
||||
private class FilterSearchTextBox : SearchTextBox
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Overlays
|
||||
Filter.Tabs.Current.ValueChanged += _ => onFilterUpdate();
|
||||
|
||||
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += _ => recreatePanels();
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => recreatePanels();
|
||||
Filter.Dropdown.Current.ValueChanged += _ => recreatePanels();
|
||||
|
||||
currentQuery.BindTo(Filter.Search.Current);
|
||||
currentQuery.ValueChanged += query =>
|
||||
@ -155,7 +155,7 @@ namespace osu.Game.Overlays
|
||||
break;
|
||||
}
|
||||
|
||||
if (Filter.DisplayStyleControl.Dropdown.Current.Value == SortDirection.Descending)
|
||||
if (Filter.Dropdown.Current.Value == SortDirection.Descending)
|
||||
sortedUsers = sortedUsers.Reverse();
|
||||
|
||||
var newPanels = new FillFlowContainer<UserPanel>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -48,7 +49,8 @@ namespace osu.Game.Screens.Multi
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
private readonly BindableList<Mod> requiredMods = new BindableList<Mod>();
|
||||
|
||||
private readonly PlaylistItem item;
|
||||
public readonly PlaylistItem Item;
|
||||
|
||||
private readonly bool allowEdit;
|
||||
private readonly bool allowSelection;
|
||||
|
||||
@ -57,8 +59,11 @@ namespace osu.Game.Screens.Multi
|
||||
public DrawableRoomPlaylistItem(PlaylistItem item, bool allowEdit, bool allowSelection)
|
||||
: base(item)
|
||||
{
|
||||
this.item = item;
|
||||
Item = item;
|
||||
|
||||
// TODO: edit support should be moved out into a derived class
|
||||
this.allowEdit = allowEdit;
|
||||
|
||||
this.allowSelection = allowSelection;
|
||||
|
||||
beatmap.BindTo(item.Beatmap);
|
||||
@ -102,14 +107,14 @@ namespace osu.Game.Screens.Multi
|
||||
difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value) { Size = new Vector2(32) };
|
||||
|
||||
beatmapText.Clear();
|
||||
beatmapText.AddLink(item.Beatmap.ToString(), LinkAction.OpenBeatmap, item.Beatmap.Value.OnlineBeatmapID.ToString());
|
||||
beatmapText.AddLink(Item.Beatmap.ToString(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString());
|
||||
|
||||
authorText.Clear();
|
||||
|
||||
if (item.Beatmap?.Value?.Metadata?.Author != null)
|
||||
if (Item.Beatmap?.Value?.Metadata?.Author != null)
|
||||
{
|
||||
authorText.AddText("mapped by ");
|
||||
authorText.AddUserLink(item.Beatmap.Value?.Metadata.Author);
|
||||
authorText.AddUserLink(Item.Beatmap.Value?.Metadata.Author);
|
||||
}
|
||||
|
||||
modDisplay.Current.Value = requiredMods.ToArray();
|
||||
@ -180,29 +185,33 @@ namespace osu.Game.Screens.Multi
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
X = -18,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new PlaylistDownloadButton(item)
|
||||
{
|
||||
Size = new Vector2(50, 30)
|
||||
},
|
||||
new IconButton
|
||||
{
|
||||
Icon = FontAwesome.Solid.MinusSquare,
|
||||
Alpha = allowEdit ? 1 : 0,
|
||||
Action = () => RequestDeletion?.Invoke(Model),
|
||||
},
|
||||
}
|
||||
ChildrenEnumerable = CreateButtons()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
protected virtual IEnumerable<Drawable> CreateButtons() =>
|
||||
new Drawable[]
|
||||
{
|
||||
new PlaylistDownloadButton(Item)
|
||||
{
|
||||
Size = new Vector2(50, 30)
|
||||
},
|
||||
new IconButton
|
||||
{
|
||||
Icon = FontAwesome.Solid.MinusSquare,
|
||||
Alpha = allowEdit ? 1 : 0,
|
||||
Action = () => RequestDeletion?.Invoke(Model),
|
||||
},
|
||||
};
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (allowSelection)
|
||||
|
66
osu.Game/Screens/Multi/DrawableRoomPlaylistWithResults.cs
Normal file
66
osu.Game/Screens/Multi/DrawableRoomPlaylistWithResults.cs
Normal file
@ -0,0 +1,66 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
|
||||
namespace osu.Game.Screens.Multi
|
||||
{
|
||||
public class DrawableRoomPlaylistWithResults : DrawableRoomPlaylist
|
||||
{
|
||||
public Action<PlaylistItem> RequestShowResults;
|
||||
|
||||
public DrawableRoomPlaylistWithResults()
|
||||
: base(false, true)
|
||||
{
|
||||
}
|
||||
|
||||
protected override OsuRearrangeableListItem<PlaylistItem> CreateOsuDrawable(PlaylistItem item) =>
|
||||
new DrawableRoomPlaylistItemWithResults(item, false, true)
|
||||
{
|
||||
RequestShowResults = () => RequestShowResults(item),
|
||||
SelectedItem = { BindTarget = SelectedItem },
|
||||
};
|
||||
|
||||
private class DrawableRoomPlaylistItemWithResults : DrawableRoomPlaylistItem
|
||||
{
|
||||
public Action RequestShowResults;
|
||||
|
||||
public DrawableRoomPlaylistItemWithResults(PlaylistItem item, bool allowEdit, bool allowSelection)
|
||||
: base(item, allowEdit, allowSelection)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<Drawable> CreateButtons() =>
|
||||
base.CreateButtons().Prepend(new FilledIconButton
|
||||
{
|
||||
Icon = FontAwesome.Solid.ChartPie,
|
||||
Action = () => RequestShowResults?.Invoke(),
|
||||
TooltipText = "View results"
|
||||
});
|
||||
|
||||
private class FilledIconButton : IconButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue,
|
||||
Colour = colours.Gray4,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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[]
|
||||
|
@ -12,11 +12,11 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
{
|
||||
public class FilterControl : SearchableListFilterControl<PrimaryFilter, SecondaryFilter>
|
||||
public class FilterControl : SearchableListFilterControl<RoomStatusFilter, RoomCategoryFilter>
|
||||
{
|
||||
protected override Color4 BackgroundColour => Color4.Black.Opacity(0.5f);
|
||||
protected override PrimaryFilter DefaultTab => PrimaryFilter.Open;
|
||||
protected override SecondaryFilter DefaultCategory => SecondaryFilter.Public;
|
||||
protected override RoomStatusFilter DefaultTab => RoomStatusFilter.Open;
|
||||
protected override RoomCategoryFilter DefaultCategory => RoomCategoryFilter.Any;
|
||||
|
||||
protected override float ContentHorizontalPadding => base.ContentHorizontalPadding + OsuScreen.HORIZONTAL_OVERFLOW_PADDING;
|
||||
|
||||
@ -43,6 +43,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
|
||||
ruleset.BindValueChanged(_ => updateFilter());
|
||||
Search.Current.BindValueChanged(_ => scheduleUpdateFilter());
|
||||
Dropdown.Current.BindValueChanged(_ => updateFilter());
|
||||
Tabs.Current.BindValueChanged(_ => updateFilter(), true);
|
||||
}
|
||||
|
||||
@ -61,26 +62,27 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
filter.Value = new FilterCriteria
|
||||
{
|
||||
SearchString = Search.Current.Value ?? string.Empty,
|
||||
PrimaryFilter = Tabs.Current.Value,
|
||||
SecondaryFilter = DisplayStyleControl.Dropdown.Current.Value,
|
||||
StatusFilter = Tabs.Current.Value,
|
||||
RoomCategoryFilter = Dropdown.Current.Value,
|
||||
Ruleset = ruleset.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum PrimaryFilter
|
||||
public enum RoomStatusFilter
|
||||
{
|
||||
Open,
|
||||
|
||||
[Description("Recently Ended")]
|
||||
RecentlyEnded,
|
||||
Ended,
|
||||
Participated,
|
||||
Owned,
|
||||
}
|
||||
|
||||
public enum SecondaryFilter
|
||||
public enum RoomCategoryFilter
|
||||
{
|
||||
Public,
|
||||
//Private,
|
||||
Any,
|
||||
Normal,
|
||||
Spotlight
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
public class FilterCriteria
|
||||
{
|
||||
public string SearchString;
|
||||
public PrimaryFilter PrimaryFilter;
|
||||
public SecondaryFilter SecondaryFilter;
|
||||
public RoomStatusFilter StatusFilter;
|
||||
public RoomCategoryFilter RoomCategoryFilter;
|
||||
public RulesetInfo Ruleset;
|
||||
}
|
||||
}
|
||||
|
@ -77,14 +77,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
if (!string.IsNullOrEmpty(criteria.SearchString))
|
||||
matchingFilter &= r.FilterTerms.Any(term => term.IndexOf(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||
|
||||
switch (criteria.SecondaryFilter)
|
||||
{
|
||||
default:
|
||||
case SecondaryFilter.Public:
|
||||
matchingFilter &= r.Room.Availability.Value == RoomAvailability.Public;
|
||||
break;
|
||||
}
|
||||
|
||||
r.MatchingFilter = matchingFilter;
|
||||
}
|
||||
});
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.GameTypes;
|
||||
@ -137,30 +136,23 @@ namespace osu.Game.Screens.Multi.Match
|
||||
new Drawable[] { new OverlinedHeader("Playlist"), },
|
||||
new Drawable[]
|
||||
{
|
||||
new DrawableRoomPlaylist(false, true) // Temporarily always allow selection
|
||||
new DrawableRoomPlaylistWithResults
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Items = { BindTarget = playlist },
|
||||
SelectedItem = { BindTarget = SelectedItem }
|
||||
SelectedItem = { BindTarget = SelectedItem },
|
||||
RequestShowResults = item =>
|
||||
{
|
||||
Debug.Assert(roomId.Value != null);
|
||||
multiplayer?.Push(new TimeshiftResultsScreen(null, roomId.Value.Value, item, false));
|
||||
}
|
||||
}
|
||||
},
|
||||
null,
|
||||
new Drawable[]
|
||||
{
|
||||
new TriangleButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Show beatmap results",
|
||||
Action = showBeatmapResults
|
||||
}
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Absolute, 5),
|
||||
new Dimension(GridSizeMode.AutoSize)
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -296,11 +288,5 @@ namespace osu.Game.Screens.Multi.Match
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showBeatmapResults()
|
||||
{
|
||||
Debug.Assert(roomId.Value != null);
|
||||
multiplayer?.Push(new TimeshiftResultsScreen(null, roomId.Value.Value, SelectedItem.Value, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ namespace osu.Game.Screens.Multi
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
|
||||
pollReq?.Cancel();
|
||||
pollReq = new GetRoomsRequest(currentFilter.Value.PrimaryFilter);
|
||||
pollReq = new GetRoomsRequest(currentFilter.Value.StatusFilter, currentFilter.Value.RoomCategoryFilter);
|
||||
|
||||
pollReq.Success += result =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user