///// Private methods ///// private void Awake() { RefreshButton = transform.Find("Refresh Button").GetComponent <Button>(); BackButton = transform.Find("Back Button").GetComponent <Button>(); SendRequestButton = transform.Find("Send Request Button").GetComponent <Button>(); ViewportContent = transform.Find("Scroll View/Viewport/Content").gameObject; ToggleGroup = ViewportContent.GetComponent <ToggleGroup>(); Opponents = new SharedUpdatable <List <User> >(); Opponents.UpdateAction = UpdateViewport; isClientConnected = new SharedUpdatable <bool>(); isClientConnected.UpdateAction = (bool value) => RefreshButton.interactable = value; isClientConnected.UpdateAction(GetComponentInParent <MainScript>().Client.is_connected); SelectedUser = null; BackButton.onClick.AddListener(RaiseExiting); RefreshButton.onClick.AddListener(RaiseUpdatingOpponentList); SendRequestButton.onClick.AddListener(RaiseSendingMatchRequest); SendRequestButton.interactable = false; /// Client simulation for testing //client = new OpponentListUpdater(); //client.OpponentListUpdated += OnOpponentListUpdated; //UpdatingOpponentList += client.OnUpdatingOpponentList; }
// ---- Private Methods ---- private void Awake() { RotatationSpeed = 10f; updateFunction = NoOpBehaviour; gameState = new SharedUpdatable <Game>(); gameState.UpdateAction = UpdateGameState; PlayerFillingObject = CrossPrefab; PlayerWonFillingObject = CrossWonPrefab; OpponentFillingObject = TorePrefab; OpponentWonFillingObject = ToreWonPrefab; mainScript = GetComponentInParent <MainScript>(); CreateGrid(); }
// Start is called before the first frame update void Awake() { OfflineColor = Color.red; OnlineColor = Color.green; OfflineText = "Offline"; OnlineText = "Online"; image = transform.Find("Background").GetComponent <Image>(); text = transform.Find("Text (TMP)").GetComponent <TextMeshProUGUI>(); image.color = OfflineColor; text.text = OfflineText; State = new SharedUpdatable <EState>(EState.Offline); State.UpdateAction = updateState; //TestClient client = new TestClient(); //client.Connected += OnConnected; //client.Disconnected += OnDisconnected; //client.Start(); }