Exemplo n.º 1
0
        protected override void DoInit()
        {
            titleContent = new GUIContent(GetTitle());
            var all = new SimpleAll();

            data = all;
            ABAssetinfos assetInfos = new ABAssetinfos();

            assetInfos.LoadFromCsv(GetLoadCsvFile());

            var tab = new SimpleTab(assetInfos.sumStr);

            all.tabs.Add(tab);

            foreach (var ai in assetInfos.sortedAllAssetInfos)
            {
                var nodename = ai.asset + ", cnt=" + ai.containingABs.Count + ", mem=" +
                               ToolUtils.readableSize(ai.memSize) + ", cansave=" +
                               ToolUtils.readableSize(ai.canSaveMemSize);

                var node = new SimpleNode(nodename, ai.containingABs)
                {
                    attach = ai
                };
                tab.nodes.Add(node);
            }
        }
Exemplo n.º 2
0
        public static void CheckDuplicate(string dupcsvfn)
        {
            _markedAsset2Bundle = new Dictionary <string, string>();
            foreach (var bundle in AssetDatabase.GetAllAssetBundleNames())
            {
                foreach (var asset in AssetDatabase.GetAssetPathsFromAssetBundle(bundle))
                {
                    _markedAsset2Bundle.Add(asset, bundle);
                }
            }

            Debug.Log("marked asset count=" + _markedAsset2Bundle.Count);
            _allAssetInfos = new Dictionary <string, ABAssetinfos.AssetInfo>();
            foreach (var kv in _markedAsset2Bundle)
            {
                CollectUnmarkedAsset(kv.Key, kv.Value);
            }

            foreach (var kv in _markedAsset2Bundle)
            {
                var ai = new ABAssetinfos.AssetInfo {
                    asset = kv.Key, isMarked = true
                };
                ai.containingABs.Add(kv.Value);
                _allAssetInfos.Add(kv.Key, ai);
            }
            Debug.Log("all asset count=" + _allAssetInfos.Count);


            _assetInfos = new ABAssetinfos();
            foreach (var kv in _allAssetInfos)
            {
                var ai = kv.Value;
                ai.memSize           = (int)CalcSize(kv.Key);
                ai.containingABCount = ai.containingABs.Count;
                ai.canSaveMemSize    = ai.memSize * (ai.containingABCount - 1);
                _assetInfos.Add(ai);
            }

            _assetInfos.Sort();
            _assetInfos.Sum();

            Resources.UnloadUnusedAssets();


            Debug.Log(_assetInfos.sumStr);

            _assetInfos.SaveToCsv(dupcsvfn);
            Debug.Log("save to " + dupcsvfn);
        }