local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef") local ZPSound = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.ZPSound") local ErWuSound = class("ErWuSound", ZPSound) local path = "mj/res/sound" local changpaiPath = "zp_erwu/res/sound" ErWuSound.man = "man" ErWuSound.women = "women" ErWuSound.pre = "c_" ErWuSound.sound_t = 0 ErWuSound.OperateSoundConfig={ [ZPDef.OpType.OP_TYPE_CHI] = "chi", --吃操作 [ZPDef.OpType.OP_TYPE_PENG] = "peng", --碰操作 [ZPDef.OpType.OP_TYPE_LAI_PENG] = "peng", --癞子碰操作 [ZPDef.OpType.OP_TYPE_HU] = "hu", --胡操作 [ZPDef.OpType.OP_TYPE_BA] = "ba", --偷操作 [ZPDef.OpType.OP_TYPE_TOU] = "tou", --巴操作 } 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 ErWuSound.setSoundType( sound_t ) ErWuSound.sound_t = sound_t if sound_t == 1 then ErWuSound.man = "c_man" ErWuSound.women = "c_women" ErWuSound.pre = "c_" else ErWuSound.man = "man" ErWuSound.women = "women" ErWuSound.pre = "" end end function ErWuSound.PlayOperateSound(sex,opType) if ErWuSound.sound_t == 1 then--普通话 ErWuSound.super.PlayOperateSound(sex,opType) else if ErWuSound.OperateSoundConfig[opType] then sex = dealSex(sex) local index = math.random(1, 2); --两套方言随机播放 if ErWuSound.OperateSoundConfig[opType] == "tou" then index = 1 end local name = string.format("%s/fangyan_%d/%s_operate/changpai_%s.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women, ErWuSound.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/changpai_baojiao.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women) playVoice(name) elseif opType == -56 then local name = string.format("%s/fangyan_%d/%s_operate/changpai_baopei.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women) playVoice(name) end end end end function ErWuSound.PlayZPSound(sex,value) if ErWuSound.sound_t == 1 then--普通话 ErWuSound.super.PlayZPSound(sex,value) else local index = math.random(1, 2); sex = dealSex(sex) local name = string.format("%s/fangyan_%d/%s/cards/changpai_%x.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women, value) playVoice(name) end end function ErWuSound.PlayHuangZhuang(sex) local index = math.random(1, 2); local name = string.format("%s/fangyan_%d/%s_operate/changpai_huangzhuang.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women) playVoice(name) end function ErWuSound.PlayZhaNiao() playVoice(changpaiPath.."/hz_zhuaniao.ogg") end return ErWuSound