Begin work on actionHandler
This commit is contained in:
		@@ -80,4 +80,6 @@ public AnimationHandler getAnimationHandler() {
 | 
			
		||||
    public AcousticHandler getAcousticHandler() {
 | 
			
		||||
        return acousticHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public MdgaState getState() {return state; }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,44 +5,9 @@
 | 
			
		||||
import pp.mdga.notification.PlayerInGameNotification;
 | 
			
		||||
 | 
			
		||||
public enum MdgaState {
 | 
			
		||||
    NONE {
 | 
			
		||||
        @Override
 | 
			
		||||
        void handleNotification(MdgaApp app, Notification notification) {
 | 
			
		||||
            throw new RuntimeException("unexpected notification");
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    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);
 | 
			
		||||
    NONE,
 | 
			
		||||
    MAIN,
 | 
			
		||||
    LOBBY,
 | 
			
		||||
    GAME,
 | 
			
		||||
    CEREMONY;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,12 @@
 | 
			
		||||
package pp.mdga.client;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.Acoustic.MusicAsset;
 | 
			
		||||
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;
 | 
			
		||||
@@ -17,7 +17,32 @@ void update() {
 | 
			
		||||
        //TODO fetch model notifications
 | 
			
		||||
 | 
			
		||||
        for (Notification n : notifications) {
 | 
			
		||||
            state.handleNotification(app, n);
 | 
			
		||||
            switch (app.getState()) {
 | 
			
		||||
                case MAIN:
 | 
			
		||||
 | 
			
		||||
                    break;
 | 
			
		||||
                case LOBBY:
 | 
			
		||||
 | 
			
		||||
                    break;
 | 
			
		||||
                case GAME:
 | 
			
		||||
 | 
			
		||||
                    break;
 | 
			
		||||
                case CEREMONY:
 | 
			
		||||
 | 
			
		||||
                    break;
 | 
			
		||||
                case NONE:
 | 
			
		||||
                    throw new RuntimeException("no notification expected");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void handleMain(Notification notification) {
 | 
			
		||||
        throw new RuntimeException("no notification expected in state: MAIN");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void handleGame(Notification notification) {
 | 
			
		||||
        if(notification instanceof ) {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user