예제 #1
0
    public void UpdateBoard()
    {
        // we set properties "lt" (last turn) and "t#" (turn number). those props might have changed
        // it's easier to use a variable in gui, so read the latter property now
        if (this.CurrentRoom.CustomProperties.ContainsKey("t#"))
        {
            this.turnNumber = (int)this.CurrentRoom.CustomProperties["t#"];
        }
        else
        {
            this.turnNumber = 1;
        }
        if (this.CurrentRoom.CustomProperties.ContainsKey("lt"))
        {
            this.lastTurnPlayer = (int)this.CurrentRoom.CustomProperties["lt"];
        }
        else
        {
            this.lastTurnPlayer = 0;    // unknown
        }

        CubeBoard board = GameObject.FindObjectOfType(typeof(CubeBoard)) as CubeBoard;

        if (!board.enabled)
        {
            board.enabled = true;
            board.ResetTileValues();
        }

        Hashtable roomProps = this.CurrentRoom.CustomProperties;
        bool      success   = board.SetBoardByCustomProperties(roomProps);

        Debug.Log("loaded board from room props. Success: " + success);

        board.ShowCubes();
    }