Ejemplo n.º 1
0
        public ScriptExportCollection(IAssetExporter assetExporter, MonoScript script)
        {
            if (assetExporter == null)
            {
                throw new ArgumentNullException(nameof(assetExporter));
            }
            AssetExporter = assetExporter;

            File = script.File;

            // find copies in whole project and skip them
            foreach (ISerializedFile file in script.File.Collection.Files)
            {
                foreach (Object asset in file.FetchAssets())
                {
                    if (asset.ClassID != ClassIDType.MonoScript)
                    {
                        continue;
                    }

                    MonoScript assetScript = (MonoScript)asset;
                    MonoScript unique      = assetScript;
                    foreach (MonoScript export in m_unique)
                    {
                        if (assetScript.ClassName != export.ClassName)
                        {
                            continue;
                        }
                        if (assetScript.Namespace != export.Namespace)
                        {
                            continue;
                        }
                        if (assetScript.AssemblyName != export.AssemblyName)
                        {
                            continue;
                        }

                        unique = export;
                        break;
                    }

                    m_scripts.Add(assetScript, unique);
                    if (assetScript == unique)
                    {
                        m_unique.Add(assetScript);
                        if (assetScript.IsScriptPresents())
                        {
                            m_export.Add(assetScript);
                        }
                    }
                }
            }
        }