示例#1
0
    private void CreateGameModules()
    {
        // 创建事件管理器
        MotionEngine.CreateModule <EventManager>();

        // 创建网络管理器
        var networkCreateParam = new NetworkManager.CreateParameters();

        networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder);
        MotionEngine.CreateModule <NetworkManager>(networkCreateParam);

        // 创建资源管理器
        var resourceCreateParam = new ResourceManager.CreateParameters();

        resourceCreateParam.LocationRoot        = GameDefine.AssetRootPath;
        resourceCreateParam.SimulationOnEditor  = SimulationOnEditor;
        resourceCreateParam.BundleServices      = new LocalBundleServices();
        resourceCreateParam.DecryptServices     = null;
        resourceCreateParam.AutoReleaseInterval = 10f;
        MotionEngine.CreateModule <ResourceManager>(resourceCreateParam);

        // 创建音频管理器
        MotionEngine.CreateModule <AudioManager>();

        // 创建场景管理器
        MotionEngine.CreateModule <SceneManager>();

        // 创建对象池管理器
        MotionEngine.CreateModule <GameObjectPoolManager>();

        // 直接进入游戏
        MotionEngine.CreateModule <LuaManager>();
    }
    /// <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();
    }
    /// <summary>
    /// 创建游戏模块
    /// </summary>
    private IEnumerator CreateGameModules()
    {
        // 创建事件管理器
        MotionEngine.CreateModule <EventManager>();

        // 创建网络管理器
        var networkCreateParam = new NetworkManager.CreateParameters();

        networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder);
        networkCreateParam.PackageMaxSize   = ushort.MaxValue;
        MotionEngine.CreateModule <NetworkManager>(networkCreateParam);

        // 本地资源服务接口
        LocalBundleServices bundleServices = new LocalBundleServices();

        yield return(bundleServices.InitializeAsync(SimulationOnEditor));

        // 创建资源管理器
        var resourceCreateParam = new ResourceManager.CreateParameters();

        resourceCreateParam.LocationRoot        = GameDefine.AssetRootPath;
        resourceCreateParam.SimulationOnEditor  = SimulationOnEditor;
        resourceCreateParam.BundleServices      = bundleServices;
        resourceCreateParam.DecryptServices     = null;
        resourceCreateParam.AutoReleaseInterval = 10f;
        MotionEngine.CreateModule <ResourceManager>(resourceCreateParam);

        // 创建音频管理器
        MotionEngine.CreateModule <AudioManager>();

        // 创建场景管理器
        MotionEngine.CreateModule <SceneManager>();

        // 创建对象池管理器
        MotionEngine.CreateModule <GameObjectPoolManager>();

        // 创建ILR管理器
        ILRManager.CreateParameters createParameters = new ILRManager.CreateParameters();
        createParameters.IsEnableILRuntime = EnableILRuntime;
        MotionEngine.CreateModule <ILRManager>(createParameters);

        // 开始游戏
        ILRManager.Instance.StartGame();
    }
示例#4
0
    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>();

        // 创建补间管理器
        MotionEngine.CreateModule <TweenManager>();

        // 本地资源服务接口
        LocalBundleServices bundleServices = new LocalBundleServices();

        yield return(bundleServices.InitializeAsync(SimulationOnEditor));

        // 创建资源管理器
        var resourceCreateParam = new ResourceManager.CreateParameters();

        resourceCreateParam.LocationRoot        = GameDefine.AssetRootPath;
        resourceCreateParam.SimulationOnEditor  = SimulationOnEditor;
        resourceCreateParam.BundleServices      = bundleServices;
        resourceCreateParam.DecryptServices     = null;
        resourceCreateParam.AutoReleaseInterval = 1f;
        MotionEngine.CreateModule <ResourceManager>(resourceCreateParam);

        // 创建音频管理器
        MotionEngine.CreateModule <AudioManager>();

        // 创建场景管理器
        MotionEngine.CreateModule <SceneManager>();

        // 创建对象池管理器
        MotionEngine.CreateModule <GameObjectPoolManager>();

        // 最后创建游戏业务逻辑模块
        MotionEngine.CreateModule <DataManager>();
        MotionEngine.CreateModule <WindowManager>();
        MotionEngine.CreateModule <FsmManager>();

        // 开始游戏逻辑
        FsmManager.Instance.StartGame();
    }
