2022-06-19 15:03:30 +08:00

44 lines
911 B
TypeScript

import { IToken } from "../data/DataModel";
import WalletBase from "./WallerBase";
const {ccclass, property} = cc._decorator;
@ccclass
export default class OneToken extends WalletBase {
@property(cc.Label)
symbolLabel: cc.Label = null;
@property(cc.Label)
countLabel: cc.Label = null;
@property(cc.Sprite)
icon: cc.Sprite = null;
data: IToken = null
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
}
// update (dt) {}
init(_data: IToken) {
this.data = _data
if (this.data.symbol) {
this.symbolLabel.string = this.data.symbol
} else {
// TODO: get from remote
}
if (this.data.balance !== undefined) {
this.countLabel.string = this.data.balance + ''
} else {
this.countLabel.string = '-'
//TODO: get from remote
}
}
}