/// <summary> /// 创建游戏模块 /// </summary> private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建补间管理器 MotionEngine.CreateModule <TweenManager>(); // 创建网络管理器 var networkCreateParam = new NetworkManager.CreateParameters(); networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder); networkCreateParam.PackageMaxSize = ushort.MaxValue; MotionEngine.CreateModule <NetworkManager>(networkCreateParam); // 创建补丁管理器 PatchManager.OfflinePlayModeParameters patchCreateParam = new PatchManager.OfflinePlayModeParameters(); patchCreateParam.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <PatchManager>(patchCreateParam); var operation = PatchManager.Instance.InitializeAsync(); yield return(operation); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = PatchManager.Instance.BundleServices; resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 10f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建配表管理器 MotionEngine.CreateModule <ConfigManager>(); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 创建窗口管理器 MotionEngine.CreateModule <WindowManager>(); // 创建ILR管理器 ILRManager.CreateParameters createParameters = new ILRManager.CreateParameters(); createParameters.IsEnableILRuntime = EnableILRuntime; createParameters.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <ILRManager>(createParameters); // 反射服务服务接口 ConfigManager.Instance.ActivatorServices = ILRManager.Instance; WindowManager.Instance.ActivatorServices = ILRManager.Instance; // 开始游戏 ILRManager.Instance.StartGame(); }
private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建网络管理器 var networkCreateParam = new NetworkManager.CreateParameters(); networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder); MotionEngine.CreateModule <NetworkManager>(networkCreateParam); // 创建补丁管理器 var patchCreateParam = new PatchManager.OfflinePlayModeParameters(); patchCreateParam.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <PatchManager>(patchCreateParam); var operation = PatchManager.Instance.InitializeAsync(); yield return(operation); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = PatchManager.Instance.BundleServices; resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 10f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 直接进入游戏 MotionEngine.CreateModule <LuaManager>(); LuaManager.Instance.StartGame(); }
/// <summary> /// 创建游戏模块 /// </summary> private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建补丁管理器 if (SkipCDN) { var patchCreateParameter = new PatchManager.OfflinePlayModeParameters(); patchCreateParameter.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <PatchManager>(patchCreateParameter); } else { var patchCreateParameter = new PatchManager.HostPlayModeParameters(); patchCreateParameter.SimulationOnEditor = SimulationOnEditor; patchCreateParameter.ClearCacheWhenDirty = false; patchCreateParameter.IgnoreResourceVersion = false; patchCreateParameter.DefaultHostServer = GetHostServerURL(); patchCreateParameter.FallbackHostServer = GetHostServerURL(); MotionEngine.CreateModule <PatchManager>(patchCreateParameter); } // 初始化补丁系统 var initializeOperation = PatchManager.Instance.InitializeAsync(); yield return(initializeOperation); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.DecryptServices = new AssetDecrypter(); resourceCreateParam.BundleServices = PatchManager.Instance.BundleServices; resourceCreateParam.AutoReleaseInterval = 1f; resourceCreateParam.AssetLoadingMaxNumber = 10; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建补丁更新器 var updaterCreateParam = new PatchUpdater.CreateParameters(); updaterCreateParam.AutoDownloadBuildinDLC = true; updaterCreateParam.AutoDownloadDLC = new string[] { "buildin", "panel", "texture" }; MotionEngine.CreateModule <PatchUpdater>(updaterCreateParam); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); if (SkipCDN) { // 开始游戏 StartGame(); } else { EventManager.Instance.AddListener <PatchEventMessageDefine.PatchStatesChange>(OnHandleEventMessage); PatchWindow.Instance.Initialize(); PatchUpdater.Instance.Run(); } }