diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 9b2d00a219..ffcbcc48e7 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -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(); + } } } } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 8586e3a2a9..18009417cb 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -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; + } } } } diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 319f565938..6c05603285 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -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(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); diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs new file mode 100644 index 0000000000..f6b1f37e66 --- /dev/null +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -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 bindable; + + public Bindable 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(); + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/General/LanguageOptions.cs b/osu.Game/Overlays/Options/General/LanguageOptions.cs index 81b60e91c9..18ff055a92 100644 --- a/osu.Game/Overlays/Options/General/LanguageOptions.cs +++ b/osu.Game/Overlays/Options/General/LanguageOptions.cs @@ -1,21 +1,33 @@ -using osu.Framework.Graphics; +using osu.Framework; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; namespace osu.Game.Overlays.Options.General { public class LanguageOptions : OptionsSubsection { - protected override string Header => "Language"; + protected override string Header => "Language"; + private CheckBoxOption showUnicode, altChatFont; 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" }, + 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(Configuration.OsuConfig.ShowUnicode); + altChatFont.Bindable = osuGame.Config.GetBindable(Configuration.OsuConfig.AlternativeChatFont); + } + } } -} \ No newline at end of file +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 051b53fafa..18bf9c1b34 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -231,6 +231,7 @@ + @@ -267,4 +268,4 @@ --> - \ No newline at end of file +