@Test public void testTriggerEvent () { AtomicInteger count = new AtomicInteger(0); AtomicInteger count1 = new AtomicInteger(0); EventListener listener = eventData -> { count.incrementAndGet(); }; EventListener listener1 = event -> { count1.incrementAndGet(); }; Events.addListener(Events.UI_THREAD, 2, listener); Events.addListener(Events.LOGIC_THREAD, 2, listener1); Events.triggerEvent(new DummyOtherEventDataObject()); Events.triggerEvent(new DummyOtherEventDataObject()); assertEquals(2, count.get()); assertEquals(2, count1.get()); Events.removeListener(Events.UI_THREAD, 1, listener); Events.removeListener(Events.LOGIC_THREAD, 1, listener1); }
public static void triggerEvent (EventData event) { event.retain(NUM_THREADS - 1); for (int i = 0; i < NUM_THREADS; i++) { managers[i].triggerEvent(event); } }
Events { public static void triggerEvent (EventData event) { event.retain(NUM_THREADS - 1); for (int i = 0; i < NUM_THREADS; i++) { managers[i].triggerEvent(event); } } }
Events { public static void triggerEvent (EventData event) { event.retain(NUM_THREADS - 1); for (int i = 0; i < NUM_THREADS; i++) { managers[i].triggerEvent(event); } } protected  Events(); }
Events { public static void triggerEvent (EventData event) { event.retain(NUM_THREADS - 1); for (int i = 0; i < NUM_THREADS; i++) { managers[i].triggerEvent(event); } } protected  Events(); static void init(); static void queueEvent(EventData event); static void triggerEvent(EventData event); static void update(int threadID, int maxMillis); static void addListener(int threadID, ClientEvents event, EventListener listener); static void addListener(int threadID, int typeID, EventListener listener); static void removeListener(int threadID, int typeID, EventListener listener); }
Events { public static void triggerEvent (EventData event) { event.retain(NUM_THREADS - 1); for (int i = 0; i < NUM_THREADS; i++) { managers[i].triggerEvent(event); } } protected  Events(); static void init(); static void queueEvent(EventData event); static void triggerEvent(EventData event); static void update(int threadID, int maxMillis); static void addListener(int threadID, ClientEvents event, EventListener listener); static void addListener(int threadID, int typeID, EventListener listener); static void removeListener(int threadID, int typeID, EventListener listener); static final int UI_THREAD; static final int LOGIC_THREAD; static final int NETWORK_THREAD; }