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

1178 lines
38 KiB
JavaScript

var game;
!(function (game) {
const AlertMediator = class AlertMediator extends BaseMediator {
constructor(t = null) {
super(AlertMediator.NAME, t);
this.alertInterval = null;
this.alertWaiting = null;
this.runningAlert = null;
}
listNotificationInterests() {
return [PanelNotify.OPEN_ALERT, PanelNotify.CLOSE_ALERT];
}
onRegister() {
(super.onRegister(), this.startInterVal(), (this.alertWaiting = []), (Global.alertMediator = this));
}
showViewComponent(e = 6) {
((this.viewComponent = new game.AlertPanel(this.runningAlert)), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_ALERT:
const e = t.getBody();
(this.alertWaiting || (this.alertWaiting = []),
this.alertWaiting.push(e),
this.alertInterval || this.startInterVal());
break;
case PanelNotify.CLOSE_ALERT:
((this.runningAlert = null), this.closeViewComponent(1));
}
}
startInterVal() {
const t = this;
this.alertInterval = setInterval(function () {
t.checkHasAlert();
}, 100);
}
addAlert(t, e = null, i = null, n = !0) {
(n || (n = !1),
this.sendNotification(PanelNotify.OPEN_ALERT, {
tips: t,
okCallback: e,
noCallback: i,
onlyOkBtn: n
}));
}
checkHasAlert() {
if (!this.runningAlert) {
if (!this.alertWaiting || this.alertWaiting.length < 1)
return (clearInterval(this.alertInterval), void (this.alertInterval = null));
((this.runningAlert = this.alertWaiting.shift()), this.showViewComponent(2));
}
}
initUI() {}
initData() {}
static NAME = "AlertMediator";
};
((game.AlertMediator = AlertMediator), __reflect(AlertMediator.prototype, "game.AlertMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const BagMediator = class BagMediator extends BaseMediator {
constructor() {
super("BagMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_BAG, PanelNotify.CLOSE_BAG];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7, i) {
((this.viewComponent = new game.BagPanel(i)), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_BAG:
const e = t.getBody().type;
this.showViewComponent(10, e);
break;
case PanelNotify.CLOSE_BAG:
this.closeViewComponent(10);
}
}
static NAME = "BagMediator";
};
((game.BagMediator = BagMediator), __reflect(BagMediator.prototype, "game.BagMediator"));
})(game || (game = {}));
var GameConfig;
!(function (GameConfig) {
const ServerCode = class ServerCode {
constructor() {}
};
ServerCode[0] = "操作成功";
ServerCode[1] = "操作失败";
ServerCode[2] = "参数解析异常";
ServerCode[3] = "命令类型错误";
ServerCode[4] = "未知异常";
ServerCode[5] = "帐号已经被禁用";
ServerCode[6] = "帐号或者密码错误";
ServerCode[7] = "您的帐号在其他地方登录,请重新登录!";
ServerCode[12] = "帐号或者密码错误";
ServerCode[13] = "帐号或者密码错误";
ServerCode[14] = "注册失败";
ServerCode[15] = "帐号或者密码错误";
ServerCode[1001] = "帐号已经被注册";
ServerCode[1002] = "缺少token";
ServerCode[1003] = "不存在的数据";
ServerCode[1004] = "金币不够";
ServerCode[1005] = "发送数据参数错误";
ServerCode[1007] = "参数错误";
ServerCode[1008] = "农田上已经有农作物";
ServerCode[1009] = "当前等级不足";
ServerCode[1010] = "系统错误";
ServerCode[1011] = "你没有这个物品";
ServerCode[1012] = "物品数量不够";
ServerCode[1013] = "该物品不能购买多个";
ServerCode[1014] = "物品类型错误";
ServerCode[1015] = "农田上没有种植种子";
ServerCode[1016] = "尚未成熟";
ServerCode[1017] = "你已经收割过该农作物";
ServerCode[1018] = "农田不需要清理";
ServerCode[1019] = "农作物已经成熟";
ServerCode[1020] = "操作错误";
ServerCode[1021] = "系统错误";
ServerCode[1022] = "你已经添加过TA了";
ServerCode[1023] = "这个好友请求已经回复过你";
ServerCode[1024] = "没有可偷取的数量";
ServerCode[1025] = "请等待好友的回复";
ServerCode[1026] = "你已经偷过了,给主人留一点吧";
ServerCode[1027] = "你已经放过虫了";
ServerCode[1028] = "你已经放过草了";
ServerCode[1029] = "你已经浇过水了";
ServerCode[1030] = "你已经帮主人除过虫";
ServerCode[1031] = "你已经帮主人除过草";
ServerCode[1032] = "手机号码错误";
ServerCode[1033] = "系统错误";
ServerCode[1034] = "转赠用户不存在";
ServerCode[1035] = "操作太快";
ServerCode[1036] = "转赠用户不在线";
ServerCode[1037] = "发布消息信息错误";
ServerCode[1038] = "支付密码错误";
ServerCode[1039] = "请等待对方确认";
ServerCode[1040] = "你没有购买宠物";
ServerCode[1041] = "等级已经满了";
ServerCode[1042] = "自己不能给自己交易";
ServerCode[1043] = "服务器系统错误";
ServerCode[1044] = "施肥已经到达上限";
ServerCode[1045] = "施肥时间错误";
ServerCode[1046] = "你们不是好友";
ServerCode[1047] = "土地等级不够,无法种植该植物";
ServerCode[1048] = "验证码错误";
ServerCode[1049] = "发送验证码失败";
ServerCode[1050] = "用户不存在或者被禁用";
ServerCode[1051] = "推荐码错误";
ServerCode[1052] = "钻石不够";
ServerCode[1058] = "已升到满级";
GameConfig.ServerCode = ServerCode;
__reflect(ServerCode.prototype, "GameConfig.ServerCode");
})(GameConfig || (GameConfig = {}));
var game;
!(function (game) {
const DogMediator = class DogMediator extends BaseMediator {
constructor() {
super("DogMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_DOG, PanelNotify.CLOSE_DOG];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.DogPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_DOG:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_DOG:
this.closeViewComponent(1);
}
}
static NAME = "DogMediator";
};
((game.DogMediator = DogMediator), __reflect(DogMediator.prototype, "game.DogMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const ExGoldMediator = class ExGoldMediator extends BaseMediator {
constructor() {
super("ExGoldMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_EXGOLD, PanelNotify.CLOSE_EXGOLD];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.ExGoldPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_EXGOLD:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_EXGOLD:
this.closeViewComponent(1);
}
}
static NAME = "ExGoldMediator";
};
((game.ExGoldMediator = ExGoldMediator), __reflect(ExGoldMediator.prototype, "game.ExGoldMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const FindPasswordMediator = class FindPasswordMediator extends BaseMediator {
constructor() {
super("FindPasswordMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_FIND_PASSWORD, PanelNotify.CLOSE_FIND_PASSWORD];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.FindPasswordScene()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = this;
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_FIND_PASSWORD:
let i = Global.playerProxy.uuid;
"" == i && ((i = egret.getTimer().toString()), (Global.playerProxy.uuid = i), (i = Global.playerProxy.uuid));
const n = GameConfig.SERVER_PATH + "user/get-code-image";
Global.netProxy.sendRequest(
n,
{
uuid: i
},
function (t) {
if (0 == t.status) {
const i = t.data,
n = i.split(",")[1];
return ((Global.playerProxy.imgstr = n), void e.showViewComponent(7));
}
}
);
break;
case PanelNotify.CLOSE_FIND_PASSWORD:
this.closeViewComponent(1);
}
}
static NAME = "FindPasswordMediator";
};
((game.FindPasswordMediator = FindPasswordMediator),
__reflect(FindPasswordMediator.prototype, "game.FindPasswordMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const HelpMediator = class HelpMediator extends BaseMediator {
constructor() {
super("HelpMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_HELP, PanelNotify.CLOSE_HELP];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7, i) {
((this.viewComponent = new game.HelpPanel(i)), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_HELP:
this.showViewComponent(7, e.textId);
break;
case PanelNotify.CLOSE_HELP:
this.closeViewComponent(1);
}
}
static NAME = "HelpMediator";
};
((game.HelpMediator = HelpMediator), __reflect(HelpMediator.prototype, "game.HelpMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const HouseUpgradeMediator = class HouseUpgradeMediator extends BaseMediator {
constructor() {
super("HouseUpgradeMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_HOUSEUPGRADE, PanelNotify.CLOSE_HOUSEUPGRADE, ClientNotify.UPGREADE_HOUSE];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.HouseUpgradePanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_HOUSEUPGRADE:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_HOUSEUPGRADE:
this.closeViewComponent(1);
break;
case ClientNotify.UPGREADE_HOUSE:
this.houseUpgrade(e.upgradeData);
}
}
houseUpgrade(e) {
const i = GameConfig.SERVER_PATH + "farm/upgrade",
n = this;
Global.netProxy.sendRequest(i, {}, function (i) {
if (0 === i.status) {
PopUpManager.popTip("房屋升级");
(game.CostUtils.applyCostDeduction(e.items),
(Global.playerProxy.playerData.exp += e.add_exp),
TipsUtils.showTipsDownToUp("增加经验" + e.add_exp + "点"),
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE),
game.EventManager.instance.dispatch(
SysNotify.USER_HOUSE_CHANGE,
Global.playerProxy.playerData.farm_level + 1
),
n.viewComponent.flushPanel());
} else TipsUtils.showErrorCodeTips(i.status);
});
}
static NAME = "HouseUpgradeMediator";
};
((game.HouseUpgradeMediator = HouseUpgradeMediator),
__reflect(HouseUpgradeMediator.prototype, "game.HouseUpgradeMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const LandExtendMediator = class LandExtendMediator extends BaseMediator {
constructor() {
super("LandExtendMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_LANDEXTEND, PanelNotify.CLOSE_LANDEXTEND, ClientNotify.LAND_EXTEND];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.LandExtendPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_LANDEXTEND:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_LANDEXTEND:
this.closeViewComponent(1);
break;
case ClientNotify.LAND_EXTEND:
const i = e.gold;
this.extendLand(i);
}
}
extendLand(e) {
const i = GameConfig.SERVER_PATH + "farm/extend-land",
n = Global.playerProxy.playerData,
a = this;
Global.netProxy.sendRequest(i, {}, function (i) {
(0 === i.status
? ((n.gold -= e),
Global.playerProxy.updateLandData(i.data.position, i.data),
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE),
PopUpManager.popTip("扩建土地成功"))
: TipsUtils.showTipsDownToUp(GameConfig.ServerCode[i.status]),
a.closeViewComponent(10));
});
}
static NAME = "LandExtendMediator";
};
((game.LandExtendMediator = LandExtendMediator), __reflect(LandExtendMediator.prototype, "game.LandExtendMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const LandUpgradeMediator = class LandUpgradeMediator extends BaseMediator {
constructor() {
super("LandUpgradeMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_LAND_UPGRADE, PanelNotify.CLOSE_LAND_UPGRADE, ClientNotify.LAND_UPGRADE];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.LandUpgradePanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_LAND_UPGRADE:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_LAND_UPGRADE:
this.closeViewComponent(1);
break;
case ClientNotify.LAND_UPGRADE:
this.landUpgrade(e);
}
}
landUpgrade(e) {
const i = GameConfig.SERVER_PATH + "farm/upgrade-land",
n = Global.playerProxy.playerData,
a = this,
o = e.landData;
Global.netProxy.sendRequest(
i,
{
level: e.level
},
function (e) {
if (0 === e.status) {
(game.CostUtils.applyCostDeduction(o.items),
Global.playerProxy.updateLandData(e.data.position, e.data),
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE),
PopUpManager.popTip("升级成功"),
a.viewComponent.flushPanel());
} else TipsUtils.showTipsDownToUp(GameConfig.ServerCode[e.status]);
}
);
}
static NAME = "LandUpgradeMediator";
};
((game.LandUpgradeMediator = LandUpgradeMediator),
__reflect(LandUpgradeMediator.prototype, "game.LandUpgradeMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const LogMediator = class LogMediator extends BaseMediator {
constructor() {
super("LogMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_LOG, PanelNotify.CLOSE_LOG];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.LogPanel()),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
getPlayerLogList(t, e, i) {
const n = GameConfig.SERVER_PATH + "comm/get-user-log";
Global.netProxy.sendRequest(
n,
{
offset: t,
count: e
},
function (t) {
i && i(t.data);
}
);
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_LOG:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_LOG:
this.closeViewComponent(1);
}
}
clearLog(t) {
const e = GameConfig.SERVER_PATH + "comm/clean-user-log";
Global.netProxy.sendRequest(e, {}, function (e) {
0 == e.status ? t && t(e.data) : TipsUtils.showErrorCodeTips(e.data);
});
}
getSystemLogList(t, e, i) {
const n = GameConfig.SERVER_PATH + "comm/get-user-system-log";
Global.netProxy.sendRequest(
n,
{
offset: t,
count: e
},
function (t) {
0 == t.status ? i && i(t.data) : TipsUtils.showErrorCodeTips(t.data);
}
);
}
static NAME = "LogMediator";
};
((game.LogMediator = LogMediator), __reflect(LogMediator.prototype, "game.LogMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const LotteryMediator = class LotteryMediator extends BaseMediator {
constructor() {
super("LotteryMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_LOTTERY, PanelNotify.CLOSE_LOTTERY];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.LotteryPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_LOTTERY:
this.showViewComponent(10);
break;
case PanelNotify.CLOSE_LOTTERY:
this.closeViewComponent(10);
}
}
static NAME = "LotteryMediator";
};
((game.LotteryMediator = LotteryMediator), __reflect(LotteryMediator.prototype, "game.LotteryMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const NoticeMediator = class NoticeMediator extends BaseMediator {
constructor() {
super("NoticeMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_NOTICE, PanelNotify.CLOSE_NOTICE];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.NoticePanel()),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_NOTICE:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_NOTICE:
this.closeViewComponent(1);
}
}
getSystemNoticeList(t, e, i) {
const n = GameConfig.SERVER_PATH + "comm/get-notice-list";
Global.netProxy.sendRequest(
n,
{
offset: t,
count: e
},
function (t) {
0 == t.status ? i && i(t.data) : TipsUtils.showErrorCodeTips(t.data);
}
);
}
static NAME = "NoticeMediator";
};
((game.NoticeMediator = NoticeMediator), __reflect(NoticeMediator.prototype, "game.NoticeMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const PayMediator = class PayMediator extends BaseMediator {
constructor() {
super("PayMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_PAY, PanelNotify.CLOSE_PAY];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.PayPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_PAY:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_PAY:
this.closeViewComponent(1);
}
}
static NAME = "PayMediator";
};
((game.PayMediator = PayMediator), __reflect(PayMediator.prototype, "game.PayMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const PlayerInfoMediator = class PlayerInfoMediator extends BaseMediator {
constructor() {
super("PlayerInfoMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_PLAYER_INFO, PanelNotify.CLOSE_PLAYER_INFO];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.PlayerInfoPanel()),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_PLAYER_INFO:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_PLAYER_INFO:
this.closeViewComponent(1);
}
}
list(t, e, i, n) {
const a = GameConfig.SERVER_PATH + "user/get-rebate-list";
Global.netProxy.sendRequest(
a,
{
level: t,
offset: e,
count: i
},
function (t) {
n && n(t.data);
}
);
}
static NAME = "PlayerInfoMediator";
};
((game.PlayerInfoMediator = PlayerInfoMediator), __reflect(PlayerInfoMediator.prototype, "game.PlayerInfoMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const RegisterMediator = class RegisterMediator extends BaseMediator {
constructor() {
super("RegisterMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_REGIST, PanelNotify.CLOSE_REGIST];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.RegistPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = this;
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_REGIST:
let i = Global.playerProxy.uuid;
"" == i && ((i = egret.getTimer().toString()), (Global.playerProxy.uuid = i), (i = Global.playerProxy.uuid));
const n = GameConfig.SERVER_PATH + "user/get-code-image";
Global.netProxy.sendRequest(
n,
{
uuid: i
},
function (t) {
if (0 == t.status) {
const i = t.data,
n = i.split(",")[1];
return ((Global.playerProxy.imgstr = n), void e.showViewComponent(7));
}
}
);
break;
case PanelNotify.CLOSE_REGIST:
this.closeViewComponent(1);
}
}
static NAME = "RegisterMediator";
};
((game.RegisterMediator = RegisterMediator), __reflect(RegisterMediator.prototype, "game.RegisterMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const SendMesageMediator = class SendMesageMediator extends BaseMediator {
constructor() {
super("SendMesageMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_SEND_MESSAGE, PanelNotify.CLOSE_SEND_MESSAGE];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.SendMessagePanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_SEND_MESSAGE:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_SEND_MESSAGE:
this.closeViewComponent(1);
}
}
static NAME = "SendMesageMediator";
};
((game.SendMesageMediator = SendMesageMediator), __reflect(SendMesageMediator.prototype, "game.SendMesageMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const ShopMediator = class ShopMediator extends BaseMediator {
constructor() {
super("ShopMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_SHOP, PanelNotify.CLOSE_SHOP];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.ShopPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_SHOP:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_SHOP:
this.closeViewComponent(1);
}
}
buy(e, i) {
const n = GameConfig.SERVER_PATH + "store/buy",
a = Global.playerProxy.playerData,
o = e.gold,
r = e.diamond;
return o > a.gold
? void TipsUtils.showTipsDownToUp("购买失败:金币不足")
: r > a.gem
? void TipsUtils.showTipsDownToUp("购买失败:钻石不足,请充值!")
: new Promise(function (o, r) {
Global.netProxy.sendRequest(
n,
{
store_id: e.id,
num: i
},
function (i) {
(0 === i.status
? ((a.gold -= e.gold),
(a.gem -= e.diamond),
Global.playerProxy.updateWareHouseItem(i.data),
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE),
TipsUtils.showTipsDownToUp("购买成功"))
: TipsUtils.showTipsDownToUp(GameConfig.ServerCode[i.status]),
o(i.status));
}
);
});
}
static NAME = "ShopMediator";
};
((game.ShopMediator = ShopMediator), __reflect(ShopMediator.prototype, "game.ShopMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const SkinMediator = class SkinMediator extends BaseMediator {
constructor() {
super("SkinMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_SKIN, PanelNotify.CLOSE_SKIN];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.SkinPanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_SKIN:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_SKIN:
this.closeViewComponent(1);
}
}
changeSkin(e) {
const i = GameConfig.SERVER_PATH + "farm/change-bg",
n = Global.playerProxy.playerData;
Global.netProxy.sendRequest(
i,
{
item_id: e
},
function (i) {
0 === i.status
? ((n.bg_image_id = e), game.EventManager.instance.dispatch(SysNotify.USER_SKIN_CHANGE))
: TipsUtils.showErrorCodeTips(i.status);
}
);
}
static NAME = "SkinMediator";
};
((game.SkinMediator = SkinMediator), __reflect(SkinMediator.prototype, "game.SkinMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const WareHouseMediator = class WareHouseMediator extends BaseMediator {
constructor() {
super("WareHouseMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_WARE_HOUSE, PanelNotify.CLOSE_WARE_HOUSE];
}
onRegister() {
super.onRegister();
}
sellWareHouseItem(e, i, n) {
const a = this,
o = GameConfig.SERVER_PATH + "store-house/sell",
r = Global.playerProxy.playerData;
Global.netProxy.sendRequest(
o,
{
item_id: e.id,
num: i
},
function (o) {
0 === o.status
? ((r.gold += e.sellPrice * i),
Global.playerProxy.sellWareHouseItem(e, i),
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE),
TipsUtils.showTipsDownToUp("出售成功,获得" + e.sellPrice * i + "金币"),
a.viewComponent.flushList(),
n())
: TipsUtils.showErrorCodeTips(o.status);
}
);
}
showViewComponent(e = 7) {
((this.viewComponent = new game.WareHousePanel()), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_WARE_HOUSE:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_WARE_HOUSE:
this.closeViewComponent(1);
}
}
static NAME = "WareHouseMediator";
};
((game.WareHouseMediator = WareHouseMediator), __reflect(WareHouseMediator.prototype, "game.WareHouseMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const FriendAddMediator = class FriendAddMediator extends BaseMediator {
constructor() {
super("FriendAddMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_FRIEND_ADD, PanelNotify.CLOSE_FRIEND_ADD];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.FriendAddPanel()),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_FRIEND_ADD:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_FRIEND_ADD:
this.closeViewComponent(1);
}
}
addFriend(t) {
const e = this,
i = GameConfig.SERVER_PATH + "friend/add";
Global.netProxy.sendRequest(
i,
{
friend_user_id: t
},
function (t) {
0 === t.status
? (PopUpManager.popTip("申请发出成功"), e.closeViewComponent(1))
: TipsUtils.showErrorCodeTips(t.status);
}
);
}
static NAME = "FriendAddMediator";
};
((game.FriendAddMediator = FriendAddMediator), __reflect(FriendAddMediator.prototype, "game.FriendAddMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const FriendGiveListMediator = class FriendGiveListMediator extends BaseMediator {
constructor() {
super("FriendGiveListMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_FRIEND_GIVE_LIST, PanelNotify.CLOSE_FRIEND_GIVE_LIST];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7, i) {
((this.viewComponent = new game.FriendGiveListPanel(i)), this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_FRIEND_GIVE_LIST:
this.showViewComponent(7, e);
break;
case PanelNotify.CLOSE_FRIEND_GIVE_LIST:
this.closeViewComponent(1);
}
}
static NAME = "FriendGiveListMediator";
};
((game.FriendGiveListMediator = FriendGiveListMediator),
__reflect(FriendGiveListMediator.prototype, "game.FriendGiveListMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const FriendGiveMediator = class FriendGiveMediator extends BaseMediator {
constructor() {
super("FriendGiveMediator");
}
listNotificationInterests() {
return [
PanelNotify.CLOSE_FRIEND_GIVE,
PanelNotify.OPEN_FRIEND_GIVE,
ClientNotify.SHOW_CONFIRM_ALERT,
ClientNotify.GIVE_SUCCESS
];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.FriendGivePanel()),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
const e = t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_FRIEND_GIVE:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_FRIEND_GIVE:
this.closeViewComponent(1);
break;
case ClientNotify.SHOW_CONFIRM_ALERT:
this.showConfrimAlert(e);
break;
case ClientNotify.GIVE_SUCCESS:
this.giveSuccess(e);
}
}
giveSuccess(e) {
if ((PopUpManager.popTip("本次交易完成"), 0 == e.type))
((Global.playerProxy.playerData.gold += e.data.gold),
game.EventManager.instance.dispatch(SysNotify.TOPLAYER_INFO_UPDATE));
else {
const i = e.data.item_list;
i.forEach(function (t) {
Global.playerProxy.updateWareHouseItem(
{
item_id: t.item_id
},
t.num
);
});
}
game.EventManager.instance.dispatch(SysNotify.FLUSH_GROUP3);
}
showConfrimAlert(e) {
const i = "编号:" + e.deal_id + " " + e.from_user_nickname + " 给 " + e.be_user_nickname + " 的转赠";
Global.alertMediator.addAlert(
"是否确定本次交易---" + i,
function () {
const i = GameConfig.SERVER_PATH + "deal/deal-confirm",
n = {
deal_id: e.deal_id
};
game.SurePasswordPanel.instance.show(i, n, function (e) {
0 == e.status
? (game.EventManager.instance.dispatch(SysNotify.FLUSH_GROUP3),
PopUpManager.popTip("本次交易完成"),
game.AppFacade.getInstance().sendNotification(PanelNotify.CLOSE_FRIEND_GIVE_LIST))
: TipsUtils.showErrorCodeTips(e.status);
});
},
null,
!0
);
}
static NAME = "FriendGiveMediator";
};
((game.FriendGiveMediator = FriendGiveMediator), __reflect(FriendGiveMediator.prototype, "game.FriendGiveMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const FriendMediator = class FriendMediator extends BaseMediator {
constructor() {
super("FriendMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_FRIEND, PanelNotify.CLOSE_FRIEND, PanelNotify.HIDE_FRIEND, PanelNotify.SHOW_FRIEND];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7, i) {
((this.viewComponent = new game.FriendPanel(i)),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(e) {
const i = e.getBody();
switch (e.getName()) {
case PanelNotify.OPEN_FRIEND:
(this.showViewComponent(7, i.index),
this.facade.registerMediator(new game.FriendAddMediator()),
this.facade.registerMediator(new game.FriendReqMediator()));
break;
case PanelNotify.CLOSE_FRIEND:
(this.closeViewComponent(1),
this.facade.removeMediator(game.FriendAddMediator.NAME),
this.facade.removeMediator(game.FriendReqMediator.NAME));
break;
case PanelNotify.SHOW_FRIEND:
this.hideViewComponent(!0);
break;
case PanelNotify.HIDE_FRIEND:
this.hideViewComponent(!1);
}
}
getFriendList(t, e, i, n) {
const a = GameConfig.SERVER_PATH + "friend/friend-list",
o = {
type: t,
count: i,
offset: e * i
};
Global.netProxy.sendRequest(a, o, function (t) {
return 0 !== t.status ? void TipsUtils.showErrorCodeTips(t.status) : void (n && n(t.data));
});
}
getRankList(t, e, i, n) {
const a = GameConfig.SERVER_PATH + "comm/get-level-ranking",
o = {
type: t,
count: i,
offset: e * i
};
Global.netProxy.sendRequest(a, o, function (t) {
return 0 !== t.status ? void TipsUtils.showErrorCodeTips(t.status) : void (n && n(t.data));
});
}
static NAME = "FriendMediator";
};
((game.FriendMediator = FriendMediator), __reflect(FriendMediator.prototype, "game.FriendMediator"));
})(game || (game = {}));
var game;
!(function (game) {
const FriendReqMediator = class FriendReqMediator extends BaseMediator {
constructor() {
super("FriendReqMediator");
}
listNotificationInterests() {
return [PanelNotify.OPEN_FRIEND_ADD_REQ, PanelNotify.CLOSE_FRIEND_ADD_REQ];
}
onRegister() {
super.onRegister();
}
showViewComponent(e = 7) {
((this.viewComponent = new game.FriendAddReqPanel()),
(this.viewComponent.mediator = this),
this.showUI(this.viewComponent, !0, 0, 0, e));
}
handleNotification(t) {
t.getBody();
switch (t.getName()) {
case PanelNotify.OPEN_FRIEND_ADD_REQ:
this.showViewComponent(7);
break;
case PanelNotify.CLOSE_FRIEND_ADD_REQ:
this.closeViewComponent(1);
}
}
applyList(t, e, i) {
const n = GameConfig.SERVER_PATH + "friend/get-respond-list";
Global.netProxy.sendRequest(
n,
{
offset: t,
count: e
},
function (t) {
i && i(t.data);
}
);
}
applyAllReq(t, e) {
const i = this,
n = GameConfig.SERVER_PATH + "friend/respond-list";
Global.netProxy.sendRequest(
n,
{
type: t
},
function (e) {
return 0 == e.status
? (1 === t
? PopUpManager.popTip("通过了全部好友请求")
: 2 == t && PopUpManager.popTip("拒绝了全部通过请求"),
void i.closeViewComponent(1))
: void TipsUtils.showErrorCodeTips(e.status);
}
);
}
applyResult(t, e, i) {
const n = GameConfig.SERVER_PATH + "friend/respond",
a = {
type: t,
respond_user_id: e
};
Global.netProxy.sendRequest(n, a, function (e) {
return 0 == e.status
? (1 === t ? PopUpManager.popTip("通过了好友请求") : 2 == t && PopUpManager.popTip("拒绝了好友请求"),
void (i && i(e.data)))
: void TipsUtils.showErrorCodeTips(e.status);
});
}
static NAME = "FriendReqMediator";
};
((game.FriendReqMediator = FriendReqMediator), __reflect(FriendReqMediator.prototype, "game.FriendReqMediator"));
})(game || (game = {}));