hy-farm/muchang/home/web/game/js/main/17-sports-full.js
2026-05-29 19:54:56 +08:00

1812 lines
75 KiB
JavaScript

// Original arena UI and battle scene runtime migration.
// Visual resources are copied from farmer/resource/skins/panel/sports and scene/battlePet.
(function () {
var panelValues = {
OPEN_BATTLE_FRUIT_TIPS: "OPEN_BATTLE_FRUIT_TIPS",
CLOSE_BATTLE_FRUIT_TIPS: "CLOSE_BATTLE_FRUIT_TIPS"
};
Object.keys(panelValues).forEach(function (name) { PanelNotify[name] = PanelNotify[name] || panelValues[name]; });
var sceneValues = {
OPEN_BATTLEPET: "SceneNotify_OPEN_BATTLEPET",
CLOSE_BATTLEPET: "SceneNotify_CLOSE_BATTLEPET"
};
Object.keys(sceneValues).forEach(function (name) { SceneNotify[name] = SceneNotify[name] || sceneValues[name]; });
var sysValues = {
START_ATTACK: "START_ATTACK",
END_ATTACK: "END_ATTACK",
BE_ATTACK: "BE_ATTACK",
BE_END_ATTACK: "BE_END_ATTACK",
DODGE: "DODGE",
DODGE_END: "DODGE_END",
SPORT_UPDATA: "SPORT_UPDATA"
};
Object.keys(sysValues).forEach(function (name) { SysNotify[name] = SysNotify[name] || sysValues[name]; });
var proxyProto = game.GameProxy && game.GameProxy.prototype;
if (proxyProto) {
var originalGetCommonConfig = proxyProto.getCommonConfig;
proxyProto.getCommonConfig = function () {
var common = originalGetCommonConfig ? originalGetCommonConfig.call(this) : (this.gameConfig.common || {});
common[20] = common[20] || { id: 20, namg: "每天可以挑战竞技场次数", type: 2, min: 5, max: 5 };
common[21] = common[21] || { id: 21, namg: "每次挑战竞技场时间间隔(秒)", type: 2, min: 600, max: 600 };
return common;
};
proxyProto.getItemSFConfig = proxyProto.getItemSFConfig || function () { return this.gameConfig.battle || {}; };
proxyProto.getItemSFConfigForID = proxyProto.getItemSFConfigForID || function (id) { return this.getItemSFConfig()[id] || null; };
proxyProto.getSportConfig = proxyProto.getSportConfig || function () { return this.gameConfig.arena || {}; };
proxyProto.getSportConfigForID = proxyProto.getSportConfigForID || function (id) { return this.getSportConfig()[id] || null; };
proxyProto.getSportConfigForRank = proxyProto.getSportConfigForRank || function (rank) {
var list = this.getSportConfig();
for (var key in list) {
var item = list[key];
if (rank >= item.ranking_min_id && rank <= item.ranking_mzx_id) return item;
}
return null;
};
}
var audioProto = game.AudioProxy && game.AudioProxy.prototype;
if (audioProto && !audioProto.startBgMusic1) {
audioProto.startBgMusic1 = function () {
if (this.isOpen) {
var sound = RES.getRes("background_1_mp3") || RES.getRes("background_mp3");
if (sound) {
this.channel && this.channel.stop();
this.backgroundSound = sound;
this.channel = sound.play(0, -1);
}
}
};
}
})();
var MYUtils =
window.MYUtils ||
(window.MYUtils = (function () {
function MYUtils() {}
MYUtils.distance = function (start, end) {
return Math.sqrt(Math.pow(start.x - end.x, 2) + Math.pow(start.y - end.y, 2));
};
MYUtils.pointAmongAngle = function (startX, startY, endX, endY) {
var deltaX = endX - startX,
deltaY = endY - startY,
angle = 0;
return 0 == deltaX && 0 == deltaY
? 0
: (deltaX >= 0 && deltaY >= 0
? (angle = (180 * Math.atan(deltaY / deltaX)) / Math.PI)
: deltaX <= 0 && deltaY >= 0
? (angle = (180 * Math.atan(Math.abs(deltaX) / deltaY)) / Math.PI + 90)
: deltaX <= 0 && deltaY <= 0
? (angle = (180 * Math.atan(Math.abs(deltaY) / Math.abs(deltaX))) / Math.PI + 180)
: deltaX >= 0 &&
deltaY <= 0 &&
(angle = (180 * Math.atan(deltaX / Math.abs(deltaY))) / Math.PI + 270),
angle);
};
return MYUtils;
})());
var GuideManager = typeof GuideManager !== "undefined" ? GuideManager : (function () {
var instance = {
isShowGuide: false,
target: 0,
step: 0,
des: "",
show: function () {},
setsVisable: function () {},
sendNetMessage: function () {}
};
function GuideManager() {}
GuideManager.getInsatance = function () { return instance; };
return GuideManager;
})();
var TextConst = typeof TextConst !== "undefined" ? TextConst : { textObj: {} };
var SportPanel = class SportPanel extends game.BasePanel {
constructor() {
super();
this.isFullScreen = true;
this.isVisibleAnimate = true;
this.skinName = SportsPanelSkin;
}
onAdded() {
super.onAdded();
game.EventManager.instance.addEvent(SysNotify.SPORT_UPDATA, this.updata, this);
}
onRemoved() {
super.onRemoved();
game.EventManager.instance.removeEvent(SysNotify.SPORT_UPDATA, this.updata, this);
}
createChildren() {
super.createChildren();
this.commonPanel.setPanelWidth(640);
this.commonPanel.setPanelHeight(940);
this.commonPanel.setTitleIcon("");
this.commonPanel.setTitle("sport_json.sport_sp3");
this.initTab();
if (GuideManager.getInsatance().isShowGuide && GuideManager.getInsatance().target == 9 && GuideManager.getInsatance().step == 0) {
GuideManager.getInsatance().setsVisable(true);
GuideManager.getInsatance().des = TextConst.textObj[36];
GuideManager.getInsatance().show(this.btnClose, false, 220, 883);
}
}
onShow() {}
childrenCreated() {
super.childrenCreated();
this.updata();
}
updata() {
this.ssc.visible = false;
this.src.visible = false;
var index = this.tab.selectIndex;
switch (index) {
case 0:
this.ssc.visible = true;
this.ssc.updata();
break;
case 1:
this.src.visible = true;
this.src.updata();
break;
}
}
initTab() {
var titles = ["竞技场", "竞技场排名"];
this.tab = new game.Tab(titles, this.onTabItemClickCallback.bind(this));
this.tab.bottom = 0;
this.groupbar.addChild(this.tab);
}
onTabItemClickCallback(index) {
this.updata();
}
btnCloseTouchEnded() {
game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_SPORTS);
}
};
__reflect(SportPanel.prototype, "SportPanel");
var SportsItem0 = function(t) {
function e() {
return t.call(this) || this
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this)
},
e
} (eui.Component);
__reflect(SportsItem0.prototype, "SportsItem0");
var SportsItem1 = function(t) {
function e() {
return t.call(this) || this
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this),
this.sportButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onSports, this)
},
e.prototype.onSports = function(t) {
var e = SportsManager.getInstance().sports;
if (e.myinfo.remaining_challenges_count > 0) {
var i = Global.gameProxy.getCommonConfig(),
n = parseFloat(e.myinfo.last_challenge_time) + i[21].min - DateTimer.instance.now;
0 >= n ? (BattleFruitManager.getInstance().openType = 0, game.AppFacade.instance.sendNotification(SceneNotify.OPEN_BATTLEPET, {
uid: this.uid
})) : TipsUtils.showTipsDownToUp("时间未到")
} else TipsUtils.showTipsDownToUp("挑战次数不足")
},
e
} (eui.Component);
__reflect(SportsItem1.prototype, "SportsItem1");
var SportsManager = function(t) {
function e() {
return t.call(this) || this
}
return __extends(e, t),
e.getInstance = function() {
return this._instance || (this._instance = new e),
this._instance
},
e.prototype.getSportInfo = function(t, e) {
this.callBak = t,
this.callObj = e,
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "arena/get-rank-list", {},
this.onGetRankListInfoInfo.bind(this))
},
e.prototype.onGetRankListInfoInfo = function(t) {
if (0 == t.status) {
this.initSports();
for (var e = 0; e < t.data.list.length; e++) {
var i = new BattleFriendInfo;
i.readData(t.data.list[e]),
this.sports.rankList.push(i)
}
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "arena/get-challenge-list", {},
this.onGetChallgeListInfo.bind(this))
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
},
e.prototype.onGetChallgeListInfo = function(t) {
if (0 == t.status) {
for (var e = 0; e < t.data.list.length; e++) {
var i = new BattleFriendInfo;
i.readData(t.data.list[e]),
this.sports.areaList.push(i)
}
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "arena/get-arena", {},
this.onMyInfo.bind(this))
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
},
e.prototype.onMyInfo = function(t) {
if (0 == t.status) {
var e = new BattleFriendInfo;
e.readData(t.data),
this.sports.myinfo = e,
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "arena/week-gift-list", {},
this.onRewardData.bind(this))
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
},
e.prototype.onRewardData = function(t) {
0 == t.status ? (this.sports.rewardData = t.data.list, this.callBak.call(this.callObj)) : TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
},
e.prototype.initSports = function() {
this.sports = new Sports
},
e.prototype.sendNetEndGame = function() {
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "arena/challenge", {
type: BattleFruitManager.getInstance().battleData.result,
be_user_id: BattleFruitManager.getInstance().friendData.id
},
this.onSendNetEndGame.bind(this))
},
e.prototype.onSendNetEndGame = function(t) {
0 == t.status && (0 == BattleFruitManager.getInstance().battleData.result ? TipsUtils.showTipsDownToUp("挑战成功") : TipsUtils.showTipsDownToUp("挑战失败"), game.AppFacade.instance.sendNotification(SceneNotify.OPEN_MINE_GAME), game.AppFacade.instance.sendNotification(SceneNotify.CLOSE_BATTLEPET), game.AppFacade.instance.sendNotification(PanelNotify.OPEN_SPORTS), GuideManager.getInsatance().isShowGuide && 8 == GuideManager.getInsatance().target && 0 == GuideManager.getInsatance().step && (GuideManager.getInsatance().target = 9, GuideManager.getInsatance().step = 0, GuideManager.getInsatance().sendNetMessage()))
},
e.prototype.sendNetGetReward = function() {
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "arena/get-gift", {},
this.onSendNetGetReward.bind(this))
},
e.prototype.onSendNetGetReward = function(t) {
if (0 == t.status) {
var e = this.getRewardForIndex(this.sports.myinfo.last_week_index),
i = e.fixed_id,
n = e.fixed_id2,
a = e.random_id;
Global.playerProxy.addItem1(i + "," + n + "," + a),
this.sports.myinfo.is_get_gift = 1,
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE),
game.EventManager.instance.dispatch(SysNotify.SPORT_UPDATA)
}
},
e.prototype.getRewardForIndex = function(t) {
for (var e in this.sports.rewardData) {
var i = this.sports.rewardData[e].ranking_mzx_id,
n = this.sports.rewardData[e].ranking_min_id;
if (t >= n && i >= t) return this.sports.rewardData[e]
}
return this.sports.rewardData[13]
},
e
} (egret.EventDispatcher);
__reflect(SportsManager.prototype, "SportsManager");
var BattleFriendInfo = function() {
function t() {}
return t.prototype.readData = function(t) {
this.id = t.id,
this.user_id = t.user_id,
this.nickname = t.nickname,
this.index = t.index,
this.score = t.score,
this.fighting_capacity = t.fighting_capacity,
this.pet_id = t.pet_id,
this.win_count = t.win_count,
this.fail_count = t.fail_count,
this.remaining_challenges_count = t.remaining_challenges_count,
this.last_challenge_time = t.last_challenge_time,
this.is_get_gift = t.is_get_gift,
this.week = t.week,
this.avastar = t.avatar,
this.next_week_time = t.next_week_time,
this.last_week_index = t.last_week_index,
this.hasTime = this.last_challenge_time + 600 - DateTimer.instance.now
},
t
} ();
__reflect(BattleFriendInfo.prototype, "BattleFriendInfo");
var Sports = function() {
function t() {
this.rankList = [],
this.areaList = [],
this.rewardData = [],
this.myinfo = new BattleFriendInfo,
this.rankList.length = 0,
this.areaList.length = 0
}
return t
} ();
__reflect(Sports.prototype, "Sports");
var SportsMeditor = class SportsMeditor extends BaseMediator {
constructor() {
super(SportsMeditor.NAME);
}
listNotificationInterests() {
return [PanelNotify.OPEN_SPORTS, PanelNotify.CLOSE_SPORTS];
}
onRegister() {
super.onRegister();
if (this.facade && (!this.facade.hasMediator || !this.facade.hasMediator(BattlePetSenceMediator.NAME))) {
this.facade.registerMediator(new BattlePetSenceMediator());
}
if (this.facade && (!this.facade.hasMediator || !this.facade.hasMediator(BattleFruitTipsMediator.NAME))) {
this.facade.registerMediator(new BattleFruitTipsMediator());
}
}
showViewComponent(layer) {
if (layer === void 0) layer = 7;
this.viewComponent = new SportPanel();
this.showUI(this.viewComponent, true, 0, 0, layer);
}
handleNotification(notification) {
switch (notification.getName()) {
case PanelNotify.OPEN_SPORTS:
SportsManager.getInstance().getSportInfo(this.onGetInfo, this);
break;
case PanelNotify.CLOSE_SPORTS:
this.closeViewComponent();
break;
}
}
onGetInfo() {
this.showViewComponent();
}
};
SportsMeditor.NAME = "SportsMeditor";
__reflect(SportsMeditor.prototype, "SportsMeditor");
var SportsRankCompoment = function(t) {
function e() {
var e = t.call(this) || this;
return e.addEventListener(egret.Event.ADDED_TO_STAGE, e.onAdd, e),
e.addEventListener(egret.Event.REMOVED_FROM_STAGE, e.onRemove, e),
e
}
return __extends(e, t),
e.prototype.onAdd = function() {
this.getButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTab, this),
core.TimerManager.instance.addTick(1e3, -1, this.onTimer, this)
},
e.prototype.onRemove = function() {
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdd, this),
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemove, this),
this.getButton.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTab, this),
core.TimerManager.instance.removeTick(this.onTimer, this)
},
e.prototype.onTimer = function() {
var t = SportsManager.getInstance().sports,
e = parseFloat(t.myinfo.next_week_time) - DateTimer.instance.now;
e >= 0 ? this.timeLabel.text = TimeFormat.showDDHH(1e3 * e) : this.timeLabel.text = TimeFormat.showDDHH(0)
},
e.prototype.partAdded = function(e, i) {
t.prototype.partAdded.call(this, e, i)
},
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this),
this.scrolls.viewport = this.list,
this.list.itemRenderer = SportsRewardItemRender
},
e.prototype.updata = function() {
var t = SportsManager.getInstance().sports,
e = [];
for (var i in t.rewardData) parseInt(i) >= 0 && parseInt(i) <= 4 && e.push({
rank: parseInt(i),
data: t.rewardData[i]
});
e.push({
rank: 5,
data: t.rewardData[5]
}),
e.push({
rank: 6,
data: t.rewardData[5]
}),
e.push({
rank: 7,
data: t.rewardData[5]
}),
e.push({
rank: 8,
data: t.rewardData[5]
}),
e.push({
rank: 9,
data: t.rewardData[5]
}),
this.list.dataProvider = new eui.ArrayCollection(e);
for (var n = 0; 3 > n; n++) this["rewardItem" + n].imghead.source = "",
this["rewardItem" + n].numLabel.text = "";
var a = SportsManager.getInstance().getRewardForIndex(t.myinfo.last_week_index),
o = a.fixed_id,
s = o.split(":")[0],
r = Global.gameProxy.getItemImageId(s),
h = parseInt(o.split(":")[1]);
this.rewardItem0.imghead.source = r + "_png",
this.rewardItem0.numLabel.text = h + "",
o = a.fixed_id2,
s = o.split(":")[0],
r = Global.gameProxy.getItemImageId(s),
h = parseInt(o.split(":")[1]),
this.rewardItem1.imghead.source = r + "_png",
this.rewardItem1.numLabel.text = h + "",
o = a.random_id,
"" != o && (s = o.split(":")[0], r = Global.gameProxy.getItemImageId(s), h = parseInt(o.split(":")[1]), this.rewardItem2.imghead.source = r + "_png", this.rewardItem2.numLabel.text = h + ""),
this.ranlLabel.text = t.myinfo.last_week_index.toString(),
1 == t.myinfo.is_get_gift ? this.getButton.enabled = !1 : this.getButton.enabled = !0
},
e.prototype.onTab = function(t) {
SportsManager.getInstance().sendNetGetReward()
},
e
} (eui.Component);
__reflect(SportsRankCompoment.prototype, "SportsRankCompoment");
var SportsRankItem = function(t) {
function e() {
return t.call(this) || this
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this)
},
e
} (eui.Component);
__reflect(SportsRankItem.prototype, "SportsRankItem");
var SportsRewardItemRender = function(t) {
function e() {
var e = t.call(this) || this;
return e.skinName = SportsRewardItemRenderSkin,
e
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this)
},
e.prototype.dataChanged = function() {
t.prototype.dataChanged.call(this),
this.item0.imghead.source = "",
this.item0.numLabel.text = "",
this.item1.imghead.source = "",
this.item1.numLabel.text = "",
this.item2.imghead.source = "",
this.item2.numLabel.text = "";
var e = this.data.data,
i = e.fixed_id,
n = i.split(":")[0],
a = Global.gameProxy.getItemImageId(n),
o = parseInt(i.split(":")[1]);
this.item0.imghead.source = a + "_png",
this.item0.numLabel.text = o + "",
i = e.fixed_id2,
n = i.split(":")[0],
a = Global.gameProxy.getItemImageId(n),
o = parseInt(i.split(":")[1]),
this.item1.imghead.source = a + "_png",
this.item1.numLabel.text = o + "",
"" != e.random_id && (i = e.random_id, n = i.split(":")[0], a = Global.gameProxy.getItemImageId(n), o = parseInt(i.split(":")[1]), this.item2.imghead.source = a + "_png", this.item2.numLabel.text = o + ""),
this.rankImg.source = "sport_json.sport_num" + (this.data.rank + 1)
},
e
} (eui.ItemRenderer);
__reflect(SportsRewardItemRender.prototype, "SportsRewardItemRender");
var SportsSportsCompoment = function(t) {
function e() {
var e = t.call(this) || this;
return e.addEventListener(egret.Event.ADDED_TO_STAGE, e.onAdd, e),
e.addEventListener(egret.Event.REMOVED_FROM_STAGE, e.onRemove, e),
e
}
return __extends(e, t),
e.prototype.onAdd = function() {
core.TimerManager.instance.addTick(1e3, -1, this.onTimer, this)
},
e.prototype.onRemove = function() {
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdd, this),
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemove, this),
core.TimerManager.instance.removeTick(this.onTimer, this)
},
e.prototype.onTimer = function() {
var t = SportsManager.getInstance().sports,
e = Global.gameProxy.getCommonConfig(),
i = parseFloat(t.myinfo.last_challenge_time) + e[21].min - DateTimer.instance.now;
i > 0 ? this.countLabel4.text = i + "s": this.countLabel4.text = "0s"
},
e.prototype.partAdded = function(e, i) {
t.prototype.partAdded.call(this, e, i)
},
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this)
},
e.prototype.updata = function() {
for (var t = SportsManager.getInstance().sports, e = 0; e < t.rankList.length; e++) {
var i = this["item" + e],
n = t.rankList[e].avastar;
"" == n && (n = 1),
i.headImg.source = game.URLConfig.getHead(n),
i.nameLabel.text = t.rankList[e].nickname
}
for (var e = 0; e < t.areaList.length; e++) {
var a = this["unit" + e],
n = t.areaList[e].avastar;
"" == n && (n = 1),
a.headImg.source = game.URLConfig.getHead(n),
a.nameLabel.text = t.areaList[e].nickname,
a.rankLabel.text = t.areaList[e].index + "",
a.powerLabel.text = t.areaList[e].fighting_capacity + "",
a.uid = t.areaList[e].user_id
}
this.nameLabel.text = t.myinfo.nickname,
this.countLabel0.text = t.myinfo.win_count,
this.countLabel1.text = t.myinfo.remaining_challenges_count,
this.countLabel2.text = t.myinfo.index,
this.countLabel3.text = t.myinfo.fail_count;
var o = SportsManager.getInstance().getRewardForIndex(t.myinfo.index),
s = o.fixed_id,
r = s.split(":")[0],
h = Global.gameProxy.getItemImageId(r),
l = parseInt(s.split(":")[1]);
this.headImg0.source = h + "_png",
this.label0.text = l + "",
s = o.fixed_id2,
r = s.split(":")[0],
h = Global.gameProxy.getItemImageId(r),
l = parseInt(s.split(":")[1]),
this.headImg1.source = h + "_png",
this.label1.text = l + "",
s = o.random_id,
r = s.split(":")[0],
h = Global.gameProxy.getItemImageId(r),
l = parseInt(s.split(":")[1]),
this.headImg2.source = h + "_png",
this.label2.text = l + "",
GuideManager.getInsatance().isShowGuide && 8 == GuideManager.getInsatance().target && 0 == GuideManager.getInsatance().step && (GuideManager.getInsatance().des = TextConst.textObj[34], GuideManager.getInsatance().show(this.unit2))
},
e
} (eui.Component);
__reflect(SportsSportsCompoment.prototype, "SportsSportsCompoment");
var BattlePetScence = function(t) {
function e() {
var i = Reflect.construct(t, [], e);
return i.selectedArr = [],
i.itemArr = [[null, null, null, null, null, null, null, null], [null, null, null, null, null, null, null, null], [null, null, null, null, null, null, null, null], [null, null, null, null, null, null, null, null], [null, null, null, null, null, null, null, null], [null, null, null, null, null, null, null, null], [null, null, null, null, null, null, null, null]],
i.isCanTouch = !0,
i.moveIsComplete = !0,
i.isOnMove = !0,
i.isEnd = !1,
i.len = 0,
i.isSend = !0,
i.skinName = BattleScenceSkin,
i.addEventListener(egret.Event.ADDED_TO_STAGE, i.onAdd, i),
i.addEventListener(egret.Event.REMOVED_FROM_STAGE, i.onRemove, i),
i
}
return __extends(e, t),
e.prototype.onAdd = function(t) {
game.EventManager.instance.addEvent(SysNotify.BE_ATTACK, this.onBeAttck, this),
game.EventManager.instance.addEvent(SysNotify.START_ATTACK, this.onAttack, this),
game.EventManager.instance.addEvent(SysNotify.BE_END_ATTACK, this.onEndBeAttck, this),
game.EventManager.instance.addEvent(SysNotify.END_ATTACK, this.onEndAttack, this),
game.EventManager.instance.addEvent(SysNotify.DODGE, this.onEndDodge, this),
this.gfruit.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onBegin, this),
this.gfruit.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.onMove, this),
this.stage.addEventListener(egret.TouchEvent.TOUCH_END, this.onEnd, this),
this.backButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onBack, this)
},
e.prototype.onRemove = function(t) {
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdd, this),
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemove, this),
game.EventManager.instance.removeEvent(SysNotify.BE_ATTACK, this.onBeAttck, this),
game.EventManager.instance.removeEvent(SysNotify.START_ATTACK, this.onAttack, this),
this.backButton.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onBack, this),
game.EventManager.instance.removeEvent(SysNotify.BE_END_ATTACK, this.onEndBeAttck, this),
game.EventManager.instance.removeEvent(SysNotify.END_ATTACK, this.onEndAttack, this),
game.EventManager.instance.removeEvent(SysNotify.DODGE, this.onEndDodge, this),
this.gfruit.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, this.onBegin, this),
this.gfruit.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.onMove, this),
this.stage.removeEventListener(egret.TouchEvent.TOUCH_END, this.onEnd, this),
this.mc1.removeEventListener(egret.Event.COMPLETE, this.onAttackPlayComplete, this),
this.mc2.removeEventListener(egret.Event.COMPLETE, this.onOtherAttackPlayComplete, this),
egret.Tween.removeTweens(this)
},
e.prototype.onBack = function(t) {
GuideManager.getInsatance().target > 11 && game.AppFacade.instance.sendNotification(SceneNotify.OPEN_MINE_GAME)
},
e.prototype.createChildren = function() {
t.prototype.createChildren.call(this)
},
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this),
this.initItem(),
this.intAnimation(),
this.initHead(),
GuideManager.getInsatance().isShowGuide && 8 == GuideManager.getInsatance().target && 0 == GuideManager.getInsatance().step && (GuideManager.getInsatance().des = TextConst.textObj[35], GuideManager.getInsatance().show(this.gfruit))
},
e.prototype.initHead = function() {
this.otherHead.prosslabel.scaleX = -1
},
e.prototype.intAnimation = function() {
this.myPet.setV( - 1);
var t = BattleFruitManager.getInstance().myPet,
e = (Global.gameProxy.getItemImageId(t.pet_config_id), Global.playerProxy.playerData),
i = e.avatar.toString();
this.myhead.setHead(i),
this.myPet.setData(t),
this.myPet.sleep(),
this.otherPet.setV(1),
this.otherPet.sleep();
var n = BattleFruitManager.getInstance().otherPet,
i = BattleFruitManager.getInstance().friendData.avatar;
this.otherHead.setHead(i),
this.otherPet.setData(n),
this.updata()
},
e.prototype.updata = function() {
var t = BattleFruitManager.getInstance().myPet,
e = BattleFruitManager.getInstance().otherPet;
this.stepLabel.text = BattleFruitManager.getInstance().battleData.step + "",
this.myhead.setPross(t.curBlood, t.petData.blood),
this.otherHead.setPross(e.curBlood, e.petData.blood)
},
e.prototype.onBeAttck = function(t) {},
e.prototype.onAttack = function(t) {
var e = ["lion", "wolf", "snake", "bear", "dragon"],
i = [new egret.Point(80, 40), new egret.Point(30, 220), new egret.Point(70, 200), new egret.Point(100, 60), new egret.Point(100, 150)],
n = [new egret.Point(520, 40), new egret.Point(600, 220), new egret.Point(580, 200), new egret.Point(510, 60), new egret.Point(500, 150)];
if (this.datas = t.data, -1 == t.data.status) {
if (!this.mc1) {
var a = e[t.data.pettype];
this.mc1 = game.MCUtils.getMc(a, null),
this.ga.addChild(this.mc1),
this.mc1.addEventListener(egret.Event.COMPLETE, this.onAttackPlayComplete, this)
}
this.mc1.x = i[t.data.pettype].x,
this.mc1.y = i[t.data.pettype].y,
this.mc1.visible = !0,
this.mc1.gotoAndPlay(1, 1)
} else {
if (!this.mc2) {
var a = e[t.data.pettype];
this.mc2 = game.MCUtils.getMc(a, null),
this.ga.addChild(this.mc2),
this.mc2.addEventListener(egret.Event.COMPLETE, this.onOtherAttackPlayComplete, this)
}
this.mc2.scaleX = -1,
this.mc2.visible = !0,
this.mc2.x = n[t.data.pettype].x,
this.mc2.y = n[t.data.pettype].y,
this.mc2.gotoAndPlay(1, 1)
}
},
e.prototype.onEndBeAttck = function(t) {
if ( - 1 == t.data.status) {
var e = BattleFruitManager.getInstance().myPet,
i = BattleFruitManager.getInstance().otherPet,
n = (e.level ? e.level: 1, Math.ceil(i.petData.attack * (1 - e.petData.anti / (10 * i.level + e.petData.anti))));
0 > n && (n = 0);
var a = 2 * n,
o = Math.ceil(i.petData.crit / 10),
s = Math.ceil(100 * Math.random()) < o ? !0 : !1,
r = e.petData.dodge / 10,
h = Math.ceil(100 * Math.random()) < r ? !0 : !1,
l = h ? 0 : s ? a: n;
BattleFruitManager.getInstance().myPet.curBlood - l > 0 ? (BattleFruitManager.getInstance().myPet.curBlood -= l, 0 == BattleFruitManager.getInstance().battleData.step && this.isSend && (this.isSend = !1, BattleFruitManager.getInstance().battleData.result = 1, 1 == BattleFruitManager.getInstance().openType ? BattleFruitManager.getInstance().sendNetWarResult() : SportsManager.getInstance().sendNetEndGame())) : (BattleFruitManager.getInstance().myPet.curBlood = 0, this.myPet.die(), this.moveIsComplete = !1, this.isSend && (this.isSend = !1, BattleFruitManager.getInstance().battleData.result = 1, 1 == BattleFruitManager.getInstance().openType ? BattleFruitManager.getInstance().sendNetWarResult() : SportsManager.getInstance().sendNetEndGame())),
BloodTips.getInstance().createTips(this.myPet.x, this.myPet.y - this.myPet.icons.height, "s" + l, 0, 1e3)
} else {
var e = BattleFruitManager.getInstance().myPet,
i = BattleFruitManager.getInstance().otherPet,
n = (i.level ? i.level: 1, Math.ceil(e.petData.attack * (1 - i.petData.anti / (10 * e.level + i.petData.anti))));
0 > n && (n = 0),
GuideManager.getInsatance().isShowGuide && 8 == GuideManager.getInsatance().target && 0 == GuideManager.getInsatance().step && (n = Math.ceil(i.petData.blood / 8));
var a = 2 * n,
o = Math.ceil(e.petData.crit / 10),
s = Math.ceil(100 * Math.random()) < o ? !0 : !1,
r = i.petData.dodge / 10,
h = Math.ceil(100 * Math.random()) < r ? !0 : !1,
l = h ? 0 : s ? a: n;
BattleFruitManager.getInstance().otherPet.curBlood - l > 0 ? (BattleFruitManager.getInstance().otherPet.curBlood -= l, this.otherPet.attack()) : (BattleFruitManager.getInstance().otherPet.curBlood = 0, this.moveIsComplete = !1, this.otherPet.die(), this.isSend && (this.isSend = !1, BattleFruitManager.getInstance().battleData.result = 0, 1 == BattleFruitManager.getInstance().openType ? BattleFruitManager.getInstance().sendNetWarResult() : SportsManager.getInstance().sendNetEndGame())),
BloodTips.getInstance().createTips(this.otherPet.x, this.otherPet.y - this.otherPet.icons.height, "s" + l, 0, 1e3)
}
this.updata()
},
e.prototype.onEndAttack = function(t) { - 1 == t.data.status ? this.myPet.sleep() : this.otherPet.sleep()
},
e.prototype.onEndDodge = function(t) {},
e.prototype.onAttackPlayComplete = function(t) {
this.mc1.visible = !1,
this.otherPet.beAttack()
},
e.prototype.onOtherAttackPlayComplete = function(t) {
this.mc2.visible = !1,
this.myPet.beAttack()
},
e.prototype.callSleep = function(t) { - 1 == t.status ? this.myPet.sleep() : this.otherPet.sleep()
},
e.prototype.initItem = function() {
BattleFruitManager.getInstance().initRandomArr();
for (var t = 0; t < BattleFruitManager.getInstance().fruitRadomArr.length; t++) for (var e = 0; e < BattleFruitManager.getInstance().fruitRadomArr[t].length; e++) {
var i = new BattlePetUnit(t, e);
this.gfruit.addChild(i),
this.itemArr[t][e] = i,
i.setType(BattleFruitManager.getInstance().fruitRadomArr[t][e]),
i.gotoPoint()
}
},
e.prototype.onBegin = function(t) {
this.moveIsComplete && (this.moveIsComplete = !1, this.clearLine(), this.isCanTouch = !0, this.isOnMove = !0, this.isEnd = !1, this.selectedArr.length = 0, GuideManager.getInsatance().isShowGuide && 8 == GuideManager.getInsatance().target && 0 == GuideManager.getInsatance().step && GuideManager.getInsatance().setsVisable(!1))
},
e.prototype.onMove = function(t) {
if (this.isCanTouch && this.isOnMove) {
var e = t.stageX / (GameConfig.curWidth() / Const.DESGIN_W) - this.gfruit.x,
i = t.stageY / (GameConfig.curHeight() / Const.DESGIN_H) - this.gfruit.y,
n = Math.floor(e / (BattlePetUnit.W + BattlePetUnit.JIANGE)),
a = Math.floor(i / (BattlePetUnit.H + BattlePetUnit.JIANGE));
if (a >= 0 && 7 > a && 8 > n && n >= 0) {
var o = this.itemArr[a][n];
if (o.types > 0 && BattleFruitManager.getInstance().isCanSelected(o, this.selectedArr) && (this.selectedArr.push(o), console.log(this.selectedArr.length), this.selectedArr.length > 1)) {
var s = new egret.Point(this.selectedArr[this.selectedArr.length - 2].x, this.selectedArr[this.selectedArr.length - 2].y),
r = new egret.Point(this.selectedArr[this.selectedArr.length - 1].x, this.selectedArr[this.selectedArr.length - 1].y);
this.drawLine(s, r)
}
}
this.selectedArr.length > 0 && this.updataLine(new egret.Point(this.selectedArr[this.selectedArr.length - 1].x, this.selectedArr[this.selectedArr.length - 1].y), new egret.Point(t.stageX / (GameConfig.curWidth() / Const.DESGIN_W) - this.gLine0.x, t.stageY / (GameConfig.curHeight() / Const.DESGIN_H) - this.gLine0.y))
}
},
e.prototype.onEnd = function(t) {
this.isOnMove = !1,
this.isEnd || (this.isEnd = !0, this.gLine0.removeChildren(), this.g0Line = null, this.clearLine(), this.selectedArr.length >= 3 ? this.startClearItem() : this.moveIsComplete = !0)
},
e.prototype.drawLine = function(t, e) {
var i = MYUtils.pointAmongAngle(t.x, t.y, e.x, e.y),
n = MYUtils.distance(t, e),
a = new BattleFruitLine;
this.gLine.addChild(a),
a.anchorOffsetY = 5,
a.width = n + 5,
a.rotation = i,
a.x = t.x,
a.y = t.y
},
e.prototype.clearLine = function() {
this.gLine.removeChildren()
},
e.prototype.updataLine = function(t, e) {
if (this.isCanTouch) {
this.g0Line || (this.g0Line = new BattleFruitLine, this.gLine0.addChild(this.g0Line));
var i = MYUtils.pointAmongAngle(t.x, t.y, e.x, e.y),
n = MYUtils.distance(t, e);
this.g0Line.anchorOffsetY = 5,
this.g0Line.width = n + 5,
this.g0Line.rotation = i,
this.g0Line.x = t.x,
this.g0Line.y = t.y
}
},
e.prototype.startClearItem = function() {
for (var t = 0; t < this.selectedArr.length; t++) egret.Tween.get(this.selectedArr[t]).to({
scaleX: 1.5,
scaleY: 1.5
},
100, egret.Ease.backIn).to({
scaleX: 1.2,
scaleY: 1.2
},
100, egret.Ease.backOut),
this.itemArr[this.selectedArr[t].i][this.selectedArr[t].j] = null;
egret.Tween.get(this).wait(200).call(this.clearItem, this)
},
e.prototype.clearItem = function() {
Global.audioProxy.playSound("battle_xiaochu_mp3");
for (var t = 0; t < this.selectedArr.length; t++) this.gfruit.removeChild(this.selectedArr[t]);
for (var e = this.itemArr[0].length - 1; e >= 0;) {
for (var i = this.itemArr.length - 1,
n = this.itemArr.length - 1; n >= 0; n--) if (null != this.itemArr[n][e]) {
var a = this.itemArr[n][e];
this.itemArr[n][e] = null,
this.itemArr[i][e] = a,
this.itemArr[i][e].i = i,
this.itemArr[i][e].j = e,
i--
}
for (var o = 0; i >= o; o++) {
var a = new BattlePetUnit(i, e);
this.itemArr[o][e] = a,
this.itemArr[o][e].setPoint(new egret.Point(o - i - 1, e)),
this.gfruit.addChild(a),
a.i = o,
a.j = e,
a.setType(Math.floor(1 + 5 * Math.random()))
}
e--
}
this.onUpDataItem()
},
e.prototype.onUpDataItem = function() {
this.moveIsComplete = !0,
this.len = this.selectedArr.length;
for (var t = 0; t < this.itemArr.length; t++) for (var e = 0; e < this.itemArr[t].length; e++) this.itemArr[t][e] && this.itemArr[t][e].gotoPoint();
this.len >= 3 && this.sattack()
},
e.prototype.sattack = function() {
BattleFruitManager.getInstance().battleData.step > 0 ? (this.myPet.attack(), BattleFruitManager.getInstance().battleData.step -= 1) : TipsUtils.showTipsDownToUp("没有足够的步数")
},
e
} (game.BaseComponent);
__reflect(BattlePetScence.prototype, "BattlePetScence");
var __sportsFullSceneClasses = {
CreateRoleScene: game && game.CreateRoleScene,
GameScene: game && game.GameScene,
LoginScene: game && game.LoginScene,
LogoScene: game && game.LogoScene,
SayScene: game && game.SayScene
};
var game; !
function(t) {
var e = function(e) {
function i() {
var t = e.call(this) || this;
return t.selectIconId = 1,
t.skinName = new CreateRoleSceneSkin,
t
}
return __extends(i, e),
i.prototype.createChildren = function() {
e.prototype.createChildren.call(this),
this.setSelectHeadIcon(t.Utils.rang(1, 6e4) % 6 + 1)
},
i.prototype.setSelectHeadIcon = function(t) {
this.selectIconId = t;
for (var e = 1; 6 >= e; e++) {
var i = this["groupHead" + e];
i.touchChildren = !1,
i.name = "groupHead" + e;
var n = i.getChildByName("imgSelect");
n.visible = t == e
}
},
i.prototype.onTouchTap = function(t) {
switch (t.target) {
case this.btnOk:
this.createRole()
}
var e = t.target.name;
if (e.indexOf("groupHead") > -1) {
var i = parseInt(e.replace("groupHead", ""));
this.setSelectHeadIcon(i)
}
},
i.prototype.createRole = function() {
var e = this.inpName.text.trim();
if (!e) return void TipsUtils.showTipsDownToUp("请输入名称", !0);
if (e.length > 7) TipsUtils.showTipsDownToUp("输入的名称太长了", !0);
else {
var i = GameConfig.SERVER_PATH + "user/modify-user-info",
n = {
nickname: e,
avatar: this.selectIconId + ""
};
Global.netProxy.sendRequest(i, n,
function(i) {
return 0 === i.status ? (Global.playerProxy.setPlayerDataProperty("nickname", e), Global.playerProxy.setPlayerDataProperty("avatar", n.avatar), TipsUtils.showTipsDownToUp("创建成功"), t.AppFacade.getInstance().sendNotification(SceneNotify.CLOSE_CREATEROLE), void t.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_MINE_GAME)) : void TipsUtils.showTipsDownToUp(GameConfig.ServerCode[i.status], !0)
})
}
},
i
} (t.BaseComponent);
t.CreateRoleScene = e,
__reflect(e.prototype, "game.CreateRoleScene")
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i(t) {
var i = e.call(this) || this;
return i.isMine = t,
i.isMine ? i.playerProxy = Global.playerProxy: i.playerProxy = Global.otherPlayerProxy,
i.skinName = new GameSceneSkin,
i
}
return __extends(i, e),
i.prototype.update = function(t) {},
i.prototype.flushGameScene = function() {
this.isMine && (this.topLayer.updateTopInfo(), this.gameView.flushGameView())
},
i.prototype.changeDog = function() {
this.showDog()
},
i.prototype.onAdded = function() {
e.prototype.onAdded.call(this),
manager.UpdateTickerManager.instance.add(this),
this.isMine && (t.EventManager.instance.addEvent(SysNotify.USER_HOUSE_CHANGE, this.updateHouse, this), t.EventManager.instance.addEvent(SysNotify.USER_SKIN_CHANGE, this.updateGround, this), t.EventManager.instance.addEvent(SysNotify.DOG_UPDAT, this.changeDog, this), 0 == Global.playerProxy.playerData.is_get_new_gift && (this.giftmc = t.MCUtils1.getMc("firstGiftmc"), this.addChild(this.giftmc), this.giftmc.gotoAndPlay(1, -1), this.giftmc.x = 100, this.giftmc.y = 300, this.giftmc.touchEnabled = !0, this.giftmc.addEventListener(egret.TouchEvent.TOUCH_TAP, this.getFirstGift, this)), this.updateTimer || (this.updateTimer = new egret.Timer(3e4, Number.MAX_VALUE), this.updateTimer.addEventListener(egret.TimerEvent.TIMER, this.onUpdatePlantTimer, this)), this.updateTimer.reset(), this.updateTimer.start()),
this.nuchangButton.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onGoMuchang, this)
},
i.prototype.onRemoved = function() {
e.prototype.onRemoved.call(this),
manager.UpdateTickerManager.instance.remove(this),
this.updateTimer || (t.EventManager.instance.removeEvent(SysNotify.USER_HOUSE_CHANGE, this.updateHouse, this), t.EventManager.instance.removeEvent(SysNotify.USER_SKIN_CHANGE, this.updateGround, this), t.EventManager.instance.removeEvent(SysNotify.DOG_UPDAT, this.changeDog, this), this.giftmc && this.giftmc.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.getFirstGift, this), this.updateTimer && this.updateTimer.stop()),
this.nuchangButton.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onGoMuchang, this)
},
i.prototype.getFirstGift = function(t) {
var e = this;
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "user/get-new-user-gift", {
item_id: 330200
},
function(t) {
if (0 == t.status) {
var i = Global.gameProxy.getFirstGiftConfig(),
n = i[330200];
Global.playerProxy.addItem1(n.item_id),
Global.playerProxy.playerData.is_get_new_gift = 1,
e.removeChild(e.giftmc)
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
})
},
i.prototype.onGoMuchang = function(e) {
this.isMine ? t.AppFacade.instance.sendNotification(SceneNotify.OPEN_MINE_MGAME) : t.AppFacade.instance.sendNotification(SceneNotify.OPEN_OTHER_MGAME),
t.AppFacade.instance.sendNotification(SceneNotify.CLOSE_GAME)
},
i.prototype.createChildren = function() {
e.prototype.createChildren.call(this),
this.imgHouse = new eui.Image,
this.groupHouse.addChild(this.imgHouse),
this.updateHouse(),
//this.showDog(),
this.updateGround(!1),
this.gameView = new t.GameView(this),
this.addChild(this.gameView),
this.gameView.x = 280,
this.gameView.y = Const.DESGIN_H - 460,
this.imgFenceFront.touchEnabled = this.imgFenceBack.touchEnabled = !1,
this.addChild(this.imgFenceFront),
this.isMine ? (this.mainMenu = new t.MainMenu, this.addChild(this.mainMenu), this.btnBackHome.visible = !1) : (this.btnBackHome.visible = !0, this.addChild(this.btnBackHome)),
this.topLayer = new t.GameTopLayer(this),
this.addChild(this.topLayer);
if((this.isMine&&Global.playerProxy.playerData.use_dog_item_id>0)||(!this.isMine&&Global.otherPlayerProxy.playerData.use_dog_item_id>0)){
console.log('显示狗狗');
this.showDog();
}
},
i.prototype.childrenCreated = function() {
e.prototype.childrenCreated.call(this),
this.isMine
},
i.prototype.onUpdatePlantTimer = function() {
this.isMine && t.AppFacade.getInstance().sendNotification(ClientNotify.FLUSH_FARM)
},
i.prototype.onTouchTap = function(e) {
switch (e.target) {
case this.btnBackHome:
Global.otherPlayerProxy.clearPlayerData(),
t.AppFacade.getInstance().sendNotification(SceneNotify.BACK_MINE_GAME);
break;
case this.imgDogHouse:
this.isMine && t.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_DOG);
break;
case this.imgHouse:
this.isMine && t.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_HOUSEUPGRADE)
}
},
i.prototype.showDog = function() {
this.groupDog.removeChildren();
var e = new t.WidgetDog(this.playerProxy);
this.groupDog.addChild(e),
e.showType(106002),
e.runTypeAni()
},
i.prototype.updateHouse = function(e) {
var i = this;
void 0 === e && (e = null);
var n = this.playerProxy.playerData,
a = n.farm_level;
e && e.data && (a = e.data),
a = t.Utils.limit(a, 1, 12),
n.farm_level = a;
var o = t.URLConfig.getHouse(a);
RES.getResByUrl(o,
function(t) {
if (t) {
var e = t.textureWidth,
n = t.textureHeight;
i.imgHouse.source = t,
i.imgHouse.anchorOffsetX = .46 * e,
i.imgHouse.anchorOffsetY = .8673 * n
}
},
this)
},
i.prototype.updateGround = function(e) {
void 0 === e && (e = !0);
var i = this.playerProxy.playerData,
n = Global.gameProxy.getItemImageId(i.bg_image_id);
this.imgGround.source = t.URLConfig.getGround(n),
this.imgFenceFront.source = t.URLConfig.getGroundFenceFront(n),
this.imgFenceBack.source = t.URLConfig.getGroundFenceBack(n),
e || (GameConfig.curHeight() > 1024 ? (this.imgGround.scale9Grid = new egret.Rectangle(0, 1, 1, 1), this.imgGround.top = 0) : (this.imgGround.scale9Grid = null, this.imgGround.top = 0 / 0))
},
i
} (t.BaseComponent);
t.GameScene = e,
__reflect(e.prototype, "game.GameScene", ["IUpdate"])
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i() {
var t = e.call(this) || this;
return t.skinName = new LoginSceneSkin,
t
}
return __extends(i, e),
i.prototype.createChildren = function() {
e.prototype.createChildren.call(this);
var t = NativeApi.getLocalData("usernames");
if (t) {
var i = t.split(":"),
n = i[0];
if (n) {
var a = n.split(",");
this.inpKey.text = a[0],
this.inpPw.text = a[1]
}
}
this.inpPw.displayAsPassword = !0,
this.usernameGroup.visible = !1
},
i.prototype.childrenCreated = function() {
e.prototype.childrenCreated.call(this);
var t = JSON.parse(egret.localStorage.getItem("isRemember"));
t ? this.check2.selected = !0 : this.check2.selected = !1
},
i.prototype.xialaImageTouchEnded = function() {
this.usernameGroup.visible = !this.usernameGroup.visible;
var t = NativeApi.getLocalData("usernames");
if (t) for (var e = t.split(":"), i = 0; i < e.length; i++) {
var n = e[i].split(",");
n && (this["label" + (i + 1)].text = n[0])
}
},
i.prototype.label1TouchEnded = function() {
this.showUser(1)
},
i.prototype.label2TouchEnded = function() {
this.showUser(2)
},
i.prototype.label3TouchEnded = function() {
this.showUser(3)
},
i.prototype.label4TouchEnded = function() {
this.showUser(4)
},
i.prototype.showUser = function(t) {
var e = NativeApi.getLocalData("usernames"),
i = e.split(":"),
n = i[t - 1],
a = n.split(",");
this.inpKey.text = a[0],
this.inpPw.text = a[1],
this.usernameGroup.visible = !1
},
i.prototype.btnRegTouchEnded = function() {
t.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_REGIST)
},
i.prototype.btnFindpwdTouchEnded = function() {
t.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_FIND_PASSWORD)
},
i.prototype.setPlayerDataLocal = function(e, i) {
var n = e + "," + i,
a = NativeApi.getLocalData("usernames");
if (a) {
var o = a.split(":");
o.indexOf(n) > -1 && t.Utils.removeArrayItem(o, n),
o.unshift(n);
for (var s = "",
r = 0; r < o.length && !(r > 3); r++) s += o[r] + ":";
s = s.substring(0, s.length - 1),
NativeApi.setLocalData("usernames", s)
} else NativeApi.setLocalData("usernames", n)
},
i.prototype.btnLoginTouchEnded = function() {
return __awaiter(this, void 0, void 0,
function() {
var e, i, n, a = this;
return __generator(this,
function(o) {
return e = this.inpKey.text,
i = this.inpPw.text,
e && i ? (Global.netProxy.setToken(null), n = {
username: e,
password: i
},
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "user/login", n,
function(n) {
//登录
0 === n.status && (Global.netProxy.setToken(n.data.token), TipsUtils.showTipsDownToUp("登陆成功"), egret.localStorage.setItem("isRemember", JSON.stringify(a.check2.selected)), Global.playerProxy.setPlayerData(n.data), a.check2.selected ? a.setPlayerDataLocal(e, i) : a.setPlayerDataLocal(e, ""), Global.gameProxy.getGameConfigJson(function() {
Global.playerProxy.setPlayerLandData(n.data),
Global.playerProxy.getPlayerStoreHouse(function() {
egret.setTimeout(function() {
n.data.nickname ? (t.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_MINE_GAME),Global.audioProxy.startBgMusic()) : t.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_CREATEROLE),
t.UIUtils.removeSelf(a),
t.AppFacade.getInstance().sendNotification(SceneNotify.CLOSE_LOGIN),
t.GamePaoMa.instance.show(),
window.parent && window.parent.openiframe && window.parent.gonggaoUrl && window.parent.openiframe(window.parent.gonggaoUrl)
},
a, 200)
})
})),
TipsUtils.showTipsDownToUp(GameConfig.ServerCode[n.status], !0)
}), [2]) : (TipsUtils.showTipsDownToUp("请输入账号", !0), [2])
})
})
},
i
} (t.BaseComponent);
t.LoginScene = e,
__reflect(e.prototype, "game.LoginScene")
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i() {
var t = e.call(this) || this;
return t.maxLength = 0,
t.skinName = new LogoSceneSkin,
t
}
return __extends(i, e),
i.prototype.createChildren = function() {
e.prototype.createChildren.call(this),
this.resGroup = "main",
this.maxLength = 560,
this.beganLoadResGroup()
},
i.prototype.beganLoadResGroup = function() {
this.startTime = (new Date).getTime(),
RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this),
RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadComplete, this),
RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this),
RES.loadGroup(this.resGroup)
},
i.prototype.onResourceLoadComplete = function(t) {
t.groupName == this.resGroup && (RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadComplete, this), RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this), this.onResourceLoadOver())
},
i.prototype.onResourceProgress = function(t) {
if (t.groupName == this.resGroup) {
var e = t.itemsLoaded / t.itemsTotal;
this.progressBar.width = this.maxLength * e,
this.textLabel.text = Math.floor(100 * e) + "%"
}
},
i.prototype.onResourceLoadOver = function() {
var e = (new Date).getTime();
e - this.startTime;
egret.Tween.get(this).to({
alpha: 0
},
1e3).call(function() {
t.AppFacade.getInstance().sendNotification(SceneNotify.CLOSE_LOADING),
t.AppFacade.getInstance().sendNotification(SceneNotify.OPEN_LOGIN)
},
this)
},
i
} (t.BaseComponent);
t.LogoScene = e,
__reflect(e.prototype, "game.LogoScene")
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i() {
var t = e.call(this) || this;
return t.skinName = new SaySceneSkin,
t
}
return __extends(i, e),
i.prototype.createChildren = function() {
e.prototype.createChildren.call(this)
},
i.prototype.onTouchTap = function() {
t.AppFacade.getInstance().sendNotification(SceneNotify.CLOSE_SAY)
},
i
} (t.BasePanel);
t.SayScene = e,
__reflect(e.prototype, "game.SayScene")
} (game || (game = {}));
game.CreateRoleScene = __sportsFullSceneClasses.CreateRoleScene || game.CreateRoleScene;
game.GameScene = __sportsFullSceneClasses.GameScene || game.GameScene;
game.LoginScene = __sportsFullSceneClasses.LoginScene || game.LoginScene;
game.LogoScene = __sportsFullSceneClasses.LogoScene || game.LogoScene;
game.SayScene = __sportsFullSceneClasses.SayScene || game.SayScene;
var BattleFruitLine = function(t) {
function e() {
var e = t.call(this) || this;
return e.skinName = Battle_fruitLineSkin,
e
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this),
this.addAction()
},
e.prototype.addAction = function() {
egret.Tween.get(this, {
loop: !0
}).to({
scaleY: 2
},
300).to({
scaleY: 1
},
300)
},
e.prototype.deleteAction = function() {
egret.Tween.removeTweens(this)
},
e
} (eui.Component);
__reflect(BattleFruitLine.prototype, "BattleFruitLine");
var BattleFruitTipsMediator = class BattleFruitTipsMediator extends BaseMediator {
constructor() {
super(BattleFruitTipsMediator.NAME);
}
listNotificationInterests() {
return [PanelNotify.OPEN_BATTLE_FRUIT_TIPS, PanelNotify.CLOSE_BATTLE_FRUIT_TIPS];
}
onRegister() {
super.onRegister();
}
showViewComponent(layer) {
if (layer === void 0) layer = 7;
this.viewComponent = new BattleFruitTipss();
this.showUI(this.viewComponent, true, 0, 0, layer);
}
handleNotification(notification) {
switch (notification.getName()) {
case PanelNotify.OPEN_BATTLE_FRUIT_TIPS:
this.showViewComponent();
break;
case PanelNotify.CLOSE_BATTLE_FRUIT_TIPS:
this.closeViewComponent();
break;
}
}
};
BattleFruitTipsMediator.NAME = "BattleFruitTipsMediator";
__reflect(BattleFruitTipsMediator.prototype, "BattleFruitTipsMediator");
var BattleFruitTipss = function(t) {
function e() {
var e = t.call(this) || this;
return e.skinName = RewardTipsSkin,
e
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this)
},
e
} (eui.Component);
__reflect(BattleFruitTipss.prototype, "BattleFruitTipss");
var BattlePetHead = function(t) {
function e() {
var e = t.call(this) || this;
return e.skinName = BattlePetHeadSkin,
e
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this),
this.gs.mask = this.masks,
this.headImg.mask = this.headmask
},
e.prototype.setPross = function(t, e) {
var i = t / e;
this.imgProssBar.x = this.imgProssBar.width * i - this.imgProssBar.width,
this.prosslabel.text = t + "/" + e
},
e.prototype.setHead = function(t) {
"" == t && (t = "1");
var e = t.toString();
if (e.indexOf("http") > -1) this.headImg.source = e;
else {
var i = game.URLConfig.getHead(t);
this.headImg.source = i
}
},
e
} (eui.Component);
__reflect(BattlePetHead.prototype, "BattlePetHead");
var BattlePetUnit = function(t) {
function e(e, i) {
var n = t.call(this) || this;
return n.skinName = BattlePetUnitSkin,
n.anchorOffsetX = 37,
n.anchorOffsetY = 37,
n.i = e,
n.j = i,
n
}
return __extends(e, t),
e.prototype.childrenCreated = function() {
t.prototype.childrenCreated.call(this)
},
e.prototype.setType = function(t) {
this.types = t,
this.icons.source = "battle_fruit" + this.types + "_png"
},
e.prototype.gotoPoint = function(t) {
void 0 === t && (t = null),
this.isgoComplete = !1,
t ? egret.Tween.get(this).to({
x: t.y * e.W + e.W / 2 + t.y * e.JIANGE,
y: t.x * e.H + e.H / 2 + t.x * e.JIANGE
},
200).call(this.playComplete, this) : egret.Tween.get(this).to({
x: e.W * this.j + e.W / 2 + this.j * e.JIANGE,
y: e.H * this.i + e.H / 2 + this.i * e.JIANGE
},
200).call(this.playComplete, this)
},
e.prototype.setPoint = function(t) {
void 0 === t && (t = null),
this.isgoComplete = !1,
t ? (this.x = t.y * e.W + e.W / 2 + t.y * e.JIANGE, this.y = t.x * e.H + e.H / 2 + t.x * e.JIANGE) : (this.x = e.W * this.j + e.W / 2 + this.j * e.JIANGE, this.y = e.H * this.i + e.H / 2 + this.i * e.JIANGE)
},
e.prototype.playComplete = function() {
this.isgoComplete = !0
},
e.W = 74,
e.H = 74,
e.JIANGE = 1.5,
e
} (eui.Component);
__reflect(BattlePetUnit.prototype, "BattlePetUnit");
var PetAnimation = function(t) {
function e() {
var e = t.call(this) || this;
return e.addEventListener(egret.Event.ADDED_TO_STAGE, e.onAdd, e),
e.addEventListener(egret.Event.REMOVED_FROM_STAGE, e.onRemove, e),
e
}
return __extends(e, t),
e.prototype.onAdd = function() {},
e.prototype.onRemove = function() {
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAdd, this),
this.removeEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemove, this),
egret.Tween.removeTweens(this)
},
e.prototype.setV = function(t) {
this.icons.scaleX = t,
this.t = t
},
e.prototype.setIcon = function(t) {
this.icons.source = t + "_png"
},
e.prototype.setData = function(t) {
this.data = t;
var i = t.pet_config_id;
this.petType = e.getTypeForID(i);
var n = Global.gameProxy.getItemImageId(i);
this.setIcon(n)
},
e.prototype.sleep = function() {
var t = this.y;
egret.Tween.get(this, {
loop: !0
}).to({
scaleY: 1.03,
y: t - 5
},
200).to({
scaleY: 1,
y: t
},
300)
},
e.prototype.dodge = function() {
game.EventManager.instance.dispatch(SysNotify.DODGE, {
status: this.t
}),
egret.Tween.get(this).to({
rotation: -20
},
300).to({
rotation: 0
},
200, egret.Ease.backIn).call(this.dodgeCompete, this)
},
e.prototype.dodgeCompete = function() {
game.EventManager.instance.dispatch(SysNotify.DODGE_END, {
status: this.t,
pettype: this.petType
})
},
e.prototype.beAttack = function() {
game.EventManager.instance.dispatch(SysNotify.BE_ATTACK, {
status: this.t,
pettype: this.petType
});
var t = this.x;
egret.Tween.get(this).to({
x: t + 20 * this.t
},
50, egret.Ease.backIn).to({
x: t
},
100, egret.Ease.backIn).call(this.beAttackCompete)
},
e.prototype.beAttackCompete = function() {
game.EventManager.instance.dispatch(SysNotify.BE_END_ATTACK, {
status: this.t,
pettype: this.petType
})
},
e.prototype.attack = function() {
game.EventManager.instance.dispatch(SysNotify.START_ATTACK, {
status: this.t,
pettype: this.petType
});
this.x,
this.y;
switch (this.petType) {
case AlimalsType.LION:
-1 == this.t ? egret.Tween.get(this).to({
rotation: 20
},
50).to({
rotation: -20
},
50).to({
rotation: 0
},
300).wait(1e3).call(this.attackComplete) : egret.Tween.get(this).to({
rotation: 20
},
50).to({
rotation: -20
},
50).to({
rotation: 0
},
300).wait(1e3).call(this.attackComplete);
break;
case AlimalsType.WOLF:
-1 == this.t ? egret.Tween.get(this).wait(300).to({
x: e.AW1,
y: e.AH1 - 50
},
300).to({
x: e.W1,
y: e.H1
},
300).call(this.attackComplete) : egret.Tween.get(this).wait(300).to({
x: e.AW2,
y: e.AH2 - 50
},
300).to({
x: e.AW1,
y: e.AH1
},
300).call(this.attackComplete);
break;
case AlimalsType.SNAKE:
-1 == this.t ? egret.Tween.get(this).to({
x: e.AW1,
y: e.AH1 - 50
},
100).to({
x: e.W1,
y: e.H1
},
100).call(this.attackComplete) : egret.Tween.get(this).to({
x: e.AW2,
y: e.AH2 - 50
},
100).to({
x: e.AW1,
y: e.AH1
},
100).call(this.attackComplete);
break;
case AlimalsType.BEAR:
-1 == this.t ? egret.Tween.get(this).to({
rotation: 20
},
50).to({
rotation: -20
},
50).to({
rotation: 0
},
300).wait(1e3).call(this.attackComplete) : egret.Tween.get(this).to({
rotation: 20
},
50).to({
rotation: -20
},
50).to({
rotation: 0
},
300).wait(1e3).call(this.attackComplete);
break;
case AlimalsType.DRAGON:
-1 == this.t ? egret.Tween.get(this).to({
rotation: 20
},
50).to({
rotation: -20
},
50).to({
rotation: 0
},
300).wait(1e3).call(this.attackComplete) : egret.Tween.get(this).to({
rotation: 20
},
50).to({
rotation: -20
},
50).to({
rotation: 0
},
300).wait(1e3).call(this.attackComplete)
}
},
e.prototype.die = function() {
egret.Tween.get(this).to({
scaleX: .8,
scaleY: .8
},
200, egret.Ease.backIn).to({
scaleX: 1.1,
scaleY: 1.1
},
200, egret.Ease.backOut).to({
scaleX: 0,
scaleY: 0
},
200, egret.Ease.backOut).call(this.callDie, this)
},
e.prototype.callDie = function() { - 1 == this.t ? BattleFruitManager.getInstance().battleData.result = 1 : BattleFruitManager.getInstance().battleData.result = 0
},
e.prototype.attackComplete = function() {},
e.prototype.callSleep = function() {
this.sleep()
},
e.getTypeForID = function(t) {
return t >= 501e3 && 501003 >= t ? AlimalsType.LION: t >= 501004 && 501007 >= t ? AlimalsType.WOLF: t >= 501008 && 501011 >= t ? AlimalsType.SNAKE: t >= 501012 && 501015 >= t ? AlimalsType.BEAR: t >= 501016 && 501019 >= t ? AlimalsType.DRAGON: void 0
},
e.W1 = 97,
e.H1 = 421,
e.AW1 = 547,
e.AH1 = 416,
e.W2 = 547,
e.H2 = 416,
e.AW2 = 97,
e.AH2 = 421,
e
} (eui.Component);
__reflect(PetAnimation.prototype, "PetAnimation");
var AlimalsType = function() {
function t() {}
return t.LION = 0,
t.WOLF = 1,
t.SNAKE = 2,
t.BEAR = 3,
t.DRAGON = 4,
t
} ();
__reflect(AlimalsType.prototype, "AlimalsType");
var BattleFruitManager = function(t) {
function e() {
var e = t.call(this) || this;
return e.fruitRadomArr = [[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]],
e
}
return __extends(e, t),
e.getInstance = function() {
return this._insatance || (this._insatance = new e),
this._insatance
},
e.prototype.initRandomArr = function() {
for (var t = 0; t < this.fruitRadomArr.length; t++) for (var e = 0; e < this.fruitRadomArr[t].length; e++) this.fruitRadomArr[t][e] = Math.floor(1 + 5 * Math.random())
},
e.prototype.isCanSelected = function(t, e) {
if (this.isSame(t, e)) return ! 1;
if (!this.isSameType(t, e)) return ! 1;
if (e.length > 0) {
if (Math.abs(t.i - e[e.length - 1].i) > 1) return ! 1;
if (Math.abs(t.j - e[e.length - 1].j) > 1) return ! 1
}
return ! 0
},
e.prototype.isSame = function(t, e) {
for (var i = 0; i < e.length; i++) if (t.i == e[i].i && t.j == e[i].j) return ! 0;
return ! 1
},
e.prototype.isSameType = function(t, e) {
for (var i = 0; i < e.length; i++) if (t.types == e[i].types) return ! 0;
return 0 == e.length ? !0 : !1
},
e.prototype.initanimalData = function(t) {
this.battleData = new AnimalBattleData,
this.battleData.init(),
this.myPet = new Pet,
this.myPet.readData(t.from_pet),
this.otherPet = new Pet,
this.otherPet.readData(t.be_pet),
this.friendData = t.be_user
},
e.prototype.sendNetWarResult = function() {
GuideManager.getInsatance().isShowGuide && 8 == GuideManager.getInsatance().target && 0 == GuideManager.getInsatance().step && (GuideManager.getInsatance().target = 9, GuideManager.getInsatance().step = 0, GuideManager.getInsatance().sendNetMessage()),
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "pet/battle", {
user_id: Global.playerProxy.playerData.id,
pet_id: this.myPet.id,
be_user_id: this.friendData.user_id,
type: this.battleData.result
},
this.onSendNetWarResult.bind(this))
},
e.prototype.onSendNetWarResult = function(t) {
if (0 == t.status) {
var e = Global.gameProxy.getItemSFConfig();
if (0 == this.battleData.result) {
Global.audioProxy.playSound("battlesuc_mp3");
var i = e[1],
n = i.outcome_id;
Global.playerProxy.addItem1(n),
Global.playerProxy.addExp(i.experience_outcome),
AsumentParkManager.getInstance().sucfaildType = 0,
game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_REWARD_TIPS)
} else {
Global.audioProxy.playSound("battlefail_mp3");
var a = e[2],
n = a.outcome_id;
Global.playerProxy.addItem1(n),
AsumentParkManager.getInstance().sucfaildType = 1,
game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_REWARD_TIPS)
}
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE)
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[t.status])
},
e
} (egret.EventDispatcher);
__reflect(BattleFruitManager.prototype, "BattleFruitManager");
function getSportsBattlePetConfig(id) {
if (Global.gameProxy && Global.gameProxy.getPetBaseConfigForID) return Global.gameProxy.getPetBaseConfigForID(id);
if ("function" == typeof battlePetPetConfig) return battlePetPetConfig(id);
var table = Global.gameProxy && Global.gameProxy.getTabelConfigByType ? Global.gameProxy.getTabelConfigByType("pet") || {} : {};
return table[id] || {
id: id,
hunger: 0,
graphical_id: 11001,
blood: 0,
attack: 0,
anti: 0,
crit: 0,
dodge: 0
}
}
var AnimalBattleData = function() {
function t() {}
return t.prototype.init = function() {
this.step = 30,
this.result = 0
},
t
} ();
__reflect(AnimalBattleData.prototype, "AnimalBattleData");
var BattlePetSenceMediator = class BattlePetSenceMediator extends BaseMediator {
constructor(viewComponent) {
if (viewComponent === void 0) viewComponent = null;
super(BattlePetSenceMediator.NAME, viewComponent);
this.type = "scene";
this.GroupName = "battlescence";
this.isSendReq = true;
}
listNotificationInterests() {
return [SceneNotify.OPEN_BATTLEPET, SceneNotify.CLOSE_BATTLEPET];
}
onRegister() {
super.onRegister();
}
handleNotification(notification) {
var body = notification.getBody() || {};
switch (notification.getName()) {
case SceneNotify.OPEN_BATTLEPET:
this.id = body.uid || body.user_id || body.id;
if (RES.isGroupLoaded(this.GroupName)) this.showPre();
else {
LoadingCompoment.getInstance().show();
RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
RES.addEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
RES.loadGroup(this.GroupName);
}
break;
case SceneNotify.CLOSE_BATTLEPET:
this.closeViewComponent(1);
Global.audioProxy.closeBgMusic();
Global.audioProxy.startBgMusic();
break;
}
}
showViewComponent() {
this.viewComponent = new BattlePetScence();
var layer = GameLayerManager.gameLayer().sceneLayer;
layer.addChild(this.viewComponent);
Global.audioProxy.closeBgMusic();
Global.audioProxy.startBgMusic1();
}
showPre() {
if (this.isSendReq) {
this.isSendReq = false;
var type = BattleFruitManager.getInstance().openType;
Global.netProxy.sendRequest(GameConfig.SERVER_PATH + "pet/get-battle-info", { be_user_id: this.id, type: type }, this.onGetBattleInfo.bind(this));
}
var self = this;
egret.setTimeout(function () { self.isSendReq = true; }, this, 2000);
}
onGetBattleInfo(response) {
if (response.status == 0) {
if (BattleFruitManager.getInstance().openType == 1) {
if (response.data.be_pet == null) {
game.AppFacade.getInstance().sendNotification(ClientNotify.GO_OTHER_FARM, { uid: response.data.be_user.user_id });
game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_FRIEND);
} else {
var petConfig = getSportsBattlePetConfig(response.data.from_pet.pet_config_id);
if (!(GuideManager.getInsatance().target == 8 && GuideManager.getInsatance().step == 0 && GuideManager.getInsatance().isShowGuide == 1)) {
if (petConfig.hunger > response.data.from_pet.feed) return void TipsUtils.showTipsDownToUp("宠物饥饿度不足");
}
BattleFruitManager.getInstance().initanimalData(response.data);
this.showViewComponent();
game.AppFacade.instance.sendNotification(SceneNotify.CLOSE_GAME);
game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_FRIEND);
}
} else {
var petConfig2 = getSportsBattlePetConfig(response.data.from_pet.pet_config_id);
if (!(GuideManager.getInsatance().target == 8 && GuideManager.getInsatance().step == 0 && GuideManager.getInsatance().isShowGuide == 1)) {
if (petConfig2.hunger > response.data.from_pet.feed) return void TipsUtils.showTipsDownToUp("宠物饥饿度不足");
}
BattleFruitManager.getInstance().initanimalData(response.data);
this.showViewComponent();
game.AppFacade.instance.sendNotification(SceneNotify.CLOSE_GAME);
game.AppFacade.instance.sendNotification(PanelNotify.CLOSE_SPORTS);
}
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[response.status]);
}
initUI() {}
initData() {}
onResourceLoadComplete(event) {
if (event.groupName == this.GroupName) {
RES.removeEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
RES.removeEventListener(RES.ResourceEvent.GROUP_LOAD_ERROR, this.onResourceLoadError, this);
RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
LoadingCompoment.getInstance().hide();
this.showPre();
}
}
onResourceLoadError(event) {
console.warn("Group:" + event.groupName + " has failed to load");
this.onResourceLoadComplete(event);
}
onResourceProgress(event) {
if (event.groupName == this.GroupName) LoadingCompoment.getInstance().prossBar.setPross(event.itemsLoaded, event.itemsTotal);
}
};
BattlePetSenceMediator.NAME = "BattlePetSenceMediator";
__reflect(BattlePetSenceMediator.prototype, "BattlePetSenceMediator");
(function () {
game.WorldSportsPanel = SportPanel;
game.WorldSportsMediator = SportsMeditor;
__reflect(SportPanel.prototype, "game.WorldSportsPanel");
__reflect(SportsMeditor.prototype, "game.WorldSportsMediator");
})();