local linshuiSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound") local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine") local path = "mj/res/sound" local linshuiPath = "mj/res/sound" linshuiSound.man = "c_man" linshuiSound.women = "c_women" linshuiSound.pre = "c_" linshuiSound.soundType = 1 --方言操作配置 linshuiSound.OperateFYSoundConfig={ [MJDefine.MJOperateType.OPREATE_PENG] = "peng", --碰操作 [MJDefine.MJOperateType.OPREATE_ZHIGANG] = "gang", --直杠操作minggang [MJDefine.MJOperateType.OPREATE_BAGANG] = "gang", --巴杠penggang [MJDefine.MJOperateType.OPREATE_ANGANG] = "angang", --暗杠 angang [MJDefine.MJOperateType.OPREATE_DIANPAOHU] = "hu", --点炮胡牌 [MJDefine.MJOperateType.OPREATE_ZIMOHU] = "zimo", --自胡牌 } linshuiSound.operateCfg = { [1] = { [MJDefine.MJOperateType.OPREATE_PENG] = 2, [MJDefine.MJOperateType.OPREATE_ZHIGANG] = 3, [MJDefine.MJOperateType.OPREATE_BAGANG] = 1, [MJDefine.MJOperateType.OPREATE_ANGANG] = 1, [MJDefine.MJOperateType.OPREATE_DIANPAOHU] = 2, [MJDefine.MJOperateType.OPREATE_ZIMOHU] = 1, }, [2] = { [MJDefine.MJOperateType.OPREATE_PENG] = 2, [MJDefine.MJOperateType.OPREATE_ZHIGANG] = 3, [MJDefine.MJOperateType.OPREATE_BAGANG] = 1, [MJDefine.MJOperateType.OPREATE_ANGANG] = 1, [MJDefine.MJOperateType.OPREATE_DIANPAOHU] = 2, [MJDefine.MJOperateType.OPREATE_ZIMOHU] = 1, }, } 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 linshuiSound.setSoundType( sound_t ) print("linshuiSound.setSoundType---"..sound_t) if sound_t == 1 then linshuiSound.man = "c_man" linshuiSound.women = "c_women" linshuiSound.pre = "c_" linshuiSound.soundType = 1 linshuiPath = "mj/res/sound" print("linshuiSound.setSoundType--- pth") else linshuiSound.man = "f_man" linshuiSound.women = "f_women" linshuiSound.pre = "f_" linshuiPath = "mj_linshui/res/sound" linshuiSound.soundType = 2 print("linshuiSound.setSoundType--- fy") end end function linshuiSound.PlayOperateSound(sex,opType) if linshuiSound.OperateSoundConfig[opType] then sex = dealSex(sex) local name if linshuiSound.soundType == 1 then name = string.format("%s/%s/%sbase_mj_%s_%s.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, linshuiSound.OperateSoundConfig[opType]) else local randNum = 1 if linshuiSound.operateCfg[sex][opType] then randNum = math.random(1, linshuiSound.operateCfg[sex][opType]) end local opTypeStr = linshuiSound.OperateFYSoundConfig[opType] name = string.format("%s/%s/%slinshui_mj_%s_%s_%d.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, opTypeStr,randNum) end playVoice(name) end end linshuiSound.mjSoundCfg = { [1] = { [1] = 2,[2] = 2,[3] = 2,[4] = 2,[5] = 2,[6] = 2,[7] = 2,[8] = 2,[9] = 2, [11] = 2,[12] = 2,[13] = 2,[14] = 2,[15] = 2,[16] = 2,[17] = 2,[18] = 2,[19] = 2, [21] = 2,[22] = 2,[23] = 2,[24] = 2,[25] = 2,[26] = 2,[27] = 2,[28] = 2,[29] = 2, [41] = 1,[42] = 1,[43] = 1, }, [2] = { [1] = 2,[2] = 2,[3] = 2,[4] = 2,[5] = 2,[6] = 2,[7] = 2,[8] = 2,[9] = 2, [11] = 2,[12] = 2,[13] = 2,[14] = 2,[15] = 2,[16] = 2,[17] = 2,[18] = 2,[19] = 2, [21] = 2,[22] = 2,[23] = 2,[24] = 2,[25] = 2,[26] = 2,[27] = 2,[28] = 2,[29] = 2, [41] = 1,[42] = 1,[43] = 1, }, } function linshuiSound.PlayMJSound(sex,value) sex = dealSex(sex) local name local randNum = 1 local newValue = tonumber(string.format("%x",value)) if linshuiSound.mjSoundCfg[sex][newValue] then randNum = math.random(1, linshuiSound.mjSoundCfg[sex][newValue]) end if linshuiSound.soundType == 1 then name = string.format("%s/%s/%sbase_mj_%s_%x.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, value) else name = string.format("%s/%s/%slinshui_mj_%s_%x_%d.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, value,randNum) --name = string.format("%s/%s/%slinshui_mj_%s_%x.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, value) end print("linshuiSound.PlayMJSound---"..name) playVoice(name) end function linshuiSound.PlayBaoSound(sex) sex = dealSex(sex) local name if linshuiSound.soundType == 1 then name = string.format("%s/%s/%sbase_mj_%s_bao.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex) else name = string.format("%s/%s/%slinshui_mj_%s_bao.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex) end playVoice(name) end --飘音效 function linshuiSound.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 --躺音效 function linshuiSound.PlayTangSound(sex) sex = dealSex(sex) local name = "" local randNum = 1 randNum = math.random(1,3) if sex == 1 then name = string.format("%s/%s/%slinshui_mj_%s_bai_%d.ogg", "mj_linshui/res/sound","f_man", "f_", sex,randNum) else name = string.format("%s/%s/%slinshui_mj_%s_bai_%d.ogg", "mj_linshui/res/sound","f_women", "f_", sex,randNum) end playVoice(name) end function linshuiSound.PlayGameBGM() playBGMusic("MJ_GameBGM","mj_linshui/res/sound".."/mj_game_bg.ogg") end return linshuiSound