Package ch.sahits.game.openpatrician.server

Source Code of ch.sahits.game.openpatrician.server.SinglePlayerEventListener

package ch.sahits.game.openpatrician.server;

import ch.sahits.game.event.ChangeRequest;
import ch.sahits.game.event.EViewChangeEvent;
import ch.sahits.game.event.Event;
import ch.sahits.game.event.IEventListener;
import ch.sahits.game.event.ViewChangeEvent;
import ch.sahits.game.event.ViewChangeRequestEvent;
import ch.sahits.game.openpatrician.client.event.IMainGameView;
/**
* Event listener delegate for the single player game. The communication between server and
* listener happens in package and must happen in a synchronized manner.
* @author Andi Hotz, (c) Sahits GmbH, 2011
* Created on Sep 18, 2011
*
*/
class SinglePlayerEventListener implements IEventListener {

  @Override
  public void gameUpdate(Event e, Object eventNotice) {
    if (e instanceof ViewChangeRequestEvent){
      ViewChangeRequestEvent event = (ViewChangeRequestEvent) e;
      if (event.getAdressee().equals(ChangeRequest.ALL)){
        if (eventNotice.equals(EViewChangeEvent.START_GAME)){
          // notify the human player of the gameview change
          new ViewChangeEvent(IMainGameView.class).notify(EViewChangeEvent.START_GAME);
        }
      }
    }
    // TODO Auto-generated method stub

  }

}
TOP

Related Classes of ch.sahits.game.openpatrician.server.SinglePlayerEventListener

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.