Exemplo n.º 1
0
        /// <summary>
        /// Handles a click on the "Start" button.
        /// </summary>
        private void HandleStart()
        {
            if (_needsExtraInfo && !TryGetExtraInfo())
            {
                _popup.Message = $"PROVIDE THE MODE {_matchMode.InfoName().ToUpper()} BEFORE STARTING A MATCH";
                _popup.Show();
                return;
            }

            MatchSettings settings;

            if (_needsExtraInfo)
            {
                settings = new MatchSettings(_matchMode, _extraInfo);
            }
            else
            {
                settings = new MatchSettings(_matchMode);
            }
            OnStartMatch?.Invoke(settings);

            bool TryGetExtraInfo()
            {
                var culture = CultureInfo.InvariantCulture;

                if (int.TryParse(_extraInfoInput.text, NumberStyles.Integer, culture, out var value) && value > 0)
                {
                    _extraInfo = (uint)value;
                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 2
0
 private void OnClick()
 {
     if (IsPause)
     {
         IsPause = false;
         OnStartMatch?.Invoke();
     }
 }
Exemplo n.º 3
0
 private void StartMatch(MatchSettings settings)
 {
     OnStartMatch?.Invoke(settings);
     _currentScreen = null;
 }