summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XScript.cs
blob: 95851b75af151622f7f44ee50e9e1f6e104f9594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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);
    }
}