public AssetBundleEditorController()
        {
            m_ConfigurationPath = Type.GetConfigurationPath <AssetBundleEditorConfigPathAttribute>() ?? Utility.Path.GetCombinePath(Application.dataPath, "GameFramework/Configs/AssetBundleEditor.xml");

            m_AssetBundleCollection = new AssetBundleCollection();

            m_AssetBundleCollection.OnLoadingAssetBundle += delegate(int index, int count)
            {
                if (OnLoadingAssetBundle != null)
                {
                    OnLoadingAssetBundle(index, count);
                }
            };

            m_AssetBundleCollection.OnLoadingAsset += delegate(int index, int count)
            {
                if (OnLoadingAsset != null)
                {
                    OnLoadingAsset(index, count);
                }
            };

            m_AssetBundleCollection.OnLoadCompleted += delegate()
            {
                if (OnLoadCompleted != null)
                {
                    OnLoadCompleted();
                }
            };

            m_SourceAssetSearchPaths         = new List <string>();
            m_SourceAssetSearchRelativePaths = new List <string>();
            m_SourceAssets                 = new Dictionary <string, SourceAsset>();
            m_SourceAssetRoot              = null;
            m_SourceAssetRootPath          = null;
            m_SourceAssetUnionTypeFilter   = null;
            m_SourceAssetUnionLabelFilter  = null;
            m_SourceAssetExceptTypeFilter  = null;
            m_SourceAssetExceptLabelFilter = null;
            m_AssetSorter = AssetSorterType.Path;

            SourceAssetRootPath = DefaultSourceAssetRootPath;
        }
        public AssetBundleEditorController()
        {
            m_AssetBundleCollection = new AssetBundleCollection();
            m_AssetBundleCollection.OnLoadingAssetBundle += delegate(int index, int count) { OnLoadingAssetBundle?.Invoke(index, count); };
            m_AssetBundleCollection.OnLoadingAsset       += delegate(int index, int count) { OnLoadingAsset?.Invoke(index, count); };
            m_AssetBundleCollection.OnLoadCompleted      += delegate() { OnLoadCompleted?.Invoke(); };

            m_SourceAssetSearchPaths         = new List <string>();
            m_SourceAssetSearchRelativePaths = new List <string>();
            m_SourceAssets                 = new Dictionary <string, SourceAsset>();
            m_SourceAssetRoot              = null;
            m_SourceAssetRootPath          = null;
            m_SourceAssetUnionTypeFilter   = null;
            m_SourceAssetUnionLabelFilter  = null;
            m_SourceAssetExceptTypeFilter  = null;
            m_SourceAssetExceptLabelFilter = null;
            m_AssetSorter = AssetSorterType.Path;

            SourceAssetRootPath = DefaultSourceAssetRootPath;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public ResourceEditorController()
        {
            m_ConfigurationPath  = Path.Combine(Application.dataPath, "Framework/Configs/ResourceEditor.xml");
            m_ResourceCollection = new ResourceCollection();
            m_ResourceCollection.OnLoadingResource += delegate(int index, int count)
            {
                if (OnLoadingResource != null)
                {
                    OnLoadingResource(index, count);
                }
            };

            m_ResourceCollection.OnLoadingAsset += delegate(int index, int count)
            {
                if (OnLoadingAsset != null)
                {
                    OnLoadingAsset(index, count);
                }
            };

            m_ResourceCollection.OnLoadCompleted += delegate()
            {
                if (OnLoadCompleted != null)
                {
                    OnLoadCompleted();
                }
            };

            m_SourceAssetSearchPaths         = new List <string>();
            m_SourceAssetSearchRelativePaths = new List <string>();
            m_SourceAssets                 = new Dictionary <string, SourceAsset>();
            m_SourceAssetRoot              = null;
            m_SourceAssetRootPath          = null;
            m_SourceAssetUnionTypeFilter   = null;
            m_SourceAssetUnionLabelFilter  = null;
            m_SourceAssetExceptTypeFilter  = null;
            m_SourceAssetExceptLabelFilter = null;
            m_AssetSorter = AssetSorterType.Path;

            SourceAssetRootPath = DefaultSourceAssetRootPath;
        }
Exemplo n.º 4
0
        public ResourceEditorController()
        {
            m_ConfigurationPath  = Type.GetConfigurationPath <ResourceEditorConfigPathAttribute>() ?? Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "Res/Configs/ResourceEditor.xml"));
            m_ResourceCollection = new ResourceCollection();
            m_ResourceCollection.OnLoadingResource += delegate(int index, int count)
            {
                if (OnLoadingResource != null)
                {
                    OnLoadingResource(index, count);
                }
            };

            m_ResourceCollection.OnLoadingAsset += delegate(int index, int count)
            {
                if (OnLoadingAsset != null)
                {
                    OnLoadingAsset(index, count);
                }
            };

            m_ResourceCollection.OnLoadCompleted += delegate()
            {
                if (OnLoadCompleted != null)
                {
                    OnLoadCompleted();
                }
            };

            m_SourceAssetSearchPaths         = new List <string>();
            m_SourceAssetSearchRelativePaths = new List <string>();
            m_SourceAssets                 = new Dictionary <string, SourceAsset>(StringComparer.Ordinal);
            m_SourceAssetRoot              = null;
            m_SourceAssetRootPath          = null;
            m_SourceAssetUnionTypeFilter   = null;
            m_SourceAssetUnionLabelFilter  = null;
            m_SourceAssetExceptTypeFilter  = null;
            m_SourceAssetExceptLabelFilter = null;
            m_AssetSorter = AssetSorterType.Path;

            SourceAssetRootPath = DefaultSourceAssetRootPath;
        }
        public bool Load()
        {
            if (!File.Exists(m_ConfigurationPath))
            {
                return(false);
            }

            try
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(m_ConfigurationPath);
                XmlNode xmlRoot     = xmlDocument.SelectSingleNode("UnityGameFramework");
                XmlNode xmlEditor   = xmlRoot.SelectSingleNode("ResourceEditor");
                XmlNode xmlSettings = xmlEditor.SelectSingleNode("Settings");

                XmlNodeList xmlNodeList = null;
                XmlNode     xmlNode     = null;

                xmlNodeList = xmlSettings.ChildNodes;
                for (int i = 0; i < xmlNodeList.Count; i++)
                {
                    xmlNode = xmlNodeList.Item(i);
                    switch (xmlNode.Name)
                    {
                    case "SourceAssetRootPath":
                        SourceAssetRootPath = xmlNode.InnerText;
                        break;

                    case "SourceAssetSearchPaths":
                        m_SourceAssetSearchRelativePaths.Clear();
                        XmlNodeList xmlNodeListInner = xmlNode.ChildNodes;
                        XmlNode     xmlNodeInner     = null;
                        for (int j = 0; j < xmlNodeListInner.Count; j++)
                        {
                            xmlNodeInner = xmlNodeListInner.Item(j);
                            if (xmlNodeInner.Name != "SourceAssetSearchPath")
                            {
                                continue;
                            }

                            m_SourceAssetSearchRelativePaths.Add(xmlNodeInner.Attributes.GetNamedItem("RelativePath").Value);
                        }
                        break;

                    case "SourceAssetUnionTypeFilter":
                        SourceAssetUnionTypeFilter = xmlNode.InnerText;
                        break;

                    case "SourceAssetUnionLabelFilter":
                        SourceAssetUnionLabelFilter = xmlNode.InnerText;
                        break;

                    case "SourceAssetExceptTypeFilter":
                        SourceAssetExceptTypeFilter = xmlNode.InnerText;
                        break;

                    case "SourceAssetExceptLabelFilter":
                        SourceAssetExceptLabelFilter = xmlNode.InnerText;
                        break;

                    case "AssetSorter":
                        AssetSorter = (AssetSorterType)Enum.Parse(typeof(AssetSorterType), xmlNode.InnerText);
                        break;
                    }
                }

                RefreshSourceAssetSearchPaths();
            }
            catch
            {
                File.Delete(m_ConfigurationPath);
                return(false);
            }

            ScanSourceAssets();

            m_ResourceCollection.Load();

            return(true);
        }