local zigong7zSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound") local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine") local path = "mj/res/sound" local zigongPath = "mj/res/sound" zigong7zSound.man = "c_man" zigong7zSound.women = "c_women" zigong7zSound.pre = "c_" zigong7zSound.soundType = 1 -- 吃操作 --[[zigong7zSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_CHI] = "chi" zigong7zSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_MANGANG] = "gang"--]] local function dealSex(s) local sex=tonumber(s) if sex~=1 and sex~=2 then sex=1 end return sex end -- sound_t 1 普通话 2 方言 function zigong7zSound.setSoundType( sound_t ) if sound_t == 1 then zigong7zSound.man = "c_man" zigong7zSound.women = "c_women" zigong7zSound.pre = "c_" zigong7zSound.soundType = 1 zigongPath = "mj/res/sound" else zigong7zSound.man = "f_man" zigong7zSound.women = "f_women" zigong7zSound.pre = "f_" zigongPath = "mj_zigong7z/res/sound" zigong7zSound.soundType = 2 end end function zigong7zSound.PlayOperateSound(sex,opType) if zigong7zSound.OperateSoundConfig[opType] then sex = dealSex(sex) local name if zigong7zSound.soundType == 1 then name = string.format("%s/%s/%sbase_mj_%s_%s.ogg", zigongPath,sex ==1 and zigong7zSound.man or zigong7zSound.women, zigong7zSound.pre, sex, zigong7zSound.OperateSoundConfig[opType]) else name = string.format("%s/%s/%szg_mj_%s_%s.ogg", zigongPath,sex ==1 and zigong7zSound.man or zigong7zSound.women, zigong7zSound.pre, sex, zigong7zSound.OperateSoundConfig[opType]) end playVoice(name) end end zigong7zSound.mjSoundCfg = { [1] = { [11] = 4,[12] = 4,[13] = 4,[14] = 4,[15] = 4,[16] = 4,[17] = 4,[18] = 4,[19] = 3, [21] = 4,[22] = 2,[23] = 3,[24] = 4,[25] = 3,[26] = 3,[27] = 4,[28] = 3,[29] = 3, }, [2] = { [11] = 4,[12] = 4,[13] = 4,[14] = 4,[15] = 4,[16] = 4,[17] = 4,[18] = 4,[19] = 3, [21] = 4,[22] = 2,[23] = 3,[24] = 4,[25] = 3,[26] = 3,[27] = 4,[28] = 3,[29] = 3, }, } function zigong7zSound.PlayMJSound(sex,value) sex = dealSex(sex) local name local randNum = 1 local newValue = tonumber(string.format("%x",value)) if zigong7zSound.mjSoundCfg[sex][newValue] then randNum = math.random(1, zigong7zSound.mjSoundCfg[sex][newValue]) end if zigong7zSound.soundType == 1 then name = string.format("%s/%s/%sbase_mj_%s_%x.ogg", zigongPath,sex ==1 and zigong7zSound.man or zigong7zSound.women, zigong7zSound.pre, sex, value) else name = string.format("%s/%s/%szg_mj_%s_%x_%d.ogg", zigongPath,sex ==1 and zigong7zSound.man or zigong7zSound.women, zigong7zSound.pre, sex, value,randNum) end playVoice(name) end function zigong7zSound.PlayBaoSound(sex) sex = dealSex(sex) local name if zigong7zSound.soundType == 1 then name = string.format("%s/%s/%sbase_mj_%s_bao.ogg", zigongPath,sex ==1 and zigong7zSound.man or zigong7zSound.women, zigong7zSound.pre, sex) else name = string.format("%s/%s/%szg_mj_%s_bao.ogg", zigongPath,sex ==1 and zigong7zSound.man or zigong7zSound.women, zigong7zSound.pre, sex) end playVoice(name) end --飘音效 function zigong7zSound.PlayPiaoSound(sex) sex = dealSex(sex) local name = "" if sex == 1 then name = string.format("%s/%s/%sbase_mj_%s_piao.ogg", "mj/res/sound","c_man", "c_", sex) else name = string.format("%s/%s/%sbase_mj_%s_piao.ogg", "mj/res/sound","c_women", "c_", sex) end playVoice(name) end return zigong7zSound