moved timermanger to app
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
import com.sun.tools.javac.Main;
|
import com.sun.tools.javac.Main;
|
||||||
import pp.mdga.client.acoustic.AcousticHandler;
|
import pp.mdga.client.acoustic.AcousticHandler;
|
||||||
import com.jme3.system.AppSettings;
|
import com.jme3.system.AppSettings;
|
||||||
|
import pp.mdga.client.animation.TimerManager;
|
||||||
import pp.mdga.client.dialog.JoinDialog;
|
import pp.mdga.client.dialog.JoinDialog;
|
||||||
import pp.mdga.client.view.*;
|
import pp.mdga.client.view.*;
|
||||||
|
|
||||||
@@ -66,6 +67,9 @@ public class MdgaApp extends SimpleApplication {
|
|||||||
|
|
||||||
private ServerConnection networkConnection;
|
private ServerConnection networkConnection;
|
||||||
|
|
||||||
|
private final TimerManager timerManager = new TimerManager();
|
||||||
|
|
||||||
|
|
||||||
public static final int DEBUG_MULTIPLIER = 0;
|
public static final int DEBUG_MULTIPLIER = 0;
|
||||||
|
|
||||||
public MdgaApp() {
|
public MdgaApp() {
|
||||||
@@ -144,6 +148,7 @@ public void simpleUpdate(float tpf) {
|
|||||||
acousticHandler.update();
|
acousticHandler.update();
|
||||||
notificationSynchronizer.update();
|
notificationSynchronizer.update();
|
||||||
inputSynchronizer.update(tpf);
|
inputSynchronizer.update(tpf);
|
||||||
|
timerManager.update(tpf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -324,5 +329,9 @@ public void afterGameCleanup() {
|
|||||||
public GameView getGameView(){
|
public GameView getGameView(){
|
||||||
return gameView;
|
return gameView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TimerManager getTimerManager() {
|
||||||
|
return timerManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class MatrixAnimation extends ActionControl {
|
|||||||
private List<ParticleEmitter> activeEmitter = new ArrayList<>();
|
private List<ParticleEmitter> activeEmitter = new ArrayList<>();
|
||||||
private ParticleEmitter radarEmitter = null;
|
private ParticleEmitter radarEmitter = null;
|
||||||
private float timeElapsed = 0f;
|
private float timeElapsed = 0f;
|
||||||
private final TimerManager timerManager = new TimerManager();
|
|
||||||
|
|
||||||
|
|
||||||
private enum MatrixState{
|
private enum MatrixState{
|
||||||
@@ -61,8 +60,9 @@ protected void controlUpdate(float tpf) {
|
|||||||
state = MatrixState.RADAR_OFF;
|
state = MatrixState.RADAR_OFF;
|
||||||
timeElapsed = 0;
|
timeElapsed = 0;
|
||||||
radarEmitter.setParticlesPerSec(0);
|
radarEmitter.setParticlesPerSec(0);
|
||||||
timerManager.addTask(3f, () -> app.enqueue(() -> {
|
app.getTimerManager().addTask(3f, () -> app.enqueue(() -> {
|
||||||
app.getRootNode().detachChild(radarEmitter);
|
app.getRootNode().detachChild(radarEmitter);
|
||||||
|
System.out.println("delete radar");
|
||||||
return null;
|
return null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -80,14 +80,13 @@ protected void controlUpdate(float tpf) {
|
|||||||
state = MatrixState.MATRIX_OFF;
|
state = MatrixState.MATRIX_OFF;
|
||||||
timeElapsed = 0;
|
timeElapsed = 0;
|
||||||
turnOff();
|
turnOff();
|
||||||
new Timer().schedule(new TimerTask() {
|
app.getTimerManager().addTask(3f, () -> app.enqueue(() -> {
|
||||||
@Override
|
for (ParticleEmitter particleEmitter : activeEmitter){
|
||||||
public void run() {
|
app.getRootNode().detachChild(particleEmitter);
|
||||||
for (ParticleEmitter particleEmitter : activeEmitter){
|
|
||||||
app.getRootNode().detachChild(particleEmitter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 3000);
|
System.out.println("delete particle");
|
||||||
|
return null;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MATRIX_OFF -> {
|
case MATRIX_OFF -> {
|
||||||
@@ -98,7 +97,6 @@ public void run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timerManager.update(tpf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void turnOff(){
|
private void turnOff(){
|
||||||
|
|||||||
Reference in New Issue
Block a user