Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

155 Zeilen
5.0 KiB

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