using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; namespace Chop.Game.Rooms.Games { public class ArenaTemplate { public enum bbTileState { Default = 0, Touched = 1, Clicked = 2, Pressed = 3, Sealed = 4 } public enum bbTileColor { Disabled = -2, Default = -1, Red = 0, Blue = 1, Yellow = 2, Green = 3 } public string Heightmap; public byte[,] Height; public bool[,] Blocked; public bbTileState[,] bbTState; public bbTileColor[,] bbTColor; public int maxX; public int maxY; public ArenaTemplate() { Heightmap = "xxxx000000000000000xxxx" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "00000000000000000000000" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9) + "xxxx000000000000000xxxx" + Convert.ToChar(9); string[] dynHeightmap = Heightmap.Split(Convert.ToChar(9)); maxX = dynHeightmap[0].Length; maxY = dynHeightmap.Length - 1; bbTState = new bbTileState[maxX, maxY]; bbTColor = new bbTileColor[maxX, maxY]; Height = new byte[maxX, maxY]; Blocked = new bool[maxX, maxY]; string[] _T = ("00001111111111111110000" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "11111111111111111111111" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9) + "00001111111111111110000" + Convert.ToChar(9)).Split(Convert.ToChar(9)); for (int y = 0; y < maxY; y++) { for (int x = 0; x < maxX; x++) { char q = dynHeightmap[y][x]; if (q == 'x') // blocked { Blocked[x, y] = true; bbTColor[x, y] = bbTileColor.Disabled; bbTState[x, y] = bbTileState.Sealed; } else { Height[x, y] = (byte)q; if(_T[y][x] == '1') bbTColor[x, y] = bbTileColor.Default; else { bbTColor[x, y] = bbTileColor.Disabled; bbTState[x, y] = bbTileState.Sealed; } } } } } //public static ArenaTemplate Parse(DataRow row) //{ //} } }