Client work of the Week #4
@@ -0,0 +1,4 @@
|
||||
package Acoustic;
|
||||
|
||||
public class AcousticHandler {
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public void update() {
|
||||
if(animation.isOver()) {
|
||||
animation = null;
|
||||
|
||||
//trigger next state
|
||||
//trigger next state in model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
import pp.mdga.notification.Notification;
|
||||
import pp.mdga.notification.PieceInGameNotification;
|
||||
import pp.mdga.notification.PlayerInGameNotification;
|
||||
|
||||
public enum MdgaState {
|
||||
MAIN {
|
||||
@Override
|
||||
void handleNotification(MdgaApp app, Notification notification) {
|
||||
throw new RuntimeException("unexpected notification");
|
||||
}
|
||||
},
|
||||
LOBBY {
|
||||
@Override
|
||||
void handleNotification(MdgaApp app, Notification notification) {
|
||||
throw new RuntimeException("unexpected notification");
|
||||
}
|
||||
},
|
||||
GAME {
|
||||
@Override
|
||||
void handleNotification(MdgaApp app, Notification notification) {
|
||||
if(notification instanceof PlayerInGameNotification) {
|
||||
//TODO
|
||||
}
|
||||
else if(notification instanceof PieceInGameNotification){
|
||||
//TODO
|
||||
}
|
||||
else {
|
||||
throw new RuntimeException("unexpected notification");
|
||||
}
|
||||
}
|
||||
},
|
||||
CEREMONY {
|
||||
@Override
|
||||
void handleNotification(MdgaApp app, Notification notification) {
|
||||
throw new RuntimeException("unexpected notification");
|
||||
}
|
||||
};
|
||||
|
||||
abstract void handleNotification(MdgaApp app, Notification notification);
|
||||
}
|
||||
@@ -1,5 +1,23 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class NotificationSynchronizer {
|
||||
import pp.mdga.notification.Notification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class NotificationSynchronizer {
|
||||
private final MdgaApp app;
|
||||
private MdgaState state = MdgaState.MAIN;
|
||||
|
||||
NotificationSynchronizer(MdgaApp app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
void update() {
|
||||
ArrayList<Notification> notifications = new ArrayList<>();
|
||||
//TODO fetch model notifications
|
||||
|
||||
for (Notification n : notifications) {
|
||||
state.handleNotification(app, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.State;
|
||||
|
||||
public class CeremonyState {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.State;
|
||||
|
||||
public class GameState {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.State;
|
||||
|
||||
public class LobbyState {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.State;
|
||||
|
||||
public class MdgaState {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.State;
|
||||
|
||||
public class MusicState {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.State;
|
||||
|
||||
public class SoundState {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user