You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.3 KiB

  1. local xzddSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound")
  2. local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
  3. local path = "mj/res/sound"
  4. local xzddPath = "mj/res/sound"
  5. xzddSound.man = "c_man"
  6. xzddSound.women = "c_women"
  7. xzddSound.pre = "c_"
  8. xzddSound.soundType = 1
  9. -- 吃操作
  10. --[[xzddSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_CHI] = "chi"
  11. xzddSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_MANGANG] = "gang"--]]
  12. local function dealSex(s)
  13. local sex=tonumber(s)
  14. if sex~=1 and sex~=2 then
  15. sex=1
  16. end
  17. return sex
  18. end
  19. -- sound_t 1 普通话 2 方言
  20. function xzddSound.setSoundType( sound_t )
  21. if sound_t == 1 then
  22. xzddSound.man = "c_man"
  23. xzddSound.women = "c_women"
  24. xzddSound.pre = "c_"
  25. xzddSound.soundType = 1
  26. xzddPath = "mj/res/sound"
  27. else
  28. xzddSound.man = "f_man"
  29. xzddSound.women = "f_women"
  30. xzddSound.pre = "f_"
  31. xzddPath = "mj_xzdd/res/sound"
  32. xzddSound.soundType = 2
  33. end
  34. end
  35. function xzddSound.PlayOperateSound(sex,opType)
  36. if xzddSound.OperateSoundConfig[opType] then
  37. sex = dealSex(sex)
  38. local name
  39. if xzddSound.soundType == 1 then
  40. name = string.format("%s/%s/%sbase_mj_%s_%s.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex, xzddSound.OperateSoundConfig[opType])
  41. else
  42. name = string.format("%s/%s/%sxzdd_mj_%s_%s.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex, xzddSound.OperateSoundConfig[opType])
  43. end
  44. playVoice(name)
  45. end
  46. end
  47. xzddSound.mjSoundCfg =
  48. {
  49. [1] = {
  50. [11] = 4,[12] = 4,[13] = 4,[14] = 4,[15] = 4,[16] = 4,[17] = 4,[18] = 4,[19] = 3,
  51. [21] = 4,[22] = 2,[23] = 3,[24] = 4,[25] = 3,[26] = 3,[27] = 4,[28] = 3,[29] = 3,
  52. },
  53. [2] = {
  54. [11] = 4,[12] = 4,[13] = 4,[14] = 4,[15] = 4,[16] = 4,[17] = 4,[18] = 4,[19] = 3,
  55. [21] = 4,[22] = 2,[23] = 3,[24] = 4,[25] = 3,[26] = 3,[27] = 4,[28] = 3,[29] = 3,
  56. },
  57. }
  58. function xzddSound.PlayMJSound(sex,value)
  59. sex = dealSex(sex)
  60. local name
  61. local randNum = 1
  62. local newValue = tonumber(string.format("%x",value))
  63. if xzddSound.mjSoundCfg[sex][newValue] then
  64. randNum = math.random(1, xzddSound.mjSoundCfg[sex][newValue])
  65. end
  66. if xzddSound.soundType == 1 then
  67. name = string.format("%s/%s/%sbase_mj_%s_%x.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex, value)
  68. else
  69. --name = string.format("%s/%s/%sxzdd_mj_%s_%x_%d.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex, value,randNum)
  70. name = string.format("%s/%s/%sxzdd_mj_%s_%x.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex, value)
  71. end
  72. playVoice(name)
  73. end
  74. function xzddSound.PlayBaoSound(sex)
  75. sex = dealSex(sex)
  76. local name
  77. if xzddSound.soundType == 1 then
  78. name = string.format("%s/%s/%sbase_mj_%s_bao.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex)
  79. else
  80. name = string.format("%s/%s/%sxzdd_mj_%s_bao.ogg", xzddPath,sex ==1 and xzddSound.man or xzddSound.women, xzddSound.pre, sex)
  81. end
  82. playVoice(name)
  83. end
  84. --飘音效
  85. function xzddSound.PlayPiaoSound(sex)
  86. sex = dealSex(sex)
  87. local name = ""
  88. if sex == 1 then
  89. name = string.format("%s/%s/%sbase_mj_%s_piao.ogg", "mj/res/sound","c_man", "c_", sex)
  90. else
  91. name = string.format("%s/%s/%sbase_mj_%s_piao.ogg", "mj/res/sound","c_women", "c_", sex)
  92. end
  93. playVoice(name)
  94. end
  95. return xzddSound