mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 08:52:55 +08:00
Fix filter controls having margin when no controls given, add DisplayStyleControl to social, misc cleanups
This commit is contained in:
parent
63313045d9
commit
2d3995b85c
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Browse
|
|||||||
|
|
||||||
protected abstract Color4 BackgroundColour { get; }
|
protected abstract Color4 BackgroundColour { get; }
|
||||||
protected abstract T DefaultTab { get; }
|
protected abstract T DefaultTab { get; }
|
||||||
protected virtual Drawable CreateControls() => new Container(); //todo: naming
|
protected virtual Drawable CreateControls() => null; //todo: naming
|
||||||
|
|
||||||
public BrowseFilterControl()
|
public BrowseFilterControl()
|
||||||
{
|
{
|
||||||
@ -34,6 +34,8 @@ namespace osu.Game.Overlays.Browse
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
var controls = CreateControls();
|
||||||
|
Container controlsContainer;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -60,15 +62,11 @@ namespace osu.Game.Overlays.Browse
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
},
|
||||||
new Container
|
controlsContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Margin = new MarginPadding { Top = padding }, //todo: margin is still applied without any controls
|
Margin = new MarginPadding { Top = controls != null ? padding : 0 },
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
CreateControls(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Tabs = new PageTabControl<T>
|
Tabs = new PageTabControl<T>
|
||||||
{
|
{
|
||||||
@ -84,6 +82,7 @@ namespace osu.Game.Overlays.Browse
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (controls != null) controlsContainer.Children = new[] { controls };
|
||||||
Tabs.Current.Value = DefaultTab;
|
Tabs.Current.Value = DefaultTab;
|
||||||
Tabs.Current.TriggerChange();
|
Tabs.Current.TriggerChange();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Browse
|
|||||||
}
|
}
|
||||||
|
|
||||||
//todo: naming
|
//todo: naming
|
||||||
//todo: crash when pressing tab
|
|
||||||
public abstract class BrowseOverlay<T,U> : BrowseOverlay
|
public abstract class BrowseOverlay<T,U> : BrowseOverlay
|
||||||
{
|
{
|
||||||
private readonly Container scrollContainer;
|
private readonly Container scrollContainer;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.Browse;
|
using osu.Game.Overlays.Browse;
|
||||||
@ -12,4 +13,15 @@ namespace osu.Game.Overlays.Social
|
|||||||
protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a");
|
protected override Color4 BackgroundColour => OsuColour.FromHex(@"47253a");
|
||||||
protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name;
|
protected override SocialSortCriteria DefaultTab => SocialSortCriteria.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum SocialSortCriteria
|
||||||
|
{
|
||||||
|
Name,
|
||||||
|
Rank,
|
||||||
|
Location,
|
||||||
|
[Description("Time Zone")]
|
||||||
|
TimeZone,
|
||||||
|
[Description("World Map")]
|
||||||
|
WorldMap,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Social
|
namespace osu.Game.Overlays.Social
|
||||||
{
|
{
|
||||||
@ -48,4 +49,16 @@ namespace osu.Game.Overlays.Social
|
|||||||
browser.Colour = colours.Pink;
|
browser.Colour = colours.Pink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum SocialTab
|
||||||
|
{
|
||||||
|
[Description("Online Players")]
|
||||||
|
OnlinePlayers,
|
||||||
|
[Description("Online Friends")]
|
||||||
|
OnlineFriends,
|
||||||
|
[Description("Online Team Members")]
|
||||||
|
OnlineTeamMembers,
|
||||||
|
[Description("Chat Channels")]
|
||||||
|
ChatChannels,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.Browse;
|
using osu.Game.Overlays.Browse;
|
||||||
using osu.Game.Overlays.Social;
|
using osu.Game.Overlays.Social;
|
||||||
|
|
||||||
|
using Container = osu.Framework.Graphics.Containers.Container;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class SocialOverlay : BrowseOverlay<SocialTab, SocialSortCriteria>
|
public class SocialOverlay : BrowseOverlay<SocialTab, SocialSortCriteria>
|
||||||
@ -17,28 +20,32 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override BrowseFilterControl<SocialSortCriteria> CreateFilterControl() => new FilterControl();
|
protected override BrowseFilterControl<SocialSortCriteria> CreateFilterControl() => new FilterControl();
|
||||||
protected override BrowseHeader<SocialTab> CreateHeader() => new Header();
|
protected override BrowseHeader<SocialTab> CreateHeader() => new Header();
|
||||||
|
|
||||||
|
public SocialOverlay()
|
||||||
|
{
|
||||||
|
ScrollFlow.Children = new[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding { Vertical = 10 },
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DisplayStyleControl<SortDirection>
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SocialTab
|
public enum SortDirection
|
||||||
{
|
{
|
||||||
[Description("Online Players")]
|
Ascending,
|
||||||
OnlinePlayers,
|
Descending,
|
||||||
[Description("Online Friends")]
|
|
||||||
OnlineFriends,
|
|
||||||
[Description("Online Team Members")]
|
|
||||||
OnlineTeamMembers,
|
|
||||||
[Description("Chat Channels")]
|
|
||||||
ChatChannels,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SocialSortCriteria
|
|
||||||
{
|
|
||||||
Name,
|
|
||||||
Rank,
|
|
||||||
Location,
|
|
||||||
[Description("Time Zone")]
|
|
||||||
TimeZone,
|
|
||||||
[Description("World Map")]
|
|
||||||
WorldMap,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user