package extend.pk;

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.*;
import extend.pk.room.state.*;

import java.util.Map;

/**
 * 
 * 
 */
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(EXRoomBaoChunState.class, new EXRoomBaoChunState());

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

		Global.registerState(EXPlayerBaoChunState.class, new EXPlayerBaoChunState());
		Global.registerState(EXPlayerTongYiBaoChunState.class, new EXPlayerTongYiBaoChunState());
	}


	@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();
	}
}
