Class HudValueChangeDetector
Tracks one bound value across reads and decides whether the change it just saw is worth reporting.
Inherited Members
Namespace: Serenity.GameUi.Application.Binding
Assembly: Serenity.GameUi.Application.dll
Syntax
public sealed class HudValueChangeDetector
Remarks
Engine-agnostic and unit-testable on its own: it knows nothing about feedback, cooldowns or targeting — only "did the value I was handed change, and which way". A HUD element owns one instance per binding it wants to react to.
The first observation is always silent, mirroring the isInitialSelection guard
Serenity.Menu.Infrastructure.Views.UnityMenuView uses for its own navigation tick: building a
HUD reads every element's starting value, and none of those starting reads is a "change" — only a value
that moves after the element already had a baseline is.
Constructors
HudValueChangeDetector()
Declaration
public HudValueChangeDetector()
Methods
ObserveSilently(object)
Records value as the new baseline without ever reporting a change.
Declaration
public void ObserveSilently(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to re-baseline against. |
Remarks
Used whenever a read happens but the caller already knows the change must not be reacted to — a hidden element re-showing must not fire feedback for whatever moved while it was off screen. The next call to TryObserveChange(object, out HudValueChangeDirection) compares against this baseline like any other.
TryObserveChange(object, out HudValueChangeDirection)
Records value as the new baseline and reports whether it counts as a change worth
reacting to.
Declaration
public bool TryObserveChange(object value, out HudValueChangeDirection direction)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value just read from the binding. |
| HudValueChangeDirection | direction | The direction the value moved, when this call reports a change. ANY when the caller should not filter by direction (no change, or a non-numeric change). |
Returns
| Type | Description |
|---|---|
| bool | True when this is not the first observation and the value actually changed. |
Remarks
The baseline moves on every call, whether or not this call reports a change — a caller that ignores the result (feedback on cooldown, element hidden) must not have that state resurface as a large, stale "change" the next time it is allowed to look.