d5e91df4-5b64-4df5-8d4a-c4a12a6b4a43.js 2.11 KB
"use strict";
cc._RF.push(module, 'd5e9130W2RN9Y1KxKEqa0pD', 'SectionBtn');
// script/game/ui/SectionBtn.ts

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const CCDummyObjects_1 = require("../../common/CCDummyObjects");
const { ccclass, property } = cc._decorator;
let SectionBtn = /** @class */ (() => {
    let SectionBtn = class SectionBtn extends cc.Component {
        constructor() {
            super(...arguments);
            this.label = CCDummyObjects_1.DummyLabel;
            this.pointSpr = CCDummyObjects_1.DummyNode;
        }
        setData(chapterId, chapterName, isCurrChapter, callback) {
            this._callback = callback;
            this.label.string = chapterId.toString() + "." + chapterName;
            if (isCurrChapter) {
                this.pointSpr.active = true;
                cc.tween(this.pointSpr)
                    .repeatForever(cc.tween()
                    .to(0.5, { scale: 1.15, x: -25 }, { easing: 'sineInOut' })
                    .to(0.5, { scale: 1, x: -30 }, { easing: 'sineInOut' }))
                    .start();
                this.label.node.color = cc.color(255, 238, 149, 255);
            }
        }
        onItemClick() {
            this._callback();
        }
    };
    __decorate([
        property(cc.Label)
    ], SectionBtn.prototype, "label", void 0);
    __decorate([
        property(cc.Node)
    ], SectionBtn.prototype, "pointSpr", void 0);
    SectionBtn = __decorate([
        ccclass
    ], SectionBtn);
    return SectionBtn;
})();
exports.default = SectionBtn;

cc._RF.pop();