Beispiel #1
0
        public AssetExternal GetExtAsset(AssetsFileInstance relativeTo, AssetTypeValueField atvf, bool onlyGetInfo = false)
        {
            AssetExternal ext    = new AssetExternal();
            uint          fileId = (uint)atvf.Get("m_FileID").GetValue().AsInt();
            ulong         pathId = (ulong)atvf.Get("m_PathID").GetValue().AsInt64();

            if (fileId == 0 && pathId == 0)
            {
                ext.info     = null;
                ext.instance = null;
                ext.file     = null;
            }
            else if (atvf.Get("m_FileID").GetValue().AsInt() != 0)
            {
                AssetsFileInstance dep = relativeTo.dependencies[(int)fileId - 1];
                ext.info = dep.table.getAssetInfo(pathId);
                if (!onlyGetInfo)
                {
                    ext.instance = GetATI(dep.file, ext.info);
                }
                else
                {
                    ext.instance = null;
                }
                ext.file = dep;
            }
            else
            {
                ext.info = relativeTo.table.getAssetInfo(pathId);
                if (!onlyGetInfo)
                {
                    ext.instance = GetATI(relativeTo.file, ext.info);
                }
                else
                {
                    ext.instance = null;
                }
                ext.file = relativeTo;
            }
            return(ext);
        }
        public AssetExternal GetExtAsset(AssetsFileInstance relativeTo, int fileId, long pathId, bool onlyGetInfo = false, bool forceFromCldb = false)
        {
            AssetExternal ext = new AssetExternal();

            if (fileId == 0 && pathId == 0)
            {
                ext.info     = null;
                ext.instance = null;
                ext.file     = null;
            }
            else if (fileId != 0)
            {
                AssetsFileInstance dep = relativeTo.dependencies[fileId - 1];
                ext.info = dep.table.GetAssetInfo(pathId);
                if (!onlyGetInfo)
                {
                    ext.instance = GetATI(dep.file, ext.info, forceFromCldb);
                }
                else
                {
                    ext.instance = null;
                }
                ext.file = dep;
            }
            else
            {
                ext.info = relativeTo.table.GetAssetInfo(pathId);
                if (!onlyGetInfo)
                {
                    ext.instance = GetATI(relativeTo.file, ext.info, forceFromCldb);
                }
                else
                {
                    ext.instance = null;
                }
                ext.file = relativeTo;
            }
            return(ext);
        }
Beispiel #3
0
        public AssetExternal GetExtAsset(AssetsFileInstance relativeTo, int fileId, long pathId, bool onlyGetInfo = false, bool forceFromCldb = false)
        {
            AssetExternal ext = new AssetExternal
            {
                info     = null,
                instance = null,
                file     = null
            };

            if (fileId == 0 && pathId == 0)
            {
                return(ext);
            }
            else if (fileId != 0)
            {
                AssetsFileInstance dep = relativeTo.GetDependency(this, fileId - 1);

                if (dep == null)
                {
                    return(ext);
                }

                ext.file = dep;
                ext.info = dep.table.GetAssetInfo(pathId);

                if (ext.info == null)
                {
                    return(ext);
                }

                if (!onlyGetInfo)
                {
                    ext.instance = GetTypeInstance(dep.file, ext.info, forceFromCldb);
                }
                else
                {
                    ext.instance = null;
                }

                return(ext);
            }
            else
            {
                ext.file = relativeTo;
                ext.info = relativeTo.table.GetAssetInfo(pathId);

                if (ext.info == null)
                {
                    return(ext);
                }

                if (!onlyGetInfo)
                {
                    ext.instance = GetTypeInstance(relativeTo.file, ext.info, forceFromCldb);
                }
                else
                {
                    ext.instance = null;
                }

                return(ext);
            }
        }