| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- import { RecordTYPE } from "../datas/CommonData";
- import AdM from "../manager/AdM";
- import GameM, { AUDIO_TYPE } from "../manager/GameM";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class RecordItem extends cc.Component {
- @property(cc.Label)
- labDes: cc.Label = null;
- @property(cc.Label)
- labTime: cc.Label = null;
- @property(cc.Label)
- labAdd: cc.Label = null;
- @property(cc.Label)
- labTotal: cc.Label = null;
- @property(cc.Node)
- redCodeNode: cc.Node = null;
- @property(cc.Label)
- labRedCode: cc.Label = null;
- type: RecordTYPE
- date: number
- num: number
- code = ''
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- start() {
- }
- init(type, date, num, total, CashMode = 1, withdrawalCode = '', clubType = false) {
- this.type = type
- this.date = date
- this.num = num
- if (clubType) {
- this.labDes.string = GameM.ClubData.clubRecordAwardTypeArr[this.type - 1]
- } else {
- if (type == -1) {
- this.labDes.string = '微信提现'
- }
- else {
- this.labDes.string = GameM.commonData.recordAwardTypeArr[this.type]
- }
- }
- if (clubType) {
- this.labTime.string = date + ""
- if (type == 3) {
- this.labTotal.string = ""
- } else {
- this.labTotal.string = `余额 ${total}`
- }
- } else {
- let tdate = new Date(this.date * 1000)
- this.labTime.string = tdate.getFullYear() + '-' + (tdate.getMonth() + 1) + '-' + tdate.getDate()
- this.labTotal.string = `余额 ${total}`
- }
- if (this.num > 0) {
- this.labAdd.string = `+${this.num}`
- }
- else {
- this.labAdd.string = this.num.toString()
- }
- if (CashMode == 2) {
- this.code = withdrawalCode
- this.labRedCode.string = `红包码:${this.code}`
- this.redCodeNode.active = true
- }
- else {
- this.redCodeNode.active = false
- }
- }
- /** 点击复制红包码 */
- clickCopyRedCode() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- AdM.setClipboard(this.code)
- }
- // update (dt) {}
- }
|