Dictionary <string, Dictionary <Sprite, HashSet <Object> > > GetAtlasInfo(Dictionary <Sprite, HashSet <Object> > allUsed, Dictionary <Sprite, SimpleSpriteInfo> sprCache) { Dictionary <string, Dictionary <Sprite, HashSet <Object> > > infoDictionary = new Dictionary <string, Dictionary <Sprite, HashSet <Object> > >(); foreach (var pair in allUsed) { Sprite spr = pair.Key; SimpleSpriteInfo sprData = sprCache[spr]; Dictionary <Sprite, HashSet <Object> > dict; if (!infoDictionary.TryGetValue(sprData.PackingTag, out dict)) { dict = new Dictionary <Sprite, HashSet <Object> >(); infoDictionary.Add(sprData.PackingTag, dict); } // HashSet <Object> references; if (!dict.TryGetValue(spr, out references)) { references = pair.Value; dict.Add(spr, references); } else { Debug.LogError("Dupliate Sprite Data ", spr); } } return(infoDictionary); }
string GetSprInfo(ref SimpleSpriteInfo sprData) { return(string.Format("PackingTag:{0} MipMap:{1} BundleName:{2} Path:{3}", sprData.PackingTag, AssetBundleEditorHelper.GetColorText("{0}", Color.yellow, sprData.Mipmap), AssetBundleEditorHelper.GetColorText("{0}", Color.blue, sprData.BundleName), AssetBundleEditorHelper.GetColorText("{0}", Color.gray, sprData.AssetPath))); }
SimpleSpriteInfo GetSpriteData(Dictionary <Sprite, SimpleSpriteInfo> sprCache, Sprite spr) { SimpleSpriteInfo data = new SimpleSpriteInfo(); if (sprCache.TryGetValue(spr, out data)) { return(data); } else { data.Sprite = spr; data.MemSize = AssetBundleEditorHelper.ConvertSize(Profiler.GetRuntimeMemorySizeLong(spr)); data.TexMemSize = AssetBundleEditorHelper.ConvertSize(Profiler.GetRuntimeMemorySizeLong(spr.texture)); data.InstanceId = spr.GetInstanceID(); data.TexSize = spr.rect.size; data.AssetPath = AssetDatabase.GetAssetPath(spr); data.TexName = spr.texture.name; data.TexPath = AssetDatabase.GetAssetPath(spr.texture); data.Importer = (TextureImporter)TextureImporter.GetAtPath(data.TexPath); if (data.Importer) { data.Mipmap = data.Importer.mipmapEnabled; data.BundleName = data.Importer.assetBundleName; if (string.IsNullOrEmpty(data.Importer.spritePackingTag)) { data.PackingTag = SimpleSpriteInfo.EmptyTag; } else { data.PackingTag = data.Importer.spritePackingTag; } } else if (data.TexPath == "Resources/unity_builtin_extra") { data.PackingTag = BuildInTag; } else if (data.TexPath.EndsWith("/Resources") || data.TexPath.Contains("/Resources/")) { data.PackingTag = ResourcesTag; } else { Debug.LogError("Missing " + data.TexPath); data.PackingTag = "Missing"; } sprCache.Add(spr, data); } return(data); }