25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

116 satır
3.3 KiB

  1. local xichongFunctions=ZPFramework.ZPFrameworkClassImprot("zp_base.luaScript.ZPFunctions")
  2. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  3. --获取小家是否可以看牌
  4. function xichongFunctions.getLittleIsCanLookCard()
  5. --[[ local roomInfo = app.room.roomInfo;
  6. local jsonInfo = json.decode(roomInfo.strGameInfo)
  7. if jsonInfo then
  8. if getNumBand(jsonInfo.specialRule,0x0020) > 0 then
  9. return true
  10. end
  11. end--]]
  12. return false
  13. end
  14. --获取字牌资源名字
  15. function xichongFunctions.getZPCardImgByValue(value,cardType,desktopType,backType)
  16. local textureName = ""
  17. if not backType then
  18. backType = ZPDef.BackType.Red
  19. end
  20. if not desktopType then
  21. desktopType = ZPDef.GameStyleType.XIANDAI
  22. end
  23. if cardType == ZPDef.CardType.CARD_TYPE_HAND then --手牌
  24. if value > 0 then
  25. textureName = string.format(ZPDef.CardFile.CARD_FILE_HAND,desktopType,value)
  26. end
  27. elseif cardType == ZPDef.CardType.CARD_TYPE_TABLE then --组合牌
  28. if value > 0 then
  29. textureName = string.format(ZPDef.CardFile.CARD_FILE_WEAVE_CARD,value)
  30. else
  31. textureName = string.format(ZPDef.CardFile.CARD_FILE_WEAVE_CARD,backType)
  32. end
  33. elseif cardType == ZPDef.CardType.CARD_TYPE_OUTCARD then --出牌
  34. if value > 0 then
  35. textureName = string.format(ZPDef.CardFile.CARD_FILE_OUT_CARD,desktopType,value)
  36. else
  37. textureName = string.format(ZPDef.CardFile.CARD_FILE_OUT_CARD_BACK,desktopType,backType)
  38. end
  39. elseif cardType == ZPDef.CardType.CARD_TYPE_GROUPCARD then
  40. if value > 0 then
  41. textureName = string.format(ZPDef.CardFile.CARD_FILE_GROUP_CARD,desktopType,value)
  42. end
  43. end
  44. return textureName
  45. end
  46. --获取操作显示类型
  47. function xichongFunctions.getZPOperationType(mType,isHaveGuo,isChongZhao)
  48. local mResult = {}
  49. --默认有过操作
  50. if isHaveGuo then
  51. table.insert(mResult,ZPDef.OpType.OP_TYPE_CANCEL)
  52. end
  53. --判断是否有吃
  54. local retChi = bit32.band(mType,ZPDef.OpCode.OP_CHI)
  55. if retChi > 0 then
  56. table.insert(mResult,ZPDef.OpType.OP_TYPE_CHI)
  57. end
  58. --判断是否有碰
  59. local retPeng = bit32.band(mType,ZPDef.OpCode.OP_PENG)
  60. if retPeng > 0 then
  61. table.insert(mResult,ZPDef.OpType.OP_TYPE_PENG)
  62. end
  63. --判断是否有巴
  64. local retBa2 = bit32.band(mType,ZPDef.OpCode.OP_BA_ZHUA)
  65. if retBa2 > 0 then
  66. table.insert(mResult,ZPDef.OpType.OP_TYPE_ANSIZHANG)
  67. end
  68. --判断是否有偷
  69. local retTou2 = bit32.band(mType,ZPDef.OpCode.OP_TOU_ZHUA)
  70. if retTou2 > 0 then
  71. table.insert(mResult,ZPDef.OpType.OP_TYPE_ANSANZHANG)
  72. end
  73. --判断是否有偷垮
  74. local retTou2 = bit32.band(mType,ZPDef.OpCode.OP_KUA)
  75. if retTou2 > 0 then
  76. table.insert(mResult,ZPDef.OpType.OP_TYPE_KUA)
  77. end
  78. --判断是否有违规
  79. local retweigui = bit32.band(mType,ZPDef.OpCode.OP_WEIGUI)
  80. if retweigui > 0 then
  81. table.insert(mResult,ZPDef.OpType.OP_TYPE_WEIGUI)
  82. end
  83. --判断是否有胡
  84. local retHu = bit32.band(mType,ZPDef.OpCode.OP_HU)
  85. if retHu > 0 then
  86. --isHaveGuo = false ---有胡必须胡,没有过
  87. table.insert(mResult,ZPDef.OpType.OP_TYPE_HU)
  88. end
  89. local retHu1 = bit32.band(mType,ZPDef.OpCode.OP_TIAN_HU)
  90. if retHu1 > 0 then
  91. --isHaveGuo = false ---有胡必须胡,没有过
  92. table.insert(mResult,ZPDef.OpType.OP_TYPE_HU)
  93. end
  94. print("getchangpaiPaiOperationType : "..table.tostring(mResult))
  95. return mResult
  96. end
  97. return xichongFunctions