Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AnonymousEventHandler.cs
public class AnonymousEventHandler
{
object Handler;
private AnonymousEventHandler(object handler) {
Handler = handler;
}
public static Action<Player> Create(Action<Player> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do([FromSource] Player source) {
var cb = (Action<Player>)this.Handler;
cb(source);
}
public static Action<Player, T0> Create<T0>(Action<Player, T0> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0>([FromSource] Player source, T0 _0) {
var cb = (Action<Player, T0>)this.Handler;
cb(source, _0);
}
public static Action<Player, T0, T1> Create<T0, T1>(Action<Player, T0, T1> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0, T1>([FromSource] Player source, T0 _0, T1 _1) {
var cb = (Action<Player, T0, T1>)this.Handler;
cb(source, _0, _1);
}
public static Action<Player, T0, T1, T2> Create<T0, T1, T2>(Action<Player, T0, T1, T2> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0, T1, T2>([FromSource] Player source, T0 _0, T1 _1, T2 _2) {
var cb = (Action<Player, T0, T1, T2>)this.Handler;
cb(source, _0, _1, _2);
}
public static Action<Player, T0, T1, T2, T3> Create<T0, T1, T2, T3>(Action<Player, T0, T1, T2, T3> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0, T1, T2, T3>([FromSource] Player source, T0 _0, T1 _1, T2 _2, T3 _3) {
var cb = (Action<Player, T0, T1, T2, T3>)this.Handler;
cb(source, _0, _1, _2, _3);
}
public static Action<Player, T0, T1, T2, T3, T4> Create<T0, T1, T2, T3, T4>(Action<Player, T0, T1, T2, T3, T4> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0, T1, T2, T3, T4>([FromSource] Player source, T0 _0, T1 _1, T2 _2, T3 _3, T4 _4) {
var cb = (Action<Player, T0, T1, T2, T3, T4>)this.Handler;
cb(source, _0, _1, _2, _3, _4);
}
public static Action<Player, T0, T1, T2, T3, T4, T5> Create<T0, T1, T2, T3, T4, T5>(Action<Player, T0, T1, T2, T3, T4, T5> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0, T1, T2, T3, T4, T5>([FromSource] Player source, T0 _0, T1 _1, T2 _2, T3 _3, T4 _4, T5 _5) {
var cb = (Action<Player, T0, T1, T2, T3, T4, T5>)this.Handler;
cb(source, _0, _1, _2, _3, _4, _5);
}
public static Action<Player, T0, T1, T2, T3, T4, T5, T6> Create<T0, T1, T2, T3, T4, T5, T6>(Action<Player, T0, T1, T2, T3, T4, T5, T6> func) {
var r = new AnonymousEventHandler(func);
return r.Do;
}
private void Do<T0, T1, T2, T3, T4, T5, T6>([FromSource] Player source, T0 _0, T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6) {
var cb = (Action<Player, T0, T1, T2, T3, T4, T5, T6>)this.Handler;
cb(source, _0, _1, _2, _3, _4, _5, _6);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment