Merge remote-tracking branch 'refs/remotes/upstream/master' into generic-container

This commit is contained in:
Dean Herbert 2016-11-08 18:29:21 +09:00
commit c36b54b35a
44 changed files with 465 additions and 261 deletions

@ -1 +1 @@
Subproject commit 9e9145afcd1d37c56f89a6ae6e7b59e43d51037e Subproject commit 478d0dd295a66c99556ca8039453e0f806ff4e9b

View File

@ -13,9 +13,11 @@ namespace osu.Desktop.VisualTests
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"); using (BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"))
host.Add(new VisualTestGame()); {
host.Run(); host.Add(new VisualTestGame());
host.Run();
}
} }
} }
} }

View File

@ -18,25 +18,25 @@ namespace osu.Desktop
[STAThread] [STAThread]
public static int Main(string[] args) public static int Main(string[] args)
{ {
DesktopGameHost host = Host.GetSuitableHost(@"osu", true); using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
if (!host.IsPrimaryInstance)
{ {
var importer = new BeatmapImporter(host); if (!host.IsPrimaryInstance)
{
foreach (var file in args) var importer = new BeatmapImporter(host);
if (!importer.Import(file).Wait(1000))
throw new TimeoutException(@"IPC took too long to send");
Console.WriteLine(@"Sent import requests to running instance");
}
else
{
BaseGame osu = new OsuGame(args);
host.Add(osu);
host.Run();
}
return 0; foreach (var file in args)
if (!importer.Import(file).Wait(1000))
throw new TimeoutException(@"IPC took too long to send");
Console.WriteLine(@"Sent import requests to running instance");
}
else
{
BaseGame osu = new OsuGame(args);
host.Add(osu);
host.Run();
}
return 0;
}
} }
} }
} }

View File

@ -163,7 +163,16 @@ namespace osu.Game.Configuration
Set(OsuConfig.LetterboxPositionX, 0, -100, 100); Set(OsuConfig.LetterboxPositionX, 0, -100, 100);
Set(OsuConfig.LetterboxPositionY, 0, -100, 100); Set(OsuConfig.LetterboxPositionY, 0, -100, 100);
//Set(OsuConfig.FrameSync, FrameSync.Limit120); //Set(OsuConfig.FrameSync, FrameSync.Limit120);
//Set(OsuConfig.ShowUnicode, unicodeDefault); bool unicodeDefault = false;
switch (Get<string>(OsuConfig.Language))
{
case @"zh":
case @"ja":
case @"ko":
unicodeDefault = true;
break;
}
Set(OsuConfig.ShowUnicode, unicodeDefault);
Set(OsuConfig.PermanentSongInfo, false); Set(OsuConfig.PermanentSongInfo, false);
Set(OsuConfig.Ticker, false); Set(OsuConfig.Ticker, false);
Set(OsuConfig.CompatibilityContext, false); Set(OsuConfig.CompatibilityContext, false);

View File

@ -1,30 +0,0 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class AlertsPrivacyOptions : OptionsSubsection
{
protected override string Header => "Alerts & Privacy";
public AlertsPrivacyOptions()
{
// TODO: this should probably be split into Alerts and Privacy
Children = new Drawable[]
{
new BasicCheckBox { LabelText = "Chat ticker" },
new BasicCheckBox { LabelText = "Automatically hide chat during gameplay" },
new BasicCheckBox { LabelText = "Show a notification popup when someone says your name" },
new BasicCheckBox { LabelText = "Show chat message notifications" },
new BasicCheckBox { LabelText = "Play a sound when someone says your name" },
new BasicCheckBox { LabelText = "Share your city location with others" },
new BasicCheckBox { LabelText = "Show spectators" },
new BasicCheckBox { LabelText = "Automatically link beatmaps to spectators" },
new BasicCheckBox { LabelText = "Show notification popups instantly during gameplay" },
new BasicCheckBox { LabelText = "Show notification popups when friends change status" },
new BasicCheckBox { LabelText = "Allow multiplayer game invites from all users" },
};
}
}
}

View File

