Esempio n. 1
0
 void SliderChange(float v)
 {
     if (isEditingField)
     {
         return;
     }
     isEditingSlider = true;
     inputField.text = v.ToString(stringFormat, ci);
     onValueChanged.Invoke(v);
     isEditingSlider = false;
 }
 void SliderChange()
 {
     if (isEditingField)
     {
         return;
     }
     isEditingSlider = true;
     inputField.text = slider.value.ToString(stringFormat);
     value           = slider.value;
     onValueChanged.Invoke(value);
     isEditingSlider = false;
 }
Esempio n. 3
0
        /// <summary>
        /// After all user input has been resolved, update the saved value of the control, for
        /// changing its rendered representation.
        /// </summary>
        protected override void LateUpdate()
        {
            if (camT == null)
            {
                camT = DisplayManager.MainCamera.transform;
            }

            if (Display == null)
            {
                Display = this.Query <TextMesh>("Display");
            }

            var delta = Mathf.Abs(internalValue - lastTickValue);

            if (delta > 1)
            {
                lastTickValue = internalValue;
            }

            base.LateUpdate();

            if (ValueChanged)
            {
                ValueChange?.Invoke(this, value);
            }

            wasDragged = Dragged;
            lastValue  = value;
            UpdateInternalValue();
        }
Esempio n. 4
0
        private void Accuracy(float[] output)
        {
            float buffer = 0;

            for (int i = 0; i < OutputNodes; i++)
            {
                buffer += (float)Math.Pow(output[i] - Output[i], 2);
            }
            mDiffernces.Add(buffer);

            if (mDiffernces.Count > 200)
            {
                mDiffernces.RemoveAt(0);
            }

            buffer = 0;

            foreach (float item in mDiffernces)
            {
                buffer += item;
            }

            OverallAccurecy = buffer / mDiffernces.Count;

            ValueChange?.Invoke();
        }
Esempio n. 5
0
 public void ValueChanged(object sender, EventArgs e)
 {
     if (Value.Focused)
     {
         //加个炫酷的过渡动画
         // ValueChangeFX_Timer.Start();
     }
     ValueChange?.Invoke(sender, e);
 }
Esempio n. 6
0
 private void valueChangeHelper(int index, MouseButtonEventArgs e)
 {
     if (curValues != null && index >= 0 && index < curValues.Length)
     {
         ValueChange.Invoke(canvases[index], new ValueChangeArgs()
         {
             Index = index,
             Value = (curValues[index] > 0.5 ? 0.0 : 1.0)
         });
     }
 }
Esempio n. 7
0
        public void Stop()
        {
            if (_timer != null)
            {
                _timer.Stop();
                _timer = null;

                _measures.Clear();
                _lastValue = 0;
                ValueChange?.Invoke(_lastValue);
            }
        }
        private void 确定_Click(object sender, RoutedEventArgs e)
        {
            flyout.Hide();

            if (Number > Max)
            {
                Number = Max;
            }
            if (Number < Min)
            {
                Number = Min;
            }
            Value = Number;
            ValueChange?.Invoke(this, Number); //用户控件:Value改变
        }
        private void 滑条_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
        {
            Number         = (int)e.NewValue; //修改新Value
            button.Content = Number.ToString() + text;

            if (Number > Max)
            {
                Number = Max;
            }
            if (Number < Min)
            {
                Number = Min;
            }
            Value = Number;
            ValueChange?.Invoke(this, Number); //用户控件:Value改变
        }
Esempio n. 10
0
        private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int i = canvases.IndexOf((Canvas)sender);

            if (i >= 0)
            {
                if (curValues != null && i < curValues.Length)
                {
                    ValueChange.Invoke(canvases[i], new ValueChangeArgs()
                    {
                        Index = i,
                        Value = (curValues[i] > 0.5 ? 0.0 : 1.0)
                    });
                }
            }
        }
Esempio n. 11
0
        void timer_Tick(object sender, EventArgs e)
        {
            Point currentpos = Cursor.Position;

            if (lastpos.X != currentpos.X)
            {
                if (ValueChange != null)
                {
                    var ee = new ValueChangeEventArgs
                    {
                        ChangedValue = currentpos.X - lastpos.X
                    };
                    ValueChange.Invoke(this, ee);
                }
                lastpos = currentpos;
            }
        }
