Game.UI.Widgets.ValueChangedCallback
Assembly: Assembly-CSharp.dll
Namespace: Game.UI.Widgets
Type: Delegate
Base: System.MulticastDelegate
Summary:
Represents a callback invoked when a UI widget's value changes. The delegate receives the widget instance that changed (an object implementing IWidget) so the handler can inspect the widget and react accordingly. Commonly used by UI controls to notify listeners about value or state changes.
Fields
None
This delegate type declares no fields.
Properties
None
This delegate type declares no properties.
Constructors
public ValueChangedCallback(object @object, System.IntPtr method)
Constructs a new delegate instance that will invoke the specified instance method (or static method when @object is null). This constructor is provided by the runtime for all delegate types.
Methods
-
public virtual void Invoke(IWidget widget)
Invokes the callback synchronously with the given widget instance. -
public virtual System.IAsyncResult BeginInvoke(IWidget widget, System.AsyncCallback callback, object @object)
Begins an asynchronous invocation of the callback. Returns an IAsyncResult that can be used to monitor or wait for completion. -
public virtual void EndInvoke(System.IAsyncResult result)
Ends an asynchronous invocation started with BeginInvoke. Use this to retrieve results or ensure completion.
Usage Example
// Example handler matching the delegate signature
void OnWidgetValueChanged(IWidget widget)
{
// Example: log or update other UI / game state based on the widget
Debug.Log("Widget value changed: " + widget);
}
// Subscribing to a widget's change notification (the actual event/member name may vary)
myWidget.ValueChanged += OnWidgetValueChanged;
// Alternatively, explicit delegate construction
myWidget.ValueChanged += new ValueChangedCallback(OnWidgetValueChanged);
// Unsubscribe when no longer needed
myWidget.ValueChanged -= OnWidgetValueChanged;
Notes:
- The concrete event or property name used by specific widgets may differ (for example ValueChanged
, OnValueChanged
, etc.). Check the specific widget API.
- Handlers should be lightweight; if heavy work is required, consider deferring to a background task to avoid UI stalls.