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.

98 lines
2.8 KiB

  1. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  2. local ZPSound = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.ZPSound")
  3. local ErWuSound = class("ErWuSound", ZPSound)
  4. local path = "mj/res/sound"
  5. local changpaiPath = "zp_erwu/res/sound"
  6. ErWuSound.man = "man"
  7. ErWuSound.women = "women"
  8. ErWuSound.pre = "c_"
  9. ErWuSound.sound_t = 0
  10. ErWuSound.OperateSoundConfig={
  11. [ZPDef.OpType.OP_TYPE_CHI] = "chi", --吃操作
  12. [ZPDef.OpType.OP_TYPE_PENG] = "peng", --碰操作
  13. [ZPDef.OpType.OP_TYPE_LAI_PENG] = "peng", --癞子碰操作
  14. [ZPDef.OpType.OP_TYPE_HU] = "hu", --胡操作
  15. [ZPDef.OpType.OP_TYPE_BA] = "ba", --偷操作
  16. [ZPDef.OpType.OP_TYPE_TOU] = "tou", --巴操作
  17. }
  18. local function dealSex(s)
  19. local sex=tonumber(s)
  20. if sex~=1 and sex~=2 then
  21. sex=1
  22. end
  23. return sex--sex
  24. end
  25. -- sound_t 1 普通话 2 方言
  26. function ErWuSound.setSoundType( sound_t )
  27. ErWuSound.sound_t = sound_t
  28. if sound_t == 1 then
  29. ErWuSound.man = "c_man"
  30. ErWuSound.women = "c_women"
  31. ErWuSound.pre = "c_"
  32. else
  33. ErWuSound.man = "man"
  34. ErWuSound.women = "women"
  35. ErWuSound.pre = ""
  36. end
  37. end
  38. function ErWuSound.PlayOperateSound(sex,opType)
  39. if ErWuSound.sound_t == 1 then--普通话
  40. ErWuSound.super.PlayOperateSound(sex,opType)
  41. else
  42. if ErWuSound.OperateSoundConfig[opType] then
  43. sex = dealSex(sex)
  44. local index = math.random(1, 2); --两套方言随机播放
  45. if ErWuSound.OperateSoundConfig[opType] == "tou" then
  46. index = 1
  47. end
  48. local name = string.format("%s/fangyan_%d/%s_operate/changpai_%s.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women, ErWuSound.OperateSoundConfig[opType])
  49. playVoice(name)
  50. else
  51. sex = dealSex(sex)
  52. local strtype = ""
  53. local index = math.random(1, 2);
  54. if opType == -55 then
  55. local name = string.format("%s/fangyan_%d/%s_operate/changpai_baojiao.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women)
  56. playVoice(name)
  57. elseif opType == -56 then
  58. local name = string.format("%s/fangyan_%d/%s_operate/changpai_baopei.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women)
  59. playVoice(name)
  60. end
  61. end
  62. end
  63. end
  64. function ErWuSound.PlayZPSound(sex,value)
  65. if ErWuSound.sound_t == 1 then--普通话
  66. ErWuSound.super.PlayZPSound(sex,value)
  67. else
  68. local index = math.random(1, 2);
  69. sex = dealSex(sex)
  70. local name = string.format("%s/fangyan_%d/%s/cards/changpai_%x.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women, value)
  71. playVoice(name)
  72. end
  73. end
  74. function ErWuSound.PlayHuangZhuang(sex)
  75. local index = math.random(1, 2);
  76. local name = string.format("%s/fangyan_%d/%s_operate/changpai_huangzhuang.ogg", changpaiPath, index, sex ==1 and ErWuSound.man or ErWuSound.women)
  77. playVoice(name)
  78. end
  79. function ErWuSound.PlayZhaNiao()
  80. playVoice(changpaiPath.."/hz_zhuaniao.ogg")
  81. end
  82. return ErWuSound