You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.6 KiB

  1. -- 玩家列表提示框Layout
  2. local ClubPlayerAddHuaHongTip = class("ClubPlayerAddHuaHongTip" , cc.UIView);
  3. local TIPS_TYPE_IMG_TITLE = {
  4. [1] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_honghua_jia_honghua_title.png",
  5. [2] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_honghua_jian_honghua_title.png",
  6. }
  7. local TIPS_TYPE_IMG_BTN = {
  8. [1] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_add_honghua_btn.png",
  9. [2] = "res/ui/zy_club/club_room/club_match_adjust_honghua/club_match_adjust_sub_honghua_btn.png",
  10. }
  11. function ClubPlayerAddHuaHongTip:ctor(idx,contentStr, playerInfo, okCallback, cancelCallback)
  12. ClubPlayerAddHuaHongTip.super.ctor(self)
  13. self.ui = loadUI("res/ui/ui_club/ui_club_player_addhonghuatips.ui");
  14. self:addChild(self.ui)
  15. self.idx = idx
  16. --提示内容
  17. self.contentStr = contentStr
  18. --玩家数据
  19. self.playerInfo = playerInfo
  20. --确认回调
  21. self.okCallback = okCallback
  22. --取消回调
  23. self.cancelCallback = cancelCallback
  24. end
  25. function ClubPlayerAddHuaHongTip:onEnter()
  26. ClubPlayerAddHuaHongTip.super.onEnter(self)
  27. --title
  28. self.ui.Items.ImageView_title:loadTexture(TIPS_TYPE_IMG_TITLE[self.idx]);
  29. self.ui.Items.Button_confirm:loadTextureNormal(TIPS_TYPE_IMG_BTN[self.idx]);
  30. -- 玩家id
  31. self.ui.Items.Text_player_id:setText("ID:"..self.playerInfo.uid)
  32. -- 玩家昵称
  33. self.playerInfo.name = getSubStringNickname(self.playerInfo.name, self.ui.Items.Text_nick_name)
  34. -- 玩家头像地址
  35. local nodeHead = self.ui.Items.ImageView_head
  36. local headSize = nodeHead:getContentSize()
  37. setPlayerHeadImage(self.playerInfo.uid, self.playerInfo.strHeadUrl, nodeHead)
  38. -- 提示文本
  39. self.ui.Items.Text_content:setText(tostring(self.contentStr))
  40. -- 确认回调
  41. self.ui.Items.Button_confirm:registerClick(handler(self , self.onConfirm))
  42. -- 取消回调
  43. self.ui.Items.Button_close:registerClick(handler(self , self.onClose))
  44. self.ui.Items.Layout_Intro:requestDoLayout()
  45. self.ui.Items.Layout_Intro:doLayout()
  46. self.ui.Items.Layout_content:requestDoLayout()
  47. self.ui.Items.Layout_content:doLayout()
  48. self.ui.Items.Layout_Info:setSize(cc.size(self.ui.Items.Layout_content:getSize().width,self.ui.Items.Layout_Info:getSize().height))
  49. end
  50. function ClubPlayerAddHuaHongTip:onClose()
  51. playBtnCloseEffect()
  52. if self.cancelCallback then
  53. self.cancelCallback();
  54. end
  55. self:removeFromParent()
  56. end
  57. function ClubPlayerAddHuaHongTip:onConfirm()
  58. playBtnEffect()
  59. if self.okCallback then
  60. self.okCallback();
  61. end
  62. self:removeFromParent()
  63. end
  64. return ClubPlayerAddHuaHongTip