Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

164 rindas
5.4 KiB

  1. local linshuiSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound")
  2. local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
  3. local path = "mj/res/sound"
  4. local linshuiPath = "mj/res/sound"
  5. linshuiSound.man = "c_man"
  6. linshuiSound.women = "c_women"
  7. linshuiSound.pre = "c_"
  8. linshuiSound.soundType = 1
  9. --方言操作配置
  10. linshuiSound.OperateFYSoundConfig={
  11. [MJDefine.MJOperateType.OPREATE_PENG] = "peng", --碰操作
  12. [MJDefine.MJOperateType.OPREATE_ZHIGANG] = "gang", --直杠操作minggang
  13. [MJDefine.MJOperateType.OPREATE_BAGANG] = "gang", --巴杠penggang
  14. [MJDefine.MJOperateType.OPREATE_ANGANG] = "angang", --暗杠 angang
  15. [MJDefine.MJOperateType.OPREATE_DIANPAOHU] = "hu", --点炮胡牌
  16. [MJDefine.MJOperateType.OPREATE_ZIMOHU] = "zimo", --自胡牌
  17. }
  18. linshuiSound.operateCfg =
  19. {
  20. [1] = {
  21. [MJDefine.MJOperateType.OPREATE_PENG] = 2,
  22. [MJDefine.MJOperateType.OPREATE_ZHIGANG] = 3,
  23. [MJDefine.MJOperateType.OPREATE_BAGANG] = 1,
  24. [MJDefine.MJOperateType.OPREATE_ANGANG] = 1,
  25. [MJDefine.MJOperateType.OPREATE_DIANPAOHU] = 2,
  26. [MJDefine.MJOperateType.OPREATE_ZIMOHU] = 1,
  27. },
  28. [2] = {
  29. [MJDefine.MJOperateType.OPREATE_PENG] = 2,
  30. [MJDefine.MJOperateType.OPREATE_ZHIGANG] = 3,
  31. [MJDefine.MJOperateType.OPREATE_BAGANG] = 1,
  32. [MJDefine.MJOperateType.OPREATE_ANGANG] = 1,
  33. [MJDefine.MJOperateType.OPREATE_DIANPAOHU] = 2,
  34. [MJDefine.MJOperateType.OPREATE_ZIMOHU] = 1,
  35. },
  36. }
  37. local function dealSex(s)
  38. local sex=tonumber(s)
  39. if sex~=1 and sex~=2 then
  40. sex=1
  41. end
  42. return sex
  43. end
  44. -- sound_t 1 普通话 2 方言
  45. function linshuiSound.setSoundType( sound_t )
  46. print("linshuiSound.setSoundType---"..sound_t)
  47. if sound_t == 1 then
  48. linshuiSound.man = "c_man"
  49. linshuiSound.women = "c_women"
  50. linshuiSound.pre = "c_"
  51. linshuiSound.soundType = 1
  52. linshuiPath = "mj/res/sound"
  53. print("linshuiSound.setSoundType--- pth")
  54. else
  55. linshuiSound.man = "f_man"
  56. linshuiSound.women = "f_women"
  57. linshuiSound.pre = "f_"
  58. linshuiPath = "mj_linshui/res/sound"
  59. linshuiSound.soundType = 2
  60. print("linshuiSound.setSoundType--- fy")
  61. end
  62. end
  63. function linshuiSound.PlayOperateSound(sex,opType)
  64. if linshuiSound.OperateSoundConfig[opType] then
  65. sex = dealSex(sex)
  66. local name
  67. if linshuiSound.soundType == 1 then
  68. name = string.format("%s/%s/%sbase_mj_%s_%s.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, linshuiSound.OperateSoundConfig[opType])
  69. else
  70. local randNum = 1
  71. if linshuiSound.operateCfg[sex][opType] then
  72. randNum = math.random(1, linshuiSound.operateCfg[sex][opType])
  73. end
  74. local opTypeStr = linshuiSound.OperateFYSoundConfig[opType]
  75. name = string.format("%s/%s/%slinshui_mj_%s_%s_%d.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, opTypeStr,randNum)
  76. end
  77. playVoice(name)
  78. end
  79. end
  80. linshuiSound.mjSoundCfg =
  81. {
  82. [1] = {
  83. [1] = 2,[2] = 2,[3] = 2,[4] = 2,[5] = 2,[6] = 2,[7] = 2,[8] = 2,[9] = 2,
  84. [11] = 2,[12] = 2,[13] = 2,[14] = 2,[15] = 2,[16] = 2,[17] = 2,[18] = 2,[19] = 2,
  85. [21] = 2,[22] = 2,[23] = 2,[24] = 2,[25] = 2,[26] = 2,[27] = 2,[28] = 2,[29] = 2,
  86. [41] = 1,[42] = 1,[43] = 1,
  87. },
  88. [2] = {
  89. [1] = 2,[2] = 2,[3] = 2,[4] = 2,[5] = 2,[6] = 2,[7] = 2,[8] = 2,[9] = 2,
  90. [11] = 2,[12] = 2,[13] = 2,[14] = 2,[15] = 2,[16] = 2,[17] = 2,[18] = 2,[19] = 2,
  91. [21] = 2,[22] = 2,[23] = 2,[24] = 2,[25] = 2,[26] = 2,[27] = 2,[28] = 2,[29] = 2,
  92. [41] = 1,[42] = 1,[43] = 1,
  93. },
  94. }
  95. function linshuiSound.PlayMJSound(sex,value)
  96. sex = dealSex(sex)
  97. local name
  98. local randNum = 1
  99. local newValue = tonumber(string.format("%x",value))
  100. if linshuiSound.mjSoundCfg[sex][newValue] then
  101. randNum = math.random(1, linshuiSound.mjSoundCfg[sex][newValue])
  102. end
  103. if linshuiSound.soundType == 1 then
  104. name = string.format("%s/%s/%sbase_mj_%s_%x.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, value)
  105. else
  106. name = string.format("%s/%s/%slinshui_mj_%s_%x_%d.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, value,randNum)
  107. --name = string.format("%s/%s/%slinshui_mj_%s_%x.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex, value)
  108. end
  109. print("linshuiSound.PlayMJSound---"..name)
  110. playVoice(name)
  111. end
  112. function linshuiSound.PlayBaoSound(sex)
  113. sex = dealSex(sex)
  114. local name
  115. if linshuiSound.soundType == 1 then
  116. name = string.format("%s/%s/%sbase_mj_%s_bao.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex)
  117. else
  118. name = string.format("%s/%s/%slinshui_mj_%s_bao.ogg", linshuiPath,sex ==1 and linshuiSound.man or linshuiSound.women, linshuiSound.pre, sex)
  119. end
  120. playVoice(name)
  121. end
  122. --飘音效
  123. function linshuiSound.PlayPiaoSound(sex)
  124. sex = dealSex(sex)
  125. local name = ""
  126. if sex == 1 then
  127. name = string.format("%s/%s/%sbase_mj_%s_piao.ogg", "mj/res/sound","c_man", "c_", sex)
  128. else
  129. name = string.format("%s/%s/%sbase_mj_%s_piao.ogg", "mj/res/sound","c_women", "c_", sex)
  130. end
  131. playVoice(name)
  132. end
  133. --躺音效
  134. function linshuiSound.PlayTangSound(sex)
  135. sex = dealSex(sex)
  136. local name = ""
  137. local randNum = 1
  138. randNum = math.random(1,3)
  139. if sex == 1 then
  140. name = string.format("%s/%s/%slinshui_mj_%s_bai_%d.ogg", "mj_linshui/res/sound","f_man", "f_", sex,randNum)
  141. else
  142. name = string.format("%s/%s/%slinshui_mj_%s_bai_%d.ogg", "mj_linshui/res/sound","f_women", "f_", sex,randNum)
  143. end
  144. playVoice(name)
  145. end
  146. function linshuiSound.PlayGameBGM()
  147. playBGMusic("MJ_GameBGM","mj_linshui/res/sound".."/mj_game_bg.ogg")
  148. end
  149. return linshuiSound