| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- // 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
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class TreaRecordItem extends cc.Component {
- @property(cc.Label)
- labIssue: cc.Label = null;
- @property(cc.Label)
- labTime: cc.Label = null;
- @property(cc.Label)
- labNickname: cc.Label = null;
- @property(cc.RichText)
- labHasJoin: cc.RichText = null;
- @property(cc.Sprite)
- spHead: cc.Sprite = null;
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {}
- start() {
- }
- /**
- * @param data
- * drawname 开奖名字
- * phase 开奖期数
- * drawtime 开奖时间
- * nikename 中奖者昵称
- * headimgurl 中奖者头像
- */
- init(data) {
- cc.loader.load(data.headimgurl + "?aaa=aa.jpg", (err, res) => {
- if (err) {
- console.log('err:', err);
- return;
- }
- let tex: cc.Texture2D = res as cc.Texture2D;
- this.spHead.spriteFrame = new cc.SpriteFrame(tex);
- })
- this.labNickname.string = data.nikename
- this.labIssue.string = `第${data.phase}期`
- this.labTime.string = data.drawtime
- this.labHasJoin.string = ''
- // this.labHasJoin.string = '是否参与:<color=#E12F09>否</color>'
- // this.labHasJoin.string = '是否参与:<color=#00AF0C>是</color>'
- }
- // update (dt) {}
- }
|