hy-farm/muchang/home/web/game/js/main/10-services-utils-and-effects.js
2026-05-29 19:54:56 +08:00

2226 lines
65 KiB
JavaScript

var DateTimer = class DateTimer {
constructor() {
if (((this._deltaTime = 0), DateTimer._instance)) throw new Error("DateTimer使用单例");
}
static get instance() {
return (DateTimer._instance || (DateTimer._instance = new DateTimer()), DateTimer._instance);
}
static get deltatime() {
return DateTimer.instance._deltaTime;
}
updateServerTime(t) {
this._deltaTime = Date.now() - t;
}
get now() {
return Math.floor((Date.now() - this._deltaTime) / 1e3);
}
run() {
(this.run1sTicker(), this.runTicker());
}
runSyncTicker() {
const t = new egret.Timer(15e3);
(t.addEventListener(egret.TimerEvent.TIMER, this.onSyncTimer, this), t.start());
}
onSyncTimer() {}
run1sTicker() {
const t = new egret.Timer(1e3);
(t.addEventListener(egret.TimerEvent.TIMER, this.onOneSecondTimer, this),
t.start(),
(this._last1sTime = egret.getTimer()));
}
onOneSecondTimer() {
const t = egret.getTimer(),
e = t - this._last1sTime;
((this._last1sTime = t), manager.UpdateTickerManager.onesec.update(e));
}
runTicker() {
const t = new egret.Timer(33);
(t.addEventListener(egret.TimerEvent.TIMER, this.onEnterFrameTimer, this),
t.start(),
(this._lastFpsTime = egret.getTimer()));
}
onEnterFrameTimer() {
const t = egret.getTimer(),
e = t - this._lastFpsTime;
((this._lastFpsTime = t), manager.UpdateTickerManager.instance.update(e));
}
};
__reflect(DateTimer.prototype, "DateTimer");
var game;
!(function (game) {
const EventAutoRelease = class EventAutoRelease {
constructor(t, e, i) {
this.type = t;
this.callback = e;
this.thisObj = i;
}
};
((game.EventAutoRelease = EventAutoRelease), __reflect(EventAutoRelease.prototype, "game.EventAutoRelease"));
const EventManager = class EventManager extends egret.EventDispatcher {
constructor(e) {
super(e);
if (((this.autoReleaseArr = []), EventManager._instance)) throw new Error("EventManager使用单例 ");
this.init();
}
static get instance() {
return (EventManager._instance || (EventManager._instance = new EventManager()), EventManager._instance);
}
init() {
const t = new egret.Timer(2e3);
(t.addEventListener(egret.TimerEvent.TIMER, this.autoReleaseTick, this), t.start());
}
addEvent(t, i, n, a = !1) {
(this.addEventListener(t, i, n),
a && n instanceof egret.DisplayObject && this.autoReleaseArr.push(new EventAutoRelease(t, i, n)));
}
removeEvent(t, e, i) {
this.removeEventListener(t, e, i);
}
dispatch(t, e = null) {
this.dispatchEventWith(t, !1, e);
}
autoReleaseTick() {
for (let t = this.autoReleaseArr.length - 1; t >= 0; t--) {
const e = this.autoReleaseArr[t];
e.thisObj.stage || (this.removeEvent(e.type, e.callback, e.thisObj), this.autoReleaseArr.splice(t, 1));
}
}
};
((game.EventManager = EventManager), __reflect(EventManager.prototype, "game.EventManager"));
})(game || (game = {}));
var GameLayerManager = class GameLayerManager extends eui.UILayer {
constructor() {
super();
this.sceneLayer = new eui.UILayer();
this.mainLayer = new eui.UILayer();
this.panelLayer = new eui.UILayer();
this.effectLayer = new eui.UILayer();
this.maskLayer = new eui.UILayer();
this.loadLayer = new eui.UILayer();
this.tipLayer = new eui.UILayer();
this.popLayer = new eui.UILayer();
this.init();
}
static get instance() {
return (this._instance || (this._instance = new GameLayerManager()), this._instance);
}
static gameLayer() {
return (this._instance || (this._instance = new GameLayerManager()), this._instance);
}
init() {
((this.touchThrough = !0),
(this.sceneLayer.touchThrough = !0),
(this.mainLayer.touchThrough = !0),
(this.panelLayer.touchThrough = !0),
(this.effectLayer.touchThrough = !0),
(this.maskLayer.touchThrough = !0),
(this.loadLayer.touchThrough = !0),
(this.popLayer.touchThrough = !0),
(this.tipLayer.touchThrough = !0),
this.addChild(this.sceneLayer),
this.addChild(this.mainLayer),
this.addChild(this.panelLayer),
this.addChild(this.popLayer),
this.addChild(this.tipLayer),
this.addChild(this.loadLayer),
this.addChild(this.effectLayer),
this.addChild(this.maskLayer));
}
};
__reflect(GameLayerManager.prototype, "GameLayerManager");
var PopUpManager;
!(function (PopUpManager) {
function e(t) {
return GameLayerManager.gameLayer().panelLayer.contains(t) ? !0 : !1;
}
function i(t) {
return GameLayerManager.gameLayer().sceneLayer.contains(t) ? !0 : !1;
}
function n(t, e, i, n, a, o) {
if (
(void 0 === e && (e = !1),
void 0 === i && (i = 0),
void 0 === n && (n = 0),
void 0 === a && (a = 0),
void 0 === o && (o = !1),
!GameLayerManager.gameLayer().panelLayer.contains(t))
) {
if (((t.name = "Panel" + t.hashCode), (t.scaleX = 1), (t.scaleY = 1), (t.x = 0), (t.y = 0), (t.alpha = 1), e)) {
const r = new egret.Sprite();
(r.graphics.clear(),
r.graphics.beginFill(0, 0.03),
r.graphics.drawRect(0, 0, GameConfig.curWidth(), GameConfig.curHeight()),
r.graphics.endFill(),
(r.name = "Drak" + t.hashCode),
(r.width = GameConfig.curWidth()),
(r.height = GameConfig.curHeight()),
GameLayerManager.gameLayer().panelLayer.contains(r) || GameLayerManager.gameLayer().panelLayer.addChild(r),
(r.touchEnabled = !0),
egret.Tween.get(r).to(
{
alpha: 1
},
150
),
(r.visible = !0));
}
(GameLayerManager.gameLayer().panelLayer.addChild(t),
(GameConfig.curPanel = t),
0 != i
? ((t.x = GameConfig.curWidth() / 2 - i / 2), (t.y = GameConfig.curHeight() / 2 - n / 2 - t.anchorOffsetY))
: ((i = t.width), (n = t.height)));
const s = GameConfig.curWidth() / 2 - i / 2,
l = GameConfig.curHeight() / 2 - n / 2;
switch (a) {
case 0:
break;
case 7:
((t.alpha = 0),
(t.scaleX = 0.5),
(t.scaleY = 0.5),
(t.x = t.x + i / 4),
(t.y = t.y + n / 4),
egret.Tween.get(t).to(
{
alpha: 1,
scaleX: 1,
scaleY: 1,
x: t.x - i / 4 + t.anchorOffsetX,
y: t.y - n / 4 + t.anchorOffsetY
},
250,
egret.Ease.backOut
));
break;
case 1:
((t.alpha = 0),
(t.scaleX = 0.5),
(t.scaleY = 0.5),
(t.x = t.x + i / 4),
(t.y = t.y + n / 4),
egret.Tween.get(t).to(
{
alpha: 1,
scaleX: 1,
scaleY: 1,
x: t.x - i / 4 + t.anchorOffsetX,
y: t.y - n / 4 + t.anchorOffsetY
},
300,
egret.Ease.backOut
));
break;
case 2:
((t.alpha = 0),
(t.scaleX = 0.5),
(t.scaleY = 0.5),
egret.Tween.get(t).to(
{
alpha: 1,
scaleX: 1,
scaleY: 1,
x: t.x,
y: t.y
},
600,
egret.Ease.elasticOut
));
break;
case 3:
o
? ((t.x = -i),
egret.Tween.get(t).to(
{
x: s
},
500,
egret.Ease.cubicOut
))
: ((t.x = -i),
egret.Tween.get(t).to(
{
x: 0
},
500,
egret.Ease.cubicOut
));
break;
case 4:
o
? ((t.x = i),
egret.Tween.get(t).to(
{
x: s
},
500,
egret.Ease.cubicOut
))
: ((t.x = i),
egret.Tween.get(t).to(
{
x: 0
},
500,
egret.Ease.cubicOut
));
break;
case 5:
o
? ((t.y = -n),
egret.Tween.get(t).to(
{
y: l
},
500,
egret.Ease.cubicOut
))
: ((t.y = -n),
egret.Tween.get(t).to(
{
y: 0
},
500,
egret.Ease.cubicOut
));
break;
case 6:
o
? ((t.y = GameConfig.curHeight()),
egret.Tween.get(t).to(
{
y: l
},
500,
egret.Ease.cubicOut
))
: ((t.y = n),
egret.Tween.get(t).to(
{
y: 0
},
500,
egret.Ease.cubicOut
));
}
}
}
function a(t) {
egret.Tween.removeTweens(t);
(t.anchorOffsetX, t.anchorOffsetY);
((t.anchorOffsetX = t.width / 2),
(t.anchorOffsetY = t.height / 2),
(t.x = t.anchorOffsetX),
(t.y = t.anchorOffsetY));
const e = "Drak" + t.hashCode,
i = GameLayerManager.gameLayer().panelLayer.getChildByName(e);
((i.visible = !0),
(t.visible = !0),
egret.Tween.get(t)
.to(
{
alpha: 1,
scaleX: 1,
scaleY: 1
},
250,
egret.Ease.backIn
)
.call(function () {
((t.anchorOffsetX = 0), (t.anchorOffsetY = 0), (t.x = 0), (t.y = 0));
}));
}
function o(t) {
egret.Tween.removeTweens(t);
const e = this,
i = "Drak" + t.hashCode,
n = GameLayerManager.gameLayer().panelLayer.getChildByName(i);
egret.Tween.get(t).to(
{
alpha: 0,
scaleX: 0,
scaleY: 0,
x: t.x + t.width / 2,
y: t.y + t.height / 2
},
250,
egret.Ease.backIn
);
const a = 500;
egret.setTimeout(
function () {
((n.visible = !1), (t.visible = !1));
},
e,
a
);
}
function r(t, e, i) {
if ((void 0 === e && (e = 0), t)) {
egret.Tween.removeTweens(t);
const n = this,
a = "Drak" + t.hashCode,
o = GameLayerManager.gameLayer().panelLayer.getChildByName(a),
r = function () {
GameLayerManager.gameLayer().panelLayer.contains(o) && GameLayerManager.gameLayer().panelLayer.removeChild(o);
};
switch (
(o &&
((o.alpha = 0),
egret.Tween.get(o)
.to(
{
alpha: 0
},
100
)
.call(r, n)),
e)
) {
case 10:
t.onHide && t.onHide();
break;
case 0:
break;
case 1:
egret.Tween.get(t).to(
{
alpha: 0,
scaleX: 0,
scaleY: 0,
x: t.x + t.width / 2,
y: t.y + t.height / 2
},
250,
egret.Ease.backIn
);
break;
case 2:
break;
case 3:
egret.Tween.get(t).to(
{
x: t.width
},
500,
egret.Ease.cubicOut
);
break;
case 4:
egret.Tween.get(t).to(
{
x: -t.width
},
500,
egret.Ease.cubicOut
);
break;
case 5:
egret.Tween.get(t).to(
{
y: t.height
},
500,
egret.Ease.cubicOut
);
break;
case 6:
egret.Tween.get(t).to(
{
y: -t.height
},
500,
egret.Ease.cubicOut
);
}
let s = 500;
(0 == e && (s = 0),
egret.setTimeout(
function () {
GameLayerManager.gameLayer().panelLayer.contains(t) &&
GameLayerManager.gameLayer().panelLayer.removeChild(t);
},
n,
s
));
}
}
function s(t, e, i) {
(void 0 === e && (e = 0),
void 0 === i && (i = !1),
GameLayerManager.gameLayer().sceneLayer.contains(t) || GameLayerManager.gameLayer().sceneLayer.addChild(t));
}
function l(t) {
GameLayerManager.gameLayer().sceneLayer.contains(t) && GameLayerManager.gameLayer().sceneLayer.removeChild(t);
}
function h(t, e, i, n) {
(void 0 === n && (n = 16), game.SimpleTip.popTip(t, e, i, n));
}
function c(t, e, i) {
(void 0 === e && (e = 1e3), void 0 === i && (i = !1), game.ToastTip.popTip(t, e, i));
}
((PopUpManager.panelIsAdded = e),
(PopUpManager.sceneIsAdded = i),
(PopUpManager.addPopUp = n),
(PopUpManager.showPanel = a),
(PopUpManager.hidePanel = o),
(PopUpManager.removePopUpAsync = r),
(PopUpManager.addSceneUp = s),
(PopUpManager.removeSceneUp = l),
(PopUpManager.popSimpleTip = h),
(PopUpManager.popTip = c));
})(PopUpManager || (PopUpManager = {}));
var SocketManager;
!(function (SocketManager) {
function e() {
(this.sock.close(),
Global.alertMediator.addAlert(
"网络已经断开,请重新连接",
function () {
window.location.href = window.location.href;
},
null,
!0
));
}
function i() {
((this.sock = new egret.WebSocket()),
this.sock.addEventListener(egret.ProgressEvent.SOCKET_DATA, this.onReceiveMessage, this),
this.sock.addEventListener(egret.Event.CONNECT, this.onSocketOpen, this),
this.sock.addEventListener(egret.Event.CLOSE, this.onSocketClose, this),
this.sock.addEventListener(egret.IOErrorEvent.IO_ERROR, this.onSocketError, this),
this.sock.connectByUrl("ws://" + GameConfig.SOKCET_PATH));
}
function n() {}
function a() {
this.sendMessage({
command_id: game.SocketCommand.to_command_id1,
token: Global.netProxy.token
});
}
function o() {
const t = JSON.parse(this.sock.readUTF());
return 0 == t.command_id
? void TipsUtils.showErrorCodeTips(t.status)
: void (4 == t.command_id
? ((t.data = JSON.parse(t.data)),
(1 == t.data.type || 2 == t.data.type) && game.EventManager.instance.dispatch(SysNotify.FRIEND_RED, t.data),
game.SocketCommand[t.data.type] &&
game.AppFacade.getInstance().sendNotification(game.SocketCommand[t.data.type], t.data.detail_data))
: 6 == t.command_id && game.EventManager.instance.dispatch(SysNotify.SHOW_MESSAGE, t.data));
}
function r(t) {
this.sock.writeUTF(JSON.stringify(t));
}
((SocketManager.onSocketClose = e),
(SocketManager.connectServer = i),
(SocketManager.onSocketError = n),
(SocketManager.onSocketOpen = a),
(SocketManager.onReceiveMessage = o),
(SocketManager.sendMessage = r));
})(SocketManager || (SocketManager = {}));
var manager;
!(function (manager) {
const UpdateTickerManager = class UpdateTickerManager {
constructor() {
this.allUpdateObjArr = [];
}
static get instance() {
return (
UpdateTickerManager._instance || (UpdateTickerManager._instance = new UpdateTickerManager()),
UpdateTickerManager._instance
);
}
static get onesec() {
return (
UpdateTickerManager._onesec || (UpdateTickerManager._onesec = new UpdateTickerManager()),
UpdateTickerManager._onesec
);
}
add(t) {
game.Utils.isElinArr(t, this.allUpdateObjArr) || this.allUpdateObjArr.push(t);
}
remove(t) {
for (let e = this.allUpdateObjArr.length, i = 0; e > i; i++)
t == this.allUpdateObjArr[i] && this.allUpdateObjArr.splice(i, 1);
}
update(t) {
for (let e = 0; e < this.allUpdateObjArr.length; e++) this.allUpdateObjArr[e].update(t);
}
};
((manager.UpdateTickerManager = UpdateTickerManager),
__reflect(UpdateTickerManager.prototype, "manager.UpdateTickerManager"));
})(manager || (manager = {}));
var core;
!(function (core) {
const Base64 = class Base64 {
constructor() {}
static initEncodeChar() {
for (
var t = new Array(64),
e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
i = 0,
n = e.length;
n > i;
i++
)
t[i] = e.charCodeAt(i);
return t;
}
static initDecodeChar() {
const t = [
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1
];
return t;
}
static encode(e) {
const i = new egret.ByteArray();
let n = 0;
const a = e.length;
const o = a % 3;
const r = a - o;
let s = 0;
for (e.position = 0; r > n; )
((s = ((255 & e.readByte()) << 16) | ((255 & e.readByte()) << 8) | (255 & e.readByte())),
i.writeByte(Base64.s_encodeChars[s >>> 18]),
i.writeByte(Base64.s_encodeChars[(s >>> 12) & 63]),
i.writeByte(Base64.s_encodeChars[(s >>> 6) & 63]),
i.writeByte(Base64.s_encodeChars[63 & s]),
(n += 3));
return (
1 == o
? ((s = 255 & e.readByte()),
i.writeByte(Base64.s_encodeChars[s >>> 2]),
i.writeByte(Base64.s_encodeChars[3 & s]),
i.writeByte(61),
i.writeByte(61))
: 2 == o &&
((s = ((255 & e.readByte()) << 8) | (255 & e.readByte())),
i.writeByte(Base64.s_encodeChars[s >>> 10]),
i.writeByte(Base64.s_encodeChars[(s >>> 4) & 63]),
i.writeByte(Base64.s_encodeChars[(15 & s) << 2]),
i.writeByte(61)),
(n += o),
(i.position = 0),
i.readUTFBytes(i.length)
);
}
static decode(e) {
const i = new egret.ByteArray(),
n = new egret.ByteArray();
(n.writeUTFBytes(e), (n.position = 0));
for (
let a, o, r, s, l = 0, h = n.length;
h > l &&
((a = Base64.s_decodeChars[255 & n.readByte()]), -1 != a) &&
((o = Base64.s_decodeChars[255 & n.readByte()]), -1 != o) &&
(i.writeByte((a << 2) | (3 & o)), (r = 255 & n.readByte()), 61 != r) &&
((r = Base64.s_decodeChars[r]), -1 != r) &&
(i.writeByte((240 & o) | (15 & r)), (s = 255 & n.readByte()), 61 != s) &&
((s = Base64.s_decodeChars[s]), -1 != s);
)
(i.writeByte((192 & r) | s), (l += 4));
return ((i.position = 0), i);
}
static encodeStr(e) {
if (null != e && "" != e) {
const i = new egret.ByteArray();
return (i.writeUTFBytes(e), Base64.encode(i));
}
return "";
}
static decodeStr(e) {
if (null != e && "" != e) {
const i = Base64.decode(e);
return i.readUTFBytes(i.length);
}
return "";
}
static s_encodeChars = Base64.initEncodeChar();
static s_decodeChars = Base64.initDecodeChar();
};
((core.Base64 = Base64), __reflect(Base64.prototype, "core.Base64"));
})(core || (core = {}));
var EffectUtils;
!(function (EffectUtils) {
function e(t, e) {
if (
(void 0 === e && (e = 1e3), null == this.rotationArr && (this.rotationArr = []), !this.rotationArr[t.hashCode])
) {
(null != this.rotationArr[t.hashCode] && this.rotationArr[t.hashCode]) || (this.rotationArr[t.hashCode] = !0);
const i = function () {
this.rotationArr[t.hashCode] &&
null != t &&
((t.rotation = 0),
egret.Tween.get(t)
.to(
{
rotation: 360
},
e
)
.call(i, this));
};
((t.rotation = 0),
egret.Tween.get(t)
.to(
{
rotation: 360
},
e
)
.call(i, this));
}
}
function i(t, e) {
return new Promise(function (i, n) {
egret.Tween.get(t)
.to(
{
alpha: 1
},
e
)
.call(i);
});
}
function n(t) {
(null == this.rotationArr && (this.rotationArr = []), (this.rotationArr[t.hashCode] = !1));
}
function a(t, e) {
(void 0 === e && (e = 1e3), new BitmapBlink(t, e));
}
function o(t) {
const e = 80,
i = t.x;
(egret.Tween.get(t).to(
{
x: t.x - 10
},
e
),
egret.setTimeout(
function () {
egret.Tween.get(t).to(
{
x: t.x + 20
},
e
);
},
this,
2 * e
),
egret.setTimeout(
function () {
egret.Tween.get(t).to(
{
x: t.x - 20
},
e
);
},
this,
3 * e
),
egret.setTimeout(
function () {
egret.Tween.get(t).to(
{
x: t.x + 20
},
e
);
},
this,
4 * e
),
egret.setTimeout(
function () {
egret.Tween.get(t).to(
{
x: i
},
e
);
},
this,
5 * e
));
}
function r(t) {
void 0 === t && (t = 1);
const e = GameConfig.curPanel,
i = 40,
n = e.x,
a = e.y;
1 == t
? (egret.Tween.get(e).to(
{
x: e.x - 10
},
i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x + 20
},
i
);
},
this,
2 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x - 20
},
i
);
},
this,
3 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x + 20
},
i
);
},
this,
4 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: n
},
i
);
},
this,
5 * i
))
: (egret.Tween.get(e).to(
{
x: e.x - 10,
y: e.y
},
i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x + 20,
y: e.y
},
i
);
},
this,
2 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x,
y: e.y + 15
},
i
);
},
this,
3 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x,
y: e.y - 20
},
i
);
},
this,
4 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: e.x,
y: e.y + 10
},
i
);
},
this,
5 * i
),
egret.setTimeout(
function () {
egret.Tween.get(e).to(
{
x: n,
y: a
},
i
);
},
this,
6 * i
));
}
function s(t, e, i) {
switch ((void 0 === t && (t = ""), void 0 === e && (e = 1), void 0 === i && (i = !1), e)) {
case 1:
TipsUtils.showTipsDownToUp(t, i);
break;
case 2:
TipsUtils.showTipsLeftOrRight(t, i, !0);
break;
case 3:
TipsUtils.showTipsLeftOrRight(t, i, !1);
break;
case 4:
TipsUtils.showTipsFromCenter(t, i);
break;
case 5:
TipsUtils.showTipsBigToSmall(t, i);
}
}
function l(t, e) {
if ((void 0 === e && (e = 1), !this.isPlayEffectPlay)) {
this.isPlayEffectPlay = !0;
const i = function () {
this.isPlayEffectPlay = !1;
},
n = function () {
1 == e
? egret.Tween.get(t)
.to(
{
scaleX: 1,
scaleY: 1
},
500,
egret.Ease.elasticOut
)
.call(i, this)
: 2 == e
? egret.Tween.get(t)
.to(
{
scaleX: 1,
scaleY: 1,
x: t.x - t.width / 4,
y: t.y - t.height / 4
},
500,
egret.Ease.backOut
)
.call(i, this)
: 3 == e &&
egret.Tween.get(t)
.to(
{
scaleX: 1,
scaleY: 1,
x: t.x - t.width / 4,
y: t.y - t.height / 4
},
100
)
.call(i, this);
};
egret.Tween.get(t)
.to(
{
scaleX: 0.5,
scaleY: 0.5
},
100,
egret.Ease.sineIn
)
.call(n, this);
}
}
function h(t) {
const e = function () {
if (null != t) {
const i = function () {
((t.scaleX = 1),
(t.scaleY = 1),
egret.Tween.get(t)
.to(
{
alpha: 1
},
1e3
)
.call(e, self));
};
((t.alpha = 1),
egret.Tween.get(t)
.to(
{
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
},
1e3
)
.call(i, self));
}
};
e();
}
function c(t, e, i) {
void 0 === i && (i = 50);
const n = function () {
if (null != t) {
const a = function () {
egret.Tween.get(t)
.to(
{
y: t.y - i
},
e
)
.call(n, this);
};
egret.Tween.get(t)
.to(
{
y: t.y + i
},
e
)
.call(a, this);
}
};
n();
}
function p(t, e, i) {
void 0 === i && (i = 20);
const n = function () {
if (null != t) {
const a = function () {
egret.Tween.get(t)
.to(
{
rotation: -i
},
e
)
.call(n, this);
};
egret.Tween.get(t)
.to(
{
rotation: i
},
e
)
.call(a, this);
}
};
n();
}
function d(t, e, i) {
(void 0 === e && (e = ""), void 0 === i && (i = 200));
for (let n = e.split(""), a = n.length, o = 0; a > o; o++)
egret.setTimeout(
function () {
t.appendText(n[Number(this)]);
},
o,
i * o
);
}
((EffectUtils.rotationEffect = e),
(EffectUtils.showAlphaEffect = i),
(EffectUtils.removeRotationEffect = n),
(EffectUtils.blinkEffect = a),
(EffectUtils.shakeObj = o),
(EffectUtils.shakeScreen = r),
(EffectUtils.showTips = s));
((EffectUtils.playEffect = l),
(EffectUtils.playScaleEffect = h),
(EffectUtils.flyObj = c),
(EffectUtils.rockObj = p),
(EffectUtils.typerEffect = d));
})(EffectUtils || (EffectUtils = {}));
var FontUtils = class FontUtils {
constructor() {}
static setColor(t, e) {
return '<font color="' + e + '">' + t + "</font>";
}
static setSize(t, e) {
return '<font size="' + e + '">' + t + "</font>";
}
static setColorSize(t, e, i) {
return '<font color="' + i + '" size="' + e + '">' + t + "</font>";
}
static html(t) {
return new egret.HtmlTextParser().parser(t);
}
};
__reflect(FontUtils.prototype, "FontUtils");
var Global;
!(function (Global) {
function e() {
((Global.waitPanel = new WaitPanel(1)),
GameLayerManager.gameLayer().maskLayer.removeChildren(),
GameLayerManager.gameLayer().maskLayer.addChild(Global.waitPanel));
}
function i() {
null != Global.waitPanel &&
GameLayerManager.gameLayer().maskLayer.contains(Global.waitPanel) &&
GameLayerManager.gameLayer().maskLayer.removeChild(Global.waitPanel);
}
function n(t) {
const e = new egret.HtmlTextParser();
return e.parser(t);
}
function a(t) {}
function o(t) {
switch (t) {
case 0:
return "零";
case 1:
return "一";
case 2:
return "二";
case 3:
return "三";
case 4:
return "四";
case 5:
return "五";
case 6:
return "六";
case 7:
return "七";
case 8:
return "八";
case 9:
return "九";
default:
return;
}
}
((Global.showWaritPanel = e),
(Global.hideWaritPanel = i),
(Global.getTextFlow = n),
(Global.getMessage = a),
(Global.getNumber = o));
})(Global || (Global = {}));
var HashMap = class HashMap {
constructor() {
this.data = {};
}
set(t, e) {
this.data[t] = e;
}
put(t, e) {
this.set(t, e);
}
add(t, e) {
this.set(t, e);
}
get(t, e) {
return 1 == arguments.length ? this.data[t] : this.has(t) ? this.data[t] : e;
}
has(t) {
return this.data.hasOwnProperty(t);
}
remove(t) {
((this.data[t] = void 0), delete this.data[t]);
}
clear() {
this.data = {};
}
keys() {
const t = [];
for (const e in this.data) t.push(e);
return t;
}
values() {
const t = [];
for (const e in this.data) t.push(this.data[e]);
return t;
}
reset(t) {
t && (this.data = t.data || t);
}
parse(t) {
if (t) {
const e = JSON.parse(t);
this.data = e;
}
}
toString() {
return JSON.stringify(this.data);
}
};
__reflect(HashMap.prototype, "HashMap");
var game;
!(function (game) {
const MCUtils = class MCUtils {
constructor() {}
static getMc(t, e, i) {
function n(e) {
const i = RES.getRes(t + "_png"),
n = RES.getRes(t + "_json"),
a = new egret.MovieClipDataFactory(n, i),
o = new egret.MovieClip(a.generateMovieClipData(e));
return ((o.fac = a), (o.touchEnabled = !1), o);
}
const a = this;
(void 0 === e && (e = null), void 0 === i && (i = ""));
const o = RES.getRes(t + "_png");
if (o) {
const r = n(i);
return (e && e(r), r);
}
return (
RES.getResAsync(
t + "_png",
function () {
RES.getResAsync(
t + "_json",
function () {
e && e(n(i));
},
a
);
},
this
),
null
);
}
static changeAction(t, e) {
const i = t.fac;
t.movieClipData = i.generateMovieClipData(e);
}
};
((game.MCUtils = MCUtils), __reflect(MCUtils.prototype, "game.MCUtils"));
})(game || (game = {}));
var Mta;
!(function (Mta) {
function e(t, e) {
const i = window.MtaH5;
i && i.clickStat(t, e);
}
function i() {
const t = window.MtaH5;
return t;
}
((Mta.clickStar2 = e), (Mta.getMathH5 = i));
})(Mta || (Mta = {}));
var NativeApi;
!(function (NativeApi) {
function e(t, e) {
egret.localStorage.setItem(t, e);
}
function i(t) {
return egret.localStorage.getItem(t);
}
function n(t) {
egret.localStorage.removeItem(t);
}
function a() {
egret.localStorage.clear();
}
function o() {}
function r() {}
function s(t) {
window.open("tel:" + t, "_self");
}
function l(t) {
window.open("sms:" + t, "_self");
}
function h() {
return window.location.href;
}
((NativeApi.setLocalData = e),
(NativeApi.getLocalData = i),
(NativeApi.deleteLocalData = n),
(NativeApi.clearLocalData = a),
(NativeApi.getMic = o),
(NativeApi.getScreen = r),
(NativeApi.callPhone = s),
(NativeApi.sendMessage = l),
(NativeApi.getCurUrl = h),
(NativeApi.curAngle = Number(window.orientation)));
})(NativeApi || (NativeApi = {}));
var QRCode = class QRCode {
constructor(t) {
const e = document.getElementById("gameDiv");
this.htmlCode = document.createElement("img");
this.htmlCode.src = t;
this.htmlCode.style.position = "absolute";
this.htmlCode.style.display = "none";
e.appendChild(this.htmlCode);
}
showHtmlCode() {
this.htmlCode && (this.htmlCode.style.display = "inline");
}
hideHtmlCode() {
this.htmlCode && (this.htmlCode.style.display = "none");
}
setPosition(t, e, i, n) {
if (null != this.htmlCode)
if (document.body.clientWidth < document.body.clientHeight) {
var a = document.body.clientWidth / GameConfig.curWidth(),
o = document.body.clientHeight / GameConfig.curHeight();
((this.htmlCode.style.width = i * a + "px"),
(this.htmlCode.style.height = n * o + "px"),
(this.htmlCode.style.left = t * a + "px"),
(this.htmlCode.style.top = e * o + "px"));
} else {
var a = document.body.clientWidth / GameConfig.curHeight(),
o = document.body.clientHeight / GameConfig.curWidth();
((this.htmlCode.style.width = n * a + "px"),
(this.htmlCode.style.height = i * o + "px"),
(this.htmlCode.style.top = (GameConfig.curWidth() - t - i) * o + "px"),
(this.htmlCode.style.left = e * a + "px"));
}
}
destroy() {
this.htmlCode && (this.htmlCode.parentNode.removeChild(this.htmlCode), (this.htmlCode = null));
}
};
__reflect(QRCode.prototype, "QRCode");
var RegUtils;
!(function (RegUtils) {
function e(t) {
const e = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
return e.test(t) ? !0 : !1;
}
function i(t) {
if (o(t)) return !1;
const e = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g;
return e.test(t) &&
Number(RegExp.$1) < 256 &&
Number(RegExp.$2) < 256 &&
Number(RegExp.$3) < 256 &&
Number(RegExp.$4) < 256
? !0
: !1;
}
function n(t) {
const e = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
return e.test(t) ? !0 : !1;
}
function a(t) {
const e = /^[0][1-9]{2,3}-[0-9]{5,10}$/,
i = /^[1-9]{1}[0-9]{5,8}$/;
return t.length > 9 ? (e.test(t) ? !0 : !1) : i.test(t) ? !0 : !1;
}
function o(t) {
if ("" == t) return !0;
const e = "^[ ]+$",
i = new RegExp(e);
return i.test(t);
}
function r(t) {
const e = /^[-]{0,1}[0-9]{1,}$/;
return e.test(t);
}
function s(t) {
const e = "^[0-9]+$",
i = new RegExp(e);
return -1 != t.search(i) ? !0 : !1;
}
function l(t) {
const e = "^[0-9]+[.][0-9]{0,3}$",
i = new RegExp(e);
return i.test(t) ? !0 : !1;
}
function h(t) {
if (o(t)) return !1;
const e = /^[\u4E00-\u9FA5]{2,4}$/;
return e.test(t);
}
function c(t) {
const e = /^[\u4E00-\u9FA5]/;
return e.test(t);
}
function p(t, e) {
let i = " ",
n = -1;
if (0 == e || 1 == e) {
for (; " " == i; ) (++n, (i = t.substr(n, 1)));
t = t.substring(n);
}
if (0 == e || 2 == e) {
for (i = " ", n = t.length; " " == i; ) (--n, (i = t.substr(n, 1)));
t = t.substring(0, n + 1);
}
return t;
}
((RegUtils.checkEmail = e),
(RegUtils.isIP = i),
(RegUtils.checkMobile = n),
(RegUtils.checkPhone = a),
(RegUtils.isNull = o),
(RegUtils.isInteger = r),
(RegUtils.isNumber = s),
(RegUtils.isMoney = l),
(RegUtils.isRealName = h),
(RegUtils.checkIsChinese = c),
(RegUtils.cTrim = p));
})(RegUtils || (RegUtils = {}));
var TimeFormat = class TimeFormat {
constructor() {}
static showDDHH(t) {
const e = Math.floor(t / 864e5);
t %= 864e5;
const i = Math.floor(t / 36e5);
return 0 > e ? i + "小时" : e + "天" + i + "小时";
}
static showHHMMSS(t) {
const e = Math.floor(t / 36e5);
t %= 36e5;
const i = Math.floor(t / 6e4);
t %= 6e4;
const n = Math.floor(t / 1e3);
return (10 > e ? "0" + e : e) + ":" + (10 > i ? "0" + i : i) + ":" + (10 > n ? "0" + n : n);
}
static showDayOrDate(t) {
const e = new Date(DateTimer.instance.now);
const i = new Date(1e3 * t);
const n = (e.getDate(), i.getDate());
const a = (DateTimer.instance.now - t, i.getHours());
const o = i.getMinutes();
const r = i.getSeconds();
let s = "";
const l = i.getFullYear();
const h = i.getMonth() + 1;
return (s =
l +
"-" +
h +
"-" +
n +
" " +
(10 > a ? "0" + a : a) +
":" +
(10 > o ? "0" + o : o) +
":" +
(10 > r ? "0" + r : r));
}
};
__reflect(TimeFormat.prototype, "TimeFormat");
var TipsManager;
!(function (TipsManager) {
function e(t, e, i) {
(void 0 === e && (e = ""),
void 0 === i && (i = 0),
null == this._dict && (this._dict = []),
t.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.showTips, this),
t.addEventListener(egret.TouchEvent.TOUCH_END, this.removeTips, this),
t.addEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE, this.removeTips, this),
null == this._dict[t.hashCode] &&
((this._dict[t.hashCode] = []), (this._dict[t.hashCode].descStr = e), (this._dict[t.hashCode].effectType = i)));
}
function i(t) {
const e = t.currentTarget;
let i = "";
let n = 0;
if (null == this._tips) {
(null != this._dict[e.hashCode] &&
((i = this._dict[e.hashCode].descStr), (n = this._dict[e.hashCode].effectType)),
(this._tips = new TipsPanel(this._dict[e.hashCode].descStr)),
GameLayerManager.gameLayer().effectLayer.contains(this._tips) ||
GameLayerManager.gameLayer().effectLayer.addChild(this._tips));
const a = e.parent.localToGlobal(e.x, e.y);
switch (
((a.x = a.x + e.width / 2),
(a.y = a.y - this._tips.getHeight()),
a.x + this._tips.getWidth() > GameConfig.curWidth()
? (a.x = GameConfig.curWidth() - this._tips.getWidth())
: a.x < 0 && (a.x = 0),
a.y + this._tips.getHeight() > GameConfig.curHeight()
? (a.y = GameConfig.curHeight() - this._tips.getHeight())
: a.y < 0 && (a.y = 0),
(this._tips.x = a.x),
(this._tips.y = a.y),
n)
) {
case 0:
((this._tips.alpha = 0),
egret.Tween.get(this._tips).to(
{
alpha: 1
},
300
));
break;
case 1:
((this._tips.alpha = 0),
(this._tips.y += this._tips.getHeight()),
egret.Tween.get(this._tips).to(
{
alpha: 1,
y: this._tips.y - this._tips.getHeight()
},
500,
egret.Ease.backOut
));
break;
case 2:
((this._tips.alpha = 0),
(this._tips.x -= this._tips.getWidth()),
egret.Tween.get(this._tips).to(
{
alpha: 1,
x: this._tips.x + this._tips.getWidth()
},
500,
egret.Ease.backOut
));
break;
case 3:
((this._tips.alpha = 0),
(this._tips.x += this._tips.getWidth()),
egret.Tween.get(this._tips).to(
{
alpha: 1,
x: this._tips.x - this._tips.getWidth()
},
500,
egret.Ease.backOut
));
}
}
}
function n(t) {
t.currentTarget;
if (null != this._tips) {
const e = function () {
GameLayerManager.gameLayer().effectLayer.contains(this._tips) &&
(GameLayerManager.gameLayer().effectLayer.removeChild(this._tips), (this._tips = null));
};
egret.Tween.get(this._tips)
.to(
{
alpha: 0
},
300
)
.call(e, this);
}
}
((TipsManager.addTips = e), (TipsManager.showTips = i), (TipsManager.removeTips = n));
})(TipsManager || (TipsManager = {}));
var TipsPanel = class TipsPanel extends eui.Component {
constructor(e = "") {
super();
this.descStr = "";
this.descStr = e;
this.initUI();
}
initUI() {
((this.bg = new egret.Bitmap()),
(this.bg.texture = RES.getRes("tipsBg_png")),
this.addChild(this.bg),
(this.bg.touchEnabled = !0),
(this.descTF = new egret.TextField()),
this.addChild(this.descTF),
(this.descTF.textColor = 0),
(this.descTF.size = 20),
(this.descTF.x = 5),
(this.descTF.textAlign = "center"),
(this.descTF.text = this.descStr));
const t = new egret.Rectangle(5, 5, 5, 5);
((this.bg.scale9Grid = t),
(this.bg.width = this.descTF.width + 10),
(this.bg.height = 3 * this.descTF.height),
(this.descTF.y = this.bg.height / 2 - this.descTF.height / 2 + 2));
}
getHeight() {
return this.bg.height;
}
getWidth() {
return this.bg.width;
}
};
__reflect(TipsPanel.prototype, "TipsPanel");
var game;
!(function (game) {
const UIUtils = class UIUtils {
constructor() {}
static removeFromParent(t) {
t && t.parent && t.parent.removeChild(t);
}
static resetAnchorPoint(t) {
((t.x -= t.anchorOffsetX), (t.y -= t.anchorOffsetY), (t.anchorOffsetX = 0), (t.anchorOffsetY = 0));
}
static addButtonScaleEffects(e, i) {
if ((void 0 === i && (i = !1), e))
if (i) e.addEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils.onButtonTouchBegan, e);
else if (egret.is(e, egret.getQualifiedClassName(eui.Button)))
e.addEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils.onButtonTouchBegan, e);
else
for (let n = e.numChildren, a = 0; n > a; a++) {
const o = e.getChildAt(a);
UIUtils.addButtonScaleEffects(o);
}
}
static onButtonTouchBegan(t) {
const e = t.target;
egret.Tween.get(e)
.to(
{
scaleX: 0.9,
scaleY: 0.9
},
50
)
.to(
{
scaleX: 1,
scaleY: 1
},
50
);
}
static removeButtonScaleEffects(e, i) {
if ((void 0 === i && (i = !1), e))
if (i) e.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils.onButtonTouchBegan, e);
else if (egret.is(e, egret.getQualifiedClassName(eui.Button)))
e.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils.onButtonTouchBegan, e);
else
for (let n = e.numChildren, a = 0; n > a; a++) {
const o = e.getChildAt(a);
UIUtils.removeButtonScaleEffects(o);
}
}
static setAnchorPot(t) {
((t.anchorOffsetX = t.width / 2), (t.anchorOffsetY = t.height / 2), (t.x += t.width / 2), (t.y += t.height / 2));
}
static removeSelf(e) {
UIUtils.removeFromParent(e);
}
static removeSelfByAmi(e, i) {
return new Promise(function (n, a) {
egret.Tween.get(e)
.to(
{
alpha: 0
},
i
)
.call(function () {
(UIUtils.removeFromParent(e), n("success"));
}, e);
});
}
static getParentByClass(e, i) {
const n = e.parent;
return n ? (n instanceof i ? n : UIUtils.getParentByClass(n, i)) : null;
}
static addShortTouch(e, i, n) {
((e.shortTouchCallback = i),
(e.shortTouchEndCallback = n),
e.addEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils._onShortTouchBegan, e));
}
static _onShortTouchBegan(e) {
const i = e.currentTarget;
(i.shortTouchCallback && i.shortTouchCallback(e),
Const.stage.once(egret.TouchEvent.TOUCH_END, UIUtils._onShortTouchEnd, this, !0, Number.MAX_VALUE));
}
static _onShortTouchEnd(t) {
(t.stopImmediatePropagation(), t.stopPropagation());
const e = this;
e.shortTouchEndCallback && e.shortTouchEndCallback(t);
}
static addLongTouch(e, i, n) {
((e.longTouchCallback = i),
(e.longTouchEndCallback = n),
(e.longTouchTrigger = !1),
e.addEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils._onLongTouchBegan, e));
}
static _onLongTouchBegan(e) {
const i = this,
n = e.currentTarget;
(Const.stage.once(egret.TouchEvent.TOUCH_END, UIUtils._onLongTouchEnd, this, !0, Number.MAX_VALUE),
egret.clearTimeout(UIUtils.longTouchDelayId),
(UIUtils.longTouchDelayId = egret.setTimeout(
function () {
((n.longTouchTrigger = !0),
n.longTouchCallback && n.longTouchCallback(e),
n.once(egret.TouchEvent.TOUCH_TAP, UIUtils._stopTapEvent, i, !0, Number.MAX_VALUE));
},
this,
350
)));
}
static _stopTapEvent(t) {
(t.stopImmediatePropagation(), t.stopPropagation());
}
static _onLongTouchEnd(e) {
(e.stopImmediatePropagation(), e.stopPropagation());
const i = this;
(i.longTouchTrigger
? i.longTouchEndCallback && i.longTouchEndCallback(e)
: egret.clearTimeout(UIUtils.longTouchDelayId),
(i.longTouchTrigger = !1));
}
static removeLongTouch(e) {
e.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, UIUtils._onLongTouchBegan, e);
}
static showTimeFormat(t) {
t = int(t / 1e3);
const e = int(t / 86400);
t %= 86400;
const i = int(t / 3600);
t %= 3600;
const n = int(t / 60);
t %= 60;
const a = int(t);
return 0 >= e && 0 >= i && 0 >= n
? a + "秒"
: 0 >= e && 0 >= i
? n + "分" + (a > 9 ? a : "0" + a) + "秒"
: 0 >= e
? i + "时" + (n > 0 ? n : "0" + n) + "分" + (a > 9 ? a : "0" + a) + "秒"
: e + "天" + (i > 0 ? i : "0" + i) + "时" + (n > 0 ? n : "0" + n) + "分" + (a > 9 ? a : "0" + a) + "秒";
}
};
((game.UIUtils = UIUtils), __reflect(UIUtils.prototype, "game.UIUtils"));
})(game || (game = {}));
var game;
!(function (game) {
const Utils = class Utils {
constructor() {}
static rang(t, e) {
return Math.round(Math.random() * (e - t) + t);
}
static isRang(t, e, i) {
return t >= e && i >= t;
}
static limit(t, e, i) {
return Math.max(e, Math.min(i, t));
}
static ang2rad(t) {
return (t / 180) * Math.PI;
}
static rad2ang(t) {
return (t / Math.PI) * 180;
}
static getBigNumberShow(t) {
return 1e4 > t ? t + "" : ((t /= 1e3), t.toFixed(1) + "K");
}
static isElinArr(t, e) {
return e.indexOf(t) > -1;
}
static isArrCrossing(e, i) {
for (let n = 0; n < e.length; n++) if (Utils.isElinArr(e[n], i)) return !0;
return !1;
}
static getURLQueryString(t) {
if (egret.Capabilities.runtimeType == egret.RuntimeType.WEB) {
let decodedUrl = decodeURIComponent(window.location.href);
decodedUrl = decodedUrl.replace(/&quot/g, '"');
let matchResult;
return (
decodedUrl.indexOf("#?") > 0
? ((decodedUrl = decodedUrl.replace("#?", "&")),
(matchResult = decodedUrl.match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)"))))
: (matchResult = window.location.search.substr(1).match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)"))),
matchResult ? matchResult[2] : null
);
}
}
static getMaxStr(t) {
return t.length <= 5 ? t : t.substr(0, 5) + "...";
}
static removeArrayItem(t, e) {
const i = t.indexOf(e);
i > -1 && t.splice(i, 1);
}
static mtaChainSdk(t) {
const e = window.MtaH5;
if (e && e.clickStat) {
const i = {};
((i[t.toLocaleLowerCase()] = "true"), e.clickStat("yemianshendu", i));
}
}
static isCollsionRect2(t, e, i, n, a, o, r, s) {
return (t >= a && t >= a + r) || (a >= t && a >= t + i) || (e >= o && e >= o + s) || (o >= e && o >= e + n)
? !1
: !0;
}
static rect1CollsionRect2(e, i) {
return Utils.isCollsionRect2(e.x, e.y, e.width, e.height, i.x, i.y, i.width, i.height);
}
static showTimeFormat(t) {
t = int(t / 1e3);
const e = int(t / 86400);
t %= 86400;
const i = int(t / 3600);
t %= 3600;
const n = int(t / 60);
t %= 60;
const a = int(t);
return 0 >= e && 0 >= i && 0 >= n
? a + "秒"
: 0 >= e && 0 >= i
? n + "分" + (a > 9 ? a : "0" + a) + "秒"
: 0 >= e
? i + "时" + (n > 0 ? n : "0" + n) + "分" + (a > 9 ? a : "0" + a) + "秒"
: e + "天" + (i > 0 ? i : "0" + i) + "时" + (n > 0 ? n : "0" + n) + "分" + (a > 9 ? a : "0" + a) + "秒";
}
static BigNumTostring(e) {
null == e && (e = 0);
let i = e.toString();
return (
e >= Utils.MAXK && e < Utils.MAXM
? (i = (e / 1e3).toFixed(2) + "K")
: e >= 1e6 && (i = (e / Utils.MAXM).toFixed(2) + "M"),
i.toString()
);
}
static MAXK = 1e5;
static MAXM = 1e6;
};
((game.Utils = Utils), __reflect(Utils.prototype, "game.Utils"));
})(game || (game = {}));
var WebView = class WebView extends egret.DisplayObjectContainer {
constructor(e) {
super();
this._x = 0;
this._y = 0;
this._width = 0;
this._height = 0;
this._src = "";
this._scaleMode = egret.MainContext.instance.stage.scaleMode;
this._iframeWrapper = null;
this._iframe = null;
const n = document.getElementById("StageDelegateDiv");
const a = n.parentElement;
let o = document.getElementById("iframe-wrapper");
o || ((o = document.createElement("div")), (o.style.display = "none"), (o.id = "iframe-wrapper"), n.appendChild(o));
this._iframeWrapper = o;
this._iframeWrapper.style.display = "none";
this._iframeWrapper.style.opacity = "0";
const r = (Date.now(), document.createElement("iframe")),
s = new Date().getTime();
r.src = e;
r.id = "webview-iframe-" + s;
r.name = "webview-iframe-" + s;
r.style.position = "absolute";
r.style.top = "0";
r.style.left = "0";
r.style.opacity = "0";
r.style.display = "none";
r.frameBorder = "0";
r.border = "0";
this._iframeWrapper.appendChild(r);
this._iframe = document.getElementById("webview-iframe-" + s);
const l = this;
this._iframe.onload = function () {
((l._iframeWrapper.style.opacity = "1"), (l._iframe.style.opacity = "1"));
};
this._stageW = egret.MainContext.instance.stage.stageWidth;
this._stageH = egret.MainContext.instance.stage.stageHeight;
this._windowW = window.innerWidth;
this._windowH = window.innerHeight;
this._designH = parseInt(a.attributes["data-content-height"].value);
this._designW = parseInt(a.attributes["data-content-width"].value);
const h = egret.sys.screenAdapter.calculateStageSize(
egret.MainContext.instance.stage.scaleMode,
this._windowW,
this._windowH,
this._designW,
this._designH
);
this._displayH = h.displayHeight;
this._displayW = h.displayWidth;
}
show() {
((this._iframe.style.display = "block"), (this._iframeWrapper.style.display = "block"));
}
destroy() {
this._iframe && ((this._iframeWrapper.style.display = "none"), this._iframeWrapper.removeChild(this._iframe));
}
get width() {
return this._width;
}
set width(t) {
((this._width = t),
(this._scaleMode == egret.StageScaleMode.FIXED_WIDTH || this._scaleMode == egret.StageScaleMode.FIXED_HEIGHT) &&
((this._iframe.width = (this._width / this._stageW) * this._windowW + "px"),
(this._iframeWrapper.style.width = (this._width / this._stageW) * this._windowW + "px")),
(this._scaleMode == egret.StageScaleMode.SHOW_ALL || this._scaleMode == egret.StageScaleMode.NO_BORDER) &&
(this._windowW == this._displayW
? ((this._iframe.style.width = (this._width / this._stageW) * this._windowW + "px"),
(this._iframeWrapper.style.width = (this._width / this._stageW) * this._windowW + "px"))
: ((this._iframe.style.width = (this._width / this._stageW) * this._displayW + "px"),
(this._iframeWrapper.style.width = (this._width / this._stageW) * this._displayW + "px"))));
}
get height() {
return this._height;
}
set height(t) {
((this._height = t),
(this._scaleMode == egret.StageScaleMode.FIXED_WIDTH || this._scaleMode == egret.StageScaleMode.FIXED_HEIGHT) &&
((this._iframe.height = (this._height / this._stageH) * this._windowH + "px"),
(this._iframeWrapper.style.height = (this._height / this._stageH) * this._windowH + "px")),
(this._scaleMode == egret.StageScaleMode.SHOW_ALL || this._scaleMode == egret.StageScaleMode.NO_BORDER) &&
(this._windowH == this._displayH
? ((this._iframe.style.height = (this._height / this._stageH) * this._windowH + "px"),
(this._iframeWrapper.style.height = (this._height / this._stageH) * this._windowH + "px"))
: ((this._iframe.style.height = (this._height / this._stageH) * this._displayH + "px"),
(this._iframeWrapper.style.height = (this._height / this._stageH) * this._displayH + "px"))));
}
get x() {
return this._x;
}
set x(t) {
((this._x = t),
(this._scaleMode == egret.StageScaleMode.FIXED_WIDTH || this._scaleMode == egret.StageScaleMode.FIXED_HEIGHT) &&
(this._iframeWrapper.style.left = (this._x / this._stageW) * this._windowW + "px"),
(this._scaleMode == egret.StageScaleMode.SHOW_ALL || this._scaleMode == egret.StageScaleMode.NO_BORDER) &&
(this._windowW == this._displayW
? (this._iframeWrapper.style.left = (this._x / this._stageW) * this._windowW + "px")
: (this._iframeWrapper.style.left = (this._x / this._stageW) * this._displayW + "px")));
}
get y() {
return this._y;
}
set y(t) {
((this._y = t),
(this._scaleMode == egret.StageScaleMode.FIXED_WIDTH || this._scaleMode == egret.StageScaleMode.FIXED_HEIGHT) &&
(this._iframeWrapper.style.top = (this._y / this._stageH) * this._windowH + "px"),
(this._scaleMode == egret.StageScaleMode.SHOW_ALL || this._scaleMode == egret.StageScaleMode.NO_BORDER) &&
(this._windowH == this._displayH
? (this._iframeWrapper.style.top = (this._y / this._stageH) * this._windowH + "px")
: (this._iframeWrapper.style.top = (this._y / this._stageH) * this._displayH + "px")));
}
get src() {
return this._src;
}
set src(t) {
this._src = t;
}
};
__reflect(WebView.prototype, "WebView");
var game;
!(function (game) {
const AnimateNode = class AnimateNode {
constructor(t, e, i, n, a = !1, o = !1) {
this.isFlip = !1;
this.isBackFlip = !1;
this.time = 0;
this.point = t;
this.forwardName = e;
this.backName = i;
this.time = n;
this.isFlip = a;
this.isBackFlip = o;
}
};
((game.AnimateNode = AnimateNode), __reflect(AnimateNode.prototype, "game.AnimateNode"));
})(game || (game = {}));
var game;
!(function (game) {
const Animator = class Animator {
constructor(t) {
for (var e = [], i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
if (((this.isForward = !0), (this.animIndex = 0), (this.animLen = 2), (this.target = t), e.length > 0))
if (1 == e.length && e[0] instanceof Array) this.animNodeList = e[0];
else {
this.animNodeList = [];
for (let n = 0; n < e.length; n++) this.animNodeList.push(e[n]);
}
if (!this.animNodeList || this.animNodeList.length < 2) throw new Error("动画必须2个点以上");
this.init();
}
init() {
((this.animLen = this.animNodeList.length), (this.animIndex = 0));
const t = this.animNodeList[0];
((this.target.x = t.point.x), (this.target.y = t.point.y), this.target.gotoAndPlay(t.forwardName, -1));
}
loopRun() {
this.loop();
}
loop() {
let nextAnimNode;
let nextPoint;
let moveTime;
let actionName;
const currentAnimNode = this.animNodeList[this.animIndex];
(this.isForward
? ((nextAnimNode = this.animNodeList[++this.animIndex]),
(nextPoint = nextAnimNode.point),
(moveTime = currentAnimNode.time),
(actionName = currentAnimNode.forwardName),
this.animIndex >= this.animLen - 1 && (this.isForward = !1),
currentAnimNode.isFlip ? (this.target.scaleX = -1) : (this.target.scaleX = 1))
: ((nextAnimNode = this.animNodeList[--this.animIndex]),
(nextPoint = nextAnimNode.point),
(moveTime = nextAnimNode.time),
(actionName = nextAnimNode.backName),
this.animIndex <= 0 && (this.isForward = !0),
nextAnimNode.isBackFlip ? (this.target.scaleX = -1) : (this.target.scaleX = 1)),
this.target.gotoAndPlay(actionName, -1),
egret.Tween.get(this.target)
.to(
{
x: nextPoint.x,
y: nextPoint.y
},
moveTime
)
.call(this.loop, this));
}
};
((game.Animator = Animator), __reflect(Animator.prototype, "game.Animator"));
})(game || (game = {}));
var BitmapBlink = class BitmapBlink extends egret.EventDispatcher {
constructor(e, i, n = !0) {
super();
this._target = e;
this._time = i;
n && this.start();
}
start() {
((this._currTime = egret.getTimer()), this._target.addEventListener(egret.Event.ENTER_FRAME, this.runDown, this));
}
runDown(t) {
((this._target.alpha -= 0.045),
this.checkOver() ||
(this._target.alpha <= 0.6 &&
(this._target.removeEventListener(egret.Event.ENTER_FRAME, this.runDown, this),
this._target.addEventListener(egret.Event.ENTER_FRAME, this.runUp, this))));
}
runUp(t) {
((this._target.alpha += 0.045),
this.checkOver() ||
(this._target.alpha >= 1 &&
(this._target.removeEventListener(egret.Event.ENTER_FRAME, this.runUp, this),
this._target.addEventListener(egret.Event.ENTER_FRAME, this.runDown, this))));
}
checkOver() {
const t = egret.getTimer();
return t - this._currTime >= this._time ? (this.destroy(), !0) : !1;
}
destroy() {
((this._target.alpha = 1),
this._target.removeEventListener(egret.Event.ENTER_FRAME, this.runDown, this),
this._target.removeEventListener(egret.Event.ENTER_FRAME, this.runUp, this),
this.dispatchEventWith(egret.Event.COMPLETE, !1, this._target),
(this._target = null));
}
};
__reflect(BitmapBlink.prototype, "BitmapBlink");
var TipsUtils;
!(function (TipsUtils) {
function e(t, e) {
return (void 0 === t && (t = ""), void 0 === e && (e = !1), void game.ToastTip.popTip(t));
}
function i(t, e, i) {
(void 0 === t && (t = ""), void 0 === e && (e = !1), void 0 === i && (i = !0));
let n = new egret.TextField();
((n.size = 24),
(n.y = GameConfig.curHeight() / 2),
e ? (n.textColor = GameConfig.TextColors.red) : (n.textColor = GameConfig.TextColors.green),
(n.alpha = 0),
(n.text = t),
(n.strokeColor = 0),
i ? (n.x = -n.width) : (n.x = GameConfig.curWidth()),
(n.stroke = 2),
(n.bold = !0),
(n.textAlign = egret.HorizontalAlign.CENTER),
GameLayerManager.gameLayer().effectLayer.contains(n) || GameLayerManager.gameLayer().effectLayer.addChild(n),
i
? egret.Tween.get(n).to(
{
x: GameConfig.curWidth() / 2 - n.width / 2 - 50,
alpha: 1
},
300,
egret.Ease.sineInOut
)
: egret.Tween.get(n).to(
{
x: GameConfig.curWidth() / 2 - n.width / 2 + 50,
alpha: 1
},
300,
egret.Ease.sineInOut
),
egret.setTimeout(
function () {
i
? egret.Tween.get(n).to(
{
x: n.x + 100
},
500
)
: egret.Tween.get(n).to(
{
x: n.x - 100
},
500
);
},
this,
300
),
egret.setTimeout(
function () {
i
? egret.Tween.get(n).to(
{
x: GameConfig.curWidth()
},
300,
egret.Ease.sineIn
)
: egret.Tween.get(n).to(
{
x: -n.width
},
300,
egret.Ease.sineIn
);
},
this,
800
),
egret.setTimeout(
function () {
GameLayerManager.gameLayer().effectLayer.contains(n) &&
(GameLayerManager.gameLayer().effectLayer.removeChild(n), (n = null));
},
this,
1100
));
}
function n(t, e) {
(void 0 === t && (t = ""), void 0 === e && (e = !1));
let i = new egret.TextField();
((i.size = 24),
(i.y = GameConfig.curHeight() / 2),
e ? (i.textColor = GameConfig.TextColors.red) : (i.textColor = GameConfig.TextColors.green),
(i.alpha = 0),
(i.text = t),
(i.strokeColor = 0),
(i.x = GameConfig.curWidth() / 2),
(i.stroke = 2),
(i.bold = !0),
(i.textAlign = egret.HorizontalAlign.CENTER),
GameLayerManager.gameLayer().effectLayer.contains(i) || GameLayerManager.gameLayer().effectLayer.addChild(i),
(i.anchorOffsetX = i.width / 2),
(i.anchorOffsetY = i.height / 2),
(i.scaleX = 0),
(i.scaleY = 0));
const n = function () {
GameLayerManager.gameLayer().effectLayer.contains(i) &&
(GameLayerManager.gameLayer().effectLayer.removeChild(i), (i = null));
};
(egret.Tween.get(i).to(
{
scaleX: 1,
scaleY: 1,
alpha: 1
},
200
),
egret.setTimeout(
function () {
egret.Tween.get(i)
.to(
{
alpha: 0
},
500
)
.call(n, this);
},
this,
1e3
));
}
function a(t, e) {
(void 0 === t && (t = ""), void 0 === e && (e = !1));
let i = new egret.TextField();
((i.size = 24),
(i.y = GameConfig.curHeight() / 2),
e ? (i.textColor = GameConfig.TextColors.red) : (i.textColor = GameConfig.TextColors.green),
(i.alpha = 0),
(i.text = t),
(i.strokeColor = 0),
(i.x = GameConfig.curWidth() / 2),
(i.stroke = 2),
(i.bold = !0),
(i.textAlign = egret.HorizontalAlign.CENTER),
GameLayerManager.gameLayer().effectLayer.contains(i) || GameLayerManager.gameLayer().effectLayer.addChild(i),
(i.anchorOffsetX = i.width / 2),
(i.anchorOffsetY = i.height / 2),
(i.scaleX = 4),
(i.scaleY = 4));
const n = function () {
GameLayerManager.gameLayer().effectLayer.contains(i) &&
(GameLayerManager.gameLayer().effectLayer.removeChild(i), (i = null));
};
(egret.Tween.get(i).to(
{
scaleX: 1,
scaleY: 1,
alpha: 1
},
200
),
egret.setTimeout(
function () {
egret.Tween.get(i)
.to(
{
alpha: 0
},
500
)
.call(n, this);
},
this,
1e3
));
}
function o(t) {
game.ToastTip.popTip(GameConfig.ServerCode[t]);
}
((TipsUtils.showTipsDownToUp = e),
(TipsUtils.showTipsLeftOrRight = i),
(TipsUtils.showTipsFromCenter = n),
(TipsUtils.showTipsBigToSmall = a),
(TipsUtils.showErrorCodeTips = o));
})(TipsUtils || (TipsUtils = {}));