550 lines
18 KiB
JavaScript
550 lines
18 KiB
JavaScript
var game;
|
|
!(function (game) {
|
|
const BaseComponent = class BaseComponent extends eui.Component {
|
|
constructor() {
|
|
super();
|
|
this.width = GameConfig.curWidth();
|
|
this.height = GameConfig.curHeight();
|
|
this.touchEnabled = !0;
|
|
this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
|
|
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
|
this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this);
|
|
}
|
|
onAdded() {
|
|
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
|
}
|
|
onRemoved() {
|
|
(this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this),
|
|
this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this),
|
|
game.UIUtils.removeButtonScaleEffects(this),
|
|
this.destroy());
|
|
}
|
|
createChildren() {
|
|
(super.createChildren(), game.UIUtils.addButtonScaleEffects(this), this.bindTouchEnded(this));
|
|
}
|
|
destory(t) {
|
|
egret.Tween.get(this)
|
|
.to(
|
|
{
|
|
alpha: 0
|
|
},
|
|
200
|
|
)
|
|
.call(function () {
|
|
t && t();
|
|
}, this);
|
|
}
|
|
onShowAnimateOver() {}
|
|
onTouchTap(t) {}
|
|
bindTouchEnded(t) {
|
|
if (t) {
|
|
t.name &&
|
|
this[t.name + "TouchEnded"] &&
|
|
t.addEventListener(egret.TouchEvent.TOUCH_END, this[t.name + "TouchEnded"], this);
|
|
for (let e = t.numChildren, i = 0; e > i; i++) {
|
|
const n = t.getChildAt(i);
|
|
this.bindTouchEnded(n);
|
|
}
|
|
}
|
|
}
|
|
destroy() {
|
|
this.resGroup;
|
|
}
|
|
};
|
|
((game.BaseComponent = BaseComponent), __reflect(BaseComponent.prototype, "game.BaseComponent"));
|
|
})(game || (game = {}));
|
|
var game;
|
|
!(function (game) {
|
|
const BaseItemRenderer = class BaseItemRenderer extends eui.ItemRenderer {
|
|
constructor() {
|
|
super();
|
|
this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
|
|
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
|
this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this);
|
|
}
|
|
onAdded() {
|
|
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
|
}
|
|
onRemoved() {
|
|
(this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this),
|
|
this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this),
|
|
game.UIUtils.removeButtonScaleEffects(this));
|
|
}
|
|
createChildren() {
|
|
(super.createChildren(), game.UIUtils.addButtonScaleEffects(this));
|
|
}
|
|
onTouchTap(t) {}
|
|
};
|
|
((game.BaseItemRenderer = BaseItemRenderer), __reflect(BaseItemRenderer.prototype, "game.BaseItemRenderer"));
|
|
})(game || (game = {}));
|
|
var game;
|
|
!(function (game) {
|
|
const BasePanel = class BasePanel extends eui.Component {
|
|
constructor() {
|
|
super();
|
|
this.isVisibleAnimate = !0;
|
|
this.helpTxtId = -1;
|
|
this.isFullScreen = !1;
|
|
this.createChildrened = !1;
|
|
this.touchEnabled = !0;
|
|
this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
|
|
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
|
this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this);
|
|
}
|
|
onAdded() {
|
|
this.createChildrened && this.onShow();
|
|
}
|
|
setMediator(t) {
|
|
this.mediator && (this.mediator = t);
|
|
}
|
|
createChildren() {
|
|
(super.createChildren(),
|
|
this.panelCommon &&
|
|
((this.commonPanel = new game.PanelCommon(this.panelCommon)),
|
|
(this.btnClose = this.commonPanel.btnClose),
|
|
(this.btnHelp = this.commonPanel.btnHelp),
|
|
(this.closeBtn = this.commonPanel.closeBtn)),
|
|
this.btnHelp && (this.btnHelp.visible = this.helpTxtId > 0),
|
|
this.isFullScreen && ((this.width = Const.WIN_W), (this.height = Const.WIN_H)),
|
|
this.btnClose && this.btnClose.addEventListener(egret.TouchEvent.TOUCH_TAP, this.btnCloseTouchEnded, this),
|
|
this.closeBtn && this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.closeBtnTouchEnded, this),
|
|
game.UIUtils.addButtonScaleEffects(this),
|
|
this.bindTouchEnded(this),
|
|
this.onShow(),
|
|
(this.createChildrened = !0));
|
|
}
|
|
closeBtnTouchEnded() {}
|
|
onTouchTap(t) {}
|
|
btnCloseTouchEnded() {
|
|
this.isVisibleAnimate && this.onHide();
|
|
}
|
|
onRemoved() {
|
|
(this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this),
|
|
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this),
|
|
this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this),
|
|
game.UIUtils.removeButtonScaleEffects(this));
|
|
}
|
|
bindTouchEnded(t) {
|
|
if (t) {
|
|
t.name &&
|
|
this[t.name + "TouchEnded"] &&
|
|
t.addEventListener(egret.TouchEvent.TOUCH_END, this[t.name + "TouchEnded"], this);
|
|
for (let e = t.numChildren, i = 0; e > i; i++) {
|
|
const n = t.getChildAt(i);
|
|
this.bindTouchEnded(n);
|
|
}
|
|
}
|
|
}
|
|
onShow() {
|
|
if (this.isVisibleAnimate) {
|
|
((this.x = Const.WIN_W / 2),
|
|
(this.y = Const.WIN_H / 2),
|
|
this._startPos && ((this.x = this._startPos.x), (this.y = this._startPos.y)));
|
|
const t = (Const.WIN_W - this.width) / 2,
|
|
e = (Const.WIN_H - this.height) / 2;
|
|
((this.scaleX = this.scaleY = 0),
|
|
egret.Tween.get(this)
|
|
.to(
|
|
{
|
|
x: t,
|
|
y: e,
|
|
scaleX: 1,
|
|
scaleY: 1
|
|
},
|
|
250,
|
|
egret.Ease.backOut
|
|
)
|
|
.call(this.onShowAnimateOver, this));
|
|
} else this.onShowAnimateOver();
|
|
}
|
|
onShowAnimateOver() {}
|
|
btnHelpTouchEnded() {
|
|
this.helpTxtId > 0 &&
|
|
game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_HELP, {
|
|
textId: this.helpTxtId
|
|
});
|
|
}
|
|
onHideAnimateOver() {}
|
|
onHide() {
|
|
if (this.isVisibleAnimate) {
|
|
let e = Const.WIN_W / 2,
|
|
i = Const.WIN_H / 2;
|
|
(this._startPos && ((e = this._startPos.x), (i = this._startPos.y)),
|
|
egret.Tween.get(this)
|
|
.to(
|
|
{
|
|
x: e,
|
|
y: i,
|
|
scaleX: 0,
|
|
scaleY: 0
|
|
},
|
|
250,
|
|
egret.Ease.backIn
|
|
)
|
|
.call(this.onHideAnimateOver, this)
|
|
.call(game.UIUtils.removeSelf, this, [this]));
|
|
} else (this.onHideAnimateOver(), game.UIUtils.removeSelf(this));
|
|
}
|
|
};
|
|
((game.BasePanel = BasePanel), __reflect(BasePanel.prototype, "game.BasePanel"));
|
|
})(game || (game = {}));
|
|
var BaseMediator = class BaseMediator extends puremvc.Mediator {
|
|
constructor(e = "", i = null) {
|
|
super(e, i);
|
|
this.isInitialized = !1;
|
|
this.isPopUp = !1;
|
|
this.ui = null;
|
|
this.w = 0;
|
|
this.h = 0;
|
|
this.type = "panel";
|
|
this.w = GameConfig.curWidth();
|
|
this.h = GameConfig.curHeight();
|
|
}
|
|
showUI(t, e = !0, i = 0, n = 0, a = 0, o = !1) {
|
|
((this.ui = t), this.beforShow(), this.initUI(), this.initData(), PopUpManager.addPopUp(t, e, i, n, a, o));
|
|
}
|
|
beforShow() {}
|
|
initUI() {}
|
|
hideViewComponent(t) {
|
|
t ? PopUpManager.showPanel(this.viewComponent) : PopUpManager.hidePanel(this.viewComponent);
|
|
}
|
|
async closeViewComponent(closeType = 1) {
|
|
switch (this.type) {
|
|
case "panel":
|
|
PopUpManager.removePopUpAsync(this.viewComponent, closeType, function () {});
|
|
break;
|
|
case "scene":
|
|
this.viewComponent && game.UIUtils.removeSelf(this.viewComponent);
|
|
break;
|
|
}
|
|
}
|
|
initData() {}
|
|
destroy() {}
|
|
getIsPopUp() {
|
|
return this.isPopUp;
|
|
}
|
|
getIsInit() {
|
|
return this.isInitialized;
|
|
}
|
|
getWidth() {
|
|
return this.ui.width;
|
|
}
|
|
getHeight() {
|
|
return this.ui.height;
|
|
}
|
|
};
|
|
__reflect(BaseMediator.prototype, "BaseMediator", ["puremvc.IMediator", "puremvc.INotifier"]);
|
|
var game;
|
|
!(function (game) {
|
|
const RegistPanel = class RegistPanel extends game.BasePanel {
|
|
constructor() {
|
|
super();
|
|
this.timeCount = 60;
|
|
this.skinName = new RegistSkin();
|
|
}
|
|
childrenCreated() {
|
|
RES.getResByUrl(
|
|
window.location.origin + "/validate_image/" + Global.playerProxy.uuid + ".png",
|
|
this.onComplete,
|
|
this,
|
|
"image"
|
|
);
|
|
}
|
|
onComplete(t) {
|
|
this.imgtuxing.source = t;
|
|
}
|
|
createChildren() {
|
|
(super.createChildren(),
|
|
this.commonPanel.setPanelWidth(600),
|
|
this.commonPanel.setPanelHeight(830),
|
|
this.commonPanel.setTitleIcon("panel_icon_skin_png"),
|
|
this.commonPanel.setTitle("user_regist_title_png"),
|
|
(this.commonPanel.btnClose.label = "注册"),
|
|
(this.commonPanel.closeBtn.visible = !0),
|
|
(this.pwdEt.displayAsPassword = !0),
|
|
(this.repwdEt.displayAsPassword = !0));
|
|
}
|
|
closeBtnTouchEnded() {
|
|
game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_REGIST);
|
|
}
|
|
onTouchTap(t) {
|
|
const e = this;
|
|
switch ((t.stopPropagation(), t.target)) {
|
|
case this.sendBtn:
|
|
const i = this.phoneEt.text.trim();
|
|
if (!RegUtils.checkMobile(i)) return void PopUpManager.popTip("手机号码错误");
|
|
const n = GameConfig.SERVER_PATH + "user/send-register-code";
|
|
let a = Global.playerProxy.uuid;
|
|
("" == a && ((a = egret.getTimer().toString()), (Global.playerProxy.uuid = a), (a = Global.playerProxy.uuid)),
|
|
Global.netProxy.sendRequest(
|
|
n,
|
|
{
|
|
phone: i,
|
|
image_code: this.capEt0.text,
|
|
uuid: a
|
|
},
|
|
function (t) {
|
|
return 0 == t.status
|
|
? (e.lockBtnCode(), void PopUpManager.popTip("验证码已发送"))
|
|
: void TipsUtils.showErrorCodeTips(t.status);
|
|
}
|
|
));
|
|
}
|
|
}
|
|
lockBtnCode() {
|
|
((this.timeCount = 60),
|
|
(this.sendBtn.enabled = !1),
|
|
(this.sendBtn.label = this.timeCount + "S"),
|
|
(this.timeInterval = egret.setInterval(
|
|
function () {
|
|
(this.timeCount--,
|
|
(this.sendBtn.label = this.timeCount + "S"),
|
|
this.timeCount <= 0 &&
|
|
((this.sendBtn.label = "发送"), (this.sendBtn.enabled = !0), egret.clearInterval(this.timeInterval)));
|
|
},
|
|
this,
|
|
1e3
|
|
)));
|
|
}
|
|
btnCloseTouchEnded() {
|
|
const e = this.phoneEt.text.trim(),
|
|
i = this.nameEt.text.trim(),
|
|
n = this.pwdEt.text.trim(),
|
|
a = this.repwdEt.text.trim(),
|
|
o = this.capEt.text.trim();
|
|
if (!RegUtils.checkMobile(e)) return void PopUpManager.popTip("手机号码格式错误");
|
|
if (!RegUtils.isRealName(i)) return void PopUpManager.popTip("姓名为2-4个中文汉字");
|
|
if (n.length < 4 || n.length > 8) return void PopUpManager.popTip("密码长度4-8位");
|
|
if (RegUtils.isNull(n)) return void PopUpManager.popTip("密码不能为空");
|
|
if (n != a) return void PopUpManager.popTip("2次密码不一样");
|
|
let r = Global.playerProxy.uuid;
|
|
"" == r && ((r = egret.getTimer().toString()), (Global.playerProxy.uuid = r), (r = Global.playerProxy.uuid));
|
|
const s = {
|
|
image_code: this.capEt0.text,
|
|
phone: e,
|
|
password: n,
|
|
realname: i,
|
|
sms_code: o,
|
|
uuid: r
|
|
};
|
|
(Global.netProxy.setToken(null),
|
|
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "user/register", s, function (e) {
|
|
return 0 == e.status
|
|
? (PopUpManager.popTip("注册成功"),
|
|
void game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_REGIST))
|
|
: void TipsUtils.showErrorCodeTips(e.status);
|
|
}));
|
|
}
|
|
};
|
|
((game.RegistPanel = RegistPanel), __reflect(RegistPanel.prototype, "game.RegistPanel"));
|
|
})(game || (game = {}));
|
|
var game;
|
|
!(function (game) {
|
|
const SocketCommand = class SocketCommand {
|
|
constructor() {}
|
|
static to_command_id1 = "1";
|
|
};
|
|
SocketCommand[0] = PanelNotify.OPEN_FRIEND_GIVE_LIST;
|
|
SocketCommand[3] = ClientNotify.SHOW_CONFIRM_ALERT;
|
|
SocketCommand[4] = ClientNotify.GIVE_SUCCESS;
|
|
SocketCommand[6] = SysNotify.SHOW_MESSAGE;
|
|
game.SocketCommand = SocketCommand;
|
|
__reflect(SocketCommand.prototype, "game.SocketCommand");
|
|
})(game || (game = {}));
|
|
var game;
|
|
!(function (game) {
|
|
const TabelName = class TabelName {
|
|
constructor() {}
|
|
static diamonds_recharge = "diamonds_recharge";
|
|
static init = "init";
|
|
static item_list = "item_list";
|
|
static farm_level = "farm_level";
|
|
static dog_level = "dog_level";
|
|
static lottery = "lottery";
|
|
static store_list = "store_list";
|
|
static common = "common";
|
|
static txt_list = "txt_list";
|
|
static land_extend = "land_extend";
|
|
static land_upgrade = "land_upgrade";
|
|
static player_level = "player_level";
|
|
static crop_list = "crop_list";
|
|
};
|
|
((game.TabelName = TabelName), __reflect(TabelName.prototype, "game.TabelName"));
|
|
})(game || (game = {}));
|
|
var game;
|
|
!(function (game) {
|
|
const URLConfig = class URLConfig {
|
|
constructor() {}
|
|
static getPlant(e, i) {
|
|
if (i == game.PlantStatus.seed) return "resource/assets/icon/plant/plant_p0.png";
|
|
if (i == game.PlantStatus.die) return "resource/assets/icon/plant/plant_p4.png";
|
|
const n = Global.gameProxy.getPlantConfig(e);
|
|
const plantImageId = i == game.PlantStatus.seeding ? n.g1 : i == game.PlantStatus.growup ? n.g2 : n.g3;
|
|
return "resource/assets/icon/plant/" + plantImageId + ".png";
|
|
}
|
|
static getIcon(t) {
|
|
return "resource/assets/icon/icon/" + t + ".png";
|
|
}
|
|
static getHead(t) {
|
|
return "resource/assets/icon/head/head" + t + ".png";
|
|
}
|
|
static getLand(t) {
|
|
return "resource/assets/icon/land/" + t + ".png";
|
|
}
|
|
static getSkin(t) {
|
|
return "resource/assets/icon/skin/" + t + ".png";
|
|
}
|
|
static getSkinName(t) {
|
|
return "resource/assets/icon/skin/skin_name_" + t + ".png";
|
|
}
|
|
static getGround(t) {
|
|
return "resource/assets/icon/skin/" + t + ".jpg";
|
|
}
|
|
static getGroundFenceFront(t) {
|
|
return "resource/assets/icon/skin/" + t + "_1.png";
|
|
}
|
|
static getGroundFenceBack(t) {
|
|
return "resource/assets/icon/skin/" + t + "_0.png";
|
|
}
|
|
static getHouse(t) {
|
|
return "resource/assets/icon/house/" + t + ".png";
|
|
}
|
|
static getBox(t) {
|
|
return "resource/assets/icon/box/" + t + ".png";
|
|
}
|
|
};
|
|
((game.URLConfig = URLConfig), __reflect(URLConfig.prototype, "game.URLConfig"));
|
|
})(game || (game = {}));
|
|
var game;
|
|
!(function (game) {
|
|
const AppFacade = class AppFacade extends puremvc.Facade {
|
|
constructor() {
|
|
super();
|
|
}
|
|
static getInstance() {
|
|
return (null == this.instance && (this.instance = new AppFacade()), this.instance);
|
|
}
|
|
initializeController() {
|
|
(super.initializeController(), this.registerCommand(AppFacade.STARTUP, game.StartupCommand));
|
|
}
|
|
startUp(t) {
|
|
(AppFacade.getInstance().sendNotification(AppFacade.STARTUP, t), this.removeCommand(AppFacade.STARTUP));
|
|
}
|
|
static STARTUP = "startup";
|
|
};
|
|
((game.AppFacade = AppFacade),
|
|
__reflect(AppFacade.prototype, "game.AppFacade", ["puremvc.IFacade", "puremvc.INotifier"]));
|
|
})(game || (game = {}));
|
|
var core;
|
|
!(function (core) {
|
|
const TimerManager = class TimerManager {
|
|
constructor() {
|
|
if (core.s_instance) throw new Error("单例类不可实例化");
|
|
egret.startTick(this.onTick, this);
|
|
this.m_tickList = [];
|
|
}
|
|
onTick(t) {
|
|
for (var e = this.m_tickList, i = e.length; i > 0; i--) {
|
|
var n = e[i - 1];
|
|
n.isValid || e.splice(i - 1, 1);
|
|
}
|
|
for (let i = 0, a = e.length; a > i; i++) {
|
|
var n = e[i];
|
|
if (t - n.timestamp > n.delay) {
|
|
if (((n.timestamp = t), n.count++, n.callback)) {
|
|
n.callback.call(n.thisObj, n.clone());
|
|
}
|
|
n.count == n.maxCount && (n.isValid = !1);
|
|
}
|
|
}
|
|
return !1;
|
|
}
|
|
addTick(t, e, n, a) {
|
|
for (var o = [], r = 4; r < arguments.length; r++) o[r - 4] = arguments[r];
|
|
let s = this.m_tickList;
|
|
if (s)
|
|
for (let l = 0, h = s.length; h > l; l++) {
|
|
const c = s[l];
|
|
if (c.callback == n && c.thisObj == a && c.delay == t && c.maxCount == e)
|
|
return void (
|
|
c.isValid ||
|
|
((c.isValid = !0),
|
|
(c.delay = t),
|
|
(c.count = 0),
|
|
(c.maxCount = 0 >= e ? Number.MAX_VALUE : e),
|
|
(c.callback = n),
|
|
(c.thisObj = a),
|
|
(c.args = o),
|
|
(c.timestamp = egret.getTimer()))
|
|
);
|
|
}
|
|
else ((s = []), (this.m_tickList = s));
|
|
const p = new TickData();
|
|
((p.delay = t),
|
|
(p.count = 0),
|
|
(p.maxCount = 0 >= e ? Number.MAX_VALUE : e),
|
|
(p.callback = n),
|
|
(p.thisObj = a),
|
|
(p.args = o),
|
|
(p.timestamp = egret.getTimer()),
|
|
(p.isValid = !0),
|
|
s.push(p));
|
|
}
|
|
removeTick(t, e) {
|
|
const i = this.m_tickList;
|
|
if (i)
|
|
for (let n = 0, a = i.length; a > n; n++) {
|
|
const o = i[n];
|
|
if (o.callback == t && o.thisObj == e) return void (o.isValid = !1);
|
|
}
|
|
}
|
|
removeTicks(t) {
|
|
const e = this.m_tickList;
|
|
if (e)
|
|
for (let i = 0, n = e.length; n > i; i++) {
|
|
const a = e[i];
|
|
a.thisObj == t && (a.isValid = !1);
|
|
}
|
|
}
|
|
removeAllTicks() {
|
|
this.m_tickList.length = 0;
|
|
}
|
|
static get instance() {
|
|
return (null == TimerManager.s_instance && (TimerManager.s_instance = new TimerManager()), TimerManager.s_instance);
|
|
}
|
|
};
|
|
((core.TimerManager = TimerManager), __reflect(TimerManager.prototype, "core.TimerManager"));
|
|
var TickData = class TickData extends egret.HashObject {
|
|
constructor() {
|
|
super();
|
|
}
|
|
clone() {
|
|
const t = new TickData();
|
|
return (
|
|
(t.delay = this.delay),
|
|
(t.count = this.count),
|
|
(t.maxCount = this.maxCount),
|
|
(t.callback = this.callback),
|
|
(t.thisObj = this.thisObj),
|
|
(t.args = this.args),
|
|
(t.isValid = this.isValid),
|
|
t
|
|
);
|
|
}
|
|
};
|
|
((core.TickData = TickData), __reflect(TickData.prototype, "core.TickData"));
|
|
})(core || (core = {}));
|
|
var AssetAdapter = class AssetAdapter {
|
|
constructor() {}
|
|
getAsset(t, e, i) {
|
|
function n(n) {
|
|
e.call(i, n, t);
|
|
}
|
|
if (RES.hasRes(t)) {
|
|
const a = RES.getRes(t);
|
|
a ? n(a) : RES.getResAsync(t, n, this);
|
|
} else RES.getResByUrl(t, n, this, RES.ResourceItem.TYPE_IMAGE);
|
|
}
|
|
};
|
|
__reflect(AssetAdapter.prototype, "AssetAdapter", ["eui.IAssetAdapter"]);
|