示例#6
0
    private IEnumerator CreateGameModules()
    {
        // 创建事件管理器
        MotionEngine.CreateModule <EventManager>();

        // 创建网络管理器
        var networkCreateParam = new NetworkManager.CreateParameters();

        networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder);
        MotionEngine.CreateModule <NetworkManager>(networkCreateParam);

        // 本地资源服务接口
        LocalBundleServices bundleServices = new LocalBundleServices();

        yield return(bundleServices.InitializeAsync(SimulationOnEditor));

        // 创建资源管理器
        var resourceCreateParam = new ResourceManager.CreateParameters();

        resourceCreateParam.LocationRoot        = GameDefine.AssetRootPath;
        resourceCreateParam.SimulationOnEditor  = SimulationOnEditor;
        resourceCreateParam.BundleServices      = bundleServices;
        resourceCreateParam.DecryptServices     = null;
        resourceCreateParam.AutoReleaseInterval = 10f;
        MotionEngine.CreateModule <ResourceManager>(resourceCreateParam);

        // 创建音频管理器
        MotionEngine.CreateModule <AudioManager>();

        // 创建场景管理器
        MotionEngine.CreateModule <SceneManager>();

        // 直接进入游戏
        var luaCreateParam = new LuaManager.CreateParameters();

        luaCreateParam.SimulationOnEditor = SimulationOnEditor;
        MotionEngine.CreateModule <LuaManager>(luaCreateParam);
        LuaManager.Instance.StartGame();
    }
示例#7
0
    /// <summary>
    /// 创建游戏模块
    /// </summary>
    private void CreateGameModules()
    {
        // 创建事件管理器
        MotionEngine.CreateModule <EventManager>();

        IBundleServices bundleServices;

        if (SkipCDN)
        {
            var variantRule1 = new VariantRule();
            variantRule1.VariantGroup = new List <string>()
            {
                "CN", "EN", "KR"
            };
            variantRule1.TargetVariant = "EN";
            var variantRules = new List <VariantRule>()
            {
                variantRule1
            };
            bundleServices = new LocalBundleServices(variantRules);
        }
        else
        {
            // 创建补丁管理器
            string myWebServer = "127.0.0.1";
            string myCDNServer = "127.0.0.1";

            var patchCreateParam = new PatchManager.CreateParameters();
            patchCreateParam.ServerID   = PlayerPrefs.GetInt("SERVER_ID_KEY", 0);
            patchCreateParam.ChannelID  = 0;
            patchCreateParam.DeviceID   = 0;
            patchCreateParam.TestFlag   = PlayerPrefs.GetInt("TEST_FLAG_KEY", 0);
            patchCreateParam.CheckLevel = ECheckLevel.CheckSize;

            patchCreateParam.WebServers = new Dictionary <RuntimePlatform, string>();
            patchCreateParam.WebServers.Add(RuntimePlatform.Android, $"{myWebServer}/WEB/Android/GameVersion.php");
            patchCreateParam.WebServers.Add(RuntimePlatform.IPhonePlayer, $"{myWebServer}/WEB/Iphone/GameVersion.php");

            patchCreateParam.CDNServers = new Dictionary <RuntimePlatform, string>();
            patchCreateParam.CDNServers.Add(RuntimePlatform.Android, $"{myCDNServer}/CDN/Android");
            patchCreateParam.CDNServers.Add(RuntimePlatform.IPhonePlayer, $"{myCDNServer}/CDN/Iphone");

            patchCreateParam.DefaultWebServerIP = $"{myWebServer}/WEB/PC/GameVersion.php";
            patchCreateParam.DefaultCDNServerIP = $"{myCDNServer}/CDN/PC";

            var variantRule1 = new VariantRule();
            variantRule1.VariantGroup = new List <string>()
            {
                "CN", "EN", "KR"
            };
            variantRule1.TargetVariant    = "EN";
            patchCreateParam.VariantRules = new List <VariantRule>()
            {
                variantRule1
            };

            MotionEngine.CreateModule <PatchManager>(patchCreateParam);
            bundleServices = MotionEngine.GetModule <PatchManager>();
            EventManager.Instance.AddListener <PatchEventMessageDefine.PatchStatesChange>(OnHandleEventMessage);
            EventManager.Instance.AddListener <PatchEventMessageDefine.OperationEvent>(OnHandleEventMessage);
        }

        // 创建资源管理器
        var resourceCreateParam = new ResourceManager.CreateParameters();

        resourceCreateParam.LocationRoot        = GameDefine.AssetRootPath;
        resourceCreateParam.SimulationOnEditor  = SimulationOnEditor;
        resourceCreateParam.BundleServices      = bundleServices;
        resourceCreateParam.DecryptServices     = null;
        resourceCreateParam.AutoReleaseInterval = 10f;
        MotionEngine.CreateModule <ResourceManager>(resourceCreateParam);

        if (SkipCDN)
        {
            // 开始游戏
            StartGame();
        }
        else
        {
            // 开始补丁更新流程
            PatchManager.Instance.Run();
        }
    }
    /// <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();
        }
    }
