private void SelectOnClose(GameObject selectOnClose)
        {
            if (selectOnClose != null && selectOnClose.activeInHierarchy)
            {
                IndependentSelectable.Select(selectOnClose.gameObject);
            }
            else
            {
                IndependentSelectable selectable = m_closeButton.GetComponent <IndependentSelectable>();
                if (selectable != null)
                {
                    Selectable nextSelectable = selectable.FindSelectableOnDown();
                    if (nextSelectable == null)
                    {
                        nextSelectable = selectable.FindSelectableOnLeft();
                        if (nextSelectable == null)
                        {
                            nextSelectable = selectable.FindSelectableOnRight();
                            if (nextSelectable == null)
                            {
                                nextSelectable = selectable.FindSelectableOnUp();
                            }
                        }
                    }

                    if (nextSelectable != null)
                    {
                        IndependentSelectable.Select(nextSelectable.gameObject);
                    }
                }
            }
        }
        private void OnSaveReplayAction(ButtonsPanel sender, int code)
        {
            m_saveReplayPanel.SetIsOpened(false);
            gameObject.SetActive(true);

            IndependentSelectable.Select(m_sequence[0]);
        }
 protected virtual void Awake()
 {
     if (m_sequence.Length > 0)
     {
         m_eventSystem = IndependentSelectable.GetEventSystem(m_sequence[0]);
     }
 }
 private void Update()
 {
     if (!m_progress.IsVisible)
     {
         if (m_inputProvider.IsCancelButtonDown)
         {
             IndependentSelectable.Select(m_backButton.gameObject);
             m_backButton.onClick.Invoke();
         }
         else if (m_inputProvider.IsAnyKeyDown && !Input.GetMouseButtonDown(0))
         {
             EventSystem eventSystem = IndependentSelectable.GetEventSystem(m_addBotButton);
             if (eventSystem.currentSelectedGameObject == null)
             {
                 if (m_addBotButton.interactable)
                 {
                     IndependentSelectable.Select(m_addBotButton.gameObject, 1);
                 }
                 else
                 {
                     IndependentSelectable.Select(m_goButton.gameObject, 1);
                 }
             }
         }
     }
 }
        private void GetPlayersAndDataBind()
        {
            GetPlayers(() =>
            {
                DataBind();
                UpdateButtonsState();
                if (m_goButton.interactable)
                {
                    IndependentSelectable.Select(m_goButton.gameObject);
                }
                else if (m_addBotButton.interactable)
                {
                    IndependentSelectable.Select(m_addBotButton.gameObject);
                }
                else
                {
                    IndependentSelectable.Select(m_goButton.gameObject);
                }

                if (m_room.IsReadyToLauch)
                {
                    Launch();
                }
            });
        }
        private void UpdateButtonsState()
        {
            m_backButton.interactable = m_navigation.CanGoBack;

            Text goButtonText = m_goButton.GetComponentInChildren <Text>();

            goButtonText.text = m_isReady ? "Ready" : "GO";

            if (m_players == null || m_room == null)
            {
                m_goButton.interactable        = false;
                m_addBotButton.interactable    = false;
                m_removeBotButton.interactable = false;
            }
            else
            {
                m_goButton.interactable        = m_players.Length > 1;
                m_addBotButton.interactable    = IsRoomCreator && m_players.Length < m_room.MapInfo.MaxPlayers;
                m_removeBotButton.interactable = IsRoomCreator && m_players.Any(p => p.BotType != BotType.None);
            }

            if (!m_addBotButton.interactable)
            {
                IndependentSelectable.Select(m_goButton.gameObject);
            }

            if (!m_removeBotButton.interactable)
            {
                IndependentSelectable.Select(m_addBotButton.gameObject);
            }
        }
Exemple #7
0
        protected override void OnEnable()
        {
            base.OnEnable();
            m_root.SetActive(true);
            m_goBackButton.interactable = m_navigation.CanGoBack;

            m_mapsListBox.Items  = null;
            m_progress.IsVisible = true;
            GameServer.GetPlayers(m_gSettings.ClientId, (error, players) =>
            {
                m_progress.IsVisible = false;
                if (GameServer.HasError(error))
                {
                    OutputError(error);
                    return;
                }

                m_progress.IsVisible = true;
                GameServer.GetMaps(m_gSettings.ClientId, (error2, mapsInfo) =>
                {
                    m_progress.IsVisible = false;
                    if (GameServer.HasError(error2))
                    {
                        OutputError(error2);
                        return;
                    }

                    m_maps = mapsInfo.Where(m => m.MaxPlayers >= players.Length).ToArray();
                    DataBindMaps();

                    IndependentSelectable.Select(m_mapsListBox.gameObject);
                    m_mapsListBox.IsFocused = true;
                });
            });
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            m_root.SetActive(true);
            IndependentSelectable.Select(m_joinButton.gameObject);
        }
