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