package extend.pk;


import com.game.data.BasePlayBack;
import com.game.data.Player;
import com.taurus.core.entity.ITArray;
import com.taurus.core.entity.ITObject;
import com.taurus.core.entity.TObject;

import extend.pk.uitl.CardUtil;

public class EXPlayBack  extends BasePlayBack{

	public EXPlayBack(EXRoom room) {
		super(room);
		info.putInt("left_card", room.card.getCount());
	}
	
	protected ITObject getPlayerInfo(Player p) {
		
		EXPlayer player = (EXPlayer)p;
		ITObject obj =super.getPlayerInfo(player);
		ITArray cardInhand = CardUtil.toTArray(player.cardInhand);
		obj.putTArray("hand_card", cardInhand);
		obj.putInt("score", player.score.total_score);
		obj.putInt("piao", player.piao);
		
		player.hp_info(obj);
		return obj;
	}

	public void addOutCardCommand(int seat, CardGroup ct) {
		ITObject cmdData = ct.toObject(false);
		addCommand("OutCard", seat, cmdData);
	}
	
	public void addPassCommand(int seat) {
		ITObject cmdData = TObject.newInstance();
		addCommand("pass", seat, cmdData);
	}
	
	public void addNewRoundCommand() {
		ITObject cmdData = TObject.newInstance();
		addCommand("newindex", 0, cmdData);
	}
	
	public void addResultCommand(int seat,ITObject cmdData) {
		addCommand("result", seat, cmdData);
	}
}
