Пример #1
0
        void Update()
        {
            pause_panel.SetVisible(TheGame.Get().IsPausedByPlayer());

            foreach (PlayerControls controls in PlayerControls.GetAll())
            {
                if (controls.IsPressPause() && !TheGame.Get().IsPausedByPlayer())
                {
                    TheGame.Get().Pause();
                }
                else if (controls.IsPressPause() && TheGame.Get().IsPausedByPlayer())
                {
                    TheGame.Get().Unpause();
                }
            }

            //Gamepad auto focus
            UISlotPanel focus_panel = UISlotPanel.GetFocusedPanel();

            if (focus_panel != pause_panel && TheGame.Get().IsPausedByPlayer() && PlayerControls.IsAnyGamePad())
            {
                pause_panel.Focus();
            }
            if (focus_panel == pause_panel && !TheGame.Get().IsPausedByPlayer())
            {
                UISlotPanel.UnfocusAll();
            }
        }
Пример #2
0
        protected override void Update()
        {
            base.Update();

            if (!PlayerControls.IsAnyGamePad())
            {
                return;
            }

            if (is_leader)
            {
                if (IsVisible())
                {
                    foreach (PlayerControls controls in PlayerControls.GetAll())
                    {
                        if (controls.IsMenuPressUp())
                        {
                            selection--;
                            selection = Mathf.Clamp(selection, 0, group_list.Count - 1);
                        }

                        if (controls.IsMenuPressDown())
                        {
                            selection++;
                            selection = Mathf.Clamp(selection, 0, group_list.Count - 1);
                        }

                        if (controls.IsPressMenuAccept())
                        {
                            if (selection >= 0 && selection < group_list.Count)
                            {
                                MenuButton button = group_list[selection];
                                button.Click();
                            }
                        }
                    }

                    foreach (MenuButton button in group_list)
                    {
                        button.SetArrow(selection == button.index);
                    }
                }
                else
                {
                    selection = start_index;
                }
            }
        }