1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:07:52 +08:00

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]
public static void Main(string[] args)
{
BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests");
host.Add(new VisualTestGame());
host.Run();
using (BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"))
{
host.Add(new VisualTestGame());
host.Run();
}
}
}
}

View File

@ -18,25 +18,25 @@ namespace osu.Desktop
[STAThread]
public static int Main(string[] args)
{
DesktopGameHost host = Host.GetSuitableHost(@"osu", true);
if (!host.IsPrimaryInstance)
using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true))
{
var importer = new BeatmapImporter(host);
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();
}
if (!host.IsPrimaryInstance)
{
var importer = new BeatmapImporter(host);
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.LetterboxPositionY, 0, -100, 100);
//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.Ticker, 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.UserInterface;
@ -6,16 +8,27 @@ namespace osu.Game.Overlays.Options.General
{
public class LanguageOptions : OptionsSubsection
{
protected override string Header => "Language";
protected override string Header => "Language";
private CheckBoxOption showUnicode;
public LanguageOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
new BasicCheckBox { LabelText = "Prefer metadata in original language" },
showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" },
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\Online\PrivacyOptions.cs" />
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
@ -267,4 +268,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>