Exemplo n.º 1
0
        public override void UpdateVirtual()
        {
            bool multiplePages = MenuTree.Count > MaxEntriesPerPage;

            G.Sys.MenuPanelManager_.SetBottomLeftActionButtonEnabled(InputAction.MenuPageUp, multiplePages);
            G.Sys.MenuPanelManager_.SetBottomLeftActionButtonEnabled(InputAction.MenuPageDown, multiplePages);

            G.Sys.MenuPanelManager_.SetBottomLeftActionButton(InputAction.MenuPageUp, InternalResources.Strings.MenuSystem.MenuActionPrevious);
            G.Sys.MenuPanelManager_.SetBottomLeftActionButton(InputAction.MenuPageDown, InternalResources.Strings.MenuSystem.MenuActionNext);

            if (multiplePages)
            {
                if (InputManager.GetKeyUp(InputAction.MenuPageUp))
                {
                    SwitchPage(-1);
                }

                if (InputManager.GetKeyUp(InputAction.MenuPageDown))
                {
                    SwitchPage(+1);
                }
            }

            Description = string.Format(InternalResources.Strings.MenuSystem.MenuPageDescription, CurrentPageIndex + 1, PageCount);

            TitleLabel?.SetActive(true);
            UILabel TitleLabelObject = TitleLabel.GetComponent <UILabel>();

            (menu_.menuTitleLabel_ ?? TitleLabelObject).text = Title;

            DescriptionLabel?.SetActive(true);
            UILabel DescriptionLabelObject = DescriptionLabel.GetComponent <UILabel>();

            menu_.menuDescriptionLabel_.text_ = DescriptionLabelObject.text = Description;
        }
Exemplo n.º 2
0
        public void UpdateVirtual()
        {
            G.Sys.MenuPanelManager_.SetBottomLeftActionButton(InputAction.MenuPageUp, "PREVIOUS");
            G.Sys.MenuPanelManager_.SetBottomLeftActionButton(InputAction.MenuPageDown, "NEXT");
            G.Sys.MenuPanelManager_.SetBottomLeftActionButtonEnabled(InputAction.MenuPageUp, MenuTree.Count > MaxEntriesPerPage);
            G.Sys.MenuPanelManager_.SetBottomLeftActionButtonEnabled(InputAction.MenuPageDown, MenuTree.Count > MaxEntriesPerPage);

            if (MenuTree.Count > MaxEntriesPerPage)
            {
                if (InputManager.GetKeyUp(InputAction.MenuPageUp))
                {
                    CurrentPageIndex -= 1;
                    CurrentPageIndex  = CurrentPageIndex <0 ? PageCount - 1 : CurrentPageIndex> PageCount - 1 ? 0 : CurrentPageIndex;
                    SwitchPageOnClose = true;
                    MenuPanel.Pop();
                }

                if (InputManager.GetKeyUp(InputAction.MenuPageDown))
                {
                    CurrentPageIndex += 1;
                    CurrentPageIndex  = CurrentPageIndex <0 ? PageCount - 1 : CurrentPageIndex> PageCount - 1 ? 0 : CurrentPageIndex;
                    SwitchPageOnClose = true;
                    MenuPanel.Pop();
                }
            }

            Description = $"Page {CurrentPageIndex + 1} / {PageCount}";

            TitleLabel?.SetActive(true);
            UILabel TitleLabelObject = TitleLabel.GetComponent <UILabel>();

            if (TitleLabelObject)
            {
                TitleLabelObject.text = Title;
            }

            DescriptionLabel?.SetActive(true);
            UILabel DescriptionLabelObject = DescriptionLabel.GetComponent <UILabel>();

            if (DescriptionLabelObject)
            {
                DescriptionLabelObject.text = Description;
            }
        }