Esempio n. 12
0
 public new T this[int index]
 {
     get { return(base[index]); }
     set
     {
         var data = base[index];
         //在数组修改之前,先触发事件
         if (ValueChange != null)
         {
             if (!ValueChange.Invoke(index, data, value))
             {
                 return;
             }
         }
         base.SetItem(index, value);
     }
 }
Esempio n. 13
0
        private void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            _measures.Add(_counter);
            _counter = 0;

            if (_measures.Count > MeasuresCount)
            {
                _measures.RemoveRange(0, _measures.Count - MeasuresCount);
            }

            double newValue = _measures.Average();

            if (newValue != _lastValue)
            {
                _lastValue = newValue;
                ValueChange?.Invoke(_lastValue);
            }
        }
        private void flyout_Closed(object sender, object e)
        {
            if (IsClick == false)
            {
                Number = NumberCache;                   //未点击原来该啥值就啥值,回复NumberCache
            }
            Judge();
            Change();

            if (Number > Max)
            {
                Number = Max;
            }
            if (Number < Min)
            {
                Number = Min;
            }
            Value = Number;
            ValueChange?.Invoke(this, Number); //用户控件:Value改变
        }
Esempio n. 15
0
        //private UnityAction<va>

        public void Awake()
        {
            toggles = this.gameObject.GetComponentsInChildren <Toggle>().ToDictionary(t => t.name);

            UnityAction <bool> changeSelected = v => {
                Debug.Log("Value changed: " + v);
                if (v)
                {
                    var selected = toggles.First(kv => kv.Value.isOn);
                    ValueChange.Invoke(selected.Value.name);
                }
            };

            foreach (var toggle in toggles.Values)
            {
                toggle.onValueChanged.AddListener(changeSelected);
            }

            xlSelectionGrids.Add(this);
        }
Esempio n. 16
0
        private void OnValueChange()
        {
            var result = _fNormal == null || _fNormal.Name != "微软雅黑" || _fNormal.Size != 12f ||
                         _fNormal.Style != FontStyle.Regular || _fNormal.Unit != GraphicsUnit.Point || _fNormal.GdiCharSet != 1;

            if (!result)
            {
                result = _fMove == null || _fMove.Name != "微软雅黑" || _fMove.Size != 12f ||
                         _fMove.Style != FontStyle.Regular || _fMove.Unit != GraphicsUnit.Point || _fMove.GdiCharSet != 1;
            }
            if (!result)
            {
                result = _fDown == null || _fDown.Name != "微软雅黑" || _fDown.Size != 12f ||
                         _fDown.Style != FontStyle.Regular || _fDown.Unit != GraphicsUnit.Point || _fDown.GdiCharSet != 1;
            }
            if (!result)
            {
                result = _cNormal != Color.Empty;
            }
            if (!result)
            {
                result = _cMove != Color.Empty;
            }
            if (!result)
            {
                result = _cDown != Color.Empty;
            }
            if (!result)
            {
                result = _stringHorizontal != StringAlignment.Near;
            }
            if (!result)
            {
                result = _stringVertical != StringAlignment.Near;
            }
            ValueChange?.Invoke(result);
        }
Esempio n. 17
0
 /// <summary>
 ///
 /// </summary>
 protected void OnValueChange()
 {
     ValueChange?.Invoke(this);
 }
Esempio n. 18
0
 public void TriggerChange()
 {
     ValueChange?.Invoke(value);
 }
Esempio n. 19
0
 private UnitySliderAdapter(Slider element)
 {
     this.element = element;
     this.element.onValueChanged.AddListener(f =>
                                             ValueChange?.Invoke(this, f));
 }
Esempio n. 20
0
 public void OnValueChange(T oldValue, T newValue)
 {
     ValueChange?.Invoke(oldValue, newValue);
 }
Esempio n. 21
0
 protected virtual void OnValueChange(T newValue)
 {
     ValueChange?.Invoke(newValue);
 }