Ejemplo n.º 1
0
    static void Main(string[] args)
    {
        Action <TestEvent> typeCallback = TypeCallBack;

        _EventCenter.On(typeCallback);

        _EventCenter.Emit(new TestEvent(10, "Test"));

        _EventCenter.Emit(new TestEvent(10, "Test"));

        _EventCenter.Off(typeCallback);

        _EventCenter.Emit(new TestEvent(10, "Test"));

        _EventCenter.Once(typeCallback);

        _EventCenter.Emit(new TestEvent(10, "Test"));

        _EventCenter.Emit(new TestEvent(10, "Test"));

        // string event

        _EventCenter.On("test", StingCallBack);

        _EventCenter.Emit("test", "123", 798, "321");

        _EventCenter.Emit("test", "123", 798, "321");

        _EventCenter.Off("test", StingCallBack);

        _EventCenter.Emit("test", "123", 798, "321");

        _EventCenter.Once("test", StingCallBack);

        _EventCenter.Emit("test", "123", 798, "321");

        _EventCenter.Emit("test", "123", 798, "321");

        // Number Event

        _EventCenter.On(1, StingCallBack);

        _EventCenter.Emit(1, "000", 123, "000");

        _EventCenter.Emit(1, "000", 123, "000");

        _EventCenter.Off(1, StingCallBack);

        _EventCenter.Emit(1, "000", 123, "000");

        _EventCenter.Once(1, StingCallBack);

        _EventCenter.Emit(1, "000", 123, "000");

        _EventCenter.Emit(1, "000", 123, "000");
    }
Ejemplo n.º 2
0
 private void OnDisable()
 {
     EventCenter.Off("LoseHomie", LoseHomie);
 }
Ejemplo n.º 3
0
 private void OnDisable()
 {
     EventCenter.Off("up", MoveUp);
     EventCenter.Off("down", MoveDown);
 }