void GenSeed(DOMSymbolItem item, string _path) { if (cursprite.seeds.ContainsKey(item.name)) { return; } else { Seed seed = new Seed(); aniconv.xfl.DOMSymbolItem.DOMTimeline.DOMLayer.DOMFrame.DOMBitmapInstance binst = item.m_timeline.m_DOMTimeline.layers[0].frames[0].elements[0]; string bestfile = GetBestFile(_path, binst.libraryItemName); if (string.IsNullOrEmpty(bestfile)) { throw new Exception(binst.libraryItemName + ":少了张图"); } seed.texname = bestfile.Substring(resourcepath.Length + 1); string seedname = System.IO.Path.GetFileNameWithoutExtension(seed.texname); var image = Image.FromFile(bestfile); seed.size.X = image.Width; seed.size.Y = image.Height; image.Dispose(); if (binst.matrix.Count > 0) { seed.orient.X = -binst.matrix[0].tx; seed.orient.Y = -binst.matrix[0].ty; } cursprite.seeds[seedname] = seed; seedchange[item.name] = seedname; } }
void GenSeed(DOMSymbolItem item, string _path) { //if (cursprite.seeds.ContainsKey(item.name)) //{ // return; //} //else { Seed seed = new Seed(); aniconv.xfl.DOMSymbolItem.DOMTimeline.DOMLayer.DOMFrame.DOMBitmapInstance binst = item.m_timeline.m_DOMTimeline.layers[0].frames[0].elements[0]; string bestfile = GetBestFile(_path, binst.libraryItemName); if (string.IsNullOrEmpty(bestfile)) { throw new Exception(binst.libraryItemName + ":少了张图"); } seed.texname = bestfile.Substring(resourcepath.Length + 1); string seedname = System.IO.Path.GetFileNameWithoutExtension(seed.texname); if (seedname.IndexOf("_dummy") == 0) { //dummyseed 不导出 return; } var image = Image.FromFile(bestfile); seed.size.X = image.Width; seed.size.Y = image.Height; image.Dispose(); if (binst.matrix.Count > 0) { seed.orient.X = -binst.matrix[0].tx; seed.orient.Y = -binst.matrix[0].ty; } if (cursprite.seeds.ContainsKey(seedname)) { // Console.WriteLine("Seed以有,对比"); var oldseed = cursprite.seeds[seedname]; if (System.IO.Path.GetFileName(oldseed.texname) != System.IO.Path.GetFileName(seed.texname)) { throw new Exception(seed.texname + ":seed源图冲突"); } else if (oldseed.size.Equals(seed.size) == false) { throw new Exception(System.IO.Path.GetFileName(seed.texname) + ":seed尺寸冲突"); } else if (oldseed.orient.Equals(seed.orient) == false) { //seed 锚点冲突 //Console.WriteLine("Seed冲突,需要新建"); string subname = System.IO.Path.GetFileName(_path); seedname += "_" + subname; logger.Log(LogLevel.Waring, seedname + ":Seed 冲突,已解决"); cursprite.seeds[seedname] = seed; seedchange[item.name + "_" + subname] = seedname; } else { return; } } cursprite.seeds[seedname] = seed; seedchange[item.name] = seedname; } }