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);
		obj.putInt("cur510kFen", player.cur510kFen);
		obj.putInt("ju510kFen", player.ju510kFen);
		obj.putInt("curXiFen", player.curXiFen);
		obj.putInt("juXiFen", player.juXiFen);
		
		player.hp_info(obj);
		return obj;
	}

	public void addOutCardCommand(int seat, CardGroup ct, EXPlayer owner, int all510k, EXRoom room) {
		ITObject cmdData = ct.toObject(false);
		cmdData.putInt("all510k", all510k);
		cmdData.putInt("cur5Num", room.cur5Num);
		cmdData.putInt("cur10Num", room.cur10Num);
		cmdData.putInt("curkNum", room.curkNum);
		addCommand("OutCard", seat, cmdData);
	}

	public void add510KFenCommand(int seat, EXPlayer owner) {
		ITObject obj = TObject.newInstance();
		obj.putInt("cur510kFen", owner.cur510kFen);
		obj.putInt("ju510kFen", owner.ju510kFen);
		obj.putInt("curXiFen", owner.curXiFen);
		obj.putInt("juXiFen", owner.juXiFen);
		addCommand("510kFen", seat, obj);
	}

	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);
	}
}
