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.

105 rivejä
3.4 KiB

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