@ -1,7 +1,6 @@
using System; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Audio
{ {
public class AudioDevicesOptions : OptionsSubsection public class AudioDevicesOptions : OptionsSubsection
{ {

View File

@ -1,13 +1,14 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Audio
{ {
public class AudioOptions : OptionsSection public class AudioSection : OptionsSection
{ {
protected override string Header => "Audio"; protected override string Header => "Audio";
public override FontAwesome Icon => FontAwesome.fa_headphones;
public AudioOptions() public AudioSection()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Audio
{ {
public class OffsetAdjustmentOptions : OptionsSubsection public class OffsetAdjustmentOptions : OptionsSubsection
{ {

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Audio
{ {
public class VolumeOptions : OptionsSubsection public class VolumeOptions : OptionsSubsection
{ {

View File

@ -0,0 +1,53 @@
using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class CheckBoxOption : BasicCheckBox
{
private Bindable<bool> bindable;
public Bindable<bool> Bindable
{
set
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
bindable = value;
if (bindable != null)
{
bool state = State == CheckBoxState.Checked;
if (state != bindable.Value)
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
bindable.ValueChanged += bindableValueChanged;
}
}
}
private void bindableValueChanged(object sender, EventArgs e)
{
State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked;
}
protected override void Dispose(bool isDisposing)
{
if (bindable != null)
bindable.ValueChanged -= bindableValueChanged;
base.Dispose(isDisposing);
}
protected override void OnChecked()
{
if (bindable != null)
bindable.Value = true;
base.OnChecked();
}
protected override void OnUnchecked()
{
if (bindable != null)
bindable.Value = false;
base.OnChecked();
}
}
}

View File

@ -1,15 +1,16 @@
using System; using OpenTK;
using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class EditorOptions : OptionsSection public class EditorSection : OptionsSection
{ {
protected override string Header => "Editor"; protected override string Header => "Editor";
public override FontAwesome Icon => FontAwesome.fa_pencil;
public EditorOptions() public EditorSection()
{ {
content.Spacing = new Vector2(0, 5); content.Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]

View File

@ -1,13 +1,14 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Gameplay
{ {
public class GameplayOptions : OptionsSection public class GameplaySection : OptionsSection
{ {
protected override string Header => "Gameplay"; protected override string Header => "Gameplay";
public override FontAwesome Icon => FontAwesome.fa_circle_o;
public GameplayOptions() public GameplaySection()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Gameplay
{ {
public class GeneralGameplayOptions : OptionsSubsection public class GeneralGameplayOptions : OptionsSubsection
{ {

View File

@ -1,8 +1,7 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Gameplay
{ {
public class SongSelectGameplayOptions : OptionsSubsection public class SongSelectGameplayOptions : OptionsSubsection
{ {

View File

@ -0,0 +1,22 @@
using osu.Framework.Graphics;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Options.General
{
public class GeneralSection : OptionsSection
{
protected override string Header => "General";
public override FontAwesome Icon => FontAwesome.fa_gear;
public GeneralSection()
{
Children = new Drawable[]
{
new LoginOptions(),
new LanguageOptions(),
new UpdateOptions(),
};
}
}
}

View File

@ -0,0 +1,33 @@
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Options.General
{
public class LanguageOptions : OptionsSubsection
{
protected override string Header => "Language";
private CheckBoxOption showUnicode, altChatFont;
public LanguageOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" },
altChatFont = new CheckBoxOption { LabelText = "Use alternative font for chat display" },
};
}
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
showUnicode.Bindable = osuGame.Config.GetBindable<bool>(Configuration.OsuConfig.ShowUnicode);
altChatFont.Bindable = osuGame.Config.GetBindable<bool>(Configuration.OsuConfig.AlternativeChatFont);
}
}
}
}

View File

@ -1,6 +1,4 @@
using System; using OpenTK;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework; using osu.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -9,7 +7,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.General
{ {
public class LoginOptions : OptionsSubsection public class LoginOptions : OptionsSubsection
{ {

View File

@ -1,13 +1,10 @@
using System; using osu.Framework;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.General
{ {
public class UpdateOptions : OptionsSubsection public class UpdateOptions : OptionsSubsection
{ {

View File

@ -1,26 +0,0 @@
using System;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Platform;
using osu.Game.Online.API;
namespace osu.Game.Overlays.Options
{
public class GeneralOptions : OptionsSection
{
protected override string Header => "General";
public GeneralOptions()
{
Children = new Drawable[]
{
new LoginOptions(),
new LanguageOptions(),
new UpdateOptions(),
};
}
}
}

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Graphics
{ {
public class DetailOptions : OptionsSubsection public class DetailOptions : OptionsSubsection
{ {

View File

@ -1,13 +1,14 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Graphics
{ {
public class GraphicsOptions : OptionsSection public class GraphicsSection : OptionsSection
{ {
protected override string Header => "Graphics"; protected override string Header => "Graphics";
public override FontAwesome Icon => FontAwesome.fa_laptop;
public GraphicsOptions() public GraphicsSection()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Graphics
{ {
public class LayoutOptions : OptionsSubsection public class LayoutOptions : OptionsSubsection
{ {

View File

@ -1,7 +1,6 @@
using System; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Graphics
{ {
public class MainMenuOptions : OptionsSubsection public class MainMenuOptions : OptionsSubsection
{ {

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Graphics
{ {
public class RendererOptions : OptionsSubsection public class RendererOptions : OptionsSubsection
{ {

View File

@ -1,7 +1,6 @@
using System; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Graphics
{ {
public class SongSelectGraphicsOptions : OptionsSubsection public class SongSelectGraphicsOptions : OptionsSubsection
{ {

View File

@ -1,13 +1,14 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Input
{ {
public class InputOptions : OptionsSection public class InputSection : OptionsSection
{ {
protected override string Header => "Input"; protected override string Header => "Input";
public override FontAwesome Icon => FontAwesome.fa_keyboard_o;
public InputOptions() public InputSection()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -1,8 +1,7 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Input
{ {
public class KeyboardOptions : OptionsSubsection public class KeyboardOptions : OptionsSubsection
{ {

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Input
{ {
public class MouseOptions : OptionsSubsection public class MouseOptions : OptionsSubsection
{ {

View File

@ -1,8 +1,7 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Input
{ {
public class OtherInputOptions : OptionsSubsection public class OtherInputOptions : OptionsSubsection
{ {

View File

@ -1,22 +0,0 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class LanguageOptions : OptionsSubsection
{
protected override string Header => "Language";
public LanguageOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
new BasicCheckBox { LabelText = "Prefer metadata in original language" },
new BasicCheckBox { LabelText = "Use alternative font for chat display" },
};
}
}
}

View File

@ -1,16 +1,17 @@
using System; using OpenTK;
using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class MaintenanceOptions : OptionsSection public class MaintenanceSection : OptionsSection
{ {
protected override string Header => "Maintenance"; protected override string Header => "Maintenance";
public override FontAwesome Icon => FontAwesome.fa_wrench;
public MaintenanceOptions() public MaintenanceSection()
{ {
content.Spacing = new Vector2(0, 5); content.Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]

View File

@ -1,9 +1,8 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Online
{ {
public class InGameChatOptions : OptionsSubsection public class InGameChatOptions : OptionsSubsection
{ {

View File

@ -0,0 +1,23 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Online
{
public class NotificationsOptions : OptionsSubsection
{
protected override string Header => "Notifications";
public NotificationsOptions()
{
Children = new Drawable[]
{
new BasicCheckBox { LabelText = "Enable chat ticker" },
new BasicCheckBox { LabelText = "Show a notification popup when someone says your name" },
new BasicCheckBox { LabelText = "Show chat message notifications" },
new BasicCheckBox { LabelText = "Play a sound when someone says your name" },
new BasicCheckBox { LabelText = "Show notification popups instantly during gameplay" },
new BasicCheckBox { LabelText = "Show notification popups when friends change status" },
};
}
}
}

View File

@ -1,8 +1,7 @@
using System; using osu.Framework.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options.Online
{ {
public class OnlineIntegrationOptions : OptionsSubsection public class OnlineIntegrationOptions : OptionsSubsection
{ {

View File

@ -0,0 +1,22 @@
using osu.Framework.Graphics;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Options.Online
{
public class OnlineSection : OptionsSection
{
protected override string Header => "Online";
public override FontAwesome Icon => FontAwesome.fa_globe;
public OnlineSection()
{
Children = new Drawable[]
{
new InGameChatOptions(),
new PrivacyOptions(),
new NotificationsOptions(),
new OnlineIntegrationOptions(),
};
}
}
}

View File

@ -0,0 +1,20 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Online
{
public class PrivacyOptions : OptionsSubsection
{
protected override string Header => "Privacy";
public PrivacyOptions()
{
Children = new Drawable[]
{
new BasicCheckBox { LabelText = "Share your city location with others" },
new BasicCheckBox { LabelText = "Allow multiplayer game invites from all users" },
new BasicCheckBox { LabelText = "Block private messages from non-friends" },
};
}
}
}

View File

@ -1,20 +0,0 @@
using System;
using osu.Framework.Graphics;
namespace osu.Game.Overlays.Options
{
public class OnlineOptions : OptionsSection
{
protected override string Header => "Online";
public OnlineOptions()
{
Children = new Drawable[]
{
new AlertsPrivacyOptions(),
new OnlineIntegrationOptions(),
new InGameChatOptions(),
};
}
}
}

View File

@ -1,10 +1,10 @@
using System; using OpenTK;
using OpenTK;
using OpenTK.Graphics; 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.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
@ -13,6 +13,7 @@ namespace osu.Game.Overlays.Options
protected FlowContainer content; protected FlowContainer content;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
public abstract FontAwesome Icon { get; }
protected abstract string Header { get; } protected abstract string Header { get; }
public OptionsSection() public OptionsSection()
@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Options
{ {
new Box new Box
{ {
Colour = new Color4(3, 3, 3, 255), Colour = new Color4(30, 30, 30, 255),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = borderSize, Height = borderSize,
}, },

View File

@ -0,0 +1,92 @@
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Options
{
public class OptionsSideNav : Container
{
private FlowContainer content;
protected override Container Content => content;
public OptionsSideNav()
{
RelativeSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
{
content = new FlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Direction = FlowDirection.VerticalOnly
},
new Box
{
Colour = new Color4(30, 30, 30, 255),
RelativeSizeAxes = Axes.Y,
Width = 2,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
}
};
}
public class SidebarButton : Container
{
private TextAwesome drawableIcon;
private Box backgroundBox;
public Action Action;
public FontAwesome Icon
{
get { return drawableIcon.Icon; }
set { drawableIcon.Icon = value; }
}
public SidebarButton()
{
Size = new Vector2(60);
Children = new Drawable[]
{
backgroundBox = new Box
{
RelativeSizeAxes = Axes.Both,
BlendingMode = BlendingMode.Additive,
Colour = new Color4(60, 60, 60, 255),
Alpha = 0,
},
drawableIcon = new TextAwesome
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
};
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs e)
{
Action?.Invoke();
backgroundBox.FlashColour(Color4.White, 400);
return true;
}
protected override bool OnHover(InputState state)
{
backgroundBox.FadeTo(0.4f, 200);
return true;
}
protected override void OnHoverLost(InputState state)
{
backgroundBox.FadeTo(0, 200);
}
}
}
}

View File

@ -1,5 +1,4 @@
using System; using OpenTK;
using OpenTK;
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;

View File

@ -1,17 +1,18 @@
using System; using OpenTK;
using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class SkinOptions : OptionsSection public class SkinSection : OptionsSection
{ {
protected override string Header => "Skin"; protected override string Header => "Skin";
public override FontAwesome Icon => FontAwesome.fa_paint_brush;
public SkinOptions() public SkinSection()
{ {
content.Spacing = new Vector2(0, 5); content.Spacing = new Vector2(0, 5);
Children = new Drawable[] Children = new Drawable[]

View File

@ -2,21 +2,23 @@
//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.Diagnostics; using System.Diagnostics;
using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
using osu.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Online.API;
using osu.Game.Overlays.Options; using osu.Game.Overlays.Options;
using osu.Game.Overlays.Options.Audio;
using osu.Game.Overlays.Options.Gameplay;
using osu.Game.Overlays.Options.General;
using osu.Game.Overlays.Options.Graphics;
using osu.Game.Overlays.Options.Input;
using osu.Game.Overlays.Options.Online;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -24,6 +26,11 @@ namespace osu.Game.Overlays
{ {
internal const float SideMargins = 10; internal const float SideMargins = 10;
private const float width = 400; private const float width = 400;
private const float sideNavWidth = 60;
private const float sideNavPadding = 0;
private ScrollContainer scrollContainer;
private FlowContainer flowContainer;
public OptionsOverlay() public OptionsOverlay()
{ {
@ -32,6 +39,19 @@ namespace osu.Game.Overlays
Size = new Vector2(width, 1); Size = new Vector2(width, 1);
Position = new Vector2(-width, 0); Position = new Vector2(-width, 0);
var sections = new OptionsSection[]
{
new GeneralSection(),
new GraphicsSection(),
new GameplaySection(),
new AudioSection(),
new SkinSection(),
new InputSection(),
new EditorSection(),
new OnlineSection(),
new MaintenanceSection(),
};
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
@ -40,11 +60,12 @@ namespace osu.Game.Overlays
Colour = Color4.Black, Colour = Color4.Black,
Alpha = 0.8f, Alpha = 0.8f,
}, },
// TODO: Links on the side to jump to a section scrollContainer = new ScrollContainer
new ScrollContainer
{ {
RelativeSizeAxes = Axes.Both,
ScrollDraggerAnchor = Anchor.TopLeft, ScrollDraggerAnchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.Y,
Width = width - (sideNavWidth + sideNavPadding * 2),
Position = new Vector2(sideNavWidth + sideNavPadding * 2, 0),
Children = new[] Children = new[]
{ {
new FlowContainer new FlowContainer
@ -67,20 +88,30 @@ namespace osu.Game.Overlays
TextSize = 18, TextSize = 18,
Margin = new MarginPadding { Left = SideMargins, Bottom = 30 }, Margin = new MarginPadding { Left = SideMargins, Bottom = 30 },
}, },
new GeneralOptions(), flowContainer = new FlowContainer
new GraphicsOptions(), {
new GameplayOptions(), AutoSizeAxes = Axes.Y,
new AudioOptions(), RelativeSizeAxes = Axes.X,
new SkinOptions(), Direction = FlowDirection.VerticalOnly,
new InputOptions(), }
new EditorOptions(),
new OnlineOptions(),
new MaintenanceOptions(),
} }
} }
} }
},
new OptionsSideNav
{
Padding = new MarginPadding { Left = sideNavPadding, Right = sideNavPadding },
Width = sideNavWidth + sideNavPadding * 2,
Children = sections.Select(section =>
new OptionsSideNav.SidebarButton
{
Icon = section.Icon,
Action = () => scrollContainer.ScrollIntoView(section)
}
)
} }
}; };
flowContainer.Add(sections);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
@ -91,8 +122,7 @@ namespace osu.Game.Overlays
{ {
case Key.Escape: case Key.Escape:
if (State == Visibility.Hidden) return false; if (State == Visibility.Hidden) return false;
Hide();
State = Visibility.Hidden;
return true; return true;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);

View File

@ -102,7 +102,7 @@ namespace osu.Game.Overlays
Alpha = 0, Alpha = 0,
Children = new[] Children = new[]
{ {
tooltip1 = new SpriteText() tooltip1 = new SpriteText
{ {
TextSize = 22, TextSize = 22,
}, },
@ -126,7 +126,7 @@ namespace osu.Game.Overlays
Size = new Vector2(WIDTH + (DrawableText.IsVisible ? DrawableText.DrawSize.X : 0), 1); Size = new Vector2(WIDTH + (DrawableText.IsVisible ? DrawableText.DrawSize.X : 0), 1);
} }
protected override bool OnClick(InputState state) protected override bool OnMouseDown(InputState state, MouseDownEventArgs e)
{ {
Action?.Invoke(); Action?.Invoke();
HoverBackground.FlashColour(Color4.White, 400); HoverBackground.FlashColour(Color4.White, 400);

View File

@ -197,38 +197,41 @@
<Compile Include="Database\BeatmapMetadata.cs" /> <Compile Include="Database\BeatmapMetadata.cs" />
<Compile Include="Database\BeatmapInfo.cs" /> <Compile Include="Database\BeatmapInfo.cs" />
<Compile Include="Database\BaseDifficulty.cs" /> <Compile Include="Database\BaseDifficulty.cs" />
<Compile Include="Overlays\Options\LoginOptions.cs" />
<Compile Include="Overlays\Options\GeneralOptions.cs" />
<Compile Include="Overlays\Options\LanguageOptions.cs" />
<Compile Include="Overlays\Options\UpdateOptions.cs" />
<Compile Include="Overlays\Options\GraphicsOptions.cs" />
<Compile Include="Graphics\UserInterface\OsuButton.cs" /> <Compile Include="Graphics\UserInterface\OsuButton.cs" />
<Compile Include="Overlays\Options\RendererOptions.cs" /> <Compile Include="Overlays\Options\MaintenanceSection.cs" />
<Compile Include="Overlays\Options\LayoutOptions.cs" />
<Compile Include="Overlays\Options\DetailOptions.cs" />
<Compile Include="Overlays\Options\MainMenuOptions.cs" />
<Compile Include="Overlays\Options\SongSelectGraphicsOptions.cs" />
<Compile Include="Overlays\Options\GameplayOptions.cs" />
<Compile Include="Overlays\Options\GeneralGameplayOptions.cs" />
<Compile Include="Overlays\Options\SongSelectGameplayOptions.cs" />
<Compile Include="Overlays\Options\AudioOptions.cs" />
<Compile Include="Overlays\Options\AudioDevicesOptions.cs" />
<Compile Include="Overlays\Options\VolumeOptions.cs" />
<Compile Include="Overlays\Options\OffsetAdjustmentOptions.cs" />
<Compile Include="Overlays\Options\SkinOptions.cs" />
<Compile Include="Overlays\Options\InputOptions.cs" />
<Compile Include="Overlays\Options\MouseOptions.cs" />
<Compile Include="Overlays\Options\KeyboardOptions.cs" />
<Compile Include="Overlays\Options\OtherInputOptions.cs" />
<Compile Include="Overlays\Options\EditorOptions.cs" />
<Compile Include="Overlays\Options\OnlineOptions.cs" />
<Compile Include="Overlays\Options\AlertsPrivacyOptions.cs" />
<Compile Include="Overlays\Options\OnlineIntegrationOptions.cs" />
<Compile Include="Overlays\Options\InGameChatOptions.cs" />
<Compile Include="Overlays\Options\MaintenanceOptions.cs" />
<Compile Include="Overlays\Options\OptionsSection.cs" /> <Compile Include="Overlays\Options\OptionsSection.cs" />
<Compile Include="Overlays\Options\OptionsSubsection.cs" /> <Compile Include="Overlays\Options\OptionsSubsection.cs" />
<Compile Include="Graphics\UserInterface\LoadingAnimation.cs" /> <Compile Include="Graphics\UserInterface\LoadingAnimation.cs" />
<Compile Include="Overlays\Options\OptionsSideNav.cs" />
<Compile Include="Overlays\Options\General\GeneralSection.cs" />
<Compile Include="Overlays\Options\General\LoginOptions.cs" />
<Compile Include="Overlays\Options\General\UpdateOptions.cs" />
<Compile Include="Overlays\Options\General\LanguageOptions.cs" />
<Compile Include="Overlays\Options\Graphics\GraphicsSection.cs" />
<Compile Include="Overlays\Options\Graphics\RendererOptions.cs" />
<Compile Include="Overlays\Options\Graphics\LayoutOptions.cs" />
<Compile Include="Overlays\Options\Graphics\DetailOptions.cs" />
<Compile Include="Overlays\Options\Graphics\MainMenuOptions.cs" />
<Compile Include="Overlays\Options\Graphics\SongSelectGraphicsOptions.cs" />
<Compile Include="Overlays\Options\Gameplay\GameplaySection.cs" />
<Compile Include="Overlays\Options\Gameplay\GeneralGameplayOptions.cs" />
<Compile Include="Overlays\Options\Gameplay\SongSelectGameplayOptions.cs" />
<Compile Include="Overlays\Options\Audio\AudioSection.cs" />
<Compile Include="Overlays\Options\Audio\AudioDevicesOptions.cs" />
<Compile Include="Overlays\Options\Audio\VolumeOptions.cs" />
<Compile Include="Overlays\Options\Audio\OffsetAdjustmentOptions.cs" />
<Compile Include="Overlays\Options\Input\InputSection.cs" />
<Compile Include="Overlays\Options\Input\MouseOptions.cs" />
<Compile Include="Overlays\Options\Input\KeyboardOptions.cs" />
<Compile Include="Overlays\Options\Input\OtherInputOptions.cs" />
<Compile Include="Overlays\Options\Online\OnlineSection.cs" />
<Compile Include="Overlays\Options\Online\OnlineIntegrationOptions.cs" />
<Compile Include="Overlays\Options\Online\InGameChatOptions.cs" />
<Compile Include="Overlays\Options\EditorSection.cs" />
<Compile Include="Overlays\Options\SkinSection.cs" />
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj"> <ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
@ -250,6 +253,12 @@
<ItemGroup /> <ItemGroup />
<ItemGroup> <ItemGroup>
<Folder Include="Overlays\Options\" /> <Folder Include="Overlays\Options\" />
<Folder Include="Overlays\Options\General\" />
<Folder Include="Overlays\Options\Graphics\" />
<Folder Include="Overlays\Options\Gameplay\" />
<Folder Include="Overlays\Options\Audio\" />
<Folder Include="Overlays\Options\Input\" />
<Folder Include="Overlays\Options\Online\" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@ -259,4 +268,4 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>