Пример #1
0
        public override MetaPtr CreateExportPointer(Object asset, bool isLocal)
        {
            if (isLocal)
            {
                throw new NotSupportedException();
            }

            MonoScript script = m_scripts[asset];

            if (!MonoScript.HasAssemblyName(script.File.Version, script.File.Flags) || s_unityEngine.IsMatch(script.AssemblyName))
            {
                if (MonoScript.HasNamespace(script.File.Version))
                {
                    int fileID = Compute(script.Namespace, script.ClassName);
                    return(new MetaPtr(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                }
                else
                {
                    ScriptIdentifier scriptInfo = script.GetScriptID();
                    if (!scriptInfo.IsDefault)
                    {
                        int fileID = Compute(scriptInfo.Namespace, scriptInfo.Name);
                        return(new MetaPtr(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                    }
                }
            }

            long exportID   = GetExportID(asset);
            GUID uniqueGUID = script.GUID;

            return(new MetaPtr(exportID, uniqueGUID, AssetExporter.ToExportType(asset)));
        }
Пример #2
0
        public override MetaPtr CreateExportPointer(Object asset, bool isLocal)
        {
            if (isLocal)
            {
                throw new NotSupportedException();
            }

            MonoScript script = m_scripts[asset];

            if (!MonoScript.HasAssemblyName(script.File.Version, script.File.Flags) || s_unityEngine.IsMatch(script.AssemblyName))
            {
                if (MonoScript.HasNamespace(script.File.Version))
                {
                    int fileID = Compute(script.Namespace, script.ClassName);
                    return(new MetaPtr(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                }
                else
                {
                    ScriptIdentifier scriptInfo = script.GetScriptID();
                    if (!scriptInfo.IsDefault)
                    {
                        int fileID = Compute(scriptInfo.Namespace, scriptInfo.Name);
                        return(new MetaPtr(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                    }
                }
            }

            if (!AssemblyHash.ContainsKey(script.AssemblyNameOrigin))
            {
                AssemblyHash[script.AssemblyNameOrigin] = GetAssemblyHashGuid(script.AssemblyNameOrigin);
            }

            var scriptKey = $"{script.AssemblyNameOrigin}{script.Namespace}{script.ClassName}";

            if (!ScriptId.ContainsKey(scriptKey))
            {
                ScriptId[scriptKey] = Compute(script.Namespace, script.ClassName);
            }

            return(new MetaPtr(ScriptId[scriptKey], new UnityGUID(AssemblyHash[script.AssemblyNameOrigin]), AssetExporter.ToExportType(asset)));
        }