modify scripts

This commit is contained in:
2025-10-17 10:59:23 +08:00
parent 9336ed0d6f
commit 4f782a638e
131 changed files with 79880 additions and 3549 deletions

View File

@ -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";
}
}
}