package extend.pk.room.state;

import java.util.Map.Entry;

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

import extend.pk.Config;
import extend.pk.EXPlayer;
import extend.pk.EXRoom;

/**
 * 房间开始状态
 * 
 * 
 */
public class EXRoomStartGameState extends StateBase<EXRoom> {

	@Override
	public void enter(EXRoom owner) {

		for (Entry<Integer, Player> entry : owner.playerMapBySeat.entrySet()) {
			EXPlayer player = (EXPlayer) entry.getValue();
			player.clearEx();
			player.ready = false;
		}


		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.stateMachine.changeState(Global.getState(EXRoomDaNiaoState.class));
		} else {
			owner.stateMachine.changeState(Global.getState(EXRoomDealState.class));
		}
	}
}
