package extend.mj.player.state;

import com.game.ActionEvent;
import com.game.Global;
import com.taurus.core.entity.ITObject;

import extend.mj.EXActionEvent;
import extend.mj.EXPlayer;

/**
 * ��ҳ�����ʾ״̬
 * 
 *
 * 2017��8��30��
 * EXPlayerDisCardTipState.java
 */
public class EXPlayerDisCardTipState extends EXPlayerTipState {

	@Override
	public void enter(EXPlayer owner) {
		super.enter(owner);
		owner.getRoom().tipMap.put(owner.playerid, owner.tipMgr);
	}

	@Override
	public void exit(EXPlayer owner) {
		super.exit(owner);
		owner.getRoom().tipMap.remove(owner.playerid);
	}

	@Override
	public void execute(EXPlayer owner, String cmd, int gid, Object param) {
		super.execute(owner, cmd, gid, param);
		if (cmd.equals(EXActionEvent.EVENT_ACTION)) {
			ITObject netParam = (ITObject) param;
			int id = netParam.getInt("id");
			owner.tipMgr.choicAction(id);
		}else if(cmd.equals(ActionEvent.EVENT_TIMER_AUTO)) {
			int id = 0;
			/*
			for (Entry<Integer, Tip> entry : owner.tipMgr.tipMap.entrySet()) {
				Tip tip = entry.getValue();
				if(tip.type == RuleWeight.TYPE_WIN) {
					id = tip.id;
					break;
				}
			}
			 */
			owner.tipMgr.choicAction(id);
		}else if(cmd.equals(EXActionEvent.EVENT_DOGANG)){
			ITObject netParam2 = (ITObject) param;
			int discard2 = netParam2.getInt("card");
			Global.logger.info("EVENT_DOGANG dis tip:"+discard2);
		}
	}

}
