diff options
Diffstat (limited to 'Client/Assets/Scripts/XScript.cs')
-rw-r--r-- | Client/Assets/Scripts/XScript.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XScript.cs b/Client/Assets/Scripts/XScript.cs new file mode 100644 index 00000000..95851b75 --- /dev/null +++ b/Client/Assets/Scripts/XScript.cs @@ -0,0 +1,65 @@ +using UnityEngine;
+using XUtliPoolLib;
+
+public class XScript : MonoBehaviour
+{
+ void Awake()
+ {
+ RuntimePlatform editorPlatform = Application.platform;
+#if UNITY_IOS
+ editorPlatform = RuntimePlatform.IPhonePlayer;
+#elif UNITY_ANDROID
+ editorPlatform = RuntimePlatform.Android;
+#else
+ editorPlatform = RuntimePlatform.WindowsPlayer;
+#endif
+ XUtliPoolLib.ShaderManager.singleton.Awake(editorPlatform);
+ }
+
+ // Use this for initialization
+ void Start()
+ {
+ XUpdater.XShell.singleton.Awake();
+ XUpdater.XShell.singleton.Start();
+ XResourceLoaderMgr.singleton.SetUnloadCallback(BeforeUnityUnloadResource);
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+ XUpdater.XShell.singleton.Update();
+ }
+
+ void LateUpdate()
+ {
+ XUpdater.XShell.singleton.PostUpdate();
+ }
+ void OnApplicationQuit()
+ {
+ FMODUnity.RuntimeStudioEventEmitter.isQuitting = true;
+ XUpdater.XShell.singleton.Quit();
+ }
+
+ void BeforeUnityUnloadResource()
+ {
+ FastListV3.ms_Pool.Clear();
+ FastListV2.ms_Pool.Clear();
+ FastListColor32.ms_Pool.Clear();
+ }
+
+ private IGameSysMgr m_GameSysMgr = null;
+ public IGameSysMgr GameSysMgr
+ {
+ get
+ {
+ if (null == m_GameSysMgr || m_GameSysMgr.Deprecated)
+ m_GameSysMgr = XInterfaceMgr.singleton.GetInterface<IGameSysMgr>(XCommon.singleton.XHash("IGameSysMgr"));
+ return m_GameSysMgr;
+ }
+ }
+
+ void OnApplicationPause(bool pause)
+ {
+ if (GameSysMgr != null) GameSysMgr.GamePause(pause);
+ }
+}
|