Ejemplo n.º 1
0
 public void UpdateMenuOptionAnimation(MenuBase.MenuOptionData data)
 {
     if (!data.IsEnabled())
     {
         return;
     }
     if (data.m_Button == null)
     {
         data.SetColorAlpha((this.m_ActiveMenuOption == data) ? MenuScreen.s_ButtonsHighlightedAlpha : MenuScreen.s_ButtonsAlpha);
     }
     if (data.m_AnimatedRectTransform != null)
     {
         Vector3 localPosition = data.m_AnimatedRectTransform.localPosition;
         float   num           = Mathf.Ceil(((this.m_ActiveMenuOption == data) ? this.SELECTED_OPTION_OFFSET.x : 0f) + data.GetInitialPosition().x - localPosition.x) * Mathf.Min(1f, Time.unscaledDeltaTime * 10f);
         localPosition.x += num;
         data.m_AnimatedRectTransform.localPosition = localPosition;
         if (this.m_ActiveMenuOption == data)
         {
             data.m_Button.Select();
             data.m_Button.OnSelect(null);
         }
     }
 }
Ejemplo n.º 2
0
    public void UpdateActiveMenuOption(MenuBase.MenuOptionData data)
    {
        if (data.m_Object == null)
        {
            return;
        }
        bool flag = true;

        if (data.m_Button && !this.IsMenuButtonEnabled(data.m_Button))
        {
            flag = false;
        }
        else if (data.m_Slider && !this.IsMenuSliderEnabled(data.m_Slider))
        {
            flag = false;
        }
        else if (data.m_SelectButton && !this.IsMenuSelectButtonEnabled(data.m_SelectButton))
        {
            flag = false;
        }
        else if (!data.m_Object.activeSelf)
        {
            flag = false;
        }
        if (data.m_Button)
        {
            data.m_Button.interactable = flag;
        }
        else if (data.m_Slider)
        {
            data.m_Slider.interactable = flag;
        }
        else if (data.m_SelectButton)
        {
            data.m_SelectButton.enabled = flag;
        }
        if (!flag)
        {
            data.SetColorAlpha(MenuScreen.s_InactiveButtonsAlpha);
            return;
        }
        MenuBase.MenuOptionData activeMenuOption = this.m_ActiveMenuOption;
        bool?flag2;

        if (activeMenuOption == null)
        {
            flag2 = null;
        }
        else
        {
            UISliderEx slider = activeMenuOption.m_Slider;
            flag2 = ((slider != null) ? new bool?(slider.m_IsDragged) : null);
        }
        if (flag2 ?? false)
        {
            return;
        }
        if (data.m_Slider && data.m_Slider.m_IsDragged)
        {
            this.m_ActiveMenuOption            = data;
            this.m_ActiveMenuOptionCanInteract = false;
            return;
        }
        Vector2 screenPoint = Input.mousePosition;

        RectTransform[] extentRectTransforms = data.m_ExtentRectTransforms;
        for (int i = 0; i < extentRectTransforms.Length; i++)
        {
            if (RectTransformUtility.RectangleContainsScreenPoint(extentRectTransforms[i], screenPoint))
            {
                this.m_ActiveMenuOption            = data;
                this.m_ActiveMenuOptionCanInteract = false;
                RectTransform[] interactRectTransforms = data.m_InteractRectTransforms;
                for (int j = 0; j < interactRectTransforms.Length; j++)
                {
                    if (RectTransformUtility.RectangleContainsScreenPoint(interactRectTransforms[j], screenPoint))
                    {
                        this.m_ActiveMenuOptionCanInteract = true;
                        return;
                    }
                }
                return;
            }
        }
    }