Exemplo n.º 1
0
 public static void Show(float opacity, bool showProgress, string title, string description, string backLabel, Action backAction)
 {
     instance.hideDelay        = 0;
     IsShowing                 = true;
     MenuSystem.keyboardState  = KeyboardState.Dialog;
     instance.background.color = new Color(0f, 0f, 0f, opacity);
     instance.background.gameObject.SetActive(value: true);
     instance.transform.SetAsLastSibling();
     instance.progressRing.SetActive(showProgress);
     instance.titleText.text = title;
     if (string.IsNullOrEmpty(description))
     {
         instance.descriptionText.gameObject.SetActive(value: false);
     }
     else
     {
         instance.descriptionText.gameObject.SetActive(value: true);
         instance.descriptionText.text = description;
     }
     if (string.IsNullOrEmpty(backLabel))
     {
         instance.backButton.SetActive(value: false);
         EventSystem.current.SetSelectedGameObject(instance.backButton);
         if ((bool)MenuSystem.instance && (bool)MenuSystem.instance.activeMenu)
         {
             MenuSystem.instance.activeMenu.lastFocusedElement = instance.backButton;
         }
         onBack        = backAction;
         backHideDelay = 0;
     }
     else
     {
         instance.backText.text = backLabel;
         onBack        = backAction;
         backHideDelay = 0;
         instance.backButton.SetActive(value: true);
         EventSystem.current.SetSelectedGameObject(instance.backButton);
         if ((bool)MenuSystem.instance && (bool)MenuSystem.instance.activeMenu)
         {
             MenuSystem.instance.activeMenu.lastFocusedElement = instance.backButton;
         }
     }
     ButtonLegendBar.RefreshStatus();
 }
Exemplo n.º 2
0
 private void Update()
 {
     if (hideDelay > 0)
     {
         if (--hideDelay == 0)
         {
             instance.background.gameObject.SetActive(value: false);
             ButtonLegendBar.RefreshStatus();
         }
     }
     else if (onBack != null)
     {
         InputDevice activeDevice = InputManager.ActiveDevice;
         if (activeDevice.MenuWasPressed || activeDevice.Action2.WasPressed || Input.GetKeyDown(KeyCode.Escape))
         {
             BackClick();
         }
     }
 }
Exemplo n.º 3
0
    public static void Hide(int withDelay = 0)
    {
        bool activeSelf = instance.background.gameObject.activeSelf;

        IsShowing = false;
        MenuSystem.keyboardState = KeyboardState.None;
        instance.background.gameObject.SetActive(value: false);
        onBack             = null;
        instance.hideDelay = Math.Max(withDelay, instance.hideDelay);
        if (activeSelf && instance.hideDelay > 0)
        {
            instance.background.gameObject.SetActive(value: true);
            instance.background.color = new Color(0f, 0f, 0f, 1f);
            instance.progressRing.SetActive(value: false);
            instance.titleText.text = string.Empty;
            instance.descriptionText.gameObject.SetActive(value: false);
            instance.backButton.SetActive(value: false);
        }
        ButtonLegendBar.RefreshStatus();
    }