"use strict"; cc._RF.push(module, 'd0e3bb40btBYIzPQnm0WQH/', 'UIAction'); // Script/new_20210323/UIAction.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 }); exports.EasingEnum = void 0; var EasingEnum; (function (EasingEnum) { EasingEnum[EasingEnum["quadIn"] = 0] = "quadIn"; EasingEnum[EasingEnum["quadOut"] = 1] = "quadOut"; EasingEnum[EasingEnum["quadInOut"] = 2] = "quadInOut"; EasingEnum[EasingEnum["cubicIn"] = 3] = "cubicIn"; EasingEnum[EasingEnum["cubicOut"] = 4] = "cubicOut"; EasingEnum[EasingEnum["cubicInOut"] = 5] = "cubicInOut"; EasingEnum[EasingEnum["quartIn"] = 6] = "quartIn"; EasingEnum[EasingEnum["quartOut"] = 7] = "quartOut"; EasingEnum[EasingEnum["quartInOut"] = 8] = "quartInOut"; EasingEnum[EasingEnum["quintIn"] = 9] = "quintIn"; EasingEnum[EasingEnum["quintOut"] = 10] = "quintOut"; EasingEnum[EasingEnum["quintInOut"] = 11] = "quintInOut"; EasingEnum[EasingEnum["sineIn"] = 12] = "sineIn"; EasingEnum[EasingEnum["sineOut"] = 13] = "sineOut"; EasingEnum[EasingEnum["sineInOut"] = 14] = "sineInOut"; EasingEnum[EasingEnum["expoIn"] = 15] = "expoIn"; EasingEnum[EasingEnum["expoOut"] = 16] = "expoOut"; EasingEnum[EasingEnum["expoInOut"] = 17] = "expoInOut"; EasingEnum[EasingEnum["circIn"] = 18] = "circIn"; EasingEnum[EasingEnum["circOut"] = 19] = "circOut"; EasingEnum[EasingEnum["circInOut"] = 20] = "circInOut"; EasingEnum[EasingEnum["elasticIn"] = 21] = "elasticIn"; EasingEnum[EasingEnum["elasticOut"] = 22] = "elasticOut"; EasingEnum[EasingEnum["elasticInOut"] = 23] = "elasticInOut"; EasingEnum[EasingEnum["backIn"] = 24] = "backIn"; EasingEnum[EasingEnum["backOut"] = 25] = "backOut"; EasingEnum[EasingEnum["backInOut"] = 26] = "backInOut"; EasingEnum[EasingEnum["bounceIn"] = 27] = "bounceIn"; EasingEnum[EasingEnum["bounceOut"] = 28] = "bounceOut"; EasingEnum[EasingEnum["bounceInOut"] = 29] = "bounceInOut"; EasingEnum[EasingEnum["smooth"] = 30] = "smooth"; EasingEnum[EasingEnum["fade"] = 31] = "fade"; })(EasingEnum = exports.EasingEnum || (exports.EasingEnum = {})); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var NewClass = /** @class */ (function (_super) { __extends(NewClass, _super); function NewClass() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.easings = EasingEnum.smooth; _this.duration = 2; _this.isScale = false; _this.startScale = 2; _this.targetScale = 1; /**初始隐藏 */ _this.isStartHide = false; _this.isMove = false; _this.startPos = new cc.Vec3(0, 50, 0); _this.endPos = new cc.Vec3(0, 0, 0); _this.isInterval = false; _this.intervalTime = 1; _this.isLoop = false; return _this; // update (dt) {} } // LIFE-CYCLE CALLBACKS: NewClass.prototype.onLoad = function () { var _this = this; this.Init(); (this.isInterval) ? this.scheduleOnce(function () { _this.TweenFunc(); }, this.intervalTime) : this.TweenFunc(); }; NewClass.prototype.Init = function () { if (this.isMove) this.node.position = this.startPos; if (this.isScale) this.node.setScale(this.startScale); if (this.isStartHide) this.node.opacity = 0; }; NewClass.prototype.TweenFunc = function () { if (this.isStartHide) this.node.opacity = 255; var tweens = cc.tween(); //, position: this.currentPos if (this.isScale) tweens.to(this.duration, { scale: this.targetScale }, { easing: EasingEnum[this.easings] }); if (this.isMove) tweens.to(this.duration, { position: this.endPos }, { easing: EasingEnum[this.easings] }); tweens.call(function () { // this.node.setScale(this.startScale); console.log('缓动结束回调'); // if (this.callback) this.callback(); }); (this.isLoop) ? cc.tween(this.node).repeatForever(tweens).start() : cc.tween(this.node).repeat(1, tweens).start(); }; __decorate([ property({ type: cc.Enum(EasingEnum) }) ], NewClass.prototype, "easings", void 0); __decorate([ property ], NewClass.prototype, "duration", void 0); __decorate([ property ], NewClass.prototype, "isScale", void 0); __decorate([ property ], NewClass.prototype, "startScale", void 0); __decorate([ property ], NewClass.prototype, "targetScale", void 0); __decorate([ property ], NewClass.prototype, "isStartHide", void 0); __decorate([ property ], NewClass.prototype, "isMove", void 0); __decorate([ property(cc.Vec3) ], NewClass.prototype, "startPos", void 0); __decorate([ property(cc.Vec3) ], NewClass.prototype, "endPos", void 0); __decorate([ property ], NewClass.prototype, "isInterval", void 0); __decorate([ property ], NewClass.prototype, "intervalTime", void 0); __decorate([ property ], NewClass.prototype, "isLoop", void 0); NewClass = __decorate([ ccclass ], NewClass); return NewClass; }(cc.Component)); exports.default = NewClass; cc._RF.pop();