local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef") local ZPSound = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.ZPSound") local changpaiSound = class("changpaiSound", ZPSound) local path = "mj/res/sound" local changpaiPath = "zp_changpai/res/sound" changpaiSound.man = "man" changpaiSound.women = "women" changpaiSound.pre = "c_" changpaiSound.sound_t = 0 changpaiSound.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_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 changpaiSound.setSoundType( sound_t ) changpaiSound.sound_t = sound_t if sound_t == 1 then changpaiSound.man = "c_man" changpaiSound.women = "c_women" changpaiSound.pre = "c_" else changpaiSound.man = "man" changpaiSound.women = "women" changpaiSound.pre = "" end end function changpaiSound.PlayOperateSound(sex,opType) if changpaiSound.sound_t == 1 then--普通话 changpaiSound.super.PlayOperateSound(sex,opType) else if changpaiSound.OperateSoundConfig[opType] then sex = dealSex(sex) local index = math.random(1, 2); --两套方言随机播放 if changpaiSound.OperateSoundConfig[opType] == "tou" then index = 1 end local name = string.format("%s/fangyan_%d/%s_operate/changpai_%s.ogg", changpaiPath, index, sex ==1 and changpaiSound.man or changpaiSound.women, changpaiSound.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 changpaiSound.man or changpaiSound.women) playVoice(name) elseif opType == -56 then local name = string.format("%s/fangyan_%d/%s_operate/changpai_baopei.ogg", changpaiPath, index, sex ==1 and changpaiSound.man or changpaiSound.women) playVoice(name) end end end end function changpaiSound.PlayZPSound(sex,value) if changpaiSound.sound_t == 1 then--普通话 changpaiSound.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 changpaiSound.man or changpaiSound.women, value) playVoice(name) end end function changpaiSound.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 changpaiSound.man or changpaiSound.women) playVoice(name) end function changpaiSound.PlayZhaNiao() playVoice(changpaiPath.."/hz_zhuaniao.ogg") end return changpaiSound