ClubInviteItem.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 ClubInviteItem extends cc.Component {
  17. @property(cc.Label)
  18. moneyLabel:cc.Label = null
  19. @property(cc.RichText)
  20. personLabel:cc.RichText = null
  21. @property(cc.Node)
  22. handNode:cc.Node = null
  23. @property(cc.Sprite)
  24. progressSprite:cc.Sprite = null
  25. @property(cc.Node)
  26. getNode:cc.Node = null
  27. @property(cc.Node)
  28. redCodeNode:cc.Node = null
  29. @property(cc.Node)
  30. cashNode:cc.Node = null
  31. // LIFE-CYCLE CALLBACKS:
  32. // onLoad () {}
  33. private data = null
  34. private index = 0
  35. start() {
  36. }
  37. // /**
  38. // * 招募人数
  39. // */
  40. // private Integer peopleNum;
  41. // /**
  42. // * 提现时间
  43. // */
  44. // private Date withdrawTime;
  45. // /**
  46. // * 提现状态(0未提现,1已提现)
  47. // */
  48. // private Integer status;
  49. // /**
  50. // * 奖励金额
  51. // */
  52. // private Long rewardAmount;
  53. initItem(data,index) {
  54. this.data = data
  55. this.index = index
  56. let money = (data.rewardAmount) / 10000 + ""
  57. if (data.rewardAmount % 10000 != 0) {
  58. money = ((data.rewardAmount) / 10000).toFixed(1)
  59. }
  60. this.moneyLabel.string = "¥"+ money
  61. let process = GameM.ClubData.clubInviteInfo.finishCount + "/" + data.peopleNum
  62. this.personLabel.string =`<b><outline color=#460000 width=2><color=#ffffff>招募</color> <color=#FFD86C>${process}</color> <color=#ffffff>玩家</color> </outline></b>`
  63. this.progressSprite.fillRange = GameM.ClubData.clubInviteInfo.finishCount / data.peopleNum
  64. if(GameM.ClubData.clubInviteInfo.finishCount >= data.peopleNum && this.data.status == 0){
  65. this.handNode.active = true
  66. }else{
  67. this.handNode.active = false
  68. }
  69. if(this.data.status == 0){
  70. this.getNode.active = false
  71. this.redCodeNode.active = false
  72. this.cashNode.active = true
  73. }else{
  74. this.getNode.active = true
  75. this.redCodeNode.active = true
  76. this.cashNode.active = false
  77. }
  78. }
  79. sharePic() {
  80. GameM.audioM.playEffect(AUDIO_TYPE.button)
  81. GameM.ClubData.inviteOtherPlayer()
  82. }
  83. clicktixian() {
  84. //to do
  85. if(GameM.ClubData.clubInviteInfo.finishCount < this.data.peopleNum){
  86. EffectNode.instance.PlayTip("招募人数不足")
  87. return
  88. }
  89. if(this.data.status != 0){
  90. EffectNode.instance.PlayTip("您老人家已经提现辣!")
  91. return
  92. }
  93. // GameM.ClubData.requestClubDoWithdraw(GameM.commonData.version,3+"", this.data.peopleNum, (this.data.rewardAmount)/10000)
  94. GameM.audioM.playEffect(AUDIO_TYPE.button)
  95. this.readyToLingqu(3 + "", (this.data.rewardAmount / 10000), this.data.peopleNum)
  96. }
  97. readyToLingqu(type, money, peopleNum) {
  98. GameM.audioM.playEffect(AUDIO_TYPE.button)
  99. // this.tixianNode.active = true
  100. cc.loader.loadRes('prefabs/club/ClubTixianNode', cc.Prefab, (err, assets) => {
  101. if (err) {
  102. cc.error(err);
  103. return;
  104. }
  105. let node: cc.Node = cc.instantiate(assets)
  106. node.parent = UiM.Instance.clubMainNode.getComponent(ClubMain).alertNode
  107. UiM.Instance.openPanel(node)
  108. node.getComponent(ClubTixianNode).initView(type, money, peopleNum,this.index)
  109. })
  110. }
  111. clickRedCode() {
  112. GameM.audioM.playEffect(AUDIO_TYPE.button)
  113. UiM.Instance.onPanel(PANEL_NAME.RedCodeNode, false, () => {
  114. UiM.Instance.redCodeNode.getComponent(RedCodeNode).init(50)
  115. })
  116. }
  117. // update (dt) {}
  118. }