public void HideBoard() { CubeBoard board = GameObject.FindObjectOfType(typeof(CubeBoard)) as CubeBoard; if (board.enabled) { board.enabled = false; } this.lastTilesClicked.Clear(); }
public void SaveBoardAsProperty() { CubeBoard board = GameObject.FindObjectOfType(typeof(CubeBoard)) as CubeBoard; this.turnNumber = this.turnNumber + 1; this.lastTurnPlayer = this.LocalPlayer.ID; Hashtable boardProps = board.GetBoardAsCustomProperties(); boardProps.Add("lt", this.lastTurnPlayer); // "lt" is for "last turn" and contains the ID/actorNumber of the player who did the last one boardProps.Add("t#", this.turnNumber); this.OpSetCustomPropertiesOfRoom(boardProps); Debug.Log("saved board to props " + SupportClass.DictionaryToString(boardProps)); }
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(); }
// Use this for initialization void Start() { rightToolBar = new Rect(Screen.width - rightToolBar.width - rightToolBar.x, rightToolBar.y, rightToolBar.width, Screen.height - rightToolBar.y); board = GameObject.FindObjectOfType(typeof(CubeBoard)) as CubeBoard; Debug.Log(board); }