Esempio n. 1
0
    public void rackGenerator()
    {
        string Rack = ServerIn.Get_Rack();

        if (ServerIn.Get_Ready_to_Recv())
        {
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 27; j++)
                {
                    if (Rack[i] == tiles[j].GetComponent <Tile>().letter)
                    {
                        globalGameRack.setRack(i, tiles[j], true);
                        break;
                    }
                }
            }

            for (int i = 0; i < 7; i++)
            {
                privateTile = Instantiate(globalGameRack.getTileOnRack(i));
                privateTile.transform.SetParent(slots[i].transform, true);
            }
        }
    }
Esempio n. 2
0
    public void submit()
    {
        if (!checkInDictionaryCol() || !checkInDictionaryRow())
        {
            ServerIn.Set_Message_From_Teacher("This is an invalid move");
            return;
        }

        Debug.Log("Submit works");
        for (int x = 0; x < 15; x++)     // Column
        {
            for (int y = 0; y < 15; y++) // Row
            {
                if (!GameManager.globalGameBoard.getBoard(x, y))
                {
                    Debug.Log("X = " + x + ",Y = " + y + GameManager.globalGameBoard.getTileOnBoard(x, y).GetComponent <Draggable>().getDrag());
                    if (!GameManager.globalGameBoard.getTileOnBoard(x, y).GetComponent <Draggable>().getDrag())
                    {
                        GameManager.bestMoveBoard.setBoard(x, y, GameManager.globalGameBoard.getTileOnBoard(x, y), false);
                    }
                    else
                    {
                        if (colStart == -1 && rowStart == -1)
                        {
                            colStart = x;
                            rowStart = y;
                        }
                        else
                        {
                            if (x > colStart)
                            {
                                ServerIn.Set_Horizontal_From_Gui(true); // Orientation is horizontal
                            }
                            else if (y > rowStart)
                            {
                                ServerIn.Set_Horizontal_From_Gui(false); // Orientation is vertical
                            }
                        }
                        wordOnBoard += GameManager.globalGameBoard.getTileOnBoard(x, y).GetComponent <Tile>().letter.ToString();
                        GameManager.globalGameBoard.getTileOnBoard(x, y).GetComponent <Draggable>().setDrag(false);
                    }
                }
            }
        }

        ServerIn.Set_Start_Col_From_Gui(colStart.ToString());
        ServerIn.Set_Start_Row_From_Gui(rowStart.ToString());
        ServerIn.Set_Word_From_GUi(wordOnBoard.ToLower());
        rowStart = -1;
        colStart = -1;
        Debug.Log(wordOnBoard.ToLower());
        ServerIn.Set_Ready_to_Send(true);
    }
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     rackGenerator();
     ServerIn.Set_Ready_to_Recv(false);
 }
Esempio n. 4
0
 // Update is called once per frame
 void Update()
 {
     suggestionTextbox.text = ServerIn.getTeacherOpinion();
 }