Skip to content

Commit

Permalink
Rename in the config namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 5, 2024
1 parent 917cf37 commit 3010dd6
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneLyric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public TestSceneLyric()
private void load()
{
var config = Dependencies.Get<KaraokeRulesetConfigManager>();
config.SetValue(KaraokeRulesetSetting.PreferLanguage, cultureInfo);
config.SetValue(KaraokeRulesetSetting.PreferTranslationLanguage, cultureInfo);
}

private Drawable testSingle(double timeOffset = 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ protected override void InitialiseDefaults()
SetDefault(KaraokeRulesetSetting.NoteAlpha, 1, 0.2, 1, 0.01);
SetDefault(KaraokeRulesetSetting.LyricAlpha, 1, 0.2, 1, 0.01);

// Translate
SetDefault(KaraokeRulesetSetting.PreferLanguage, new CultureInfo("en-US"));
// Translation
SetDefault(KaraokeRulesetSetting.PreferTranslationLanguage, new CultureInfo("en-US"));

// Pitch
SetDefault(KaraokeRulesetSetting.OverridePitchAtGameplay, false);
Expand All @@ -61,8 +61,8 @@ protected override void InitialiseDefaults()
SetDefault(KaraokeRulesetSetting.RomanisationFont, new FontUsage("Torus", 20, "Bold"), 8f, 48f);
SetDefault(KaraokeRulesetSetting.RomanisationMargin, 0, 0, 20);
SetDefault(KaraokeRulesetSetting.ForceUseDefaultFont, false);
SetDefault(KaraokeRulesetSetting.TranslateFont, new FontUsage("Torus", 18, "Bold"), 10f, 48f);
SetDefault(KaraokeRulesetSetting.ForceUseDefaultTranslateFont, false);
SetDefault(KaraokeRulesetSetting.TranslationFont, new FontUsage("Torus", 18, "Bold"), 10f, 48f);
SetDefault(KaraokeRulesetSetting.ForceUseDefaultTranslationFont, false);
SetDefault(KaraokeRulesetSetting.NoteFont, new FontUsage("Torus", 12, "Bold"), 10f, 32f);
SetDefault(KaraokeRulesetSetting.ForceUseDefaultNoteFont, false);
}
Expand All @@ -71,15 +71,15 @@ protected override void AddBindable<TBindable>(KaraokeRulesetSetting lookup, Bin
{
switch (lookup)
{
case KaraokeRulesetSetting.PreferLanguage:
case KaraokeRulesetSetting.PreferTranslationLanguage:
// todo : need to hve a default value here because it will cause error if object is null while saving.
base.AddBindable(lookup, new BindableCultureInfo(bindable.Value as CultureInfo));
break;

case KaraokeRulesetSetting.MainFont:
case KaraokeRulesetSetting.RubyFont:
case KaraokeRulesetSetting.RomanisationFont:
case KaraokeRulesetSetting.TranslateFont:
case KaraokeRulesetSetting.TranslationFont:
case KaraokeRulesetSetting.NoteFont:
base.AddBindable(lookup, new BindableFontUsage(TypeUtils.ChangeType<FontUsage>(bindable.Value)));
break;
Expand Down Expand Up @@ -111,7 +111,7 @@ protected BindableFontUsage SetDefault(KaraokeRulesetSetting setting, FontUsage
new TrackedSetting<double>(KaraokeRulesetSetting.ScrollTime, v => new SettingDescription(v, "Scroll Time", $"{v}ms")),
new TrackedSetting<bool>(KaraokeRulesetSetting.DisplayNoteRubyText, b => new SettingDescription(b, "Toggle display", b ? "Show" : "Hide")),
new TrackedSetting<bool>(KaraokeRulesetSetting.ShowCursor, b => new SettingDescription(b, "Cursor display", b ? "Show" : "Hide")),
new TrackedSetting<CultureInfo>(KaraokeRulesetSetting.PreferLanguage, c => new SettingDescription(c, "Translate language", CultureInfoUtils.GetLanguageDisplayText(c))),
new TrackedSetting<CultureInfo>(KaraokeRulesetSetting.PreferTranslationLanguage, c => new SettingDescription(c, "Translation language", CultureInfoUtils.GetLanguageDisplayText(c))),
new TrackedSetting<string>(KaraokeRulesetSetting.MicrophoneDevice, d => new SettingDescription(d, "Change to the new microphone device", d)),
};
}
Expand All @@ -126,8 +126,8 @@ public enum KaraokeRulesetSetting
NoteAlpha,
LyricAlpha,

// Translate
PreferLanguage,
// Translation
PreferTranslationLanguage,

// Pitch
OverridePitchAtGameplay,
Expand All @@ -154,8 +154,8 @@ public enum KaraokeRulesetSetting
RomanisationFont,
RomanisationMargin,
ForceUseDefaultFont,
TranslateFont,
ForceUseDefaultTranslateFont,
TranslationFont,
ForceUseDefaultTranslationFont,
NoteFont,
ForceUseDefaultNoteFont,
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Mods/KaraokeModTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void ApplyToDrawableHitObject(DrawableHitObject drawable)
static CultureInfo? getPreferLanguage(IReadOnlyDependencyContainer dependencyContainer)
{
var config = dependencyContainer.Get<KaraokeRulesetConfigManager>();
return config.Get<CultureInfo?>(KaraokeRulesetSetting.PreferLanguage);
return config.Get<CultureInfo?>(KaraokeRulesetSetting.PreferTranslationLanguage);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void load(KaraokeRulesetConfigManager? config)
config.BindWith(KaraokeRulesetSetting.RubyMargin, rubyMarginBindable);
config.BindWith(KaraokeRulesetSetting.RomanisationFont, romanisationFontUsageBindable);
config.BindWith(KaraokeRulesetSetting.RomanisationMargin, romanisationMarginBindable);
config.BindWith(KaraokeRulesetSetting.TranslateFont, translateFontUsageBindable);
config.BindWith(KaraokeRulesetSetting.TranslationFont, translateFontUsageBindable);
}

mainFontUsageBindable.BindValueChanged(_ => updateLyricFontInfo());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ private void load(FontManager fontManager, IRenderer renderer, KaraokeRulesetCon
config.BindWith(KaraokeRulesetSetting.MainFont, mainFont);
config.BindWith(KaraokeRulesetSetting.RubyFont, rubyFont);
config.BindWith(KaraokeRulesetSetting.RomanisationFont, romanisationFont);
config.BindWith(KaraokeRulesetSetting.TranslateFont, translationFont);
config.BindWith(KaraokeRulesetSetting.PreferLanguage, preferLanguage);
config.BindWith(KaraokeRulesetSetting.TranslationFont, translationFont);
config.BindWith(KaraokeRulesetSetting.PreferTranslationLanguage, preferLanguage);
}

protected override void Dispose(bool isDisposing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private void load()
{
LabelText = "Prefer language",
TooltipText = "Select prefer translation.",
Current = Config.GetBindable<CultureInfo>(KaraokeRulesetSetting.PreferLanguage),
Current = Config.GetBindable<CultureInfo>(KaraokeRulesetSetting.PreferTranslationLanguage),
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ private void load()
new SettingsFont
{
LabelText = "Translation font",
Current = Config.GetBindable<FontUsage>(KaraokeRulesetSetting.TranslateFont),
Current = Config.GetBindable<FontUsage>(KaraokeRulesetSetting.TranslationFont),
},
new SettingsCheckbox
{
LabelText = "Force use default translation font.",
TooltipText = "Force use default font even has customize font in skin or beatmap.",
Current = Config.GetBindable<bool>(KaraokeRulesetSetting.ForceUseDefaultTranslateFont),
Current = Config.GetBindable<bool>(KaraokeRulesetSetting.ForceUseDefaultTranslationFont),
},
};
}
Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricFontInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void ApplyTo(Drawable d)
// Apply translate font.
drawableLyric.ApplyToTranslateText(text =>
{
text.Font = getFont(KaraokeRulesetSetting.TranslateFont);
text.Font = getFont(KaraokeRulesetSetting.TranslationFont);
});

FontUsage getFont(KaraokeRulesetSetting setting, FontUsage? skinFont = null)
Expand All @@ -141,8 +141,8 @@ bool forceUseDefaultFont()
case KaraokeRulesetSetting.RomanisationFont:
return config?.Get<bool>(KaraokeRulesetSetting.ForceUseDefaultFont) ?? false;

case KaraokeRulesetSetting.TranslateFont:
return config?.Get<bool>(KaraokeRulesetSetting.ForceUseDefaultTranslateFont) ?? false;
case KaraokeRulesetSetting.TranslationFont:
return config?.Get<bool>(KaraokeRulesetSetting.ForceUseDefaultTranslationFont) ?? false;

default:
throw new InvalidOperationException(nameof(setting));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void load(FontManager fontManager, IRenderer renderer, KaraokeRulesetCon
manager.Get<FontUsage>(KaraokeRulesetSetting.MainFont),
manager.Get<FontUsage>(KaraokeRulesetSetting.RubyFont),
manager.Get<FontUsage>(KaraokeRulesetSetting.RomanisationFont),
manager.Get<FontUsage>(KaraokeRulesetSetting.TranslateFont),
manager.Get<FontUsage>(KaraokeRulesetSetting.TranslationFont),
manager.Get<FontUsage>(KaraokeRulesetSetting.NoteFont),
};

Expand Down

0 comments on commit 3010dd6

Please sign in to comment.