-- 房间设置界面 local MJRoomXiPaiView = class("MJRoomXiPaiView", cc.UIView) function MJRoomXiPaiView:ctor(callBack) MJRoomXiPaiView.super.ctor(self) self.callBack = callBack self:loadUI() end function MJRoomXiPaiView:loadUI() local ui = loadUI("mj/res/ui/ui_fangjian/mj_ui_xipai.ui") self.ui = ui self:addChild(ui) end function MJRoomXiPaiView:onEnter() MJRoomXiPaiView.super.onEnter(self) self.ui.Items.Button_OK:registerClick(handler(self , self.onClickSure)) self.ui.Items.Button_Cancel:registerClick(handler(self , self.onClickClose)) self.ui.Items.Button_Close:registerClick(handler(self , self.onClickClose)) local content = "洗牌需要消耗"..(app.room.roomInfo.shuffleNum or 2).."张"..PLN.CURRENCY.."是否继续洗牌?" self.ui.Items.Text_Content:setText(tostring(content)) self.ui.Items.CheckBox_select:addEventListener(handler(self , self.onClickSelect)) self.ui.Items.Text:setTouchEnabled(true) self.ui.Items.Text:registerClick(function () self:onClickSelect(self.ui.Items.CheckBox_select,nil,true) end) end function MJRoomXiPaiView:onClickSelect(node,event,bText) playBtnEffect() local bSelect = self.ui.Items.CheckBox_select:getSelectedState() if bText then self.ui.Items.CheckBox_select:setSelectedState(not bSelect) end bSelect = self.ui.Items.CheckBox_select:getSelectedState() if bSelect then saveUserInfo("mj_shuffle",1) else saveUserInfo("mj_shuffle",0) end end function MJRoomXiPaiView:onClickSure() playBtnEffect() if self.callBack then self.callBack() end self:removeFromParent() end function MJRoomXiPaiView:onClickClose() playBtnEffect() self:removeFromParent() end return MJRoomXiPaiView