@@ -55,15 +55,9 @@ public decimal Value
55
55
_value = value ;
56
56
valueText = value . ToString ( ) ;
57
57
if ( changed )
58
- {
59
58
ValueChanged ( this , null ) ;
60
- if ( ValueChangedCallback != null )
61
- ValueChangedCallback . Invoke ( ValueChangedCallbackInfo ) ;
62
- }
63
59
}
64
60
}
65
- public CallbackDelegate ValueChangedCallback { get ; set ; }
66
- public object ValueChangedCallbackInfo { get ; set ; }
67
61
68
62
public NumericUpDown ( ) : this ( true )
69
63
{
@@ -114,27 +108,19 @@ public NumericUpDown(bool initButtons)
114
108
Controls . Add ( ButtonDecrease ) ;
115
109
}
116
110
117
- Resize += _UpdateButtonsLocation ;
118
- LostFocus += ( s , a ) => { _ConfirmValue ( ) ; } ;
111
+ Resize += UpdateButtonsLocation ;
112
+ LostFocus += ( s , a ) => { ConfirmValue ( ) ; } ;
119
113
}
120
114
121
- private void _ConfirmValue ( )
115
+ public event EventHandler ValueChanged = delegate { } ;
116
+
117
+ protected void ConfirmValue ( )
122
118
{
123
119
decimal value = Value ;
124
120
if ( decimal . TryParse ( valueText , out value ) )
125
121
if ( Value != value )
126
122
Value = value ;
127
123
}
128
- private void _UpdateButtonsLocation ( object sender , EventArgs e )
129
- {
130
- if ( ButtonIncrease != null )
131
- ButtonIncrease . Location = new Point ( Width - 16 , Height / 2 - 8 ) ;
132
- if ( ButtonDecrease != null )
133
- ButtonDecrease . Location = new Point ( Width - 16 , Height / 2 ) ;
134
- }
135
-
136
- public event EventHandler ValueChanged = delegate { } ;
137
-
138
124
public void HideButtons ( )
139
125
{
140
126
ButtonIncrease . Visible = false ;
@@ -151,7 +137,7 @@ protected override void OnKeyPress(KeyEventArgs e)
151
137
base . OnKeyPress ( e ) ;
152
138
153
139
if ( e . KeyCode == UnityEngine . KeyCode . Return )
154
- _ConfirmValue ( ) ;
140
+ ConfirmValue ( ) ;
155
141
}
156
142
protected override void OnMouseWheel ( MouseEventArgs e )
157
143
{
@@ -187,7 +173,12 @@ public void ShowButtons()
187
173
ButtonIncrease . Visible = true ;
188
174
ButtonDecrease . Visible = true ;
189
175
}
190
-
191
- public delegate void CallbackDelegate ( object data ) ;
176
+ protected void UpdateButtonsLocation ( object sender , EventArgs e )
177
+ {
178
+ if ( ButtonIncrease != null )
179
+ ButtonIncrease . Location = new Point ( Width - 16 , Height / 2 - 8 ) ;
180
+ if ( ButtonDecrease != null )
181
+ ButtonDecrease . Location = new Point ( Width - 16 , Height / 2 ) ;
182
+ }
192
183
}
193
184
}
0 commit comments