Esempio n. 1
0
    void Initialize()
    {
        if (isInited)
        {
            return;
        }
        isInited = true;

        // 初始化随机工具的seed,int在这里没作用,所有的模板都使用同一个seed
        RandomExt <int> .RandomizeSeed();

        AddCounter();

        LywInt.SetKey(Random.Range(1, int.MaxValue - 1));
        AddCounter();

        ConfigDataBase.Instance.Initialize(new SqliteAccessorFactory(), Defines.ConfigsFolder);
        AddCounter();

        GlobalManager.Instance.Add <LabelTagManager>();
        AddCounter();

        GlobalManager.Instance.Add <DataModelManager>();
        AddCounter();

        GlobalManager.Instance.Add <ConfigUpdateManager>();
        AddCounter();

        GlobalManager.Instance.Add <SceneManager>().AddSceneManagerListener(MachineManager);
        AddCounter();

        GlobalManager.Instance.Add <RequestManager>(
#if UNITY_EDITOR
            0f,
#else
            10f,
#endif
            (System.Action <string>)GameShellManager.Instance.OnRequestManagerBroken, (System.Action <bool>)GameShellManager.Instance.OnRequestManagerBusy);
        AddCounter();
        requestManagerSuccess = true;

        GlobalManager.Instance.Add <ResourceManager>();
        AddCounter();

        GlobalManager.Instance.Add <HotFixManager>();
        AddCounter();

        GlobalManager.Instance.Add <FileManager>();
        AddCounter();

        GlobalManager.Instance.Add <InputManager>("InResource/Constants/EasyTouch"); // TODO : 从配置文件读取路径
        AddCounter();

        GlobalManager.Instance.Add <UiManager>();
        AddCounter();

        GlobalManager.Instance.Add <UiQueueManager>();
        AddCounter();

        GlobalManager.Instance.Add <UiCityPreloadManager>();
        AddCounter();

        GlobalManager.Instance.Add <AlertMessageManager>();
        AddCounter();

        GlobalManager.Instance.Add <IconManager>();
        AddCounter();

        GlobalManager.Instance.Add <FxManager>("AnimationCurve"); // Objects/Other/
        AddCounter();

        GlobalManager.Instance.Add <TimeManager>();
        AddCounter();

        GlobalManager.Instance.Add <ReConnectManager>();
        AddCounter();

        PoolManager poolManager = GlobalManager.Instance.Add <PoolManager>();
        AddCounter();

        SceneManager.Instance.AddSceneManagerListener(poolManager);
        AddCounter();

        UiRegister.UiConfigData[] configDatas = UiRegister.GetAllUiConfigDatas();
        for (int i = 0; i < configDatas.Length; i++)
        {
            UiRelations.Instance.Register(configDatas[i].type, configDatas[i].prefabName, configDatas[i].linkedTypes, configDatas[i].hideOtherModules, configDatas[i].ignoreMutexTypes);
        }

        initSuccess = true;
    }