25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.4 KiB

  1. local dazhouSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound")
  2. local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
  3. local path = "mj/res/sound"
  4. local dazhouPath = "mj/res/sound"
  5. dazhouSound.man = "c_man"
  6. dazhouSound.women = "c_women"
  7. dazhouSound.pre = "c_"
  8. dazhouSound.soundType = 1
  9. -- 吃操作
  10. --[[dazhouSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_CHI] = "chi"
  11. dazhouSound.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 dazhouSound.setSoundType( sound_t )
  21. if sound_t == 1 then
  22. dazhouSound.man = "c_man"
  23. dazhouSound.women = "c_women"
  24. dazhouSound.pre = "c_"
  25. dazhouSound.soundType = 1
  26. dazhouPath = "mj/res/sound"
  27. else
  28. dazhouSound.man = "f_man"
  29. dazhouSound.women = "f_women"
  30. dazhouSound.pre = "f_"
  31. dazhouPath = "mj_dazhou/res/sound"
  32. dazhouSound.soundType = 2
  33. end
  34. end
  35. function dazhouSound.PlayOperateSound(sex,opType)
  36. if dazhouSound.OperateSoundConfig[opType] then
  37. sex = dealSex(sex)
  38. local name
  39. if dazhouSound.soundType == 1 then
  40. name = string.format("%s/%s/%sbase_mj_%s_%s.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex, dazhouSound.OperateSoundConfig[opType])
  41. else
  42. name = string.format("%s/%s/%sxzdd_mj_%s_%s.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex, dazhouSound.OperateSoundConfig[opType])
  43. end
  44. playVoice(name)
  45. end
  46. end
  47. dazhouSound.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 dazhouSound.PlayMJSound(sex,value)
  59. sex = dealSex(sex)
  60. local name
  61. local randNum = 1
  62. local newValue = tonumber(string.format("%x",value))
  63. if dazhouSound.mjSoundCfg[sex][newValue] then
  64. randNum = math.random(1, dazhouSound.mjSoundCfg[sex][newValue])
  65. end
  66. if dazhouSound.soundType == 1 then
  67. name = string.format("%s/%s/%sbase_mj_%s_%x.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex, value)
  68. else
  69. --name = string.format("%s/%s/%sxzdd_mj_%s_%x_%d.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex, value,randNum)
  70. name = string.format("%s/%s/%sxzdd_mj_%s_%x.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex, value)
  71. end
  72. playVoice(name)
  73. end
  74. function dazhouSound.PlayBaoSound(sex)
  75. sex = dealSex(sex)
  76. local name
  77. if dazhouSound.soundType == 1 then
  78. name = string.format("%s/%s/%sbase_mj_%s_bao.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex)
  79. else
  80. name = string.format("%s/%s/%sxzdd_mj_%s_bao.ogg", dazhouPath,sex ==1 and dazhouSound.man or dazhouSound.women, dazhouSound.pre, sex)
  81. end
  82. playVoice(name)
  83. end
  84. --飘音效
  85. function dazhouSound.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 dazhouSound