Example #1
0
 private void EventLauncher_OnPointerDown(UIEventLauncher obj)
 {
     if (lockValueWhenPressed)
     {
         isLocked    = true;
         lockedValue = slider.value;
         OnLocked.Invoke();
     }
 }
Example #2
0
 private void EventLauncher_OnPointerUp(UIEventLauncher obj)
 {
     isLocked = false;
     if (lockValueWhenPressed)
     {
         OnUnlocked.Invoke();
         slider.value = lockedValue;
     }
 }
Example #3
0
    void OnEnable()
    {
        if (slider == null)
        {
            slider = GetComponent <Slider>();
        }
        if (lockValueWhenPressed)
        {
            if (handleEventLauncher == null)
            {
                handleEventLauncher = slider.GetComponent <UIEventLauncher>();
                if (handleEventLauncher == null)
                {
                    handleEventLauncher = slider.gameObject.AddComponent <UIEventLauncher>();
                }
            }

            handleEventLauncher.OnPointerDown += EventLauncher_OnPointerDown;
            handleEventLauncher.OnPointerUp   += EventLauncher_OnPointerUp;;
        }
        slider.onValueChanged.AddListener(OnValueChanged);
    }