Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

97 linhas
2.9 KiB

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