-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2201 from andy840119/move-display-translation-con…
…fig-into-mod Move the display translation/prefer language from config into mode
- Loading branch information
Showing
17 changed files
with
74 additions
and
192 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModTranslation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using NUnit.Framework; | ||
using osu.Game.Rulesets.Karaoke.Mods; | ||
using osu.Game.Rulesets.Karaoke.Tests.Beatmaps; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Mods; | ||
|
||
public partial class TestSceneKaraokeModTranslation : KaraokeModTestScene | ||
{ | ||
[Test] | ||
public void TestAllPanelExist() => CreateModTest(new ModTestData | ||
{ | ||
Mod = new KaraokeModTranslation(), | ||
Autoplay = false, | ||
Beatmap = new TestKaraokeBeatmap(new RulesetInfo()), | ||
PassCondition = () => true, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
osu.Game.Rulesets.Karaoke/Edit/Components/Menus/LyricDisplayPreviewMenuItem.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Globalization; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Localisation; | ||
using osu.Game.Rulesets.Karaoke.Configuration; | ||
using osu.Game.Rulesets.Karaoke.Objects.Drawables; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Objects.Drawables; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Mods; | ||
|
||
public class KaraokeModTranslation : Mod, IApplicableToDrawableHitObject | ||
{ | ||
public override string Name => "Translation"; | ||
|
||
public override LocalisableString Description => "Display prefer translation by ruleset configuration."; | ||
|
||
public override double ScoreMultiplier => 1.0f; | ||
|
||
public override string Acronym => "LT"; | ||
|
||
public void ApplyToDrawableHitObject(DrawableHitObject drawable) | ||
{ | ||
if (drawable is not DrawableLyric drawableLyric) | ||
return; | ||
|
||
var preferLanguage = getPreferLanguage(drawableLyric.Dependencies); | ||
drawableLyric.ChangePreferTranslationLanguage(preferLanguage); | ||
return; | ||
|
||
static CultureInfo? getPreferLanguage(IReadOnlyDependencyContainer dependencyContainer) | ||
{ | ||
var config = dependencyContainer.Get<KaraokeRulesetConfigManager>(); | ||
return config.Get<CultureInfo?>(KaraokeRulesetSetting.PreferLanguage); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.