package extend.mj;

import com.game.Util;
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;

public class EXPlayBack extends BasePlayBack{


	public EXPlayBack(EXRoom room){
		super(room);
		info.putInt("left_card", room.card.getCount());
	}
	
	protected ITObject getPlayerInfo(Player player) {
		ITObject obj =super.getPlayerInfo(player);
		EXPlayer p = (EXPlayer)player;
		ITArray cardInhand = Util.toTArray(p.cardInhand);
		obj.putTArray("hand_card", cardInhand);
		obj.putInt("score", player.score.total_score);
		obj.putInt("piao", p.piao);
		return obj;
	}
	
	public void addGetCardCommand(int seat,int card,int left_count){
		ITObject data = TObject.newInstance();
		data.putInt("card", card);
		data.putInt("left_count", left_count);
		addCommand("GetCard",seat,data);
	}
	
	
	public void addOutCardCommand(int seat,int card){
		ITObject data = TObject.newInstance();
		data.putInt("card", card);
		addCommand("OutCard",seat,data);
	}
	
	public void addOutCardKongCommand(int seat,ITArray card){
		ITObject data = TObject.newInstance();
		data.putTArray("cardList", card);
		addCommand("OutCardKong",seat,data);
	}
	
	public void addActionCommand(int seat,int type,int card,int from_seat,ITArray opcardArray){
		ITObject cmdData = TObject.newInstance();
		cmdData.putInt("card", card);
		cmdData.putInt("type", type);
		cmdData.putInt("from_seat", from_seat);
		if(opcardArray!=null)
		cmdData.putTArray("opcard", opcardArray);
		addCommand("Action",seat,cmdData);
	}

	public void addWinCardCommand(int seat,boolean zimo){
		ITObject cmdData = TObject.newInstance();
		addCommand("Win",seat,cmdData);
	}
	
	public void addNiaoCommand(int seat,ITObject param){
		addCommand("Niao",seat,param);
	}

	public void addMaiNiaoCommand(int seat,ITObject param){
		addCommand("Mai_Niao",seat,param);
	}

}
