@@ -90,6 +90,15 @@ public class Menu
9090 /// <param name="sliderPosition">The current position of the slider bar.</param>
9191 /// <param name="itemIndex">The index of this <see cref="MenuSliderItem"/>.</param>
9292 public delegate void SliderItemSelectedEvent ( Menu menu , MenuSliderItem sliderItem , int sliderPosition , int itemIndex ) ;
93+
94+ /// <summary>
95+ /// Triggered when a <see cref="MenuDynamicListItem"/>'s value was changed.
96+ /// </summary>
97+ /// <param name="menu">The <see cref="Menu"/> in which this <see cref="OnMenuDynamicListItemCurrentItemChange"/> event occurred.</param>
98+ /// <param name="dynamicListItem">The <see cref="MenuDynamicListItem"/> that was changed.</param>
99+ /// <param name="oldValue">The old <see cref="MenuDynamicListItem.CurrentItem"/> of the <see cref="MenuDynamicListItem"/>.</param>
100+ /// <param name="newValue">The new <see cref="MenuDynamicListItem.CurrentItem"/> of the <see cref="MenuDynamicListItem"/>.</param>
101+ public delegate void MenuDynamicListItemCurrentItemChangedEvent ( Menu menu , MenuDynamicListItem dynamicListItem , string oldValue , string newValue ) ;
93102 #endregion
94103
95104 #region events
@@ -146,6 +155,12 @@ public class Menu
146155 /// Parameters: <see cref="Menu"/> menu, <see cref="MenuSliderItem"/> sliderItem, <see cref="int"/> sliderPosition, <see cref="int"/> itemIndex.
147156 /// </summary>
148157 public event SliderItemSelectedEvent OnSliderItemSelect ;
158+
159+ /// <summary>
160+ /// Triggered when a <see cref="MenuDynamicListItem"/>'s value was changed.
161+ /// Parameters: <see cref="Menu"/> menu, <see cref="MenuListItem"/> dynamicListItem, <see cref="MenuDynamicListItem.CurrentItem"/> oldValue, <see cref="MenuDynamicListItem.CurrentItem"/> newValue.
162+ /// </summary>
163+ public event MenuDynamicListItemCurrentItemChangedEvent OnMenuDynamicListItemCurrentItemChange ;
149164 #endregion
150165
151166 #region virtual voids
@@ -253,6 +268,18 @@ protected virtual void SliderSelectedEvent(Menu menu, MenuSliderItem sliderItem,
253268 OnSliderItemSelect ? . Invoke ( menu , sliderItem , sliderPosition , itemIndex ) ;
254269 }
255270
271+ /// <summary>
272+ /// Triggered when a <see cref="MenuDynamicListItem"/>'s value was changed.
273+ /// </summary>
274+ /// <param name="menu">The <see cref="Menu"/> in which this <see cref="OnMenuDynamicListItemCurrentItemChange"/> event occurred.</param>
275+ /// <param name="dynamicListItem">The <see cref="MenuDynamicListItem"/> that was changed.</param>
276+ /// <param name="oldValue">The old <see cref="MenuDynamicListItem.CurrentItem"/> of the <see cref="MenuDynamicListItem"/>.</param>
277+ /// <param name="newValue">The new <see cref="MenuDynamicListItem.CurrentItem"/> of the <see cref="MenuDynamicListItem"/>.</param>
278+ protected virtual void MenuDynamicListItemCurrentItemChanged ( Menu menu , MenuDynamicListItem dynamicListItem , string oldValue , string newValue )
279+ {
280+ OnMenuDynamicListItemCurrentItemChange ? . Invoke ( menu , dynamicListItem , oldValue , newValue ) ;
281+ }
282+
256283 #endregion
257284
258285 #endregion
@@ -620,8 +647,10 @@ public void GoLeft()
620647 }
621648 else if ( item . Enabled && item is MenuDynamicListItem dynList )
622649 {
650+ string oldValue = dynList . CurrentItem ;
623651 string newSelectedItem = dynList . Callback ( dynList , true ) ;
624652 dynList . CurrentItem = newSelectedItem ;
653+ MenuDynamicListItemCurrentItemChanged ( this , dynList , oldValue , newSelectedItem ) ;
625654 PlaySoundFrontend ( - 1 , "NAV_LEFT_RIGHT" , "HUD_FRONTEND_DEFAULT_SOUNDSET" , false ) ;
626655 }
627656 }
@@ -669,8 +698,10 @@ public void GoRight()
669698 }
670699 else if ( item . Enabled && item is MenuDynamicListItem dynList )
671700 {
701+ string oldValue = dynList . CurrentItem ;
672702 string newSelectedItem = dynList . Callback ( dynList , false ) ;
673703 dynList . CurrentItem = newSelectedItem ;
704+ MenuDynamicListItemCurrentItemChanged ( this , dynList , oldValue , newSelectedItem ) ;
674705 PlaySoundFrontend ( - 1 , "NAV_LEFT_RIGHT" , "HUD_FRONTEND_DEFAULT_SOUNDSET" , false ) ;
675706 }
676707 }
0 commit comments