package extend.mj.player.state;

import java.util.Map.Entry;

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

import extend.mj.EXActionEvent;
import extend.mj.EXPlayer;
import extend.mj.RuleWeight;
import extend.mj.tip.Tip;

/**
 * 
 */
public class EXPlayerDrawTipState extends EXPlayerTipState {

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

}
