local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef") local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions") local doushisiRoomBaoPei = class("doushisiRoomBaoPei",cc.UIView) local ZPMessage = ZPFramework.ZPImport("zp_base.luaScript.Protocol.ZPMessage") function doushisiRoomBaoPei:ctor(bcard,btype) doushisiRoomBaoPei.super.ctor(self) self.ui = loadUI("zp_doushisi/res/ui/ui_fangjian/doushisi_ui_baipei.ui") self:addChild(self.ui) self.bcard = bcard or 0 self.btype = btype or 0 end function doushisiRoomBaoPei:onEnter() doushisiRoomBaoPei.super.onEnter(self) self.ui.Items.Button_Quit:registerClick(handler(self, self.onClickClose)) self.ui.Items.Button_Sure:registerClick(handler(self, self.onClickSure)) if self.btype == 1 then self.ui.Items.Text:setVisible(false) self.ui.Items.Text_2:setVisible(true) else self.ui.Items.Text:setVisible(true) self.ui.Items.Text_2:setVisible(false) end end function doushisiRoomBaoPei:onClickClose() playBtnCloseEffect() if self.btype == 0 then local request = ZPMessage.OutCard:new() request.nCard = self.bcard request.baoPei = 2 logE("doushisiRoomBaoPei:setOutCardVisible"..table.tostring(request)) self.ui:sendMsg(app.room, "sendOutCard", request, function(status, response) logE("doushisiRoomBaoPei sendOutCard() response = ", table.tostring(response)) end) end self:removeFromParent() end function doushisiRoomBaoPei:onClickSure() playBtnEffect() if self.btype == 0 then local request = ZPMessage.OutCard:new() request.nCard = self.bcard request.baoPei = 1 logE("doushisiRoomBaoPei:setOutCardVisible"..table.tostring(request)) self.ui:sendMsg(app.room, "sendOutCard", request, function(status, response) logE("doushisiRoomBaoPei sendOutCard() response = ", table.tostring(response)) end) else local operateCode = 0 operateCode = ZPDef.OpCode.OP_CANCEL local request = ZPMessage.GameSendOpCodeResponse:new() --·¢ËͲÙ×÷Âë request.operateCode = operateCode table.insert(request.opCard.Datas, 0) logE("sendOperationCode:"..table.tostring(request)) self.ui:sendMsg(app.room, "sendOperationCode", request, function(status, response) logE("doushisiRoomBaoPei sendOperationCode() response = ", table.tostring(response)) end) app.room:dispatchEvent({name = "onHideOpreationView"}); end self:removeFromParent() end return doushisiRoomBaoPei