예제 #1
0
        public void ErrorLoadingBundle_ReturnInvalidOperationException()
        {
            CreateFixture();
            SetupLoaderReturn(Observable.Throw <IBundle>(new InvalidOperationException()));
            SetupBundleReturn(Observable.Return(new AssetBundleManifest()));

            Assert.Throws <InvalidOperationException>(() => _fixture.Load().Wait());

            _innerLoader.Received(1).Load <IBundle>(Arg.Any <Uri>());
            _bundle.DidNotReceive().LoadAsset <AssetBundleManifest>(Arg.Any <string>());
        }
예제 #2
0
        IResources GetResources()
        {
            if (this.resources != null)
            {
                return(this.resources);
            }

            /* Create a BundleManifestLoader. */
            IBundleManifestLoader manifestLoader = new BundleManifestLoader();

            /* Loads BundleManifest. */
            BundleManifest manifest = manifestLoader.Load(BundleUtil.GetStorableDirectory() + BundleSetting.ManifestFilename);

            //manifest.ActiveVariants = new string[] { "", "sd" };
            //manifest.ActiveVariants = new string[] { "", "hd" };

            /* Create a PathInfoParser. */
            IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);

            /* Use a custom BundleLoaderBuilder */
            ILoaderBuilder builder = new CustomBundleLoaderBuilder(new Uri(BundleUtil.GetReadOnlyDirectory()), false);

            /* Create a BundleManager */
            IBundleManager manager = new BundleManager(manifest, builder);

            /* Create a BundleResources */
            this.resources = new BundleResources(pathInfoParser, manager);
            return(this.resources);
        }
예제 #3
0
        IResources CreateResources()
        {
            IResources resources = null;

#if UNITY_EDITOR
            if (SimulationSetting.IsSimulationMode)
            {
                Debug.Log("Use SimulationResources. Run In Editor");

                /* Create a PathInfoParser. */
                //IPathInfoParser pathInfoParser = new SimplePathInfoParser("@");
                IPathInfoParser pathInfoParser = new SimulationAutoMappingPathInfoParser();

                /* Create a BundleManager */
                IBundleManager manager = new SimulationBundleManager();

                /* Create a BundleResources */
                resources = new SimulationResources(pathInfoParser, manager);
            }
            else
#endif
            {
                /* Create a BundleManifestLoader. */
                IBundleManifestLoader manifestLoader = new BundleManifestLoader();

                /* Loads BundleManifest. */
                BundleManifest manifest = manifestLoader.Load(BundleUtil.GetReadOnlyDirectory() + BundleSetting.ManifestFilename);

                //manifest.ActiveVariants = new string[] { "", "sd" };
                manifest.ActiveVariants = new string[] { "", "hd" };

                /* Create a PathInfoParser. */
                //IPathInfoParser pathInfoParser = new SimplePathInfoParser("@");
                IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);

                /* Create a BundleLoaderBuilder */
                //ILoaderBuilder builder = new WWWBundleLoaderBuilder(new Uri(BundleUtil.GetReadOnlyDirectory()), false);

                /* AES128_CBC_PKCS7 */
                //RijndaelCryptograph rijndaelCryptograph = new RijndaelCryptograph(128, Encoding.ASCII.GetBytes(this.key), Encoding.ASCII.GetBytes(this.iv));
                IStreamDecryptor decryptor = CryptographUtil.GetDecryptor(Algorithm.AES128_CBC_PKCS7, Encoding.ASCII.GetBytes(this.key), Encoding.ASCII.GetBytes(this.iv));

                /* Use a custom BundleLoaderBuilder */
                ILoaderBuilder builder = new CustomBundleLoaderBuilder(new Uri(BundleUtil.GetReadOnlyDirectory()), false, decryptor);

                /* Create a BundleManager */
                IBundleManager manager = new BundleManager(manifest, builder);

                /* Create a BundleResources */
                resources = new BundleResources(pathInfoParser, manager);
            }
            return(resources);
        }
예제 #4
0
    IResources CreateResources()
    {
        IResources resources = null;

#if UNITY_EDITOR
        if (SimulationSetting.IsSimulationMode)
        {
            LogManager.Log("Use SimulationResources. Run In Editor");

            /* Create a PathInfoParser. */
            //IPathInfoParser pathInfoParser = new SimplePathInfoParser("@");
            IPathInfoParser pathInfoParser = new SimulationAutoMappingPathInfoParser();

            /* Create a BundleManager */
            IBundleManager manager = new SimulationBundleManager();

            /* Create a BundleResources */
            resources = new SimulationResources(pathInfoParser, manager);
        }
        else
#endif
        {
            /* Create a BundleManifestLoader. */
            IBundleManifestLoader manifestLoader = new BundleManifestLoader();


            /* Loads BundleManifest. */
            BundleManifest manifest;
            manifest = manifestLoader.Load(BundleUtil.GetStorableDirectory() + BundleSetting.ManifestFilename);

            //manifest.ActiveVariants = new string[] { "", "sd" };
            //manifest.ActiveVariants = new string[] { "", "hd" };

            /* Create a PathInfoParser. */
            //IPathInfoParser pathInfoParser = new SimplePathInfoParser("@");
            IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);

            /* Create a BundleLoaderBuilder */
            ILoaderBuilder builder;
            builder = new WWWComplexLoaderBuilder(new Uri(BundleUtil.GetStorableDirectory()), false);

            /* Create a BundleManager */
            IBundleManager manager = new BundleManager(manifest, builder);

            /* Create a BundleResources */
            resources = new BundleResources(pathInfoParser, manager);
        }
        return(resources);
    }
