@@ -164,6 +164,7 @@ public override void Initialize()
164164
165165 lbEvents = FindChild < EditorListBox > ( nameof ( lbEvents ) ) ;
166166 selEventType = FindChild < EditorPopUpSelector > ( nameof ( selEventType ) ) ;
167+ selEventType . MouseScrolled += SelEventType_MouseScrolled ;
167168 panelEventDescription = FindChild < EditorDescriptionPanel > ( nameof ( panelEventDescription ) ) ;
168169 lbEventParameters = FindChild < EditorListBox > ( nameof ( lbEventParameters ) ) ;
169170 tbEventParameterValue = FindChild < EditorTextBox > ( nameof ( tbEventParameterValue ) ) ;
@@ -177,6 +178,7 @@ public override void Initialize()
177178
178179 lbActions = FindChild < EditorListBox > ( nameof ( lbActions ) ) ;
179180 selActionType = FindChild < EditorPopUpSelector > ( nameof ( selActionType ) ) ;
181+ selActionType . MouseScrolled += SelActionType_MouseScrolled ;
180182 panelActionDescription = FindChild < EditorDescriptionPanel > ( nameof ( panelActionDescription ) ) ;
181183 lbActionParameters = FindChild < EditorListBox > ( nameof ( lbActionParameters ) ) ;
182184 tbActionParameterValue = FindChild < EditorTextBox > ( nameof ( tbActionParameterValue ) ) ;
@@ -373,6 +375,64 @@ public override void Initialize()
373375 WindowManager . WindowSizeChangedByUser += WindowManager_WindowSizeChangedByUser ;
374376 }
375377
378+ private void SelEventType_MouseScrolled ( object sender , InputEventArgs e )
379+ {
380+ e . Handled = true ;
381+
382+ if ( editedTrigger == null || lbEvents . SelectedItem == null )
383+ return ;
384+
385+ TriggerCondition existingCondition = editedTrigger . Conditions [ lbEvents . SelectedIndex ] ;
386+
387+ if ( Cursor . ScrollWheelValue < 0 )
388+ {
389+ if ( map . EditorConfig . TriggerEventTypes . ContainsKey ( existingCondition . ConditionIndex + 1 ) )
390+ {
391+ existingCondition . ConditionIndex = existingCondition . ConditionIndex + 1 ;
392+ SetTriggerEventHardcodedParameters ( existingCondition ) ;
393+ EditTrigger ( editedTrigger ) ;
394+ }
395+ }
396+ else if ( Cursor . ScrollWheelValue > 0 )
397+ {
398+ if ( map . EditorConfig . TriggerActionTypes . ContainsKey ( existingCondition . ConditionIndex - 1 ) )
399+ {
400+ existingCondition . ConditionIndex = existingCondition . ConditionIndex - 1 ;
401+ SetTriggerEventHardcodedParameters ( existingCondition ) ;
402+ EditTrigger ( editedTrigger ) ;
403+ }
404+ }
405+ }
406+
407+ private void SelActionType_MouseScrolled ( object sender , InputEventArgs e )
408+ {
409+ e . Handled = true ;
410+
411+ if ( editedTrigger == null || lbActions . SelectedItem == null )
412+ return ;
413+
414+ TriggerAction existingAction = editedTrigger . Actions [ lbActions . SelectedIndex ] ;
415+
416+ if ( Cursor . ScrollWheelValue < 0 )
417+ {
418+ if ( map . EditorConfig . TriggerActionTypes . ContainsKey ( existingAction . ActionIndex + 1 ) )
419+ {
420+ existingAction . ActionIndex = existingAction . ActionIndex + 1 ;
421+ SetTriggerActionHardcodedParameters ( existingAction ) ;
422+ EditTrigger ( editedTrigger ) ;
423+ }
424+ }
425+ else if ( Cursor . ScrollWheelValue > 0 )
426+ {
427+ if ( map . EditorConfig . TriggerActionTypes . ContainsKey ( existingAction . ActionIndex - 1 ) )
428+ {
429+ existingAction . ActionIndex = existingAction . ActionIndex - 1 ;
430+ SetTriggerActionHardcodedParameters ( existingAction ) ;
431+ EditTrigger ( editedTrigger ) ;
432+ }
433+ }
434+ }
435+
376436#region Support for handling scroll wheel input on event and action parameter text boxes
377437 private void HandleScrollWheelOnTextBoxAndList < T > ( List < T > list , Func < T , string > idGetter , string currentParameterValue , EditorTextBox textBox )
378438 {
@@ -1805,24 +1865,7 @@ private void EventWindowDarkeningPanel_Hidden(object sender, EventArgs e)
18051865
18061866 TriggerCondition condition = editedTrigger . Conditions [ lbEvents . SelectedIndex ] ;
18071867 condition . ConditionIndex = selectEventWindow . SelectedObject . ID ;
1808-
1809- for ( int i = 0 ; i < TriggerEventType . MAX_PARAM_COUNT ; i ++ )
1810- {
1811- if ( ( int ) triggerEventType . Parameters [ i ] . TriggerParamType < 0 )
1812- {
1813- condition . Parameters [ i ] = Math . Abs ( ( int ) triggerEventType . Parameters [ i ] . TriggerParamType ) . ToString ( CultureInfo . InvariantCulture ) ;
1814- continue ;
1815- }
1816-
1817- if ( triggerEventType . Parameters [ i ] . TriggerParamType == TriggerParamType . Unused )
1818- {
1819- // additional params need to be empty instead of 0 if they're unused
1820- if ( i >= TriggerCondition . DEF_PARAM_COUNT )
1821- condition . Parameters [ i ] = string . Empty ;
1822- else
1823- condition . Parameters [ i ] = "0" ;
1824- }
1825- }
1868+ SetTriggerEventHardcodedParameters ( condition ) ;
18261869
18271870 EditTrigger ( editedTrigger ) ;
18281871 }
@@ -1865,6 +1908,33 @@ private TriggerAction CreateTriggerAction(TriggerActionType triggerActionType)
18651908 return triggerAction ;
18661909 }
18671910
1911+ private void SetTriggerEventHardcodedParameters ( TriggerCondition triggerCondition )
1912+ {
1913+ if ( ! map . EditorConfig . TriggerEventTypes . TryGetValue ( triggerCondition . ConditionIndex , out var triggerEventType ) )
1914+ {
1915+ Logger . Log ( $ "{ nameof ( TriggersWindow ) } .{ nameof ( SetTriggerEventHardcodedParameters ) } : Unknown event type { triggerCondition . ConditionIndex } ") ;
1916+ return ;
1917+ }
1918+
1919+ for ( int i = 0 ; i < TriggerEventType . MAX_PARAM_COUNT ; i ++ )
1920+ {
1921+ if ( ( int ) triggerEventType . Parameters [ i ] . TriggerParamType < 0 )
1922+ {
1923+ triggerCondition . Parameters [ i ] = Math . Abs ( ( int ) triggerEventType . Parameters [ i ] . TriggerParamType ) . ToString ( CultureInfo . InvariantCulture ) ;
1924+ continue ;
1925+ }
1926+
1927+ if ( triggerEventType . Parameters [ i ] . TriggerParamType == TriggerParamType . Unused )
1928+ {
1929+ // additional params need to be empty instead of 0 if they're unused
1930+ if ( i >= TriggerCondition . DEF_PARAM_COUNT )
1931+ triggerCondition . Parameters [ i ] = string . Empty ;
1932+ else
1933+ triggerCondition . Parameters [ i ] = "0" ;
1934+ }
1935+ }
1936+ }
1937+
18681938 private void SetTriggerActionHardcodedParameters ( TriggerAction triggerAction )
18691939 {
18701940 if ( ! map . EditorConfig . TriggerActionTypes . TryGetValue ( triggerAction . ActionIndex , out var triggerActionType ) )
0 commit comments