Rewrote ActionManager with the new IActionQueue framework

This commit is contained in:
bigguy345 committed 2025-07-02 20:56:54 +03:00
1 parent 6cc9aa0e78
commit 25e6f39afd
2 files changed
+144 -238

No files matched your search

@@ -20,6 +20,11 @@ public class ActionQueue implements IActionQueue {
this.name = name;
}
public ActionQueue(ActionManager manager, String name, boolean isParallel) {
this(manager, name);
this.isParallel = isParallel;
}
@Override
public IActionQueue start() {
isWorking = true;
@@ -45,6 +50,11 @@ public class ActionQueue implements IActionQueue {
return isParallel;
}
public IActionQueue setParallel(boolean parallel) {
isParallel = parallel;
return this;
}
@Override
public Queue<IAction> getQueue() {
return queue;
@@ -53,12 +63,15 @@ public class ActionQueue implements IActionQueue {
@Override
public IAction schedule(IAction action) {
Action act = (Action) action;
if (act.unscheduledBefore != null)
if (!isParallel && act.unscheduledBefore != null)
act.scheduleAllBefore(queue);
queue.addLast(action);
if (act.unscheduledAfter != null)
if (!isParallel && act.unscheduledAfter != null)
act.scheduleAllAfter(queue);
act.isScheduled = true;
@@ -71,16 +84,17 @@ public class ActionQueue implements IActionQueue {
schedule(act);
}
@Override
public IAction schedule(Consumer<IAction> task) {
return schedule(manager.create(task));
}
@Override
public void schedule(Consumer<IAction>... tasks) {
for (Consumer<IAction> task : tasks)
schedule(task);
}
@Override
public IAction schedule(Consumer<IAction> task) {
return schedule(manager.create(task));
}
@Override
public IAction schedule(int delay, Consumer<IAction> task) {