Add Lounge FilterControl.

This commit is contained in:
DrabWeb
2018-05-22 00:24:39 -03:00
parent cae09492c3
commit f7a4a4eeef
7 changed files with 87 additions and 5 deletions

View File

@ -8,7 +8,7 @@ using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Multi.Screens;
using osu.Game.Screens.Multi.Screens.Lounge;
namespace osu.Game.Screens.Multi
{

View File

@ -0,0 +1,27 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.SearchableList;
using OpenTK.Graphics;
namespace osu.Game.Screens.Multi.Screens.Lounge
{
public class FilterControl : SearchableListFilterControl<LoungeTab, LoungeTab>
{
protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42");
protected override LoungeTab DefaultTab => LoungeTab.Public;
public FilterControl()
{
DisplayStyleControl.Hide();
}
}
public enum LoungeTab
{
Public = RoomAvailability.Public,
Private = RoomAvailability.FriendsOnly,
}
}

View File

@ -1,21 +1,24 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Screens;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.SearchableList;
using osu.Game.Screens.Multi.Components;
using OpenTK;
namespace osu.Game.Screens.Multi.Screens
namespace osu.Game.Screens.Multi.Screens.Lounge
{
public class Lounge : MultiplayerScreen
{
private readonly FilterControl filter;
private readonly Container content;
private readonly FillFlowContainer<DrawableRoom> roomsFlow;
private readonly RoomInspector roomInspector;
@ -50,6 +53,7 @@ namespace osu.Game.Screens.Multi.Screens
{
Children = new Drawable[]
{
filter = new FilterControl(),
content = new Container
{
RelativeSizeAxes = Axes.Both,
@ -84,6 +88,8 @@ namespace osu.Game.Screens.Multi.Screens
},
},
};
filter.Search.Exit += Exit;
}
protected override void UpdateAfterChildren()
@ -92,11 +98,41 @@ namespace osu.Game.Screens.Multi.Screens
content.Padding = new MarginPadding
{
Top = filter.DrawHeight,
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH,
Right = SearchableListOverlay.WIDTH_PADDING,
};
}
protected override void OnFocus(InputState state)
{
GetContainingInputManager().ChangeFocus(filter.Search);
}
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
filter.Search.HoldFocus = true;
}
protected override bool OnExiting(Screen next)
{
filter.Search.HoldFocus = false;
return base.OnExiting(next);
}
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
filter.Search.HoldFocus = true;
}
protected override void OnSuspending(Screen next)
{
base.OnSuspending(next);
filter.Search.HoldFocus = false;
}
private void didSelect(DrawableRoom room)
{
roomsFlow.Children.ForEach(c =>