using System;
using System.Collections.Generic;

using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using nativeCom;

//吴龙剑先完成这个单元    ！！！
public class mj:mjbase{
	
	
	bool isTmp=true;
	public bool fun_menqing(int hpr){//查引用 看范例
		mainDo("门清",new int[]{hpr},null);
		return getvalue_int(0)>0;
	}
	public int fun_lingpai(){
		mainDo("零牌",null,null);
		return getvalue_int(0);
	}
	public int fun_lingpaiSty(){
		mainDo("零牌类型",null,null);
		return getvalue_int(0);
	}
	
	/// <summary>
	/// 添加临时番
	/// </summary>
	/// <param name="fans"></param>
	public void fun_addTempFan(int[] fans){
		mainDo("临时番",fans,null);
	}
	/// <summary>
	/// 上把庄家
	/// </summary>
	/// <returns></returns>
	public int fun_lastZj(){
		mainDo("上把庄家",null,null);
		return getvalue_int(0);
	}
	
	/// <summary>
	/// 获取庄家ID
	/// </summary>
	/// <returns></returns>
	public int fun_zjUserID(){
		mainDo("庄家",null,null);
		return  getvalue_int(0);
	}
	
	public void fun_addTempFan_qianlouzi(int[] fans,bool canju,bool writetmp){
		sbyte[] bts=new sbyte[2];
		if(canju) bts[0]=1;else bts[0]=0;
		if(writetmp) bts[1]=1;else bts[1]=0;
		mainDo("钱娄子",fans,bts);
	}
	
	
	
	/*
	 * 
	 * 
	-----麻将----
  55: begin //增加杠 谁 牌 类型(0..2 <-10则等于-n-10 -1则等于杠上精  放杠人[0..1有效])
        C_lg.addgang_qian(pb[0][0], pb[0][1], pb[0][2], pb[0][3]);
      end;
    56: begin //删除杠 谁 牌 新分数【-1一定删   否则和老分数比较、大于老的才删】
        C_lg.delgang_qian(pb[0][0], pb[0][1], pb[0][2]);
      end;
    57: begin //牌是否杠
        p[4][0] := 0;
        if c_lg.paiisgang(pb[0][0], pb[0][1]) then
          p[4][0] := 1;
      end;
	 * 
	 **/
	
	/// <summary>
	/// 默认值sty = -1 fan = -1
	/// </summary>
	/// <param name="who"></param>
	/// <param name="pai"></param>
	/// <param name="sty"></param>
	/// <param name="fan"></param>
	public void fun_jiagang(int who,int pai,int sty,int fan){
		sbyte[] bts=new sbyte[4];
		bts[0]=(sbyte) who;
		bts[1]=(sbyte) pai;
		bts[2]=(sbyte) sty;
		bts[3]=(sbyte) fan;
		//log("加杠:" + who + "," + pai + "," + sty + "," + fan);
		mainDo("增加杠",null,bts);
	}
	public void fun_delgang(int who,int pai,int fengValue){
		sbyte[] bts=new sbyte[3];
		bts[0]=(sbyte) who;bts[1]=(sbyte) pai;
		bts[2] =(sbyte)fengValue;
		mainDo("删除杠",null,bts);
	}
	public int fun_paiIsGang(int who,int pai){
		sbyte[] bts=new sbyte[2];
		bts[0]=(sbyte) who;
		bts[1]=(sbyte) pai;
		mainDo("牌是否杠",null,bts);
		return  getvalue_int(0);
	}
	
	public byte[] fun_lajipai(sbyte[] pais,int who,int penglvl){//查引用 看范例
		mainDo("垃圾牌",new int[]{who,penglvl},pais);
		byte[] r= getvalue_byteArr(1,getvalue_byte(0));
		
		return r;
	}
	
	//视觉上，左面的剩余牌张 0..PlayerCount-1表示双方不透视        PlayerCountMax表示全透视（想赢钱的鬼）
	public int fun_paiCnt_lose(int pai,int apos){
		mainDo("剩余牌",new int[]{pai,apos},null);
		return getvalue_int(0);
	}
	
	//---------------------从这里开始   把所有需求，直接按逻辑罗列。。。 ----------------------
	public int[] fun_test(int a,int b){
		if(isTmp)return new int[]{3,4,5,2};
		mainDo("吴龙剑描述",new int[]{a,b},null);
		return new int[]{ getvalue_int(0),getvalue_int(1),getvalue_int(2),getvalue_int(3)};
	}
	
	/// <summary>
	/// 获取放炮人
	/// </summary>
	/// <param name="pack"></param>
	/// <returns></returns>
	public virtual int getFangPaoMan(int fangpaonew){
		if(fangpaonew >= 10)
			return fangpaonew - 10;
		return fangpaonew;
	}
}