Represents a user interface element for configuring context menu settings within the window framework. This form element allows customization of various context menu behaviors, such as fade time and delay.
More...
This class extends VisualElement and provides a user interface for configuring context menu animation settings. It includes sliders for adjusting fade time and fade delay, and automatically synchronizes these values with the WindowFrameController instance.
The form element is designed to be used in Unity's UI Toolkit system and can be instantiated both programmatically and through UXML markup.
var parentContainer = new VisualElement();
parentContainer.Add(contextMenuSettings);
contextMenuSettings.ContextMenuFadeTime = 0.3f;
contextMenuSettings.ContextMenuDelay = 1.5f;
| GWG.WindowFramework.FormElements.ContextMenuSettingsFormElement.~ContextMenuSettingsFormElement |
( |
| ) |
|
|
private |
This finalizer attempts to unregister the value changed callbacks from the slider controls to prevent memory leaks. However, due to the nature of finalizers in .NET, this cleanup is not guaranteed to execute in a timely manner.
Note: In practice, Unity's UI Toolkit automatically handles cleanup of visual element callbacks when elements are removed from the visual tree, so this finalizer serves as additional safety measure.
For more predictable cleanup, consider implementing System.IDisposable and calling cleanup methods explicitly when the element is no longer needed.
| float GWG.WindowFramework.FormElements.ContextMenuSettingsFormElement.ContextMenuDelay |
|
getset |
A float value representing the delay duration in seconds before fade out begins. Valid range is typically 0.0f to 5.0f seconds.
This property specifies the waiting period before the fade-out animation of a context menu is triggered. Modifying this value allows you to customize the timing of context menu closure after being dismissed. A longer delay gives users more time to interact with the menu, while a shorter delay makes the interface more responsive but potentially less user-friendly.
The property automatically synchronizes with the WindowFrameController instance when available, ensuring that changes are immediately applied to the application's behavior.
See: WindowFrameController.ContextMenuFadeDelay
contextMenuSettingsFormElement.ContextMenuDelay = 1f;
contextMenuSettingsFormElement.ContextMenuDelay = 0.2f;
float currentDelay = contextMenuSettingsFormElement.ContextMenuDelay;
| float GWG.WindowFramework.FormElements.ContextMenuSettingsFormElement.ContextMenuFadeTime |
|
getset |
A float value representing the fade animation duration in seconds. Valid range is typically 0.0f to 3.0f seconds.
This property determines the time it takes for the context menu to fade in or out when displayed or dismissed. Adjusting this value can modify the user interface experience by making transitions appear faster or slower.
The property automatically synchronizes with the WindowFrameController instance when available, ensuring that changes are immediately reflected in the application's behavior.
See: WindowFrameController.ContextMenuFadeTime
See: WindowFrameController.ContextMenuFadeDelay
contextMenuSettingsFormElement.ContextMenuFadeTime = 0.5f;
float currentFadeTime = contextMenuSettingsFormElement.ContextMenuFadeTime;
Debug.Log($"Current fade time: {currentFadeTime} seconds");