package extend.zp.room.state;

import com.game.Global;
import com.game.data.Player;
import com.game.state.StateBase;
import extend.zp.*;
import extend.zp.player.state.EXPlayerDaNiaoTipState;

import java.util.Map.Entry;

public class EXRoomDaNiaoState extends StateBase<EXRoom>{

	@Override
	public void enter(EXRoom owner) {
		if (owner.bankerSeat == 0) {
			owner.bankerSeat = 1;
		}
		owner.daNiaoCount = owner.maxPlayers;

		//owner.playBackData = new PlayBack(owner);
		for (Entry<Integer, Player> entry : owner.playerMapById.entrySet()) {
			Player player = entry.getValue();
			player.stateMachine.changeState(Global.getState(EXPlayerDaNiaoTipState.class));
		}
	}
	
	public void execute(EXRoom owner, String cmd, int gid, Object param) {
		if(cmd.equals(EXActionEvent.EVENT_DA_NIAO)) {
			if(owner.daNiaoCount==0) {
				owner.stateMachine.changeState(Global.getState(EXRoomDealState.class));
			}
		}
	}
}
