private XTPListImage(XTPListFile plist, Image image, bool isCache) { this.m_plist = plist; this.m_texture = image; if (!isCache) { this.m_frames = null; } else { this.m_frames = new Dictionary <string, XTFrameInfo>(); } }
//----------------------------------------------------------- // public //----------------------------------------------------------- // 如果 PList 文件格式不正确,则抛出:XTInvalidPListFileException 异常 // 如果加载图片资源失败,则抛出 XTNotFoundPListImageFileException 异常 public static XTPListImage FromFile(string file, bool isCache = true) { XTPListFile plfile = XTPListFile.Create(file, isCache); if (plfile == null) { return(null); } Image image; try { image = Image.FromFile(plfile.TextureFilePath); } catch { throw new XTNotFoundPListImageFileException(file, plfile.TextureFilePath); } return(new XTPListImage(plfile, image, isCache)); }