| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import { GameProp } from "../../../data/GameData";
- /**
- * 签到界面
- * - 每天第一次上线默认弹出一次【除首日】
- * - 全部签完后,不可再签到。此处需要判断上次签到天数。
- * - 签到数据几点刷新?什么方式刷新? 与后端沟通
- * @author 薛鸿潇
- */
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class Sign extends cc.Component {
- @property({ type: cc.ScrollView, displayName: '滚动视图' })
- private scroll_view: cc.ScrollView = null!;
- @property({ type: cc.Animation, displayName: '按钮_动画' })
- private anim_btn: cc.Animation = null!;
- onLoad() {
- }
- start() {
- g.sign.sign_can = g.gameData.getProp(GEnum.GameProp.sign_can)
- g.sign.initListData();
- g.sign.init_data = true;
- }
- /**
- * 初始化滚动视图
- */
- private initScollView() {
- let list_data = g.sign.list_data;
- this.scroll_view.node.emit('srollview-init', list_data)
- }
- /**
- * 点击领取按钮
- */
- private clickReceiveReward() {
- g.sign.sign_can = 0;
- }
- update(dt) {
- if (g.sign.init_data) {
- g.sign.init_data = false;
- this.initScollView();
- this.initBtnStyle();
- }
- }
- /**
- * 初始化按钮样式
- */
- private initBtnStyle() {
- if (g.sign.sign_can) {
- this.anim_btn.play();
- this.anim_btn.getComponent('SetGray').setGray(false);
- } else {
- this.anim_btn.stop();
- this.anim_btn.node.scale = 1;
- this.anim_btn.getComponent('SetGray').setGray(true);
- }
- }
- }
|