示例#9
0
    /// <summary>
    /// 创建游戏模块
    /// </summary>
    private IEnumerator CreateGameModules()
    {
        // 创建事件管理器
        MotionEngine.CreateModule <EventManager>();

        // 创建变体规则集合
        var variantRules = new List <VariantRule>();
        {
            var rule1 = new VariantRule();
            rule1.VariantGroup = new List <string>()
            {
                "EN", "KR"
            };
            rule1.TargetVariant = Language == ELanguage.Default ? VariantRule.DefaultTag : Language.ToString();
            variantRules.Add(rule1);

            var rule2 = new VariantRule();
            rule2.VariantGroup = new List <string>()
            {
                "HD"
            };
            rule2.TargetVariant = Quality == EQuality.Default ? VariantRule.DefaultTag : Quality.ToString();
            variantRules.Add(rule2);
        }

        // 资源服务接口
        IBundleServices bundleServices = null;

        if (SkipCDN)
        {
            var localBundleServices = new LocalBundleServices(variantRules);
            yield return(localBundleServices.InitializeAsync(SimulationOnEditor));

            bundleServices = localBundleServices;
        }
        else
        {
            string myWebServer = "127.0.0.1";
            string myCDNServer = "127.0.0.1";

            var patchCreateParam = new PatchManager.CreateParameters();
            patchCreateParam.ServerID   = PlayerPrefs.GetInt("SERVER_ID_KEY", 0);
            patchCreateParam.ChannelID  = 0;
            patchCreateParam.DeviceID   = 0;
            patchCreateParam.TestFlag   = PlayerPrefs.GetInt("TEST_FLAG_KEY", 0);
            patchCreateParam.CheckLevel = ECheckLevel.CheckSize;
            patchCreateParam.WebServers = new Dictionary <RuntimePlatform, string>();
            patchCreateParam.WebServers.Add(RuntimePlatform.Android, $"{myWebServer}/WEB/Android/GameVersion.php");
            patchCreateParam.WebServers.Add(RuntimePlatform.IPhonePlayer, $"{myWebServer}/WEB/Iphone/GameVersion.php");
            patchCreateParam.CDNServers = new Dictionary <RuntimePlatform, string>();
            patchCreateParam.CDNServers.Add(RuntimePlatform.Android, $"{myCDNServer}/CDN/Android");
            patchCreateParam.CDNServers.Add(RuntimePlatform.IPhonePlayer, $"{myCDNServer}/CDN/Iphone");
            patchCreateParam.DefaultWebServerIP = $"{myWebServer}/WEB/PC/GameVersion.php";
            patchCreateParam.DefaultCDNServerIP = $"{myCDNServer}/CDN/PC";
            patchCreateParam.VariantRules       = variantRules;

            PatchManager patchManager = MotionEngine.CreateModule <PatchManager>(patchCreateParam);
            yield return(patchManager.InitializeAync());

            bundleServices = MotionEngine.GetModule <PatchManager>();

            EventManager.Instance.AddListener <PatchEventMessageDefine.PatchStatesChange>(OnHandleEventMessage);
            EventManager.Instance.AddListener <PatchEventMessageDefine.OperationEvent>(OnHandleEventMessage);
        }

        // 创建资源管理器
        var resourceCreateParam = new ResourceManager.CreateParameters();

        resourceCreateParam.LocationRoot        = GameDefine.AssetRootPath;
        resourceCreateParam.SimulationOnEditor  = SimulationOnEditor;
        resourceCreateParam.BundleServices      = bundleServices;
        resourceCreateParam.DecryptServices     = null;
        resourceCreateParam.AutoReleaseInterval = 10f;
        MotionEngine.CreateModule <ResourceManager>(resourceCreateParam);

        if (SkipCDN)
        {
            // 开始游戏
            StartGame();
        }
        else
        {
            // 初始化补丁窗口
            yield return(PatchWindow.Instance.InitializeAsync());

            WaitForSeconds waiting = new WaitForSeconds(1f);
            yield return(waiting);

            // 开始补丁更新流程
            PatchManager.Instance.Download();
        }
    }