public void UpdateConnectionButton(ConnectionManager.State state) { if (state == ConnectionManager.State.CLOSED) { connectButton.gameObject.SetActive(true); } else { connectButton.gameObject.SetActive(false); } if (state == ConnectionManager.State.OPEN) { disconnectButton.gameObject.SetActive(true); } else { disconnectButton.gameObject.SetActive(false); } }
public void Update() { //Check changes in connection status to the webserver ConnectionManager.State connectionState = ConnectionManager.Instance.GetState(); if (connectionState != lastConnectionState) { lastConnectionState = connectionState; if (connectionState == ConnectionManager.State.OPEN) { RequestScore(); leaderboardDirty = true; } uiManager.UpdateConnectionButton(connectionState); } //Do actions in the queue lock (actionQueueLock) { if (actionQueue.Count > 0) { foreach (Action action in actionQueue) { action(); } actionQueue.Clear(); } } //Request leaderboard if needed if (leaderboardDirty) { leaderboardDirty = false; RequestLeaderboard(); } }