"use strict";
cc._RF.push(module, '4be67sdkexCyqLl0NHd9N1f', 'Sun');
// Script/Sun.ts

"use strict";
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 _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var NewClass = /** @class */ (function (_super) {
    __extends(NewClass, _super);
    function NewClass() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    // onLoad () {}
    NewClass.prototype.start = function () {
    };
    //初始化数据
    NewClass.prototype.init = function (_id, color, speed, repeat) {
        this.touch = true;
        this.move = false;
        this.id_Number = _id;
        this._color = color;
        this._speed = speed;
        this._repeat = repeat;
        //太阳动画
        cc.tween(this.node.getChildByName("shan"))
            .repeatForever(cc.tween()
            .to(1, { opacity: 0, scale: 0.5, })
            .delay(0.2)
            .to(1, { opacity: 255, scale: 1.2 })
            .delay(0.5))
            .start();
    };
    //用于作弊 测试
    NewClass.prototype.showNumber = function (type) {
        this.node.getChildByName("number").active = type;
        if (type == true)
            this.node.getChildByName("number").getComponent(cc.Label).string = this.id_Number + "";
    };
    //点击事件
    NewClass.prototype.clickBtn = function (event, data) {
        if (data === "1") {
            if (this.move == false && this.touch == true) {
                if (this.node.parent.parent.name == "GameNode") {
                    if (this.node.parent.parent.getComponent("GameManager").begin == true) {
                        cc.tween(this.node.getChildByName("action"))
                            .to(0.5, { opacity: 0, scale: 1.8 })
                            .start();
                        cc.tween(this.node)
                            .to(0.3, { scale: 1.3 })
                            .to(0.3, { scale: 1 })
                            .start();
                        this.touch = false;
                        this.node.zIndex = -1;
                        cc.fx.Notifications.emit("clickSun", this.id_Number);
                    }
                }
                else {
                    this.touch = false;
                    this.node.zIndex = -1;
                    cc.fx.Notifications.emit("clickSun", this.id_Number);
                }
            }
        }
        else {
            if (this.touch == true && this.node.parent.parent.getComponent("GuideManager").begin == true) {
                this.touch = false;
                this.node.zIndex = -1;
                cc.fx.Notifications.emit("clickSun", this.id_Number);
            }
        }
    };
    NewClass = __decorate([
        ccclass
    ], NewClass);
    return NewClass;
}(cc.Component));
exports.default = NewClass;

cc._RF.pop();