private void AssignQuestion() { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { int number = SudokuDataManagement.GetNumber(difficulty, sudokuIndex, i, j); if (SudokuDataManagement.GetExistedInQues(difficulty, sudokuIndex, i, j)) { images[i, j].sprite = 一到九圖案[number - 1]; GameObject tempG = images[i, j].transform.parent.GetChild(0).gameObject; tempG.SetActive(true); tempG.GetComponent <Image>().sprite = QuestionPanel; recordedNumbers[i, j] = number; } else { recordedNumbers[i, j] = 0; } } } }
public void ClickConfirm() { if (chosenGridPosRow != -1) { grids[chosenGridPosRow, chosenGridPosCol].transform.parent.GetChild(0).gameObject.SetActive(false); } chosenGridPosRow = -1; chosenGridPosCol = -1; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (recordedNumbers[i, j] != SudokuDataManagement.GetNumber(difficulty, sudokuIndex, i, j)) { EndImage.sprite = 失敗; EndPanel.SetActive(true); return; } } } EndImage.sprite = 正確; EndPanel.SetActive(true); SudokuDataManagement.SetIndexPlayed(sudokuIndex, difficulty); }