laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
153 lines (152 loc) • 4.93 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Script = void 0;
const Component_1 = require("./Component");
const Event_1 = require("../events/Event");
const ILaya_1 = require("../../ILaya");
class Script extends Component_1.Component {
get isSingleton() {
return false;
}
_onAwake() {
this.onAwake();
if (this.onStart !== Script.prototype.onStart) {
ILaya_1.ILaya.startTimer.callLater(this, this.onStart);
}
}
_onEnable() {
var proto = Script.prototype;
if (this.onTriggerEnter !== proto.onTriggerEnter) {
this.owner.on(Event_1.Event.TRIGGER_ENTER, this, this.onTriggerEnter);
}
if (this.onTriggerStay !== proto.onTriggerStay) {
this.owner.on(Event_1.Event.TRIGGER_STAY, this, this.onTriggerStay);
}
if (this.onTriggerExit !== proto.onTriggerExit) {
this.owner.on(Event_1.Event.TRIGGER_EXIT, this, this.onTriggerExit);
}
if (this.onMouseDown !== proto.onMouseDown) {
this.owner.on(Event_1.Event.MOUSE_DOWN, this, this.onMouseDown);
}
if (this.onMouseUp !== proto.onMouseUp) {
this.owner.on(Event_1.Event.MOUSE_UP, this, this.onMouseUp);
}
if (this.onClick !== proto.onClick) {
this.owner.on(Event_1.Event.CLICK, this, this.onClick);
}
if (this.onStageMouseDown !== proto.onStageMouseDown) {
ILaya_1.ILaya.stage.on(Event_1.Event.MOUSE_DOWN, this, this.onStageMouseDown);
}
if (this.onStageMouseUp !== proto.onStageMouseUp) {
ILaya_1.ILaya.stage.on(Event_1.Event.MOUSE_UP, this, this.onStageMouseUp);
}
if (this.onStageClick !== proto.onStageClick) {
ILaya_1.ILaya.stage.on(Event_1.Event.CLICK, this, this.onStageClick);
}
if (this.onStageMouseMove !== proto.onStageMouseMove) {
ILaya_1.ILaya.stage.on(Event_1.Event.MOUSE_MOVE, this, this.onStageMouseMove);
}
if (this.onDoubleClick !== proto.onDoubleClick) {
this.owner.on(Event_1.Event.DOUBLE_CLICK, this, this.onDoubleClick);
}
if (this.onRightClick !== proto.onRightClick) {
this.owner.on(Event_1.Event.RIGHT_CLICK, this, this.onRightClick);
}
if (this.onMouseMove !== proto.onMouseMove) {
this.owner.on(Event_1.Event.MOUSE_MOVE, this, this.onMouseMove);
}
if (this.onMouseOver !== proto.onMouseOver) {
this.owner.on(Event_1.Event.MOUSE_OVER, this, this.onMouseOver);
}
if (this.onMouseOut !== proto.onMouseOut) {
this.owner.on(Event_1.Event.MOUSE_OUT, this, this.onMouseOut);
}
if (this.onKeyDown !== proto.onKeyDown) {
ILaya_1.ILaya.stage.on(Event_1.Event.KEY_DOWN, this, this.onKeyDown);
}
if (this.onKeyPress !== proto.onKeyPress) {
ILaya_1.ILaya.stage.on(Event_1.Event.KEY_PRESS, this, this.onKeyPress);
}
if (this.onKeyUp !== proto.onKeyUp) {
ILaya_1.ILaya.stage.on(Event_1.Event.KEY_UP, this, this.onKeyUp);
}
if (this.onUpdate !== proto.onUpdate) {
ILaya_1.ILaya.updateTimer.frameLoop(1, this, this.onUpdate);
}
if (this.onLateUpdate !== proto.onLateUpdate) {
ILaya_1.ILaya.lateTimer.frameLoop(1, this, this.onLateUpdate);
}
if (this.onPreRender !== proto.onPreRender) {
ILaya_1.ILaya.lateTimer.frameLoop(1, this, this.onPreRender);
}
this.onEnable();
}
_onDisable() {
this.owner.offAllCaller(this);
ILaya_1.ILaya.stage.offAllCaller(this);
ILaya_1.ILaya.startTimer.clearAll(this);
ILaya_1.ILaya.updateTimer.clearAll(this);
ILaya_1.ILaya.lateTimer.clearAll(this);
}
_isScript() {
return true;
}
_onDestroy() {
this.onDestroy();
}
onAwake() {
}
onEnable() {
}
onStart() {
}
onTriggerEnter(other, self, contact) {
}
onTriggerStay(other, self, contact) {
}
onTriggerExit(other, self, contact) {
}
onMouseDown(e) {
}
onMouseUp(e) {
}
onClick(e) {
}
onStageMouseDown(e) {
}
onStageMouseUp(e) {
}
onStageClick(e) {
}
onStageMouseMove(e) {
}
onDoubleClick(e) {
}
onRightClick(e) {
}
onMouseMove(e) {
}
onMouseOver(e) {
}
onMouseOut(e) {
}
onKeyDown(e) {
}
onKeyPress(e) {
}
onKeyUp(e) {
}
onUpdate() {
}
onLateUpdate() {
}
onPreRender() {
}
onPostRender() {
}
onDisable() {
}
onDestroy() {
}
}
exports.Script = Script;