package extend.pk;

import java.util.Map;

import com.game.GameController;
import com.game.Global;
import com.game.MainServer;
import com.game.data.Player;
import com.game.data.Room;
import com.game.room.state.RoomStartGameState;

import extend.pk.player.state.EXPlayerDaNiaoTipState;
import extend.pk.player.state.EXPlayerDiscardState;
import extend.pk.player.state.EXPlayerPassState;
import extend.pk.player.state.EXPlayerPiaoNiaoTipState;
import extend.pk.room.state.EXRoomDaNiaoState;
import extend.pk.room.state.EXRoomDealState;
import extend.pk.room.state.EXRoomPiaoState;
import extend.pk.room.state.EXRoomSetpState;
import extend.pk.room.state.EXRoomStartGameState;

/**
 * 
 * 
 */
public class EXMainServer extends MainServer {
	public static EXGameController gameCtr;

	@Override
	public void onStart() {
		super.onStart();
		gameCtr = (EXGameController) Global.gameCtr;
        registerState();
	}

	private final void registerState() {
		
		Global.registerState(RoomStartGameState.class, new EXRoomStartGameState());
		Global.registerState(EXRoomSetpState.class, new EXRoomSetpState());
		Global.registerState(EXRoomDealState.class, new EXRoomDealState());
		Global.registerState(EXRoomPiaoState.class, new EXRoomPiaoState());

		Global.registerState(EXRoomDaNiaoState.class, new EXRoomDaNiaoState());
		Global.registerState(EXPlayerDaNiaoTipState.class, new EXPlayerDaNiaoTipState());
		Global.registerState(EXPlayerDiscardState.class, new EXPlayerDiscardState());
		Global.registerState(EXPlayerPassState.class, new EXPlayerPassState());
		Global.registerState(EXPlayerPiaoNiaoTipState.class, new EXPlayerPiaoNiaoTipState());
	}


	@Override
	public Room newRoom(String roomid, Map<String, String> redis_room_map) {
		// TODO Auto-generated method stub
		return new EXRoom(roomid, redis_room_map);
	}


	@Override
	public Player newPlayer(int playerid, Room room, String session_id) {
		// TODO Auto-generated method stub
		return new EXPlayer(playerid, room, session_id);
	}


	@Override
	protected GameController newController() {
		// TODO Auto-generated method stub
		return new EXGameController();
	}
}
