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.

64 line
1.8 KiB

  1. local MJSound = MJFramework.MJFrameworkClassImprot("mj.luaScript.MJSound")
  2. local hongzhongSound = class("laibingRoomView", MJSound)
  3. local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
  4. local path = "mj/res/sound"
  5. local hongzhongPath = "hongzhong/res/sound"
  6. hongzhongSound.man = "c_man"
  7. hongzhongSound.women = "c_women"
  8. hongzhongSound.pre = "c_"
  9. hongzhongSound.sound_t = 1
  10. -- 吃操作
  11. --hongzhongSound.OperateSoundConfig[MJDefine.MJOperateType.OPREATE_CHI] = "chi"
  12. local function dealSex(s)
  13. local sex=tonumber(s)
  14. if sex~=1 and sex~=2 then
  15. sex=1
  16. end
  17. return 2--sex
  18. end
  19. -- sound_t 1 普通话 2 方言
  20. function hongzhongSound.setSoundType( sound_t )
  21. hongzhongSound.sound_t = sound_t
  22. if sound_t == 1 then
  23. hongzhongSound.man = "c_man"
  24. hongzhongSound.women = "c_women"
  25. hongzhongSound.pre = "c_"
  26. else
  27. hongzhongSound.man = "man"
  28. hongzhongSound.women = "women"
  29. hongzhongSound.pre = ""
  30. end
  31. end
  32. function hongzhongSound.PlayOperateSound(sex,opType)
  33. if hongzhongSound.sound_t == 1 then--普通话
  34. hongzhongSound.super.PlayOperateSound(sex,opType)
  35. else
  36. if hongzhongSound.OperateSoundConfig[opType] then
  37. sex = dealSex(sex)
  38. local name = string.format("%s/%s/%shongzhong_mj_%s_%s.ogg", hongzhongPath,sex ==1 and hongzhongSound.man or hongzhongSound.women, hongzhongSound.pre, sex, hongzhongSound.OperateSoundConfig[opType])
  39. playVoice(name)
  40. end
  41. end
  42. end
  43. function hongzhongSound.PlayMJSound(sex,value)
  44. if hongzhongSound.sound_t == 1 then--普通话
  45. hongzhongSound.super.PlayMJSound(sex,value)
  46. else
  47. sex = dealSex(sex)
  48. local name = string.format("%s/%s/%shongzhong_mj_%s_%x.ogg", hongzhongPath,sex ==1 and hongzhongSound.man or hongzhongSound.women, hongzhongSound.pre, sex, value)
  49. playVoice(name)
  50. end
  51. end
  52. function hongzhongSound.PlayZhaNiao()
  53. playVoice(hongzhongPath.."/hz_zhuaniao.ogg")
  54. end
  55. return hongzhongSound