3d4c1c12-5959-4df1-9bb3-27fd9607734b.js 3.76 KB
"use strict";
cc._RF.push(module, '3d4c1wSWVlN8ZuzJ/2WB3NL', 'SignItem');
// scripts/prefabs/SignItem.ts

"use strict";
// 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
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
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 });
var Global_1 = require("../Global");
var TableDefine_1 = require("../kernel/table/TableDefine");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var SignItem = /** @class */ (function (_super) {
    __extends(SignItem, _super);
    function SignItem() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SignItem.prototype.setDay = function (day) {
        var _this = this;
        this._day = day;
        var config = Global_1.tMgr.getConfig(TableDefine_1.TableName.SIGN, day);
        // this.node.getChildByName('txtTitle').getComponent(Label).string = '第' + day.toString() + '天';
        this.node.getChildByName('txtNum').getComponent(cc.Label).string = config.Num.toString();
        var color = cc.color();
        color.fromHEX('#946648');
        this.node.getChildByName('imgTitle').color = color;
        if (this._day < 7) {
            cc.resources.load(config.Icon, cc.SpriteFrame, function (error, asset) {
                if (!error) {
                    _this.node.getChildByName('icon').getComponent(cc.Sprite).spriteFrame = asset;
                }
            });
        }
    };
    SignItem.prototype.setCurrent = function (flag) {
        if (this._day > 6) {
            return;
        }
        this.node.getChildByName('imgNormal').active = !flag;
        this.node.getChildByName('imgCur').active = flag;
        if (flag) {
            var color = cc.color();
            color.fromHEX('#357c44');
            this.node.getChildByName('imgTitle').color = color;
        }
    };
    SignItem.prototype.setLock = function (flag) {
        // if (this._day > 6) {
        //     this.node.getChildByName('imgNormal').getComponent(cc.Button).interactable = !flag;
        // }
        // else {
        this.node.getChildByName('imgMask').active = flag;
        if (flag) {
            var color = cc.color();
            color.fromHEX('#4a4556');
            this.node.getChildByName('imgTitle').color = color;
        }
        // }
    };
    SignItem = __decorate([
        ccclass
    ], SignItem);
    return SignItem;
}(cc.Component));
exports.default = SignItem;

cc._RF.pop();