From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XScript.cs | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Client/Assets/Scripts/XScript.cs (limited to 'Client/Assets/Scripts/XScript.cs') 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(XCommon.singleton.XHash("IGameSysMgr")); + return m_GameSysMgr; + } + } + + void OnApplicationPause(bool pause) + { + if (GameSysMgr != null) GameSysMgr.GamePause(pause); + } +} -- cgit v1.1-26-g67d0