Exemplo n.º 1
0
        /*************************************************************************//**
        * @}
        * @defgroup SC_IFASHandlers Event Handlers
        * @ingroup DocSC_IFAS
        * These are functions that the SC_InputFieldAndSlider uses to handle events.
        * @{
        *****************************************************************************/

        /**
         * @brief Handles the slider stopping a drag.
         * @param[in] aPointerData The data relating to the drag event.
         */
        public void OnEndDrag(PointerEventData aPointerData)
        {
            if (mAsInt)
            {
                mInputField.text = ((int)mSlider.value).ToString();
            }
            else
            {
                mInputField.text = mSlider.value.ToString("F2");
            }
            mValue = mSlider.value;
            ValueChanged.Invoke(mSlider.value);
        }
        private void InvokeValueChanged()
        {
            var recordKey = string.IsNullOrWhiteSpace(key) ? gameObject.name : key;
            var value     = textManager.GetRecordValue(recordKey, category);

            onValueChanged?.Invoke(value ?? DefaultValue);
        }
Exemplo n.º 3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == MouseButtons.Left)
            {
                var rect = GetThumbRect();

                if (rect.Contains(e.X, e.Y))
                {
                    Capture = true;
                }
                else if (e.X > rect.Right)
                {
                    value = Utils.Clamp(value + increment, minValue, maxValue);
                }
                else if (e.X < rect.Left)
                {
                    value = Utils.Clamp(value - increment, minValue, maxValue);
                }

                value = Math.Round(value, numDecimals);

                ValueChangedEvent?.Invoke(this, value);
            }
            else if (e.Button == MouseButtons.Right)
            {
                //value = initValue;
            }

            Invalidate();
        }
Exemplo n.º 4
0
        private void slider_border_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var mousePos = e.GetPosition(this).X;

            NowValue = (mousePos / ActualWidth) * (MaxValue - MinValue) + MinValue;
            ValueChangedEvent?.Invoke(this, NowValue);
        }
Exemplo n.º 5
0
        //SETTERS

        public virtual void setValue(decimal value)
        {
            var old = Value;

            Value = value;

            ValueChangedEvent?.Invoke(this, old);
        }
Exemplo n.º 6
0
        public override void SetValue()
        {
            startIndex = index;
            ValueChangedEvent?.Invoke(_options[index], index);

            if (!noConfirm)
            {
                SoundManager.PlaySoundEffect("menu_select");
            }
        }
Exemplo n.º 7
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (Capture)
     {
         var ratio = Utils.Clamp((e.X - thumbWidth / 2) / (double)(Width - labelWidth - thumbWidth), 0.0, 1.0);
         value = Utils.Lerp(minValue, maxValue, ratio);
         value = Math.Round(value, numDecimals);
         ValueChangedEvent?.Invoke(this, value);
         Invalidate();
     }
 }
Exemplo n.º 8
0
        protected override void RightPressed()
        {
            current += stepSize;

            if (current >= max)
            {
                current = max;
            }

            SoundManager.PlaySoundEffect("menu_move");

            ValueChangedEvent?.Invoke(current.ToString(), -1);
        }
Exemplo n.º 9
0
        protected override void LeftPressed()
        {
            current -= stepSize;

            if (current <= min)
            {
                current = min;
            }

            SoundManager.PlaySoundEffect("menu_move");

            ValueChangedEvent?.Invoke(current.ToString(), -1);
        }
Exemplo n.º 10
0
 private void ValueBox_TextChanged(object sender, EventArgs e)
 {
     if (ValueChangedEvent != null)
     {
         try
         {
             // Attempt the parse
             uint.Parse(ValueBox.Text, System.Globalization.NumberStyles.HexNumber);
             // If the value is valid, we will reach this stage
             ValueChangedEvent.Invoke(new EventArgs(), this);
         }
         catch
         {
             // Otherwise, do nothing
         }
     }
 }
Exemplo n.º 11
0
 protected void OnValueChanged(object value)
 {
     ValueChangedEvent?.Invoke(this, value);
 }
Exemplo n.º 12
0
 protected virtual void OnValueChangedEvent(ValueItem item)
 {
     ValueChangedEvent?.Invoke(this, item);
 }
Exemplo n.º 13
0
 public void SetTime(float time) // sets the time
 {
     timePlayed = time;
     valueChanged.Invoke("timePlayed", time); // and triggers the event
 }
Exemplo n.º 14
0
 public override void ResetValue()
 {
     current = start;
     ValueChangedEvent?.Invoke(current.ToString(), -1);
     SoundManager.PlaySoundEffect("menu_select");
 }
Exemplo n.º 15
0
 public void OnValueChangedEvent(TValue value, Trigger trigger)
 {
     ValueChangedEvent?.Invoke(this, new ValueChangedEventArgs <TValue>(value, trigger));
 }
Exemplo n.º 16
0
 protected void OnValueChangedEvent()
 {
     ValueChangedEvent?.Invoke(this, new EventArgs());
 }
Exemplo n.º 17
0
 protected virtual void OnValueChanged()
 {
     ValueChangedEvent?.Invoke(this, EventArgs.Empty); //reg event
 }
Exemplo n.º 18
0
 public override void ResetValue()
 {
     index = startIndex;
     ValueChangedEvent?.Invoke(_options[startIndex], startIndex);
     SetText();
 }