|
- local xcmajSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound")
- local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
-
- local path = "mj/res/sound"
- local xcmajPath = "mj/res/sound"
-
- xcmajSound.man = "c_man"
- xcmajSound.women = "c_women"
- xcmajSound.pre = "c_"
- xcmajSound.soundType = 1
-
- -- 吃操作
- --[[xcmajSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_CHI] = "chi"
- xcmajSound.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 xcmajSound.setSoundType( sound_t )
- if sound_t == 1 then
- xcmajSound.man = "c_man"
- xcmajSound.women = "c_women"
- xcmajSound.pre = "c_"
- xcmajSound.soundType = 1
- xcmajPath = "mj/res/sound"
- else
- xcmajSound.man = "f_man"
- xcmajSound.women = "f_women"
- xcmajSound.pre = "f_"
- xcmajPath = "mj_xcmaj/res/sound"
- xcmajSound.soundType = 2
- end
- end
-
- function xcmajSound.PlayOperateSound(sex,opType)
- if xcmajSound.OperateSoundConfig[opType] then
- sex = dealSex(sex)
- local name
- if xcmajSound.soundType == 1 then
- name = string.format("%s/%s/%sbase_mj_%s_%s.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex, xcmajSound.OperateSoundConfig[opType])
- else
- name = string.format("%s/%s/%sxcmaj_mj_%s_%s.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex, xcmajSound.OperateSoundConfig[opType])
- end
- playVoice(name)
- end
- end
-
- xcmajSound.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 xcmajSound.PlayMJSound(sex,value)
- sex = dealSex(sex)
- local name
- local randNum = 1
- local newValue = tonumber(string.format("%x",value))
- if xcmajSound.mjSoundCfg[sex][newValue] then
- randNum = math.random(1, xcmajSound.mjSoundCfg[sex][newValue])
- end
- if xcmajSound.soundType == 1 then
- name = string.format("%s/%s/%sbase_mj_%s_%x.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex, value)
- else
- --name = string.format("%s/%s/%sxcmaj_mj_%s_%x_%d.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex, value,randNum)
- name = string.format("%s/%s/%sxcmaj_mj_%s_%x.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex, value)
- end
- playVoice(name)
- end
-
- function xcmajSound.PlayBaoSound(sex)
- sex = dealSex(sex)
- local name
- if xcmajSound.soundType == 1 then
- name = string.format("%s/%s/%sbase_mj_%s_bao.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex)
- else
- name = string.format("%s/%s/%sxcmaj_mj_%s_bao.ogg", xcmajPath,sex ==1 and xcmajSound.man or xcmajSound.women, xcmajSound.pre, sex)
- end
- playVoice(name)
- end
-
- --飘音效
- function xcmajSound.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 xcmajSound
|