Ejemplo n.º 1
0
        /// <summary>
        /// 从assetbundle中加载脚本
        /// </summary>
        private void LoadScriptFromBundle()
        {
            AssetBundleLoader loader = null;

            if (string.IsNullOrEmpty(menu))
            {
                loader = AssetBundleLoader.Instence;
            }
            else
            {
                string url =
#if UNITY_EDITOR || UNITY_STANDALONE
                    "file:///" +
#endif
                    Application.streamingAssetsPath + "/" + menu;

                loader = AssetBundleLoader.GetInstance(url, menu);
            }
            loader.LoadAssetFromUrlAsync <TextAsset>(assetBundleName, assetName, (asset) =>
            {
                if (asset != null)
                {
                    InitScritEnv(asset.text);
                }
            });
        }
Ejemplo n.º 2
0
        public UIBundleLoadCtrl(string url, string menu, Transform root)
        {
            _root = root;
            //if (!_parentsDic.ContainsKey(_root))
            //{
            //    _parentsDic[_root] = new Dictionary<int, Transform>();
            //}
#if AssetBundleTools
            assetLoader = AssetBundleLoader.GetInstance(url, menu);
#endif
        }
Ejemplo n.º 3
0
        public PanelCreater(string menu)
        {
#if AssetBundleTools
            var url =
#if UNITY_WEBGL
#else
                "file:///" +
#endif
                Application.streamingAssetsPath + "/" + menu;

            assetLoader = AssetBundleLoader.GetInstance(url, menu);
#endif
        }
        private void LoadPanelGroupAsync()
        {
#if AssetBundleTools
            if (resetMenu)
            {
                loader = AssetBundleLoader.GetInstance(GetUrl(), menu);
            }
            else
            {
                loader = AssetBundleLoader.Instence;
            }
            loader.LoadAssetFromUrlAsync <BridgeUI.Model.PanelGroupObj>(assetbundle, groupasset, OnLoad);
#endif
        }
Ejemplo n.º 5
0
    public void Start()
    {
        loader = AssetBundleLoader.GetInstance(data.assetUrl, data.menu);
        var canvas = FindObjectOfType <Canvas>();

        for (int i = 0; i < data.rbundles.Count; i++)
        {
            loader.LoadAssetFromUrlAsync <GameObject>(data.rbundles[i].bundleName, data.rbundles[i].assetName, (x) =>
            {
                var y = Instantiate <GameObject>(x);
                if (y.GetComponent <RectTransform>())
                {
                    y.transform.SetParent(canvas.transform, false);
                }
            });
        }
    }
Ejemplo n.º 6
0
        public override void InitEnviroment()
        {
            if (!resetMenu)
            {
                assetLoader = AssetBundleLoader.Instence;
            }
            else
            {
                var url =
#if UNITY_WEBGL
#else
                    "file:///" +
#endif
                    Application.streamingAssetsPath + "/" + menu;

                assetLoader = AssetBundleLoader.GetInstance(url, menu);
            }
        }
        public ItemLoadCtrl(string url, string menu)
        {
#if AssetBundleTools
            assetLoader = AssetBundleLoader.GetInstance(url, menu);
#endif
        }