Ejemplo n.º 1
0
    // 加载mesh动画文件
    //Modify by Aoicocoon 2017/12/06
    //修改打包士兵数据+动画文件
    public override void LoadSoldierAnim(string meshName, string animName, bool IsCache, AssetLoadHook pfun)
    {
        if (null == pfun)
        {
            return;
        }

        string folder = ResourcesPath.GetRelativePath(ResourcesType.ActorSoldierMesh, ResourcesPathMode.AssetBundle);
        string key    = GetKey(folder, meshName + "/" + animName.ToLower());
        string path   = key + ConstantData.ABEXT;

        Object obj = FindAssetObj(key);

        if (null != obj)
        {
            pfun.Invoke(obj);
        }
        else
        {
            ABLoad.LoadAB(path, true,
                          (ab) =>
            {
                LoadQueue.AddLoadTask(path, animName, typeof(Texture2D), IsCache, IsCache, false, pfun);
            });
        }
    }
    public override void LoadSoldierAnim(string meshName, string animName, bool isCache, AssetLoadHook pfun)
    {
        if (null == pfun)
        {
            return;
        }

        string FileExt = ResourcesPath.GetFileExt(ResourcesType.ActorSoldierMesh);
        string key     = GetKey(ResourcesType.ActorSoldierMesh, meshName + "/" + animName, FileExt);

        Object obj = FindAssetObj(key);

        if (null != obj)
        {
            pfun.Invoke(obj);
        }
        else
        {
            string PathName = "Assets/" + ResourcesPath.GetRelativePath(ResourcesType.ActorSoldierMesh, ResourcesPathMode.Editor) + meshName + "/" + animName + FileExt;

            Texture2D ta = AssetDatabase.LoadAssetAtPath <Texture2D>(PathName) as Texture2D;

            if (null != ta)
            {
                if (isCache)
                {
                    AddCache(key, ta);
                }
                pfun.Invoke(ta);
            }
            else
            {
                Debug.Log("LoadAssetAtPath  Empty : " + key);
            }
        }
    }