I have this:
public event Action<BaseCommodity> OnGatherActionSelected = delegate { };
gmp.OnGatherActionSelected += m_Worker.CharacterActions.StartGatherMaterials; // << takes a parameter
but now i want to use the event to call a method which takes 0 parameters
gmp.OnGatherActionSelected += ParentPanel.RedrawUI; // does not take parameters .. DOES NOT WORK :(
how can i do this?
The easiest option is to add a handler that takes the parameter and ignores it, delegating to the method you want to use:
gmp.OnGatherActionSelected += _ => ParentPanel.RedrawUI();
You can wrap it in a method that takes a parameter:
gmp.OnGatherActionSelected += x => ParentPanel.RedrawUI();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With