package extend.zp.player.state;

import com.game.ActionEvent;
import com.game.state.StateBase;

import extend.zp.EXMainServer;
import extend.zp.EXPlayer;


public abstract class EXPlayerTipState extends StateBase<EXPlayer> {
	@Override
	public void enter(EXPlayer owner) {
		// TODO Auto-generated method stub

		if (!owner.isEntrust()) {
			_tipEvent(owner);
			owner.startActionTimer();
		} else {
			owner.startActionTimer(500);
		}

	}

	@SuppressWarnings("unchecked")
	@Override
	public void toNextState(EXPlayer owner) {
		owner.stateMachine.lastState.toNextState(owner);
	}

	@Override
	public void exit(EXPlayer owner) {
		owner.tipMgr.clean();
		owner.stopActionTimer();
	}

	protected void _tipEvent(EXPlayer owner) {

		EXMainServer.gameCtr.tipEvent(owner);
	}

	protected void _action(EXPlayer owner, int id, int gid) {
	}

	@Override
	public void execute(EXPlayer owner, String cmd, int gid, Object param) {
		if (ActionEvent.EVENT_ENTRUST.equals(cmd)) {
			owner.startActionTimer();
		}
	}
    @Override
	public void reload(EXPlayer owner) {
    	EXMainServer.gameCtr.tipEvent(owner);
	}
}
