CashPro.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /** 提现结果 */
  2. import UsualCaidanData from "../datas/UsualCaidanData";
  3. import AdM from "../manager/AdM";
  4. import GameM, { AUDIO_TYPE } from "../manager/GameM";
  5. import UiM, { PANEL_NAME } from "../manager/UiM";
  6. import UsualCaidanNode from "./UsualCaidanNode";
  7. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class CashPro extends cc.Component {
  10. //提现成功
  11. @property(cc.Node)
  12. loadPart: cc.Node = null;
  13. @property(cc.Animation)
  14. loadAni: cc.Animation = null;
  15. @property(cc.Node)
  16. moneyPart: cc.Node = null;
  17. @property(cc.Label)
  18. labFrom: cc.Label = null;
  19. @property(cc.Label)
  20. labRedMoney: cc.Label = null;
  21. @property(cc.Node)
  22. btnTixian: cc.Node = null;
  23. @property(cc.Node)
  24. btnAuth: cc.Node = null;
  25. @property(cc.Node)
  26. cashPro: cc.Node = null;
  27. @property(cc.Label)
  28. labMoney: cc.Label = null;
  29. //提现金额
  30. money = 0
  31. //点击冷却
  32. hasTap = false
  33. //彩蛋类型 1 投放彩蛋 2 常规彩蛋 3 裂变彩蛋
  34. fromType = 0
  35. init(type, money) {
  36. this.fromType = type
  37. this.money = money
  38. UiM.Instance.openPanel(this.moneyPart)
  39. this.loadPart.active = false
  40. this.cashPro.active = false
  41. if (GameM.commonData.isAuth) {
  42. this.btnAuth.active = false
  43. this.btnTixian.active = true
  44. }
  45. else {
  46. this.btnAuth.active = true
  47. this.btnTixian.active = false
  48. }
  49. this.labFrom.string = `幸运彩蛋`
  50. if (this.fromType == 2) {
  51. this.labRedMoney.string = ''
  52. UsualCaidanData.Instance.getUsualEggCashMoney()
  53. }
  54. else {
  55. this.labRedMoney.string = `¥${this.money.toFixed(2)}`
  56. }
  57. // //test
  58. // this.btnAuth.active = false
  59. // this.btnTixian.active = true
  60. }
  61. showLoad() {
  62. this.loadPart.active = true
  63. this.loadAni.play('load', 0)
  64. }
  65. tixianSuccess(showPro = true, moneyNum = -1) {
  66. this.loadPart.active = false
  67. this.showCashPro(showPro, moneyNum)
  68. }
  69. showCashPro(showPro, moneyNum) {
  70. if (showPro) {
  71. console.log('showCashPro ')
  72. UiM.Instance.openPanel(this.cashPro)
  73. }
  74. if (moneyNum == -1) {
  75. this.labMoney.string = `¥${this.money.toFixed(2)}`
  76. }
  77. else {
  78. this.labMoney.string = `¥${(moneyNum * 0.01).toFixed(2)}`
  79. }
  80. }
  81. tixianFail() {
  82. console.log('tixianFail ')
  83. this.loadPart.active = false
  84. UiM.Instance.closePanelFromHome()
  85. UiM.Instance.offPanel(PANEL_NAME.CashProNode)
  86. }
  87. authBack() {
  88. this.btnAuth.active = false
  89. this.btnTixian.active = true
  90. }
  91. clickClose() {
  92. GameM.audioM.playEffect(AUDIO_TYPE.button)
  93. UiM.Instance.closePanelFromHome()
  94. this.scheduleOnce(() => {
  95. UiM.Instance.offPanel(PANEL_NAME.CashProNode)
  96. if (this.fromType == 2) {
  97. UiM.Instance.onPanel(PANEL_NAME.UsualCaidanNode, false, () => {
  98. UiM.Instance.usualCaidanNode.getComponent(UsualCaidanNode).init()
  99. })
  100. }
  101. }, 0.5)
  102. }
  103. clickCash() {
  104. GameM.audioM.playEffect(AUDIO_TYPE.button)
  105. if (this.fromType == 2) {
  106. UsualCaidanData.Instance.usualeggCash()
  107. }
  108. }
  109. clickAuth() {
  110. GameM.audioM.playEffect(AUDIO_TYPE.button)
  111. if (!this.hasTap) {
  112. this.hasTap = true
  113. AdM.WxLogin()
  114. this.scheduleOnce(() => {
  115. this.hasTap = false
  116. }, 3)
  117. }
  118. }
  119. }