package extend.zp.room.state;

import java.util.Map.Entry;

import com.game.Global;
import com.game.data.Player;
import com.game.state.StateBase;

import extend.zp.Config;
import extend.zp.EXRoom;


public class EXRoomStartGameState extends StateBase<EXRoom> {

	@Override
	public void enter(EXRoom owner) {
		// TODO Auto-generated method stub
		//owner.readyCount = 0;
		//暂停托管
		for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
			Player player = entry.getValue();
			player.clear();
			player.initSeat();
			player.ready = false;
		}
		owner.startGame();

		this.toNextState(owner);
	}

	@Override
	public void toNextState(EXRoom owner) {
		// TODO Auto-generated method stub
		if(owner.config.containsKey(Config.GAME_DANIAO) && owner.config.getInt(Config.GAME_DANIAO) != 0 &&owner.daniaoflag<2) {
			owner.stateMachine.changeState(Global.getState(EXRoomDaNiaoState.class));
		}else {
			owner.stateMachine.changeState(Global.getState(EXRoomDealState.class));
		}
	}
}
