modify scripts
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using WordsToolkit.Scripts.Levels;
|
||||
|
||||
namespace WordsToolkit.Scripts.Settings
|
||||
{
|
||||
@ -36,7 +37,30 @@ namespace WordsToolkit.Scripts.Settings
|
||||
public Key SimulateDuplicate = Key.D;
|
||||
|
||||
[Header("")]
|
||||
[Tooltip("Test language, only for editor")]
|
||||
public SystemLanguage TestLanguage = SystemLanguage.English;
|
||||
[Tooltip("Test language code, only for editor (e.g., 'en', 'fr', 'es')")]
|
||||
[HideInInspector] // Hidden because we use custom editor dropdown
|
||||
public string TestLanguageCode = "en";
|
||||
|
||||
/// <summary>
|
||||
/// Validates if the TestLanguageCode exists in the provided LanguageConfiguration
|
||||
/// </summary>
|
||||
public bool IsValidTestLanguage(LanguageConfiguration config)
|
||||
{
|
||||
if (config == null || string.IsNullOrEmpty(TestLanguageCode))
|
||||
return false;
|
||||
|
||||
return config.GetLanguageInfo(TestLanguageCode) != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a valid test language code, falling back to default if current one is invalid
|
||||
/// </summary>
|
||||
public string GetValidTestLanguageCode(LanguageConfiguration config)
|
||||
{
|
||||
if (IsValidTestLanguage(config))
|
||||
return TestLanguageCode;
|
||||
|
||||
return config?.defaultLanguage ?? "en";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user