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.

86 lines
3.1 KiB

  1. --获取创建房间选项配置
  2. function getRuleFromString(gameId, jushu, ruleStr)
  3. local config=getSubGameConfig(tonumber(gameId))
  4. if type(config.wanfaConfig) == "string" then
  5. local isRequired, wanfa = pcall(require, config.wanfaConfig)
  6. if isRequired and wanfa and type(wanfa.getRuleFromString) == "function" then
  7. local tt = wanfa.getRuleFromString(gameId, jushu, ruleStr)
  8. return tt or {}
  9. end
  10. end
  11. local tt = {}
  12. local jsonData = json.decode(ruleStr);
  13. --"{\"kun\":14,\"gamerule\":0,\"baozi\":10,\"minHuShu\":18,\"specRule\":1}",
  14. -- 局数
  15. local jushuText = string.format("%d 局",jushu);
  16. table.insert(tt, {name = "局数", value = {jushuText}})
  17. --判断游戏配置是麻将
  18. local config=getSubGameConfig(tonumber(gameId))
  19. if config and config.belongType==3 then
  20. if jsonData.deductRule and jsonData.deductRule >= 0 then
  21. local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
  22. if specStr ~= "" then
  23. table.insert(tt, {name = "房费", value = {specStr}})
  24. end
  25. end
  26. local MJWanFa=MJFramework.ImportWanFa("luaScript.SubGameDefine.MaJiang.MJWanFa",tonumber(gameId))
  27. table.insertTo(tt,MJWanFa.getClubWaFaInfo(ruleStr))
  28. elseif config and config.belongType==2 then
  29. if jsonData.deductRule and jsonData.deductRule >= 0 then
  30. local specStr =jsonData.deductRule==0 and "房主付费" or "AA付费"
  31. if specStr ~= "" then
  32. table.insert(tt, {name = "房费", value = {specStr}})
  33. end
  34. end
  35. --[[-- 是否已下载
  36. local isDownGame = app.subGameManager:isInstaller(tonumber(gameId))
  37. -- 是否需要更新
  38. local isUpdate = app.subGameManager:isNeedUpdate(tonumber(gameId))
  39. if isDownGame == false or isUpdate == true then
  40. return tt
  41. end--]]
  42. local ZPWanFa = ZPFramework.ImportWanFa("luaScript.SubGameDefine.ZiPai.ZPWanFa",gameId)
  43. table.insertTo(tt,ZPWanFa.getClubRuleInfo(ruleStr))
  44. end
  45. return tt;
  46. end
  47. --获取包间多玩法桌子上显示的信息
  48. function getClubTableRuleString(gameId, ruleStr)
  49. --判断游戏配置是麻将
  50. local str =""
  51. local config=getSubGameConfig(tonumber(gameId))
  52. if type(config.wanfaConfig) == "string" then
  53. local isRequired, wanfa = pcall(require, config.wanfaConfig)
  54. if isRequired and wanfa and type(wanfa.getClubTableRuleString) == "function" then
  55. local str = wanfa.getClubTableRuleString(gameId, ruleStr, playerNum)
  56. return str or ""
  57. end
  58. end
  59. if config and config.belongType==3 then
  60. local MJWanFa=MJFramework.ImportWanFa("luaScript.SubGameDefine.MaJiang.MJWanFa",gameId)
  61. str = MJWanFa.getClubTableWanFaInfo(ruleStr)
  62. elseif config and config.belongType==2 then
  63. local ZPWanFa = ZPFramework.ImportWanFa("luaScript.SubGameDefine.ZiPai.ZPWanFa",gameId)
  64. str = ZPWanFa.getClubTableWanFaInfo(ruleStr)
  65. end
  66. if tonumber(gameId) == GAME_IDS.luzhouPaoDeKuai then
  67. local lzPDKDefine = require("luaScript.SubGameDefine.luzhouPDKDefine")
  68. str = lzPDKDefine.getClubTableWanFaInfo(ruleStr)
  69. elseif tonumber(gameId) == GAME_IDS.hejiangPaoDeKuai then
  70. local hjPDKDefine = require("luaScript.SubGameDefine.hejiangPDKDefine")
  71. str = hjPDKDefine.getClubTableWanFaInfo(ruleStr)
  72. end
  73. return str;
  74. end