示例#1
0
    protected async void LoadGame(bool isSimulate = true)
    {
        var moduleGroupTypeConfigPath = AssetPath.GetAssetPathFromResourcePath(Constant.MODULE_GROUP_TYPE_CONFIG_PATH);
        var moduleGroupTypeConfig     = Resources.Load <LayerMaskConfig>(moduleGroupTypeConfigPath);

        var worldMgr = WorldManager.Instance;

        worldMgr.Module.Init(moduleGroupTypeConfig);

        var unitTypeConfigPath = AssetPath.GetAssetPathFromResourcePath(Constant.UNIT_TYPE_CONFIG_PATH);
        var unitTypeConfig     = Resources.Load <LayerConfig>(unitTypeConfigPath);

        worldMgr.Unit.Init(unitTypeConfig);
        RegisterECSModule();

        IAssetLoader customLoader = null;

#if UNITY_EDITOR
        if (isSimulate)
        {
            customLoader = new SimulateAssetLoader();
        }
#endif
        worldMgr.Factory.CreateAssetProcess("http://localhost:8000/AssetBundles");
        await AssetProcess.Init(customLoader);

        worldMgr.Factory.CreateUIProcess();

        RegisterGameModule();

        StartGame();
    }