local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef") local ZPFuc = ZPFramework.ZPImport("zp_base.luaScript.ZPFunctions") local changpaiRoomBaoPei = class("changpaiRoomBaoPei",cc.UIView) local ZPMessage = ZPFramework.ZPImport("zp_base.luaScript.Protocol.ZPMessage") function changpaiRoomBaoPei:ctor(bcard,btype) changpaiRoomBaoPei.super.ctor(self) self.ui = loadUI("zp_changpai/res/ui/ui_fangjian/changpai_ui_baipei.ui") self:addChild(self.ui) self.bcard = bcard or 0 self.btype = btype or 0 end function changpaiRoomBaoPei:onEnter() changpaiRoomBaoPei.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 changpaiRoomBaoPei:onClickClose() playBtnCloseEffect() if self.btype == 0 then local request = ZPMessage.OutCard:new() request.nCard = self.bcard request.baoPei = 2 logE("changpaiRoomBaoPei:setOutCardVisible"..table.tostring(request)) self.ui:sendMsg(app.room, "sendOutCard", request, function(status, response) logE("changpaiRoomBaoPei sendOutCard() response = ", table.tostring(response)) end) end self:removeFromParent() end function changpaiRoomBaoPei:onClickSure() playBtnEffect() if self.btype == 0 then local request = ZPMessage.OutCard:new() request.nCard = self.bcard request.baoPei = 1 logE("changpaiRoomBaoPei:setOutCardVisible"..table.tostring(request)) self.ui:sendMsg(app.room, "sendOutCard", request, function(status, response) logE("changpaiRoomBaoPei sendOutCard() response = ", table.tostring(response)) end) else local operateCode = 0 operateCode = ZPDef.OpCode.OP_CANCEL local request = ZPMessage.GameSendOpCodeResponse:new() --·¢ËͲÙ×÷Âë request.operateCode = operateCode request.opCard = 0 logE("sendOperationCode:"..table.tostring(request)) self.ui:sendMsg(app.room, "sendOperationCode", request, function(status, response) logE("RoomView sendOperationCode() response = ", table.tostring(response)) end) app.room:dispatchEvent({name = "onHideOpreationView"}); end self:removeFromParent() end return changpaiRoomBaoPei