-- 玩家列表提示框Layout local ClubPlayerAddHuaHongTip = class("ClubPlayerAddHuaHongTip" , cc.UIView); local TIPS_TYPE_IMG_TITLE = { [1] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_honghua_jia_honghua_title.png", [2] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_honghua_jian_honghua_title.png", } local TIPS_TYPE_IMG_BTN = { [1] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_add_honghua_btn.png", [2] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_sub_honghua_btn.png", } function ClubPlayerAddHuaHongTip:ctor(idx,contentStr, playerInfo, okCallback, cancelCallback) ClubPlayerAddHuaHongTip.super.ctor(self) self.ui = loadUI("res/ui/ui_club/ui_club_player_addhonghuatips.ui"); self:addChild(self.ui) self.idx = idx --提示内容 self.contentStr = contentStr --玩家数据 self.playerInfo = playerInfo --确认回调 self.okCallback = okCallback --取消回调 self.cancelCallback = cancelCallback end function ClubPlayerAddHuaHongTip:onEnter() ClubPlayerAddHuaHongTip.super.onEnter(self) --title self.ui.Items.ImageView_title:loadTexture(TIPS_TYPE_IMG_TITLE[self.idx]); self.ui.Items.Button_confirm:loadTextureNormal(TIPS_TYPE_IMG_BTN[self.idx]); -- 玩家id self.ui.Items.Text_player_id:setText("ID:"..self.playerInfo.uid) -- 玩家昵称 self.playerInfo.name = getSubStringNickname(self.playerInfo.name, self.ui.Items.Text_nick_name) -- 玩家头像地址 local nodeHead = self.ui.Items.ImageView_head local headSize = nodeHead:getContentSize() setPlayerHeadImage(self.playerInfo.uid, self.playerInfo.strHeadUrl, nodeHead) -- 提示文本 self.ui.Items.Text_content:setText(tostring(self.contentStr)) -- 确认回调 self.ui.Items.Button_confirm:registerClick(handler(self , self.onConfirm)) -- 取消回调 self.ui.Items.Button_close:registerClick(handler(self , self.onClose)) self.ui.Items.Layout_Intro:requestDoLayout() self.ui.Items.Layout_Intro:doLayout() self.ui.Items.Layout_content:requestDoLayout() self.ui.Items.Layout_content:doLayout() self.ui.Items.Layout_Info:setSize(cc.size(self.ui.Items.Layout_content:getSize().width,self.ui.Items.Layout_Info:getSize().height)) end function ClubPlayerAddHuaHongTip:onClose() playBtnCloseEffect() if self.cancelCallback then self.cancelCallback(); end self:removeFromParent() end function ClubPlayerAddHuaHongTip:onConfirm() playBtnEffect() if self.okCallback then self.okCallback(); end self:removeFromParent() end return ClubPlayerAddHuaHongTip