| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- const { ccclass, property } = cc._decorator;
- /** 天数描边 */
- enum DayOutLineColor {
- /** 红包 */
- red_bag = '#EB3A0E' as any,
- /** 提现 */
- cash = '#2AB718' as any,
- }
- /**
- * 签到icon组件
- * @author 薛鸿潇
- */
- @ccclass
- export default class SignIconItem extends cc.Component {
- @property({ displayName: '提现样式', type: cc.Node })
- private node_cash: cc.Node = null!;
- @property({ displayName: '红包样式', type: cc.Node })
- private node_redbag: cc.Node = null!;
- @property({ displayName: '天数', type: cc.Label })
- private lbl_day: cc.Label = null!;
- /** 数据 */
- private icon_data = {
- id: 0,
- reward_type: 0,
- count: 0,
- login_day: 0,
- video_limit: 0,
- }
- // onLoad () {}
- // start() {
- // }
- /**
- * 初始化数据
- */
- public async setItemData(icon_data) {
- await this.initIcon(icon_data);
- }
- /**
- * 初始化icon
- * @param icon_data 数据
- */
- private initIcon(icon_data) {
- if (!icon_data) {
- this.node.active = false;
- return
- }
- this.lbl_day.string = '第' + icon_data.login_day + '天';
- if (icon_data.reward_type) {
- this.node_cash.active = true;
- this.node_redbag.active = false;
- this.lbl_day.node.getComponent(cc.LabelOutline).color = cc.color(DayOutLineColor.cash);
- } else {
- this.node_cash.active = false;
- this.node_redbag.active = true;
- this.lbl_day.node.getComponent(cc.LabelOutline).color = cc.color(DayOutLineColor.red_bag);
- }
- this.icon_data = icon_data;
- }
- /**
- * 领取奖励
- */
- private clickReceiveReward() {
- if (this.icon_data.reward_type) {
-
- } else {
-
- }
- }
- // update (dt) {}
- }
|