ClubInviteItem2.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. import AdM from "../../manager/AdM";
  8. import GameM, { AUDIO_TYPE } from "../../manager/GameM";
  9. import UiM, { PANEL_NAME } from "../../manager/UiM";
  10. import ClubMain from "../ClubMain";
  11. import EffectNode from "../EffectNode";
  12. import RedCodeNode from "../RedCodeNode";
  13. import ClubTixianNode from "./ClubTixianNode";
  14. const { ccclass, property } = cc._decorator;
  15. @ccclass
  16. export default class ClubInviteItem2 extends cc.Component {
  17. @property(cc.Label)
  18. moneyLabel: cc.Label = null
  19. @property(cc.Label)
  20. personLabel: cc.Label = null
  21. @property(cc.Label)
  22. sliderLabel: cc.Label = null
  23. @property(cc.Node)
  24. handNode: cc.Node = null
  25. @property(cc.Sprite)
  26. progressSprite: cc.Sprite = null
  27. @property(cc.Node)
  28. getNode: cc.Node = null
  29. @property(cc.Node)
  30. redCodeNode: cc.Node = null
  31. @property(cc.Node)
  32. cashNode: cc.Node = null
  33. @property(cc.Node)
  34. clubNode: cc.Node = null;
  35. // LIFE-CYCLE CALLBACKS:
  36. // onLoad () {}
  37. private data = null
  38. private index = 0
  39. start() {
  40. }
  41. // /**
  42. // * 招募人数
  43. // */
  44. // private Integer peopleNum;
  45. // /**
  46. // * 提现时间
  47. // */
  48. // private Date withdrawTime;
  49. // /**
  50. // * 提现状态(0未提现,1已提现)
  51. // */
  52. // private Integer status;
  53. // /**
  54. // * 奖励金额
  55. // */
  56. // private Long rewardAmount;
  57. initItem(data, index) {
  58. this.data = data
  59. this.index = index
  60. let money = (data.rewardAmount) / 10000 + ""
  61. if (data.rewardAmount % 10000 != 0) {
  62. money = ((data.rewardAmount) / 10000).toFixed(1)
  63. }
  64. this.moneyLabel.string = "¥" + money
  65. let process = GameM.ClubData.clubInviteInfo.finishCount + "/" + data.peopleNum
  66. this.personLabel.string = `招募${data.peopleNum}个徒弟`
  67. this.sliderLabel.string = process
  68. //this.personLabel.string = `<b><outline color=#460000 width=2><color=#ffffff>招募</color> <color=#FFD86C>${process}</color> <color=#ffffff>玩家</color> </outline></b>`
  69. this.progressSprite.fillRange = GameM.ClubData.clubInviteInfo.finishCount / data.peopleNum
  70. if (GameM.ClubData.clubInviteInfo.finishCount >= data.peopleNum && this.data.status == 0) {
  71. this.handNode.active = true
  72. } else {
  73. this.handNode.active = false
  74. }
  75. if (this.data.status == 0) {
  76. if (GameM.ClubData.clubInviteInfo.finishCount >= this.data.peopleNum) {
  77. this.getNode.active = false
  78. this.redCodeNode.active = false
  79. this.cashNode.active = true
  80. this.clubNode.active = false;
  81. } else {
  82. this.getNode.active = false
  83. this.redCodeNode.active = false
  84. this.cashNode.active = false
  85. this.clubNode.active = true;
  86. }
  87. } else {
  88. this.getNode.active = true
  89. this.redCodeNode.active = true
  90. this.cashNode.active = false
  91. this.clubNode.active = false;
  92. }
  93. }
  94. sharePic() {
  95. GameM.audioM.playEffect(AUDIO_TYPE.button)
  96. GameM.ClubData.inviteOtherPlayer()
  97. }
  98. clicktixian() {
  99. //to do
  100. if (GameM.ClubData.clubInviteInfo.finishCount < this.data.peopleNum) {
  101. EffectNode.instance.PlayTip("招募人数不足")
  102. return
  103. }
  104. if (this.data.status != 0) {
  105. EffectNode.instance.PlayTip("您老人家已经提现辣!")
  106. return
  107. }
  108. // GameM.ClubData.requestClubDoWithdraw(GameM.commonData.version,3+"", this.data.peopleNum, (this.data.rewardAmount)/10000)
  109. GameM.audioM.playEffect(AUDIO_TYPE.button)
  110. this.readyToLingqu(3 + "", (this.data.rewardAmount / 10000), this.data.peopleNum)
  111. }
  112. readyToLingqu(type, money, peopleNum) {
  113. GameM.audioM.playEffect(AUDIO_TYPE.button)
  114. // this.tixianNode.active = true
  115. cc.loader.loadRes('prefabs/club/ClubTixianNode', cc.Prefab, (err, assets) => {
  116. if (err) {
  117. cc.error(err);
  118. return;
  119. }
  120. let node: cc.Node = cc.instantiate(assets)
  121. node.parent = UiM.Instance.clubMainNode.getComponent(ClubMain).alertNode
  122. UiM.Instance.openPanel(node)
  123. node.getComponent(ClubTixianNode).initView(type, money, peopleNum, this.index)
  124. })
  125. }
  126. clickRedCode() {
  127. GameM.audioM.playEffect(AUDIO_TYPE.button)
  128. UiM.Instance.onPanel(PANEL_NAME.RedCodeNode, false, () => {
  129. UiM.Instance.redCodeNode.getComponent(RedCodeNode).init(50)
  130. })
  131. }
  132. //1.1.6 招募按钮
  133. clickClubBtn(){
  134. GameM.audioM.playEffect(AUDIO_TYPE.button)
  135. GameM.ClubData.inviteOtherPlayer()
  136. }
  137. // update (dt) {}
  138. }