public override void CalculateSteps() { tilemapChip = engine.tilemapChip; totalTiles = tilemapChip.total; gameChip = engine.gameChip; var colorMapChip = engine.chipManager.GetChip(ColorMapParser.chipName, false) as ColorChip; colors = colorMapChip == null ? engine.colorChip.colors : colorMapChip.colors; var spriteChip = engine.spriteChip; width = spriteChip.width * tilemapChip.columns; height = spriteChip.height * tilemapChip.rows; spriteSize = gameChip.SpriteSize(); var size = gameChip.SpriteSize(); totalPixels = size.x * size.y; loops = (int)Math.Ceiling((float)totalTiles / maxTilesPerLoop); base.CalculateSteps(); CalculateProcessingSteps(); }
public TilemapParser(IImageParser parser, ColorChip colorChip, SpriteChip spriteChip, TilemapChip tilemapChip) : base(parser, colorChip, spriteChip) { this.tilemapChip = tilemapChip; autoImport = tilemapChip.autoImport; }
// private ITexture2D tileFlagTex; // private IColor clear; // // private int flag; // private int offset; public TilemapParser(IImageParser imageParser, byte[] tileFlagData, IEngineChips chips) : base(imageParser, chips) { tilemapChip = chips.tilemapChip; autoImport = tilemapChip.autoImport; // clear = new ColorData(0f){a = 0f}; maskColor = ColorUtils.HexToColor(chips.colorChip.maskColor); }
public TilemapParser(ITexture2D tex, ITexture2D tileFlagTex, IEngineChips chips) : base(tex, chips) { //Debug.Log("Parse Tilemap"); tilemapChip = chips.tilemapChip; this.tileFlagTex = tileFlagTex; autoImport = tilemapChip.autoImport; flagColorChip = chips.chipManager.GetChip(FlagColorParser.flagColorChipName, false) as ColorChip; clear = new ColorData { a = 0 }; maskColor = new ColorData(chips.colorChip.maskColor); }
private void SerializeTilemapChip(TilemapChip tilemapChip) { JsonUtil.GetLineBreak(sb); sb.Append("\"TilemapChip\":"); JsonUtil.GetLineBreak(sb); sb.Append("{"); JsonUtil.GetLineBreak(sb, 1); // Columns sb.Append("\"columns\":"); sb.Append(tilemapChip.columns); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); // Rows sb.Append("\"rows\":"); sb.Append(tilemapChip.rows); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); // Total Flags sb.Append("\"totalFlags\":"); sb.Append(tilemapChip.totalFlags); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); sb.Append("\"autoImport\":"); sb.Append(tilemapChip.autoImport.ToString().ToLower()); sb.Append(","); JsonUtil.GetLineBreak(sb, 1); JsonUtil.GetLineBreak(sb); sb.Append("}"); sb.Append(","); currentStep++; }