Exemplo n.º 1
0
        private int calcAssetsInChildren(ProjectFolderInfo assetFolderInfo, SortedDictionary <SerializableSystemType, bool> validTypeList, out long folderFileSize)
        {
            assetFolderInfo.m_fileSize = assetFolderInfo.GetUnusedAssetSize();

            long childrenSizeAccumulated = 0;

            int value = 0;

            foreach (int indexer in assetFolderInfo.m_childFolderIndexers)
            {
                long childSize = 0;
                value += AssetHunterMainWindow.Instance.GetFolderList()[indexer].m_assetsInChildren = calcAssetsInChildren(AssetHunterMainWindow.Instance.GetFolderList()[indexer], validTypeList, out childSize);

                childrenSizeAccumulated += childSize;
            }

            List <AssetObjectInfo> assetInfoList = (assetFolderInfo.AssetList.Where(val => (validTypeList.ContainsKey(val.m_Type) && validTypeList[val.m_Type]) == true)).ToList <AssetObjectInfo>();

            assetFolderInfo.m_fileSizeString      = AssetHunterHelper.BytesToString(assetFolderInfo.m_fileSize);
            assetFolderInfo.m_fileSizeAccumulated = assetFolderInfo.m_fileSize + childrenSizeAccumulated;

            assetFolderInfo.m_fileSizeAccumulatedString = AssetHunterHelper.BytesToString(assetFolderInfo.m_fileSizeAccumulated);

            folderFileSize = assetFolderInfo.m_fileSizeAccumulated;

            return(value + assetInfoList.Count());
        }
Exemplo n.º 2
0
        internal void AddPlatformSpecificAssets()
        {
            int counter = 0;
            int countTo = Enum.GetValues(typeof(BuildTargetGroup)).Length;

            //TODO Get all the different splash screens and config files somehow
            List <UnityEngine.Object> splash = new List <UnityEngine.Object>();

            splash.Add(UnityEditor.PlayerSettings.xboxSplashScreen);

            //Loop the entries
            foreach (UnityEngine.Object obj in splash)
            {
                //Early out if it already exist
                if (obj == null || m_BuildSizeList.Exists(val => val.Path == AssetDatabase.GetAssetPath(obj)))
                {
                    continue;
                }

                BuildReportAsset newAsset = new BuildReportAsset();

                newAsset.SetAssetInfo(obj, AssetDatabase.GetAssetPath(obj));
                newAsset.SetSize(0.0f, "--");
                m_BuildSizeList.Add(newAsset);
            }



            //Loop icons in buildtargetgroups
            foreach (BuildTargetGroup btg in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
            {
                EditorUtility.DisplayProgressBar(
                    "Add Target Specifics for " + btg.ToString(),
                    "Looking at icons and splash screens for targetgroups",
                    (float)counter / (float)countTo);

                Texture2D[] buildTargetGroupTextures = UnityEditor.PlayerSettings.GetIconsForTargetGroup(btg);

                foreach (Texture2D curIcon in buildTargetGroupTextures)
                {
                    //Early out if it already exist
                    if (curIcon == null || m_BuildSizeList.Exists(val => val.Path == AssetDatabase.GetAssetPath(curIcon)))
                    {
                        continue;
                    }

                    BuildReportAsset newAsset = new BuildReportAsset();

                    newAsset.SetAssetInfo(curIcon, AssetDatabase.GetAssetPath(curIcon));
                    newAsset.SetSize(0.0f, "--");
                    m_BuildSizeList.Add(newAsset);
                }
                AssetHunterHelper.UnloadUnused();
            }

            EditorUtility.ClearProgressBar();
        }
Exemplo n.º 3
0
 public AssetObjectInfo(string path, SerializableSystemType type)
 {
     this.m_Path = path;
     string[] parts = path.Split('/');
     this.m_Name = parts[parts.Length - 1];
     this.m_Type = type;
     System.IO.FileInfo fileInfo = new System.IO.FileInfo(path);
     this.m_FileSize       = fileInfo.Length;
     this.m_FileSizeString = AssetHunterHelper.BytesToString(m_FileSize);
 }
Exemplo n.º 4
0
        internal void SetAssetInfo(UnityEngine.Object obj, string path)
        {
            this.m_path = path;
            string[] parts = path.Split('/');
            this.m_name = parts[parts.Length - 1];

            m_assetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(path);
            m_type      = new SerializableSystemType(obj.GetType());

            AssetHunterHelper.UnloadUnused();
        }
Exemplo n.º 5
0
        internal void AddPlatformSpecificAssets()
        {
            int counter = 0;
            int countTo = Enum.GetValues(typeof(BuildTargetGroup)).Length;

            //TODO Get all the different splash screens and config files somehow
            List <UnityEngine.Object> splash = new List <UnityEngine.Object>();

            splash.Add(UnityEditor.PlayerSettings.xboxSplashScreen);

            //Loop the entries
            foreach (UnityEngine.Object obj in splash)
            {
                //Early out if it already exist
                if (obj == null || m_BuildSizeList.Exists(val => val.Path == AssetDatabase.GetAssetPath(obj)))
                {
                    continue;
                }

                BuildReportAsset newAsset = new BuildReportAsset();

                newAsset.SetAssetInfo(obj, AssetDatabase.GetAssetPath(obj));
                newAsset.SetSize(0.0f, "--");
                m_BuildSizeList.Add(newAsset);
            }

            //TODO And the icons from METRO as well

#if !UNITY_5
            List <string> targetResourcePaths = new List <string>();
            targetResourcePaths.Add(UnityEditor.PlayerSettings.Metro.certificatePath);
            targetResourcePaths.AddRange(getWin8AssetPaths());

            //Loop the paths
            foreach (string path in targetResourcePaths)
            {
                //Early out if it already exist
                if (string.IsNullOrEmpty(path) || m_BuildSizeList.Exists(val => val.Path == path))
                {
                    continue;
                }

                UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(UnityEngine.Object));

                if (obj != null)
                {
                    BuildReportAsset newAsset = new BuildReportAsset();
                    newAsset.SetAssetInfo(AssetDatabase.LoadAssetAtPath(path, typeof(UnityEngine.Object)), path);
                    newAsset.SetSize(0.0f, "--");
                    m_BuildSizeList.Add(newAsset);
                }
            }
#endif

            //Loop icons in buildtargetgroups
            foreach (BuildTargetGroup btg in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
            {
                EditorUtility.DisplayProgressBar(
                    "Add Target Specifics for " + btg.ToString(),
                    "Looking at icons and splash screens for targetgroups",
                    (float)counter / (float)countTo);

                Texture2D[] buildTargetGroupTextures = UnityEditor.PlayerSettings.GetIconsForTargetGroup(btg);

                foreach (Texture2D curIcon in buildTargetGroupTextures)
                {
                    //Early out if it already exist
                    if (curIcon == null || m_BuildSizeList.Exists(val => val.Path == AssetDatabase.GetAssetPath(curIcon)))
                    {
                        continue;
                    }

                    BuildReportAsset newAsset = new BuildReportAsset();

                    newAsset.SetAssetInfo(curIcon, AssetDatabase.GetAssetPath(curIcon));
                    newAsset.SetSize(0.0f, "--");
                    m_BuildSizeList.Add(newAsset);
                }
                AssetHunterHelper.UnloadUnused();
            }

            EditorUtility.ClearProgressBar();
        }