mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 06:02:54 +08:00
Merge pull request #146 from SirCmpwn/options-wired-up
Wire up one of the settings to the config
This commit is contained in:
commit
53d1798dee
@ -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.Add(new VisualTestGame());
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -18,8 +18,8 @@ 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)
|
if (!host.IsPrimaryInstance)
|
||||||
{
|
{
|
||||||
var importer = new BeatmapImporter(host);
|
var importer = new BeatmapImporter(host);
|
||||||
@ -35,8 +35,8 @@ namespace osu.Desktop
|
|||||||
host.Add(osu);
|
host.Add(osu);
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -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);
|
||||||
|
53
osu.Game/Overlays/Options/CheckBoxOption.cs
Normal file
53
osu.Game/Overlays/Options/CheckBoxOption.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,33 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Options.General
|
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, altChatFont;
|
||||||
|
|
||||||
public LanguageOptions()
|
public LanguageOptions()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText { Text = "TODO: Dropdown" },
|
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" },
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user