mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Add expanding options sidebar
This commit is contained in:
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Audio
|
|||||||
{
|
{
|
||||||
public class AudioSection : OptionsSection
|
public class AudioSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Audio";
|
public override string Header => "Audio";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_headphones;
|
public override FontAwesome Icon => FontAwesome.fa_headphones;
|
||||||
|
|
||||||
public AudioSection()
|
public AudioSection()
|
||||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
public class EditorSection : OptionsSection
|
public class EditorSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Editor";
|
public override string Header => "Editor";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_pencil;
|
public override FontAwesome Icon => FontAwesome.fa_pencil;
|
||||||
|
|
||||||
private CheckBoxOption backgroundVideo, defaultSkin, snakingSliders, hitAnimations, followPoints, stacking;
|
private CheckBoxOption backgroundVideo, defaultSkin, snakingSliders, hitAnimations, followPoints, stacking;
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Gameplay
|
|||||||
{
|
{
|
||||||
public class GameplaySection : OptionsSection
|
public class GameplaySection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Gameplay";
|
public override string Header => "Gameplay";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_circle_o;
|
public override FontAwesome Icon => FontAwesome.fa_circle_o;
|
||||||
|
|
||||||
public GameplaySection()
|
public GameplaySection()
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.General
|
|||||||
{
|
{
|
||||||
public class GeneralSection : OptionsSection
|
public class GeneralSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "General";
|
public override string Header => "General";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_gear;
|
public override FontAwesome Icon => FontAwesome.fa_gear;
|
||||||
|
|
||||||
public GeneralSection()
|
public GeneralSection()
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Graphics
|
|||||||
{
|
{
|
||||||
public class GraphicsSection : OptionsSection
|
public class GraphicsSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Graphics";
|
public override string Header => "Graphics";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_laptop;
|
public override FontAwesome Icon => FontAwesome.fa_laptop;
|
||||||
|
|
||||||
public GraphicsSection()
|
public GraphicsSection()
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Input
|
|||||||
{
|
{
|
||||||
public class InputSection : OptionsSection
|
public class InputSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Input";
|
public override string Header => "Input";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
|
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
|
||||||
|
|
||||||
public InputSection()
|
public InputSection()
|
||||||
|
@ -8,7 +8,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
public class MaintenanceSection : OptionsSection
|
public class MaintenanceSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Maintenance";
|
public override string Header => "Maintenance";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_wrench;
|
public override FontAwesome Icon => FontAwesome.fa_wrench;
|
||||||
|
|
||||||
public MaintenanceSection()
|
public MaintenanceSection()
|
||||||
|
@ -5,7 +5,7 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
{
|
{
|
||||||
public class OnlineSection : OptionsSection
|
public class OnlineSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Online";
|
public override string Header => "Online";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_globe;
|
public override FontAwesome Icon => FontAwesome.fa_globe;
|
||||||
|
|
||||||
public OnlineSection()
|
public OnlineSection()
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public abstract FontAwesome Icon { get; }
|
public abstract FontAwesome Icon { get; }
|
||||||
protected abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
public OptionsSection()
|
public OptionsSection()
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,9 @@ using OpenTK.Graphics;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options
|
namespace osu.Game.Overlays.Options
|
||||||
@ -12,6 +14,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
public class OptionsSidebar : Container
|
public class OptionsSidebar : Container
|
||||||
{
|
{
|
||||||
private FlowContainer content;
|
private FlowContainer content;
|
||||||
|
internal const int default_width = 60, expanded_width = 200;
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public OptionsSidebar()
|
public OptionsSidebar()
|
||||||
@ -41,6 +44,25 @@ namespace osu.Game.Overlays.Options
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScheduledDelegate expandEvent;
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
expandEvent = Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
expandEvent = null;
|
||||||
|
ResizeTo(new Vector2(expanded_width, Height), 150, EasingTypes.OutQuad);
|
||||||
|
}, 750);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
expandEvent?.Cancel();
|
||||||
|
ResizeTo(new Vector2(default_width, Height), 150, EasingTypes.OutQuad);
|
||||||
|
base.OnHoverLost(state);
|
||||||
|
}
|
||||||
|
|
||||||
private class SidebarScrollContainer : ScrollContainer
|
private class SidebarScrollContainer : ScrollContainer
|
||||||
{
|
{
|
||||||
public SidebarScrollContainer()
|
public SidebarScrollContainer()
|
||||||
@ -53,6 +75,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
public class SidebarButton : Container
|
public class SidebarButton : Container
|
||||||
{
|
{
|
||||||
private TextAwesome drawableIcon;
|
private TextAwesome drawableIcon;
|
||||||
|
private SpriteText headerText;
|
||||||
private Box backgroundBox;
|
private Box backgroundBox;
|
||||||
public Action Action;
|
public Action Action;
|
||||||
|
|
||||||
@ -61,10 +84,17 @@ namespace osu.Game.Overlays.Options
|
|||||||
get { return drawableIcon.Icon; }
|
get { return drawableIcon.Icon; }
|
||||||
set { drawableIcon.Icon = value; }
|
set { drawableIcon.Icon = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Header
|
||||||
|
{
|
||||||
|
get { return headerText.Text; }
|
||||||
|
set { headerText.Text = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public SidebarButton()
|
public SidebarButton()
|
||||||
{
|
{
|
||||||
Size = new Vector2(60);
|
Height = default_width;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
backgroundBox = new Box
|
backgroundBox = new Box
|
||||||
@ -74,11 +104,25 @@ namespace osu.Game.Overlays.Options
|
|||||||
Colour = new Color4(60, 60, 60, 255),
|
Colour = new Color4(60, 60, 60, 255),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
drawableIcon = new TextAwesome
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Width = default_width,
|
||||||
Origin = Anchor.Centre,
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
drawableIcon = new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
headerText = new SpriteText
|
||||||
|
{
|
||||||
|
Position = new Vector2(default_width + 10, 0),
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,12 +136,13 @@ namespace osu.Game.Overlays.Options
|
|||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
backgroundBox.FadeTo(0.4f, 200);
|
backgroundBox.FadeTo(0.4f, 200);
|
||||||
return true;
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
backgroundBox.FadeTo(0, 200);
|
backgroundBox.FadeTo(0, 200);
|
||||||
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Options
|
|||||||
{
|
{
|
||||||
public class SkinSection : OptionsSection
|
public class SkinSection : OptionsSection
|
||||||
{
|
{
|
||||||
protected override string Header => "Skin";
|
public override string Header => "Skin";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
|
||||||
|
|
||||||
private CheckBoxOption ignoreSkins, useSkinSoundSamples, useTaikoSkin, useSkinCursor, autoCursorSize;
|
private CheckBoxOption ignoreSkins, useSkinSoundSamples, useTaikoSkin, useSkinCursor, autoCursorSize;
|
||||||
|
@ -27,7 +27,8 @@ namespace osu.Game.Overlays
|
|||||||
internal const float CONTENT_MARGINS = 10;
|
internal const float CONTENT_MARGINS = 10;
|
||||||
|
|
||||||
private const float width = 400;
|
private const float width = 400;
|
||||||
private const float sidebar_width = 60;
|
private const float sidebar_width = OptionsSidebar.default_width;
|
||||||
|
private const float sidebar_padding = 10;
|
||||||
|
|
||||||
private ScrollContainer scrollContainer;
|
private ScrollContainer scrollContainer;
|
||||||
private OptionsSidebar sidebar;
|
private OptionsSidebar sidebar;
|
||||||
@ -105,7 +106,8 @@ namespace osu.Game.Overlays
|
|||||||
new OptionsSidebar.SidebarButton
|
new OptionsSidebar.SidebarButton
|
||||||
{
|
{
|
||||||
Icon = section.Icon,
|
Icon = section.Icon,
|
||||||
Action = () => scrollContainer.ScrollIntoView(section)
|
Header = section.Header,
|
||||||
|
Action = () => scrollContainer.ScrollIntoView(section),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user