Exemple #9
0
 private void OnLoginEndEdit(string value)
 {
     if (!string.IsNullOrEmpty(value))
     {
         IndependentSelectable.Select(m_passwordInput.gameObject);
         InputFieldWithVirtualKeyboard.ActivateInputField(m_passwordInput);
     }
 }
        private IEnumerator CoSelect()
        {
            yield return(new WaitForEndOfFrame());

            IndependentSelectable.Select(m_inputField.gameObject);
            InputFieldWithVirtualKeyboard.ActivateInputField(m_inputField);

            m_coSelect = null;
        }
        private void OnReadyClick()
        {
            m_notification.GetChild(LocalPlayerIndex).Close();

            if (CancelGo != null)
            {
                CancelGo(this);
            }

            m_goButton.gameObject.SetActive(true);
            m_readyButton.gameObject.SetActive(false);

            IndependentSelectable.Select(m_goButton.gameObject);
        }
Exemple #12
0
 private void Update()
 {
     if (!m_progress.IsVisible)
     {
         if (m_inputProvider.IsAnyKeyDown && !Input.GetMouseButtonDown(0))
         {
             EventSystem eventSystem = IndependentSelectable.GetEventSystem(m_roomsListBox);
             if (eventSystem.currentSelectedGameObject == null)
             {
                 IndependentSelectable.Select(m_roomsListBox.gameObject);
                 m_roomsListBox.IsFocused = true;
             }
         }
     }
 }
        public void Apply(GameObject root, int eventSystemIndex)
        {
            IndependentSelectable[] selectables = root.GetComponentsInChildren <IndependentSelectable>(true);

            for (int i = 0; i < selectables.Length; ++i)
            {
                IndependentSelectable selectable = selectables[i];
                selectables[i].EventSystem = m_eventSystems[eventSystemIndex];

                InputFieldWithVirtualKeyboard ifwvk = selectable as InputFieldWithVirtualKeyboard;
                if (ifwvk != null)
                {
                    ifwvk.VirtualKeyboard = m_virtualKeyboards[eventSystemIndex];
                }
            }
        }
        private void SelectFirstButton()
        {
            if (m_loginPanel.isActiveAndEnabled || m_signUpPanel.isActiveAndEnabled)
            {
                return;
            }

            if (m_player != null)
            {
                m_loggedInPanel.SetActive(true);
                IndependentSelectable.Select(m_goButton.gameObject);
                m_goButton.OnSelect(null);
            }
            else
            {
                m_loggedOffPanel.SetActive(true);
                IndependentSelectable.Select(m_loginButton.gameObject);
                m_loginButton.OnSelect(null);
            }
        }
Exemple #15
0
        protected override void OnEnable()
        {
            base.OnEnable();
            m_root.SetActive(true);
            m_goBackButton.interactable = m_navigation.CanGoBack;

            m_replaysListBox.Items = null;
            m_progress.IsVisible   = true;
            GameServer.GetReplays(m_gSettings.ClientId, (error, replays) =>
            {
                m_progress.IsVisible = false;
                if (GameServer.HasError(error))
                {
                    OutputError(error);
                    return;
                }

                m_replays = replays.OrderByDescending(r => r.DateTime).ToArray();
                DataBindReplays();

                IndependentSelectable.Select(m_replaysListBox.gameObject);
                m_replaysListBox.IsFocused = true;
            });
        }
 public void OnPointerExit(Selectable selectable, BaseEventData data)
 {
     IndependentSelectable.Unselect(selectable);
 }
Exemple #17
0
 private void OnReplaysListBoxSubmit(object sender, System.EventArgs e)
 {
     IndependentSelectable.Select(m_createButton.gameObject);
 }
        private IEnumerator CoSelect()
        {
            yield return(new WaitForEndOfFrame());

            IndependentSelectable.Select(m_closeButton.gameObject);
        }
Exemple #19
0
 private void OnPasswordEndEdit(string value)
 {
     IndependentSelectable.Select(m_okButton.gameObject);
 }
 private void OnInputEndEdit(string value)
 {
     IndependentSelectable.Select(m_sequence[0]);
 }
Exemple #21
0
 private void OnMapsListBoxSubmit(object sender, System.EventArgs e)
 {
     IndependentSelectable.Select(m_joinButton.gameObject);
 }
Exemple #22
0
 private void OnMapsListBoxCancel(object sender, System.EventArgs e)
 {
     IndependentSelectable.Select(m_goBackButton.gameObject);
     m_goBackButton.onClick.Invoke();
 }