Wire up one of the settings to the config

One step at a time, right
This commit is contained in:
Drew DeVault
2016-11-07 19:04:31 -05:00
parent 42102f7378
commit 1bca78f4b6
6 changed files with 104 additions and 26 deletions

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)
{
var importer = new BeatmapImporter(host);
foreach (var file in args) foreach (var file in args)
if (!importer.Import(file).Wait(1000)) if (!importer.Import(file).Wait(1000))
throw new TimeoutException(@"IPC took too long to send"); throw new TimeoutException(@"IPC took too long to send");
Console.WriteLine(@"Sent import requests to running instance"); Console.WriteLine(@"Sent import requests to running instance");
}
else
{
BaseGame osu = new OsuGame(args);
host.Add(osu);
host.Run();
}
return 0;
} }
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

@ -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,4 +1,6 @@
using osu.Framework.Graphics; using System;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -7,15 +9,26 @@ namespace osu.Game.Overlays.Options.General
public class LanguageOptions : OptionsSubsection public class LanguageOptions : OptionsSubsection
{ {
protected override string Header => "Language"; protected override string Header => "Language";
private CheckBoxOption showUnicode; private CheckBoxOption showUnicode;
public LanguageOptions() public LanguageOptions()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new BasicCheckBox { LabelText = "Prefer metadata in original language" }, new SpriteText { Text = "TODO: Dropdown" },
showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" }, showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" },
new BasicCheckBox { LabelText = "Use alternative font for chat display" }, new BasicCheckBox { 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);
}
} }
} }

View File

@ -231,6 +231,7 @@
<Compile Include="Overlays\Options\SkinSection.cs" /> <Compile Include="Overlays\Options\SkinSection.cs" />
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" /> <Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
<Compile Include="Overlays\Options\Online\NotificationsOptions.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">