public void LoadGame() { string json = JsonDataGame.text; SavaDataGame a = JsonUtility.FromJson <SavaDataGame>(json); //InforShapeSplit.InforShape = ListToDirectoryShape(a.shape); //InforShapeSplit.List_Point = ListToDataGamePositon(a.Postion); InforShapeSplit.ArrayDataGameShape = a.shape.ToArray(); InforShapeSplit.ArrayPositonShape = a.Postion.ToArray(); // StartCoroutine(Start_1(a.shape, a.Postion)); // //Debug.Log("FILE : " + InforShapeSplit.InforShape.Count); //Debug.Log("FILE : " + InforShapeSplit.List_Point.Count); InforShapeSplit.Filter(); CompleteCode = true; Debug.Log("Loading"); }
public void Process(int[,] matrix, string keyRoll) { //First Commit -m: for (int i = 0; i < matrix.GetLength(0); i++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntBefor(i); int[] column = new int[0]; for (int r = 0; r < row.Length; r++) { key += row[r]; } key += "]"; key += "["; for (int c = 0; c < column.Length; c++) { // key += column[c].ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, null, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } for (int i = 0; i < matrix.GetLength(1); i++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = new int[0]; int[] column = getListIntBefor(i); for (int r = 0; r < row.Length; r++) { // key += r.ToString(); } key += "]"; key += "["; for (int c = 0; c < column.Length; c++) { key += column[c].ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, null, column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntBefor(i); int[] column = new int[1] { j }; for (int r = 0; r < row.Length; r++) { key += r.ToString(); } key += "]"; key += "["; for (int c = 0; c < column.Length; c++) { key += column[c].ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = new int[1] { i }; int[] column = getListIntBefor(j); for (int r = 0; r < row.Length; r++) { key += row[r]; } key += "]"; key += "["; for (int c = 0; c < column.Length; c++) { key += c.ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntBefor(i); int[] column = getListIntBefor(j); for (int r = 0; r < row.Length; r++) { key += r.ToString(); } key += "]"; key += "["; for (int c = 0; c < column.Length; c++) { key += c.ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntForward(i, matrix.GetLength(0)); int[] column = getListIntForward(j, matrix.GetLength(1)); for (int r = 0; r < row.Length; r++) { key += r.ToString(); } key += "]"; key += "["; for (int c = 0; c < column.Length; c++) { key += c.ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } for (int i = 0; i < matrix.GetLength(0); i++) { string col = "[]"; string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntBefor(i); for (int r = 0; r < row.Length; r++) { key += r.ToString(); } key += "]"; key += col; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, null, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } for (int i = 0; i < matrix.GetLength(0); i++) { string col = "[]"; string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntForward(i, matrix.GetLength(0)); for (int r = 0; r < row.Length; r++) { key += row[r]; } key += "]"; key += col; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, null, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row = getListIntForward(i, matrix.GetLength(0)); for (int r = 0; r < row.Length; r++) { key += row[r]; } key += "]"; key += "["; int[] Column = new int[1] { j }; for (int c = 0; c < Column.Length; c++) { key += Column[c]; } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, row, Column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - "; string Row = "[]"; key += Row; int[] Column = getListIntBefor(j); key += "["; for (int c = 0; c < Column.Length; c++) { key += c.ToString(); } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, null, Column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - "; string Row = "[]"; key += Row; int[] Column = getListIntForward(j, matrix.GetLength(1)); key += "["; for (int c = 0; c < Column.Length; c++) { key += Column[c]; } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, null, Column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] Row = new int[1] { i }; for (int r = 0; r < Row.Length; r++) { key += Row[r]; } key += "]"; int[] Column = getListIntForward(j, matrix.GetLength(1)); key += "["; for (int c = 0; c < Column.Length; c++) { key += Column[c]; } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, Row, Column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } //Final for (int i = -1; i < matrix.GetLength(0); i++) { for (int j = -1; j < matrix.GetLength(1); j++) { Debug.Log("RORRRR : " + i + j); string TypeShape = "CUT" + " - "; string key = keyRoll + " - " + "["; int[] row; int[] column; if (i != -1) { row = new int[1] { i }; } else { row = null; } if (j != -1) { column = new int[1] { j }; } else { column = null; } if (i != -1) { for (int r = 0; r < row.Length; r++) { key += row[r]; } } key += "]"; key += "["; if (j != -1) { for (int c = 0; c < column.Length; c++) { key += column[c]; } } key += "]"; TypeShape += key + " - "; Debug.Log("KEY ::::::::: " + key); if (InforShape.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = new List <int[, ]>(); if (i == -1) { TotalMatrixSplit = SplitMatrix(matrix, null, column, out ListPoint); } else if (j == -1) { TotalMatrixSplit = SplitMatrix(matrix, row, null, out ListPoint); } else { TotalMatrixSplit = SplitMatrix(matrix, row, column, out ListPoint); } //Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); // Debug.log("Complete : " + key); } } }
public void Process_1(int[,] matrix, string keyRoll) { //for (int i = 0; i < matrix.GetLength(0); i++) //{ // //1 /// // List<List<int>> ListTopHopRow = new List<List<int>>(); // ToHop toHopRow = new ToHop(); // Debug.Log("TH ROW: " + i + " " + (matrix.GetLength(0) - 1)); // ListTopHopRow = toHopRow.Start_Find(matrix.GetLength(0),i+1); // ////////////////////////// // for (int j = 0; j < matrix.GetLength(1); j++) // { // //2 /// // ToHop toHopColumn = new ToHop(); // List<List<int>> ListTopHopColumn = new List<List<int>>(); // Debug.Log("TH COLUMN: "+j+" "+ (matrix.GetLength(1) - 1)); // ListTopHopColumn = toHopColumn.Start_Find(matrix.GetLength(1),j+1); // for(int t = 0; t < ListTopHopColumn.Count; t++) // { // Debug.Log("COLUMN : " + CtrlGamePlay.RenderList(ListTopHopColumn[t])); // } // for(int r = 0; r < ListTopHopRow.Count; r++) // { // int[] row = ListTopHopRow[r].ToArray(); // for (int c = 0; c < ListTopHopColumn.Count; c++) // { // string TypeShape = "CUT" + " - "; // string key = keyRoll + " : " + "["; // int[] column = ListTopHopColumn[c].ToArray(); // for (int r1 = 0; r1 < row.Length; r1++) // { // key += row[r1]; // } // key += "]"; // key += "["; // for (int c1 = 0; c1 < column.Length; c1++) // { // key += column[c1]; // } // key += "]"; // TypeShape += key + " - "; // if (List_Point.ContainsKey(key)) // { // continue; // } // string TypeShapePoint = TypeShape; // List<Vector2> ListPoint = new List<Vector2>(); // List<int[,]> TotalMatrixSplit = SplitMatrix(matrix, row, column, out ListPoint); // Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); // for (int z = 0; z < TotalMatrixSplit.Count; z++) // { // string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; // TypeShape += ss; // Debug.Log(ss); // } // string sss = ListToString(ListPoint); // TypeShape += " - "; // TypeShape += sss; // Debug.Log(key); // InforShape.Add(key, TotalMatrixSplit); // List_Point.Add(key, ListPoint); // ReadFile.WriteString(TypeShape); // } // } // } //} //for (int i = 0; i < matrix.GetLength(0); i++) //{ // string col = "[]"; // ToHop ToHopRow_1 = new ToHop(); // List<List<int>> ListToHoprow = ToHopRow_1.Start_Find(matrix.GetLength(0), i + 1); // for (int r = 0; r < ListToHoprow.Count; r++) // { // string TypeShape = "CUT" + " - "; // string key = keyRoll + " : " + "["; // int[] Row = ListToHoprow[r].ToArray(); // string TypeShapePoint = ""; // for (int r1 = 0; r1 < Row.Length; r1++) // { // key += Row[r1]; // } // key += "]"; // key += col; // TypeShape += key + " - "; // if (List_Point.ContainsKey(key)) // { // continue; // } // List<Vector2> ListPoint = new List<Vector2>(); // List<int[,]> TotalMatrixSplit = SplitMatrix(matrix,Row, null, out ListPoint); // Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); // for (int z = 0; z < TotalMatrixSplit.Count; z++) // { // string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; // TypeShape += ss; // Debug.Log(ss); // } // string sss = ListToString(ListPoint); // TypeShape += " - "; // TypeShape += sss; // Debug.Log(key); // InforShape.Add(key, TotalMatrixSplit); // List_Point.Add(key, ListPoint); // ReadFile.WriteString(TypeShape); // } //} //////////// for (int j = 0; j < matrix.GetLength(1); j++) { ToHop ToHopColumn = new ToHop(); List <List <int> > Column = ToHopColumn.Start_Find(matrix.GetLength(1), j + 1); for (int c = 0; c < Column.Count; c++) { string TypeShape = "CUT" + " - "; string key = keyRoll + " : "; string Row = "[]"; key += Row; key += "["; int[] column = Column[c].ToArray(); for (int c1 = 0; c1 < column.Length; c1++) { key += column[c1]; } key += "]"; TypeShape += key + " - "; if (List_Point.ContainsKey(key)) { continue; } List <Vector2> ListPoint = new List <Vector2>(); List <int[, ]> TotalMatrixSplit = SplitMatrix(matrix, null, column, out ListPoint); Debug.Log("RENDER111 : " + TotalMatrixSplit.Count); for (int z = 0; z < TotalMatrixSplit.Count; z++) { string ss = InforShapeSplit.MatrixToString(TotalMatrixSplit[z]) + "||"; TypeShape += ss; Debug.Log(ss); } string sss = ListToString(ListPoint); TypeShape += " - "; TypeShape += sss; Debug.Log(key); InforShape.Add(key, TotalMatrixSplit); List_Point.Add(key, ListPoint); ReadFile.WriteString(TypeShape); } } }