application cycle verwijderd, structuur input listener aangepast en event manager netter gemaakt.
This commit is contained in:
@@ -5,15 +5,15 @@ import java.util.ArrayList;
|
||||
import pm.Application;
|
||||
import pm.Device;
|
||||
import pm.Main;
|
||||
import pm.application.ApplicationCycle;
|
||||
import pm.event.task.Stopper;
|
||||
import pm.util.ArrayCycle;
|
||||
import pm.value.Target;
|
||||
|
||||
public class EventManager {
|
||||
protected static ArrayList<EventListener> eventListenerList;
|
||||
protected static ApplicationCycle applicationCycle;
|
||||
protected static ArrayCycle<Application> applicationCycle;
|
||||
|
||||
public static void initialise(ApplicationCycle applicationCycle) {
|
||||
public static void initialise(ArrayCycle<Application> applicationCycle) {
|
||||
eventListenerList = new ArrayList<EventListener>();
|
||||
EventManager.applicationCycle = applicationCycle;
|
||||
}
|
||||
@@ -30,8 +30,7 @@ public class EventManager {
|
||||
|
||||
public static void add(EventListener self, Task task) {
|
||||
if (task instanceof Stopper) {
|
||||
Stopper stopper = (Stopper) task;
|
||||
stopper.stop();
|
||||
((Stopper) task).stop();
|
||||
} else {
|
||||
Target target = task.getTarget();
|
||||
switch (target) {
|
||||
@@ -43,7 +42,7 @@ public class EventManager {
|
||||
applicationCycle.current().add(task);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default: {
|
||||
for (EventListener eventListener : eventListenerList) {
|
||||
switch (target) {
|
||||
case ALL:
|
||||
@@ -66,11 +65,16 @@ public class EventManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void add(Task task) {
|
||||
add(null, task);
|
||||
}
|
||||
|
||||
private static void add(Task task) {
|
||||
if (!task.getTarget().equals(Target.SELF)) {
|
||||
add(null, task);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user