Exemplo n.º 1
0
        public AssetGetter LoadAllAssets(string assetPath)
        {
            string loadPath = GetAssetPathWithExtend(assetPath.ToLower());

            string pullPath = System.IO.Path.Combine(Application.dataPath, loadPath.ToLower());

            pullPath = pullPath.Replace('\\', '/');
            string []     files = System.IO.Directory.GetFiles(pullPath);
            List <Object> objs  = new List <Object>();

            for (int i = 0; i < files.Length; ++i)
            {
                if (files[i].Contains(".meta"))
                {
                    continue;
                }
                Logger.LogWarp.Log(files[i].Substring(files[i].Replace('\\', '/').LastIndexOf("/")));

                var o = AssetDatabase.LoadAssetAtPath <Object>("Assets/" + loadPath + files[i].Substring(files[i].Replace('\\', '/').LastIndexOf("/")));
                objs.Add(o);
            }

            AssetHolder assetHolder = new AssetHolder(objs.ToArray());
            AssetGetter getter      = new AssetGetter();

            getter.SetAssetHolder(assetHolder);
            return(getter);
        }
Exemplo n.º 2
0
        //同步
        public AssetGetter LoadAsset(string assetPath)
        {
            string      loadPath    = GetAssetPathWithExtend(assetPath.ToLower());
            Object      obj         = AssetDatabase.LoadAssetAtPath <Object>(loadPath);
            AssetHolder assetHolder = new AssetHolder(obj);
            AssetGetter getter      = new AssetGetter();

            getter.SetAssetHolder(assetHolder);
            return(getter);
        }
Exemplo n.º 3
0
        //异步

        public void LoadAssetAsync(string assetPath, System.Action <AssetGetter> callback)
        {
            string      loadPath    = GetAssetPathWithExtend(assetPath.ToLower());
            Object      obj         = AssetDatabase.LoadAssetAtPath <Object>(loadPath);
            AssetHolder assetHolder = new AssetHolder(obj);
            AssetGetter getter      = new AssetGetter();

            getter.SetAssetHolder(assetHolder);
            callback(getter);
        }
 static int SetAssetHolder(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UFrame.ResourceManagement.AssetGetter obj  = (UFrame.ResourceManagement.AssetGetter)ToLua.CheckObject <UFrame.ResourceManagement.AssetGetter>(L, 1);
         UFrame.ResourceManagement.AssetHolder arg0 = (UFrame.ResourceManagement.AssetHolder)ToLua.CheckObject <UFrame.ResourceManagement.AssetHolder>(L, 2);
         obj.SetAssetHolder(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }