Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

77 строки
2.3 KiB

  1. local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
  2. local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions")
  3. local doushisiRoomBaoPei = class("doushisiRoomBaoPei",cc.UIView)
  4. local ZPMessage = ZPFramework.ZPImport("zp_base.luaScript.Protocol.ZPMessage")
  5. function doushisiRoomBaoPei:ctor(bcard,btype)
  6. doushisiRoomBaoPei.super.ctor(self)
  7. self.ui = loadUI("zp_doushisi/res/ui/ui_fangjian/doushisi_ui_baipei.ui")
  8. self:addChild(self.ui)
  9. self.bcard = bcard or 0
  10. self.btype = btype or 0
  11. end
  12. function doushisiRoomBaoPei:onEnter()
  13. doushisiRoomBaoPei.super.onEnter(self)
  14. self.ui.Items.Button_Quit:registerClick(handler(self, self.onClickClose))
  15. self.ui.Items.Button_Sure:registerClick(handler(self, self.onClickSure))
  16. if self.btype == 1 then
  17. self.ui.Items.Text:setVisible(false)
  18. self.ui.Items.Text_2:setVisible(true)
  19. else
  20. self.ui.Items.Text:setVisible(true)
  21. self.ui.Items.Text_2:setVisible(false)
  22. end
  23. end
  24. function doushisiRoomBaoPei:onClickClose()
  25. playBtnCloseEffect()
  26. if self.btype == 0 then
  27. local request = ZPMessage.OutCard:new()
  28. request.nCard = self.bcard
  29. request.baoPei = 2
  30. logE("doushisiRoomBaoPei:setOutCardVisible"..table.tostring(request))
  31. self.ui:sendMsg(app.room, "sendOutCard", request, function(status, response)
  32. logE("doushisiRoomBaoPei sendOutCard() response = ", table.tostring(response))
  33. end)
  34. end
  35. self:removeFromParent()
  36. end
  37. function doushisiRoomBaoPei:onClickSure()
  38. playBtnEffect()
  39. if self.btype == 0 then
  40. local request = ZPMessage.OutCard:new()
  41. request.nCard = self.bcard
  42. request.baoPei = 1
  43. logE("doushisiRoomBaoPei:setOutCardVisible"..table.tostring(request))
  44. self.ui:sendMsg(app.room, "sendOutCard", request, function(status, response)
  45. logE("doushisiRoomBaoPei sendOutCard() response = ", table.tostring(response))
  46. end)
  47. else
  48. local operateCode = 0
  49. operateCode = ZPDef.OpCode.OP_CANCEL
  50. local request = ZPMessage.GameSendOpCodeResponse:new()
  51. --·¢ËͲÙ×÷Âë
  52. request.operateCode = operateCode
  53. table.insert(request.opCard.Datas, 0)
  54. logE("sendOperationCode:"..table.tostring(request))
  55. self.ui:sendMsg(app.room, "sendOperationCode", request, function(status, response)
  56. logE("doushisiRoomBaoPei sendOperationCode() response = ", table.tostring(response))
  57. end)
  58. app.room:dispatchEvent({name = "onHideOpreationView"});
  59. end
  60. self:removeFromParent()
  61. end
  62. return doushisiRoomBaoPei