/// <summary> /// ワークシートからセル画像をロードします /// </summary> /// <param name="sheet">ロード元の画像</param> /// <param name="images">画像と名前のテーブル</param> /// <param name="animes">アニメーションと名前のテーブル</param> void LoadImages(dynamic sheet) { var imagePairs = new Dictionary <string, CellImage>(); var animePairs = new Dictionary <string, CellAnimation>(); int currentLine = 2; while (!String.IsNullOrEmpty((sheet.Cells[currentLine, 1].Text))) { var name = sheet.Cells[currentLine, 1].Text; var rect = CellRectangle.LoadImageInfo(sheet, currentLine); var frame = sheet.Cells[currentLine, 6].Text; var image = new CellImage(sheet, rect); imagePairs.Add(name, image); var frameCount = Int32.Parse(frame); //一枚以上あるなら if (frameCount > 1) { //アニメーションを読み込み animePairs.Add(name, CellAnimation.Load(sheet, rect, frameCount)); } currentLine++; } images = imagePairs; animations = animePairs; }
public CellImage(dynamic sheet, CellRectangle rect, bool isDeletedBoarder = true) { Rectangle = rect; Image = sheet.Range[sheet.Cells[Row, Column], sheet.Cells[Row + Height - 1, Column + Width - 1]]; if (isDeletedBoarder) { Image.Borders.LineStyle = 0; } }
/// <summary> /// アニメーションをロードします /// </summary> /// <param name="sheet">取得元のワークシート</param> /// <param name="rect">一つのフレームの大きさ</param> /// <param name="frameCount">フレーム数</param> /// <returns>取得されたアニメーション</returns> public static CellAnimation Load(dynamic sheet, CellRectangle rect, int frameCount) { var imageList = new List <CellImage>(); for (int i = 0; i < frameCount; i++) { var rec = new CellRectangle() { Row = rect.Row + rect.Height * i, Column = rect.Column, Width = rect.Width, Height = rect.Height, }; var img = new CellImage(sheet, rec); imageList.Add(img); } imageList.Reverse(); return(new CellAnimation(imageList.ToArray())); }