Skip to content

Commit 32effe1

Browse files
committed
style: readability
1 parent 4dd561d commit 32effe1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Assets/JCSUnity/Scripts/Managers/JCS_AppManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ private void Start()
160160
JCS_GameManager.FirstInstance().RegisterOnSystemAfterInit(RefreshSimulateLanguage);
161161
}
162162

163+
#if UNITY_EDITOR
163164
private void OnValidate()
164165
{
165166
RefreshSimulateLanguage();
166167
}
168+
#endif
167169

168170
public bool IsPC() { return (mPlatformType == JCS_PlatformType.PC); }
169171
public bool IsMobile() { return (mPlatformType == JCS_PlatformType.MOBILE); }

Assets/JCSUnity/Scripts/UI/Dropdown/JCS_DropdownLanguage.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public void Refresh(bool removeAllOptions)
7878
if (removeAllOptions)
7979
ClearOptions();
8080

81+
if (mOptions.Count == 0)
82+
return;
83+
8184
foreach (SystemLanguage option in mOptions)
8285
{
8386
string text = JCS_Locale.SystemLangToString(option);
@@ -87,7 +90,9 @@ public void Refresh(bool removeAllOptions)
8790

8891
// Default to the current windowed mode.
8992
{
90-
string text = JCS_Locale.SystemLangToString(JCS_AppManager.FirstInstance().systemLanguage);
93+
SystemLanguage lang = JCS_AppManager.FirstInstance().systemLanguage;
94+
95+
string text = JCS_Locale.SystemLangToString(lang);
9196

9297
JCS_UIUtil.Dropdown_SetSelection(this, text);
9398
}
@@ -115,6 +120,9 @@ private void OnValueChanged_TMP(TMP_Dropdown dropdown)
115120
}
116121
private void OnValueChanged(string text)
117122
{
123+
if (mOptions.Count == 0)
124+
return;
125+
118126
SystemLanguage selected = JCS_Locale.StringToSystemLang(text);
119127

120128
JCS_AppManager.FirstInstance().systemLanguage = selected;

0 commit comments

Comments
 (0)