Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MapRow
- {
- public List<MapCell> Columns = new List<MapCell>();
- }
- class Map()
- {
- public List<MapRow> Rows = new List<MapRow>();
- private static int GetRowLength(string path)
- {
- var maxLength = File.ReadLines(path).Max(x => x.Length);
- return maxLength;
- }
- private int GetRownumber(string path)
- {
- var lineCount = File.ReadAllLines(path).Length;
- return lineCount;
- }
- static void Main(string[] args)
- {
- string path = @"map.txt";
- float RowLength = GetRowLength(path);
- float RowNumber = GetRownumber(path);
- string[,] item = new string[(int)RowLength, (int)RowNumber]; //(int most került be)
- string[] line = File.ReadAllLines("map.map");
- for (int j = 0; j < RowNumber; j++)
- {
- for (int i = 1; i < RowLength; i++)
- {
- item[i, j] = line[j].Substring(i, 1);
- if (item[i, j] == "0")
- Rows[j].Columns[i].TileID = 0;
- else if (item[i, j] == "1")
- Rows[j].Columns[i].TileID = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment