Esempio n. 1
0
    public void ChooseGrid(GameObject g)
    {
        int tempRow = -1, tempCol = -1;

        for (int i = 0; i < 9; i++)
        {
            for (int j = 0; j < 9; j++)
            {
                if (grids[i, j] == g)
                {
                    tempRow = i;
                    tempCol = j;
                }
            }
        }
        if (!SudokuDataManagement.GetExistedInQues(difficulty, sudokuIndex, tempRow, tempCol))
        {
            if (chosenGridPosRow != -1)
            {
                grids[chosenGridPosRow, chosenGridPosCol].transform.parent.GetChild(0).gameObject.SetActive(false);
            }

            g.transform.parent.GetChild(0).gameObject.SetActive(true);
            chosenGridPosRow = tempRow;
            chosenGridPosCol = tempCol;
        }
    }
Esempio n. 2
0
 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;
             }
         }
     }
 }