Added + operator to HandlerList<T>. Now it works just like events meaning you don't have to initialize it. Note that means you also cannot call 'Register' unless you create an instance first.
You can do 'TileEdit += HandlerList<TileEditEventArgs>.Create(test, priority, true);'. Which 'Create' takes the same parameters as Register. Or if you don't need the parameters you can do 'TileEdit += test;'.
This commit is contained in:
parent
6437d2a977
commit
5816b5badd
2 changed files with 36 additions and 7 deletions
|
|
@ -58,9 +58,12 @@ namespace TShockAPI
|
|||
public float Type { get; set; }
|
||||
public float EditType { get; set; }
|
||||
}
|
||||
public static HandlerList<TileEditEventArgs> TileEdit = new HandlerList<TileEditEventArgs>();
|
||||
public static HandlerList<TileEditEventArgs> TileEdit;
|
||||
public static bool OnTileEdit(float x, float y, float type, float editType)
|
||||
{
|
||||
if (TileEdit == null)
|
||||
return false;
|
||||
|
||||
var args = new TileEditEventArgs
|
||||
{
|
||||
X = x,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue