local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef") local ZPSound = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.ZPSound") local doushisiSound = class("doushisiSound", ZPSound) local doushisiPath = "zp_doushisi/res/sound" doushisiSound.man = "man" doushisiSound.women = "women" doushisiSound.pre = "c_" doushisiSound.sound_t = 0 doushisiSound.OperateSoundConfig={ [ZPDef.OpType.OP_TYPE_CHI] = "chi", --吃操作 [ZPDef.OpType.OP_TYPE_PENG] = "peng", --碰操作 [ZPDef.OpType.OP_TYPE_HU] = "hu", --胡操作 [ZPDef.OpType.OP_TYPE_BA] = "ba", --进牌巴操作 [ZPDef.OpType.OP_TYPE_FANPAI_BA] = "ba", --翻牌巴操作 [ZPDef.OpType.OP_TYPE_TOU] = "tou", --偷操作 [ZPDef.OpType.OP_TYPE_LAI_PENG] = "peng", } local function dealSex(s) local sex=tonumber(s) if sex~=1 and sex~=2 then sex=1 end return sex--sex end -- sound_t 1 普通话 2 方言 function doushisiSound.setSoundType( sound_t ) doushisiSound.sound_t = sound_t if sound_t == 1 then doushisiSound.man = "c_man" doushisiSound.women = "c_women" doushisiSound.pre = "c_" else doushisiSound.man = "man" doushisiSound.women = "women" doushisiSound.pre = "" end end function doushisiSound.PlayOperateSound(sex,opType) if doushisiSound.sound_t == 1 then--普通话 doushisiSound.super.PlayOperateSound(sex,opType) else if doushisiSound.OperateSoundConfig[opType] then sex = dealSex(sex) local index = math.random(1, 2); --两套方言随机播放 if doushisiSound.OperateSoundConfig[opType] == "tou" then index = 1 end local name = string.format("%s/fangyan_%d/%s_operate/doushisi_%s.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women, doushisiSound.OperateSoundConfig[opType]) playVoice(name) else sex = dealSex(sex) local strtype = "" local index = math.random(1, 2); if opType == -55 then local name = string.format("%s/fangyan_%d/%s_operate/doushisi_baojiao.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women) playVoice(name) elseif opType == -56 then local name = string.format("%s/fangyan_%d/%s_operate/doushisi_baopei.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women) playVoice(name) end end end end function doushisiSound.PlayZPSound(sex,value) if doushisiSound.sound_t == 1 then--普通话 doushisiSound.super.PlayZPSound(sex,value) else if value ~= 0x54 then local index = math.random(1, 2); sex = dealSex(sex) local name = string.format("%s/fangyan_%d/%s/cards/doushisi_%d.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women, value%16) playVoice(name) end end end function doushisiSound.PlayHuangZhuang(sex) local index = math.random(1, 2); local name = string.format("%s/fangyan_%d/%s_operate/doushisi_huangzhuang.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women) playVoice(name) end function doushisiSound.PlayZhaNiao() playVoice(changpaiPath.."/hz_zhuaniao.ogg") end return doushisiSound