예제 #5
0
    public IEnumerator LoadGame(string name)
    {
        if (!gamesMap.ContainsKey(name))
        {
            Debug.Log("load game not found: " + name);
            yield break;
        }

#if UNITY_EDITOR
        if (SimulationSetting.IsSimulationMode)
        {
            var ret = simulator.LoadBundle(name + "lua");
            yield return(ret.WaitForDone());

            yield break;
        }
#endif

        Debug.Log("enter LoadGame " + name);

        var cfg = gamesMap[name];

        IBundleManifestLoader manifestLoader = new BundleManifestLoader();

        var path = BundleUtil.GetStorableDirectory() + name + "/";
        var mani = path + BundleSetting.ManifestFilename;

        BundleManifest  manifest       = manifestLoader.Load(mani);
        IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);
        ILoaderBuilder  builder        = new CustomBundleLoaderBuilder(new Uri(path), false);

        IBundleManager manager = new BundleManager(manifest, builder);

        var rc = new BundleResources(pathInfoParser, manager);

        cfg.resources = rc;

        var result = rc.LoadBundle(name + "lua");
        yield return(result.WaitForDone());

        cfg.luaBundle = result.Result as DefaultBundle;

        Debug.Log("leave LoadGame " + name);
    }
        IResources GetResources()
        {
            if (resources != null)
            {
                return(resources);
            }

            IBundleManifestLoader manifestLoader = new BundleManifestLoader();
            BundleManifest        manifest       = manifestLoader.Load(uriString + BundleSetting.ManifestFilename);

            IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);

            ILoaderBuilder builder = new Loxodon.Framework.Examples.Bundle.CustomBundleLoaderBuilder(new Uri(uriString), false, new RijndaelCryptograph(128, Encoding.ASCII.GetBytes(key), Encoding.ASCII.GetBytes(iv)));

            IBundleManager manager = new BundleManager(manifest, builder);

            resources = new BundleResources(pathInfoParser, manager);

            return(resources);
        }
        void Awake()
        {
            /* Create a BundleManifestLoader. */
            IBundleManifestLoader manifestLoader = new BundleManifestLoader();

            /* Loads BundleManifest. */
            BundleManifest manifest = manifestLoader.Load(BundleUtil.GetReadOnlyDirectory() + BundleSetting.ManifestFilename);

            /* Create a PathInfoParser. */
            IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);

            /* Use a BundleLoaderBuilder */
            ILoaderBuilder builder = new CustomBundleLoaderBuilder(new Uri(BundleUtil.GetReadOnlyDirectory()), false, new RijndaelCryptograph(128, Encoding.ASCII.GetBytes(key), Encoding.ASCII.GetBytes(iv)));

            /* Create a BundleManager */
            IBundleManager manager = new BundleManager(manifest, builder);

            /* Create a BundleResources */
            resources = new BundleResources(pathInfoParser, manager);
        }
        void Awake()
        {
            /* Create a BundleManifestLoader. */
            IBundleManifestLoader manifestLoader = new BundleManifestLoader();

            /* Loads BundleManifest. */
            BundleManifest manifest = manifestLoader.Load(BundleUtil.GetReadOnlyDirectory() + BundleSetting.ManifestFilename);

            /* Create a PathInfoParser. */
            IPathInfoParser pathInfoParser = new AutoMappingPathInfoParser(manifest);

            IStreamDecryptor decryptor = CryptographUtil.GetDecryptor(Algorithm.AES128_CBC_PKCS7, Encoding.ASCII.GetBytes(this.key), Encoding.ASCII.GetBytes(this.iv));

            /* Use a BundleLoaderBuilder */
            ILoaderBuilder builder = new CustomBundleLoaderBuilder(new Uri(BundleUtil.GetReadOnlyDirectory()), false, decryptor);

            /* Create a BundleManager */
            IBundleManager manager = new BundleManager(manifest, builder);

            /* Create a BundleResources */
            resources = new BundleResources(pathInfoParser, manager);
        }