mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Changes in line with framework changes
This commit is contained in:
Submodule osu-framework updated: 56ce220e7f...926d7c971d
@ -39,18 +39,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override void AnimateOpen() => this.FadeIn(fade_duration, Easing.OutQuint);
|
protected override void AnimateOpen() => this.FadeIn(fade_duration, Easing.OutQuint);
|
||||||
protected override void AnimateClose() => this.FadeOut(fade_duration, Easing.OutQuint);
|
protected override void AnimateClose() => this.FadeOut(fade_duration, Easing.OutQuint);
|
||||||
|
|
||||||
protected override FlowContainer<MenuItemRepresentation> CreateItemsFlow()
|
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding { Vertical = DrawableOsuContextMenuItem.MARGIN_VERTICAL };
|
||||||
{
|
|
||||||
var flow = base.CreateItemsFlow();
|
|
||||||
flow.Padding = new MarginPadding { Vertical = OsuContextMenuItemRepresentation.MARGIN_VERTICAL };
|
|
||||||
|
|
||||||
return flow;
|
protected override DrawableMenuItem CreateDrawableMenuItem(TItem item) => new DrawableOsuContextMenuItem(this, item);
|
||||||
}
|
|
||||||
|
|
||||||
protected override MenuItemRepresentation CreateMenuItemRepresentation(TItem model) => new OsuContextMenuItemRepresentation(this, model);
|
#region DrawableOsuContextMenuItem
|
||||||
|
private class DrawableOsuContextMenuItem : DrawableMenuItem
|
||||||
#region OsuContextMenuItemRepresentation
|
|
||||||
private class OsuContextMenuItemRepresentation : MenuItemRepresentation
|
|
||||||
{
|
{
|
||||||
private const int margin_horizontal = 17;
|
private const int margin_horizontal = 17;
|
||||||
private const int text_size = 17;
|
private const int text_size = 17;
|
||||||
@ -63,8 +57,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private OsuSpriteText text;
|
private OsuSpriteText text;
|
||||||
private OsuSpriteText textBold;
|
private OsuSpriteText textBold;
|
||||||
|
|
||||||
public OsuContextMenuItemRepresentation(Menu<TItem> menu, TItem model)
|
public DrawableOsuContextMenuItem(Menu<TItem> menu, TItem item)
|
||||||
: base(menu, model)
|
: base(item)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +76,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void updateTextColour()
|
private void updateTextColour()
|
||||||
{
|
{
|
||||||
switch (Model.Type)
|
switch (Item.Type)
|
||||||
{
|
{
|
||||||
case MenuItemType.Standard:
|
case MenuItemType.Standard:
|
||||||
textBold.Colour = text.Colour = Color4.White;
|
textBold.Colour = text.Colour = Color4.White;
|
||||||
@ -117,7 +111,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return base.OnClick(state);
|
return base.OnClick(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateText(string title) => new Container
|
protected override Drawable CreateContent() => new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -129,7 +123,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
Text = title,
|
Text = Item.Text,
|
||||||
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
|
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
|
||||||
},
|
},
|
||||||
textBold = new OsuSpriteText
|
textBold = new OsuSpriteText
|
||||||
@ -139,7 +133,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
Text = title,
|
Text = Item.Text,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
|
Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL },
|
||||||
}
|
}
|
||||||
|
@ -44,18 +44,40 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
#region OsuDropdownMenu
|
#region OsuDropdownMenu
|
||||||
protected class OsuDropdownMenu : DropdownMenu
|
protected class OsuDropdownMenu : DropdownMenu
|
||||||
{
|
{
|
||||||
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
|
public OsuDropdownMenu()
|
||||||
|
{
|
||||||
|
CornerRadius = 4;
|
||||||
|
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
|
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
|
||||||
|
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
|
||||||
|
|
||||||
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
|
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding(5);
|
||||||
|
|
||||||
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
|
protected override void UpdateMenuHeight()
|
||||||
|
{
|
||||||
|
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
|
||||||
|
this.ResizeHeightTo(State == MenuState.Opened ? actualHeight : 0, 300, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||||
|
|
||||||
protected override MenuItemRepresentation CreateMenuItemRepresentation(DropdownMenuItem<T> model)
|
|
||||||
|
protected override DrawableMenuItem CreateDrawableMenuItem(DropdownMenuItem<T> item)
|
||||||
{
|
{
|
||||||
var newItem = new OsuDropdownMenuItemRepresentation(this, model);
|
var newItem = new DrawableOsuDropdownMenuItem(item);
|
||||||
newItem.AccentColour.BindTo(AccentColour);
|
newItem.AccentColour.BindTo(AccentColour);
|
||||||
|
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region OsuDropdownMenuItemRepresentation
|
#region DrawableOsuDropdownMenuItem
|
||||||
protected class OsuDropdownMenuItemRepresentation : DropdownMenuItemRepresentation
|
protected class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem
|
||||||
{
|
{
|
||||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||||
|
|
||||||
@ -65,8 +87,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private Color4 nonAccentHoverColour;
|
private Color4 nonAccentHoverColour;
|
||||||
private Color4 nonAccentSelectedColour;
|
private Color4 nonAccentSelectedColour;
|
||||||
|
|
||||||
public OsuDropdownMenuItemRepresentation(Menu<DropdownMenuItem<T>> menu, DropdownMenuItem<T> model)
|
public DrawableOsuDropdownMenuItem(DropdownMenuItem<T> item)
|
||||||
: base(menu, model)
|
: base(item)
|
||||||
{
|
{
|
||||||
Foreground.Padding = new MarginPadding(2);
|
Foreground.Padding = new MarginPadding(2);
|
||||||
|
|
||||||
@ -88,17 +110,17 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
BackgroundColourHover = newValue ?? nonAccentHoverColour;
|
BackgroundColourHover = newValue ?? nonAccentHoverColour;
|
||||||
BackgroundColourSelected = newValue ?? nonAccentSelectedColour;
|
BackgroundColourSelected = newValue ?? nonAccentSelectedColour;
|
||||||
AnimateBackground(IsHovered);
|
UpdateBackgroundColour();
|
||||||
AnimateForeground(IsHovered);
|
UpdateForegroundColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AnimateForeground(bool hover)
|
protected override void UpdateForegroundColour()
|
||||||
{
|
{
|
||||||
base.AnimateForeground(hover);
|
base.UpdateForegroundColour();
|
||||||
chevron.Alpha = hover ? 1 : 0;
|
chevron.Alpha = IsHovered ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateText(string title) => new FillFlowContainer
|
protected override Drawable CreateContent() => new FillFlowContainer
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -118,7 +140,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
},
|
},
|
||||||
Label = new OsuSpriteText
|
Label = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = title,
|
Text = Item.Text,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
// 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 OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
@ -28,16 +26,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
this.ResizeHeightTo(State == MenuState.Opened ? actualHeight : 0, 300, Easing.OutQuint);
|
this.ResizeHeightTo(State == MenuState.Opened ? actualHeight : 0, 300, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FlowContainer<MenuItemRepresentation> CreateItemsFlow()
|
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding(5);
|
||||||
{
|
|
||||||
var flow = base.CreateItemsFlow();
|
|
||||||
flow.Padding = new MarginPadding(5);
|
|
||||||
|
|
||||||
return flow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OsuMenu : OsuMenu<MenuItem>
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
accentColour = value;
|
accentColour = value;
|
||||||
var dropDown = Dropdown as OsuTabDropdown;
|
var dropdown = Dropdown as OsuTabDropdown;
|
||||||
if (dropDown != null)
|
if (dropdown != null)
|
||||||
dropDown.AccentColour.Value = value;
|
dropdown.AccentColour.Value = value;
|
||||||
foreach (var item in TabContainer.Children.OfType<OsuTabItem>())
|
foreach (var item in TabContainer.Children.OfType<OsuTabItem>())
|
||||||
item.AccentColour = value;
|
item.AccentColour = value;
|
||||||
}
|
}
|
||||||
@ -140,16 +140,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override void OnDeactivated() => fadeInactive();
|
protected override void OnDeactivated() => fadeInactive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: this needs to go
|
||||||
private class OsuTabDropdown : OsuDropdown<T>
|
private class OsuTabDropdown : OsuDropdown<T>
|
||||||
{
|
{
|
||||||
public OsuTabDropdown()
|
public OsuTabDropdown()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DropdownMenu CreateMenu() => new OsuTabDropdownMenu();
|
protected override DropdownMenu CreateMenu()
|
||||||
|
{
|
||||||
|
var menu = new OsuTabDropdownMenu();
|
||||||
|
menu.AccentColour.BindTo(AccentColour);
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
protected override DropdownHeader CreateHeader()
|
protected override DropdownHeader CreateHeader()
|
||||||
{
|
{
|
||||||
@ -175,18 +179,24 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
MaxHeight = 400;
|
MaxHeight = 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override MenuItemRepresentation CreateMenuItemRepresentation(DropdownMenuItem<T> model) => new OsuTabDropdownMenuItemRepresentation(this, model);
|
protected override DrawableMenuItem CreateDrawableMenuItem(DropdownMenuItem<T> item)
|
||||||
|
|
||||||
private class OsuTabDropdownMenuItemRepresentation : OsuDropdownMenuItemRepresentation
|
|
||||||
{
|
{
|
||||||
public OsuTabDropdownMenuItemRepresentation(Menu<DropdownMenuItem<T>> menu, DropdownMenuItem<T> model)
|
var poop = new DrawableOsuTabDropdownMenuItem(this, item);
|
||||||
: base(menu, model)
|
poop.AccentColour.BindTo(AccentColour);
|
||||||
|
return poop;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DrawableOsuTabDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||||
|
{
|
||||||
|
public DrawableOsuTabDropdownMenuItem(Menu<DropdownMenuItem<T>> menu, DropdownMenuItem<T> item)
|
||||||
|
: base(item)
|
||||||
{
|
{
|
||||||
ForegroundColourHover = Color4.Black;
|
ForegroundColourHover = Color4.Black;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected class OsuTabDropdownHeader : OsuDropdownHeader
|
protected class OsuTabDropdownHeader : OsuDropdownHeader
|
||||||
{
|
{
|
||||||
public OsuTabDropdownHeader()
|
public OsuTabDropdownHeader()
|
||||||
|
@ -306,20 +306,14 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
BackgroundColour = colours.Gray3;
|
BackgroundColour = colours.Gray3;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FlowContainer<MenuItemRepresentation> CreateItemsFlow()
|
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding();
|
||||||
|
|
||||||
|
protected override DrawableMenuItem CreateDrawableMenuItem(DropdownMenuItem<UserAction> item) => new DrawableUserDropdownMenuItem(this, item);
|
||||||
|
|
||||||
|
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||||
{
|
{
|
||||||
var flow = base.CreateItemsFlow();
|
public DrawableUserDropdownMenuItem(Menu<DropdownMenuItem<UserAction>> menu, DropdownMenuItem<UserAction> item)
|
||||||
flow.Padding = new MarginPadding(0);
|
: base(item)
|
||||||
|
|
||||||
return flow;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override MenuItemRepresentation CreateMenuItemRepresentation(DropdownMenuItem<UserAction> model) => new UserDropdownMenuItem(this, model);
|
|
||||||
|
|
||||||
private class UserDropdownMenuItem : OsuDropdownMenuItemRepresentation
|
|
||||||
{
|
|
||||||
public UserDropdownMenuItem(Menu<DropdownMenuItem<UserAction>> menu, DropdownMenuItem<UserAction> model)
|
|
||||||
: base(menu, model)
|
|
||||||
{
|
{
|
||||||
Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 5 };
|
Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 5 };
|
||||||
Label.Margin = new MarginPadding { Left = UserDropdownHeader.LABEL_LEFT_MARGIN - 11 };
|
Label.Margin = new MarginPadding { Left = UserDropdownHeader.LABEL_LEFT_MARGIN - 11 };
|
||||||
|
Reference in New Issue
Block a user