コード例 #1
0
        // Load asset from the given assetBundle.
        static public AssetBundleAssetOperation LoadAssetAsync(string assetBundleName, string assetName, System.Type type)
        {
            AssetBundleAssetOperation operation = null;

            LoadAssetBundle(assetBundleName);
            operation = new AssetBundleLoadAssetOperation(assetBundleName, assetName, type);
            m_InProgressOperations.Add(operation);  //添加进处理中列表,等Update处理
            return(operation);
        }
コード例 #2
0
    static int LoadAssetAsync(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        string arg0 = LuaScriptMgr.GetLuaString(L, 1);
        string arg1 = LuaScriptMgr.GetLuaString(L, 2);
        Type   arg2 = LuaScriptMgr.GetTypeObject(L, 3);

        SimpleFramework.Manager.AssetBundleAssetOperation o = SimpleFramework.Manager.ResourceManager.LoadAssetAsync(arg0, arg1, arg2);
        LuaScriptMgr.Push(L, o);
        return(1);
    }
コード例 #3
0
        IEnumerator OnLoadAsset(string abname, string assetName, LuaFunction func)
        {
            // Load asset from assetBundle.
            string abName = abname.ToLower() + AppConst.ExtName;
            AssetBundleAssetOperation request = ResourceManager.LoadAssetAsync(abName, assetName, typeof(GameObject));

            if (request == null)
            {
                yield break;
            }
            yield return(StartCoroutine(request));

            // Get the asset.
            GameObject prefab = request.GetAsset <GameObject>();

            if (func != null)
            {
                func.Call(prefab);
                func.Dispose();
                func = null;
            }
        }
コード例 #4
0
        IEnumerator OnCreatePanel(string name, LuaFunction func = null)
        {
            yield return(StartCoroutine(Initialize()));

            string assetName = name + "Panel";
            // Load asset from assetBundle.
            string abName = name.ToLower() + AppConst.ExtName;
            AssetBundleAssetOperation request = ResourceManager.LoadAssetAsync(abName, assetName, typeof(GameObject));

            if (request == null)
            {
                yield break;
            }
            yield return(StartCoroutine(request));

            // Get the asset.
            GameObject prefab = request.GetAsset <GameObject>();

            if (Parent.FindChild(name) != null || prefab == null)
            {
                yield break;
            }
            GameObject go = Instantiate(prefab) as GameObject;

            go.name  = assetName;
            go.layer = LayerMask.NameToLayer("Default");
            go.transform.SetParent(Parent);
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = Vector3.zero;
            go.AddComponent <LuaBehaviour>();

            if (func != null)
            {
                func.Call(go);
            }
            Debug.LogWarning("CreatePanel::>> " + name + " " + prefab);
        }