107 lines
4.4 KiB
JavaScript
107 lines
4.4 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '4be67sdkexCyqLl0NHd9N1f', 'Sun');
|
|
// Script/Sun.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 _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
|
|
var Notification_1 = require("./Notification");
|
|
var NewClass = /** @class */ (function (_super) {
|
|
__extends(NewClass, _super);
|
|
function NewClass() {
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
// LIFE-CYCLE CALLBACKS:
|
|
// onLoad () {}
|
|
NewClass.prototype.start = function () {
|
|
this.touch = true;
|
|
this.move = false;
|
|
this._color = 0;
|
|
this._speed = 0;
|
|
var shan = this.node.getChildByName("shan");
|
|
cc.tween(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.init = function (_id, color, speed, repeat) {
|
|
this.id_Number = _id;
|
|
this._color = color;
|
|
this._speed = speed;
|
|
this._repeat = repeat;
|
|
};
|
|
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 () {
|
|
var temp = this.node.parent.parent.name;
|
|
// console.log(temp,this.move,this.touch);
|
|
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;
|
|
Notification_1.Notification.emit("clickSun", this.id_Number);
|
|
}
|
|
}
|
|
else {
|
|
this.touch = false;
|
|
this.node.zIndex = -1;
|
|
Notification_1.Notification.emit("clickSun", this.id_Number);
|
|
}
|
|
}
|
|
};
|
|
NewClass.prototype.clickBtn2 = function () {
|
|
if (this.touch == true && this.node.parent.parent.getComponent("GuideManager").begin == true) {
|
|
this.touch = false;
|
|
this.node.zIndex = -1;
|
|
Notification_1.Notification.emit("clickSun", this.id_Number);
|
|
}
|
|
};
|
|
NewClass.prototype.update = function (dt) {
|
|
};
|
|
NewClass = __decorate([
|
|
ccclass
|
|
], NewClass);
|
|
return NewClass;
|
|
}(cc.Component));
|
|
exports.default = NewClass;
|
|
|
|
cc._RF.pop(); |