Skip to content

Commit 67e9566

Browse files
committed
feat: Refresh simulate language on start
1 parent e55a098 commit 67e9566

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

Assets/JCSUnity/Scripts/Interfaces/JCS_Manager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2016 by Shen, Jen-Chieh $
88
*/
9+
using UnityEngine;
910

1011
namespace JCSUnity
1112
{
@@ -14,6 +15,7 @@ namespace JCSUnity
1415
///
1516
/// Manager have to be in every scene in Unity Engine's scene system.
1617
/// </summary>
18+
[DisallowMultipleComponent]
1719
public class JCS_Manager<T> : JCS_Instance<T>
1820
{
1921
/* Variables */

Assets/JCSUnity/Scripts/Interfaces/JCS_Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace JCSUnity
1313
/// <summary>
1414
/// Interface of all setting class.
1515
/// </summary>
16+
[DisallowMultipleComponent]
1617
public abstract class JCS_Settings<T> : JCS_InstanceNew<T>
1718
where T : MonoBehaviour
1819
{

Assets/JCSUnity/Scripts/Managers/JCS_AppManager.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,14 @@ private void Awake()
156156
APP_INITIALIZING = false;
157157
}
158158

159+
private void Start()
160+
{
161+
JCS_GameManager.instance.onSystemAfterInitialize += RefreshSimulateLanguage;
162+
}
163+
159164
private void OnValidate()
160165
{
161-
if (mSimulateSystemLanguage)
162-
systemLanguage = SimulateLanguage;
166+
RefreshSimulateLanguage();
163167
}
164168

165169
public bool IsPC() { return (PlatformType == JCS_PlatformType.PC); }
@@ -183,6 +187,15 @@ public void Quit(bool fade = true)
183187
}
184188
}
185189

190+
/// <summary>
191+
/// Refresh the simulate language once.
192+
/// </summary>
193+
public void RefreshSimulateLanguage()
194+
{
195+
if (mSimulateSystemLanguage)
196+
systemLanguage = SimulateLanguage;
197+
}
198+
186199
/// <summary>
187200
/// Register a new language text.
188201
/// </summary>
@@ -197,8 +210,11 @@ public void AddLangText(JCS_LangText txt)
197210
public void RefreshLangTexts()
198211
{
199212
this.mLangTexts = JCS_Util.RemoveEmptySlotIncludeMissing(this.mLangTexts);
213+
200214
foreach (JCS_LangText txt in mLangTexts)
215+
{
201216
txt.Refresh();
217+
}
202218
}
203219

204220
public void StartRequestCamera() { StartCoroutine("DoRequestCamera"); }

Assets/JCSUnity/Scripts/Managers/JCS_GameManager.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class JCS_GameManager : JCS_Manager<JCS_GameManager>
1919
/* Variables */
2020

2121
// Callback after the game is done initialize.
22+
public EmptyFunction onSystemAfterInitialize = null;
2223
public EmptyFunction onAfterInitialize = null;
2324

2425
[Separator("Check Variable (JCS_GameManager)")]
@@ -61,10 +62,11 @@ private void Awake()
6162
instance = this;
6263

6364
SetSpecificGameTypeGameManager();
64-
}
6565

66+
Invoke("OnFirstFrame", 0.0f);
67+
}
6668

67-
private void Update()
69+
private void OnFirstFrame()
6870
{
6971
SetDoneInitializeFlag();
7072
}
@@ -94,6 +96,9 @@ private void SetDoneInitializeFlag()
9496

9597
this.mDoneInitialize = true;
9698

99+
if (onSystemAfterInitialize != null)
100+
onSystemAfterInitialize.Invoke();
101+
97102
if (onAfterInitialize != null)
98103
onAfterInitialize.Invoke();
99104
}

Assets/_Project/Scenes/UI/FT_UITest.unity

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ MonoBehaviour:
833833
mTargetTransform: {fileID: 0}
834834
mFollowing: 1
835835
mPositionOffset: {x: 0, y: 2, z: -10}
836-
mDeltaTimeType: 0
836+
mTimeType: 0
837837
mSmoothTrack: 1
838838
mTargetPosition: {x: 0, y: 0, z: 0}
839839
mSetToPlayerPositionAtStart: 1
@@ -2512,7 +2512,7 @@ MonoBehaviour:
25122512
mScaleZ: 1
25132513
mScaleValue: {x: 0.5, y: 0.5, z: 0.5}
25142514
mScaleFriction: {x: 0.2, y: 0.2, z: 0.2}
2515-
mDeltaTimeType: 0
2515+
mTimeType: 0
25162516
mAutoAddEvent: 1
25172517
mActiveEventTriggerType: 0
25182518
mDeactiveEventTriggerType: 1
@@ -5246,7 +5246,7 @@ MonoBehaviour:
52465246
mDurationX: 0.2
52475247
mDurationY: 0.2
52485248
mDurationZ: 0.2
5249-
mDeltaTimeType: 0
5249+
mTimeType: 0
52505250
mDestroyWhenDoneTweening: 0
52515251
mDestroyDoneTweeningCount: 1
52525252
mRandomizeDuration: 0

0 commit comments

Comments
 (0)