您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

100 行
3.0 KiB

  1. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  2. local ZPSound = ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.ZPSound")
  3. local doushisiSound = class("doushisiSound", ZPSound)
  4. local doushisiPath = "zp_doushisi/res/sound"
  5. doushisiSound.man = "man"
  6. doushisiSound.women = "women"
  7. doushisiSound.pre = "c_"
  8. doushisiSound.sound_t = 0
  9. doushisiSound.OperateSoundConfig={
  10. [ZPDef.OpType.OP_TYPE_CHI] = "chi", --吃操作
  11. [ZPDef.OpType.OP_TYPE_PENG] = "peng", --碰操作
  12. [ZPDef.OpType.OP_TYPE_HU] = "hu", --胡操作
  13. [ZPDef.OpType.OP_TYPE_BA] = "ba", --进牌巴操作
  14. [ZPDef.OpType.OP_TYPE_FANPAI_BA] = "ba", --翻牌巴操作
  15. [ZPDef.OpType.OP_TYPE_TOU] = "tou", --偷操作
  16. [ZPDef.OpType.OP_TYPE_LAI_PENG] = "peng",
  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 doushisiSound.setSoundType( sound_t )
  27. doushisiSound.sound_t = sound_t
  28. if sound_t == 1 then
  29. doushisiSound.man = "c_man"
  30. doushisiSound.women = "c_women"
  31. doushisiSound.pre = "c_"
  32. else
  33. doushisiSound.man = "man"
  34. doushisiSound.women = "women"
  35. doushisiSound.pre = ""
  36. end
  37. end
  38. function doushisiSound.PlayOperateSound(sex,opType)
  39. if doushisiSound.sound_t == 1 then--普通话
  40. doushisiSound.super.PlayOperateSound(sex,opType)
  41. else
  42. if doushisiSound.OperateSoundConfig[opType] then
  43. sex = dealSex(sex)
  44. local index = math.random(1, 2); --两套方言随机播放
  45. if doushisiSound.OperateSoundConfig[opType] == "tou" then
  46. index = 1
  47. end
  48. local name = string.format("%s/fangyan_%d/%s_operate/doushisi_%s.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women, doushisiSound.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/doushisi_baojiao.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women)
  56. playVoice(name)
  57. elseif opType == -56 then
  58. local name = string.format("%s/fangyan_%d/%s_operate/doushisi_baopei.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women)
  59. playVoice(name)
  60. end
  61. end
  62. end
  63. end
  64. function doushisiSound.PlayZPSound(sex,value)
  65. if doushisiSound.sound_t == 1 then--普通话
  66. doushisiSound.super.PlayZPSound(sex,value)
  67. else
  68. if value ~= 0x54 then
  69. local index = math.random(1, 2);
  70. sex = dealSex(sex)
  71. local name = string.format("%s/fangyan_%d/%s/cards/doushisi_%d.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women, value%16)
  72. playVoice(name)
  73. end
  74. end
  75. end
  76. function doushisiSound.PlayHuangZhuang(sex)
  77. local index = math.random(1, 2);
  78. local name = string.format("%s/fangyan_%d/%s_operate/doushisi_huangzhuang.ogg", doushisiPath, index, sex ==1 and doushisiSound.man or doushisiSound.women)
  79. playVoice(name)
  80. end
  81. function doushisiSound.PlayZhaNiao()
  82. playVoice(changpaiPath.."/hz_zhuaniao.ogg")
  83. end
  84. return doushisiSound