///// Event handlers ///// private void OnSendingMatchRequest(object sender, MatchRequestEventArgs e) { // Set popup var popup = PopupPanel.InstanciateWaitingPopupCancelButton(); popup.Text = "Waiting for \n<color=#66FFD9><b>" + e.User.UserName + "</b></color>"; popup.CancelButton.onClick.AddListener(() => { Destroy(popup.gameObject); Debug.Log("CancelButton clicked"); MatchRequestUpdated?.Invoke(this, new MatchRequestEventArgs(e.User, MatchRequestEventArgs.EStatus.Canceled)); }); popup.StatorAnimation.StartRotate(1); // Set popup updater function var popupUpdater = MatchRequestResponseUpdaterGen(popup, e.User); popupUpdaters.Add(popupUpdater); popup.Disabled += (sender_, e_) => popupUpdaters.Remove(popupUpdater); // Notify web client MatchRequestUpdated?.Invoke(this, new MatchRequestEventArgs(e.User, MatchRequestEventArgs.EStatus.New)); }