1288 lines
42 KiB
JavaScript
1288 lines
42 KiB
JavaScript
var game;
|
||
!(function (game) {
|
||
const WidgetDog = class WidgetDog extends egret.Sprite {
|
||
constructor(t) {
|
||
super();
|
||
this.playerProxy = t;
|
||
}
|
||
showType(e) {
|
||
if (this.type !== e) {
|
||
this.type = e;
|
||
const i = DateTimer.instance.now,
|
||
n = this.playerProxy.playerData.dog_hunger_end_time;
|
||
(106001 === e
|
||
? ((this.mc = game.MCUtils.getMc("dog")), (this.mc.scaleX = 1), (this.mc.scaleY = 1))
|
||
: 106002 == e &&
|
||
(i >= n
|
||
? (this.mc = game.MCUtils.getMc("dog1", null, "hungry"))
|
||
: (this.mc = game.MCUtils.getMc("dog1", null, "idle")),
|
||
(this.mc.scaleX = 0.8),
|
||
(this.mc.scaleY = 0.8)),
|
||
this.addChild(this.mc));
|
||
}
|
||
}
|
||
changeDog() {
|
||
(egret.Tween.removeTweens(this.mc), game.UIUtils.removeSelf(this.mc));
|
||
const e = Global.playerProxy.playerData.use_dog_item_id;
|
||
(this.showType(e), this.runTypeAni());
|
||
}
|
||
runTypeAni() {
|
||
const t = this;
|
||
t.scaleX = 1;
|
||
const e = DateTimer.instance.now,
|
||
i = this.playerProxy.playerData.dog_hunger_end_time;
|
||
switch (this.type) {
|
||
case 106001:
|
||
if (((this.x = 125), (this.y = 60), (t.scaleX = -1), e >= i)) return;
|
||
(t.mc.gotoAndPlay("forward", -1),
|
||
egret.Tween.get(this, {
|
||
loop: !0
|
||
})
|
||
.to(
|
||
{
|
||
x: 455,
|
||
y: 195
|
||
},
|
||
5e3
|
||
)
|
||
.call(function () {
|
||
(t.mc.gotoAndPlay("back", -1), (t.scaleX = 1));
|
||
})
|
||
.to(
|
||
{
|
||
x: 125,
|
||
y: 60
|
||
},
|
||
5e3
|
||
)
|
||
.call(function () {
|
||
((t.scaleX = -1), t.mc.gotoAndPlay("forward", -1));
|
||
}));
|
||
break;
|
||
case 106002:
|
||
if (((this.x = 125), (this.y = 60), e >= i)) return void this.mc.gotoAndPlay("0", -1);
|
||
egret.Tween.get(this, {
|
||
loop: !0
|
||
})
|
||
.to(
|
||
{
|
||
x: 125,
|
||
y: 60
|
||
},
|
||
3e3
|
||
)
|
||
.call(function () {
|
||
t.mc.gotoAndPlay("1", -1);
|
||
})
|
||
.to(
|
||
{
|
||
x: 455,
|
||
y: 195
|
||
},
|
||
5e3
|
||
)
|
||
.call(function () {
|
||
t.mc.gotoAndPlay("3", -1);
|
||
})
|
||
.to(
|
||
{
|
||
x: 125,
|
||
y: 60
|
||
},
|
||
5e3
|
||
)
|
||
.call(function () {
|
||
t.mc.gotoAndPlay("4", -1);
|
||
})
|
||
.to(
|
||
{
|
||
x: 125,
|
||
y: 60
|
||
},
|
||
2e3
|
||
)
|
||
.call(function () {
|
||
t.mc.gotoAndPlay("0", -1);
|
||
});
|
||
}
|
||
}
|
||
};
|
||
((game.WidgetDog = WidgetDog), __reflect(WidgetDog.prototype, "game.WidgetDog"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const FriendData = class FriendData {
|
||
constructor(t) {
|
||
this.uid = t.user_id;
|
||
this.lv = t.level;
|
||
this.gold = t.gold;
|
||
this.name = t.nickname;
|
||
this.rank = t.ranking;
|
||
this.hasInteraction = t.has_interaction;
|
||
}
|
||
};
|
||
((game.FriendData = FriendData), __reflect(FriendData.prototype, "game.FriendData"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const FriendGiveItemRender = class FriendGiveItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.exNum = 0;
|
||
this.skinName = new FriendGiveItemSkin();
|
||
}
|
||
createChildren() {
|
||
(super.createChildren(),
|
||
(this.inpNum.text = this.exNum + ""),
|
||
this.inpNum.addEventListener(egret.Event.FOCUS_OUT, this.onNumInpChange, this));
|
||
}
|
||
onNumInpChange() {
|
||
((this.exNum = int(this.inpNum.text)),
|
||
(this.exNum = game.Utils.limit(this.exNum, 0, Math.floor(this.itemData.number / 100))),
|
||
(this.inpNum.text = this.exNum + ""));
|
||
}
|
||
dataChanged() {
|
||
((this.itemData = this.data),
|
||
(this.imageIcon.source = game.URLConfig.getIcon(this.itemData.config.icon)),
|
||
(this.labelNum.text = this.itemData.number + ""),
|
||
(this.inpNum.text = this.exNum + ""));
|
||
}
|
||
onTouchTap(t) {
|
||
switch ((t.stopPropagation(), t.target)) {
|
||
case this.addBtn:
|
||
var e = Math.floor(this.itemData.number / 100);
|
||
if (1 > e) return void PopUpManager.popTip("果实不足,果实转赠一手单位为100个");
|
||
this.changeExNumber(1);
|
||
break;
|
||
case this.subBtn:
|
||
var e = Math.floor(this.itemData.number / 100);
|
||
if (1 > e) return void PopUpManager.popTip("果实不足,果实转赠一手单位为100个");
|
||
this.changeExNumber(-1);
|
||
}
|
||
}
|
||
changeExNumber(e) {
|
||
((this.exNum += e),
|
||
(this.exNum = game.Utils.limit(this.exNum, 0, Math.floor(this.itemData.number / 100))),
|
||
(this.inpNum.text = this.exNum + ""));
|
||
}
|
||
};
|
||
((game.FriendGiveItemRender = FriendGiveItemRender),
|
||
__reflect(FriendGiveItemRender.prototype, "game.FriendGiveItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const FriendGiveNoComRender = class FriendGiveNoComRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new FriendGiveNoCompleteSkin();
|
||
}
|
||
createChildren() {
|
||
super.createChildren();
|
||
}
|
||
onTouchTap(e) {
|
||
(e.stopPropagation(),
|
||
game.AppFacade.getInstance().sendNotification(PanelNotify.OPEN_FRIEND_GIVE_LIST, this.data));
|
||
}
|
||
dataChanged() {
|
||
const t = this.data.from_user_nickname,
|
||
e = 0 == this.data.type ? "金币转赠" : "果实转赠",
|
||
i = this.data.deal_id,
|
||
n = "编号:" + i + " " + t + " 给 " + this.data.be_user_nickname + " 的" + e;
|
||
this.labelContent.text = n;
|
||
}
|
||
};
|
||
((game.FriendGiveNoComRender = FriendGiveNoComRender),
|
||
__reflect(FriendGiveNoComRender.prototype, "game.FriendGiveNoComRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const FriendItemRender = class FriendItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new FriendRankItemSkin();
|
||
}
|
||
createChildren() {
|
||
super.createChildren();
|
||
}
|
||
dataChanged() {
|
||
const t = this.data;
|
||
((this.friendData = t),
|
||
t.rank <= 3
|
||
? ((this.imgRank.visible = !0),
|
||
(this.labelRank.visible = !1),
|
||
(this.imgRank.source = "rank" + t.rank + "_png"))
|
||
: ((this.imgRank.visible = !1), (this.labelRank.visible = !0), (this.labelRank.text = t.rank + "")),
|
||
(this.labelName.text = t.name.length > 7 ? t.name.substr(0, 7) + "..." : t.name),
|
||
1 == Const.RANK_SHOW_TYPE ? (this.labelLv.text = t.lv + "") : (this.labelLv.text = t.gold + ""),
|
||
t.uid != Global.playerProxy.playerData.id && t.hasInteraction
|
||
? (this.btnHand.visible = !0)
|
||
: (this.btnHand.visible = !1));
|
||
}
|
||
onTouchTap(e) {
|
||
const i = e.target;
|
||
(i == this.btnHome || i == this.btnHand) &&
|
||
(this.friendData.uid == Global.playerProxy.playerData.id
|
||
? PopUpManager.popTip("这是你的农场,不用去啦!")
|
||
: game.AppFacade.getInstance().sendNotification(ClientNotify.GO_OTHER_FARM, {
|
||
uid: this.friendData.uid
|
||
}));
|
||
}
|
||
};
|
||
((game.FriendItemRender = FriendItemRender), __reflect(FriendItemRender.prototype, "game.FriendItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const FriendReqItemRender = class FriendReqItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new FriendReqItemSkin();
|
||
}
|
||
createChildren() {
|
||
super.createChildren();
|
||
}
|
||
dataChanged() {
|
||
const t = this.data;
|
||
((this.labelName.text = t.name.length > 6 ? t.name.substr(0, 7) + "..." : t.name),
|
||
(this.labelLv.text = t.lv + ""),
|
||
(this.labelMoney.text = t.gold + ""));
|
||
}
|
||
onTouchTap(e) {
|
||
const i = game.AppFacade.getInstance().retrieveMediator(game.FriendReqMediator.NAME);
|
||
const n = this.data;
|
||
const a = e.target;
|
||
let o = 2;
|
||
(a == this.btnOk && (o = 1), i.applyResult(o, n.uid, this.dealOver.bind(this)));
|
||
}
|
||
dealOver() {
|
||
game.EventManager.instance.dispatch(SysNotify.FRIEND_DEAL_OVER, this.data);
|
||
}
|
||
};
|
||
((game.FriendReqItemRender = FriendReqItemRender),
|
||
__reflect(FriendReqItemRender.prototype, "game.FriendReqItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ItemData = class ItemData {
|
||
constructor(t, e) {
|
||
const i = Global.gameProxy.getItemConfig(t);
|
||
i && (this.chageConfigToHasContent(i), (this.number = e));
|
||
}
|
||
chageConfigToHasContent(t) {
|
||
const e = {};
|
||
((e.id = t.id),
|
||
(e.type = t.type1),
|
||
(e.smallType = t.type2),
|
||
(e.name = t.name),
|
||
(e.lv = t.player_level),
|
||
(e.icon = t.graphical_id),
|
||
(e.desc = t.desc),
|
||
(e.sellPrice = t.sell_gold),
|
||
(e.effect = t.effect_id),
|
||
(this.config = e));
|
||
}
|
||
};
|
||
((game.ItemData = ItemData), __reflect(ItemData.prototype, "game.ItemData"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ItemTip = class ItemTip extends eui.Component {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new GoodsTipSkin();
|
||
}
|
||
static show(e, n) {
|
||
let a = ItemTip._instance;
|
||
a || ((a = new ItemTip()), (ItemTip._instance = a));
|
||
const o = game.URLConfig.getIcon(e.config.icon);
|
||
(RES.getResByUrl(
|
||
o,
|
||
function (t) {
|
||
a.imgIcon.source = o;
|
||
const e = t.textureWidth,
|
||
i = t.textureHeight;
|
||
if (e > 70 || i > 70) {
|
||
const n = Math.min(70 / e, 70 / i);
|
||
a.imgIcon.scaleX = a.imgIcon.scaleY = n;
|
||
}
|
||
},
|
||
this
|
||
),
|
||
(a.labelName.text = e.config.name),
|
||
(a.labelDesc.text = e.config.desc),
|
||
egret.callLater(function () {
|
||
((a.anchorOffsetX = a.width / 2), (a.anchorOffsetY = a.height / 2));
|
||
let t = n.x,
|
||
e = n.y - a.height / 2 - 16;
|
||
(n.x < a.width / 2 ? (t = a.width / 2) : n.x > Const.WIN_W - a.width / 2 && (t = Const.WIN_W - a.width / 2),
|
||
n.y < 0.2 * Const.WIN_H && (e = n.y + a.height / 2 + 20),
|
||
(a.x = t),
|
||
(a.y = e));
|
||
}, this),
|
||
(a.scaleX = a.scaleY = 0),
|
||
GameLayerManager.instance.tipLayer.addChild(a),
|
||
egret.Tween.get(a).to(
|
||
{
|
||
scaleX: 1,
|
||
scaleY: 1
|
||
},
|
||
150
|
||
));
|
||
}
|
||
static hide() {
|
||
const e = ItemTip._instance;
|
||
e &&
|
||
egret.Tween.get(e)
|
||
.to(
|
||
{
|
||
scaleX: 0,
|
||
scaleY: 0
|
||
},
|
||
150
|
||
)
|
||
.call(game.UIUtils.removeSelf, e, [e]);
|
||
}
|
||
};
|
||
((game.ItemTip = ItemTip), __reflect(ItemTip.prototype, "game.ItemTip"));
|
||
})(game || (game = {}));
|
||
var ItemType;
|
||
!(function (ItemType) {
|
||
((ItemType[(ItemType.SEED = 1)] = "SEED"),
|
||
(ItemType[(ItemType.FRUIT = 2)] = "FRUIT"),
|
||
(ItemType[(ItemType.PROPS = 3)] = "PROPS"),
|
||
(ItemType[(ItemType.DOG = 4)] = "DOG"));
|
||
})(ItemType || (ItemType = {}));
|
||
var SmallType;
|
||
!(function (SmallType) {
|
||
((SmallType[(SmallType.MANURE = 3)] = "MANURE"),
|
||
(SmallType[(SmallType.DOG_FOOD = 4)] = "DOG_FOOD"),
|
||
(SmallType[(SmallType.RE_SIGN = 5)] = "RE_SIGN"),
|
||
(SmallType[(SmallType.DOG = 6)] = "DOG"),
|
||
(SmallType[(SmallType.MAGIC_FRUIT = 10)] = "MAGIC_FRUIT"),
|
||
(SmallType[(SmallType.CRYSTAL = 11)] = "CRYSTAL"),
|
||
(SmallType[(SmallType.SKIN = 990)] = "SKIN"),
|
||
(SmallType[(SmallType.CURRENCY = 1e3)] = "CURRENCY"));
|
||
})(SmallType || (SmallType = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const LandData = class LandData {
|
||
constructor(t, e) {
|
||
this.landLv = 0;
|
||
this.status = -1;
|
||
this.cropNum = 0;
|
||
this.landId = t;
|
||
this.updateData(e);
|
||
}
|
||
updateData(t) {
|
||
t &&
|
||
((this.landLv = t.level),
|
||
this.setPlantId(t.crop_id),
|
||
(this.cropNum = t.crop_num),
|
||
(this.stateBug = t.has_bug),
|
||
(this.stateGrass = t.has_grass),
|
||
(this.stateDry = t.has_dry),
|
||
(this.stateGather = t.has_gather),
|
||
(this.plantGatherTime = t.crop_gather_time),
|
||
(this.plantStartTime = t.crop_start_time),
|
||
(this.is_mystery_seed = t.is_mystery_seed),
|
||
this.setStatus());
|
||
}
|
||
setStatus() {
|
||
if (this.plantId < 1) return void (this.status = -1);
|
||
if (1 == this.stateGather) return void (this.status = game.PlantStatus.die);
|
||
if (this.plantStartTime === this.plantGatherTime) return void (this.status = game.PlantStatus.ripe);
|
||
const e = DateTimer.instance.now,
|
||
i = e - this.plantStartTime,
|
||
n = this.plantConfig.time3,
|
||
a = this.plantConfig.time2,
|
||
o = this.plantConfig.time1;
|
||
o > i
|
||
? (this.status = game.PlantStatus.seed)
|
||
: i >= o && o + a > i
|
||
? (this.status = game.PlantStatus.seeding)
|
||
: i >= o + a && o + a + n > i
|
||
? (this.status = game.PlantStatus.growup)
|
||
: (this.status = game.PlantStatus.ripe);
|
||
}
|
||
setPlantId(t) {
|
||
((this.plantId = t),
|
||
t > 0 &&
|
||
((this.plantConfig = Global.gameProxy.getPlantConfig(t)),
|
||
(this.plantName = this.plantConfig.name),
|
||
(this.plantAllStatusTime = [this.plantConfig.time1, this.plantConfig.time2, this.plantConfig.time3])));
|
||
}
|
||
get currPhaseTotalTime() {
|
||
return this.status < 3 ? 1e3 * this.plantAllStatusTime[this.status] : -1;
|
||
}
|
||
get currPhaseRunTime() {
|
||
for (var t = DateTimer.instance.now - this.plantStartTime, e = 0, i = 0; i < this.status; i++)
|
||
e += this.plantAllStatusTime[i];
|
||
return 1e3 * (t - e);
|
||
}
|
||
get currPhaseNeedTime() {
|
||
let t = this.currPhaseTotalTime - this.currPhaseRunTime;
|
||
return (0 > t && (t = 0), t);
|
||
}
|
||
};
|
||
((game.LandData = LandData), __reflect(LandData.prototype, "game.LandData"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const PlantConfig = class PlantConfig {
|
||
constructor(t = {}) {
|
||
this.id = int(t.id);
|
||
this.name = t.name || "未知作物" + this.id;
|
||
this.g1 = t.seedling_id || 1011;
|
||
this.g2 = t.grow_id || 1012;
|
||
this.g3 = t.ripe_id || 1013;
|
||
this.time1 = int(t.seedling_time);
|
||
this.time2 = int(t.grow_time);
|
||
this.time3 = int(t.ripe_time);
|
||
this.outputId = t.item_id || 102001;
|
||
}
|
||
};
|
||
((game.PlantConfig = PlantConfig), __reflect(PlantConfig.prototype, "game.PlantConfig"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const PlantStatus = game.PlantStatus || (game.PlantStatus = {});
|
||
PlantStatus[(PlantStatus.empty = -1)] = "empty";
|
||
PlantStatus[(PlantStatus.seed = 0)] = "seed";
|
||
PlantStatus[(PlantStatus.seeding = 1)] = "seeding";
|
||
PlantStatus[(PlantStatus.growup = 2)] = "growup";
|
||
PlantStatus[(PlantStatus.ripe = 3)] = "ripe";
|
||
PlantStatus[(PlantStatus.die = 4)] = "die";
|
||
const PlantStatusCode = class PlantStatusCode {
|
||
constructor() {}
|
||
static getName(t) {
|
||
let statusName = "";
|
||
switch (t) {
|
||
case PlantStatus.empty:
|
||
break;
|
||
case PlantStatus.seed:
|
||
statusName = "种子期";
|
||
break;
|
||
case PlantStatus.seeding:
|
||
statusName = "发芽期";
|
||
break;
|
||
case PlantStatus.growup:
|
||
statusName = "生长期";
|
||
break;
|
||
case PlantStatus.ripe:
|
||
statusName = "成熟期";
|
||
break;
|
||
case PlantStatus.die:
|
||
statusName = "枯萎";
|
||
}
|
||
return statusName;
|
||
}
|
||
};
|
||
((game.PlantStatusCode = PlantStatusCode), __reflect(PlantStatusCode.prototype, "game.PlantStatusCode"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const WidgetLand = class WidgetLand extends eui.Group {
|
||
constructor(t) {
|
||
super();
|
||
this.lastResURL = "";
|
||
this.landData = t;
|
||
this.touchChildren = this.touchEnabled = !1;
|
||
this.touchThrough = !0;
|
||
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAdded, this);
|
||
this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this);
|
||
this.init();
|
||
}
|
||
onRemoved(e) {
|
||
game.UIUtils.removeSelf(this.stateGroup);
|
||
}
|
||
init() {
|
||
(this.renderContent(), GameLayerManager.instance.plantStateLayer.addChild(this.stateGroup));
|
||
}
|
||
setDisease(e) {
|
||
if (
|
||
(this.stateGroup.removeChildren(),
|
||
game.Utils.isElinArr(this.landData.status, [
|
||
game.PlantStatus.seed,
|
||
game.PlantStatus.growup,
|
||
game.PlantStatus.seeding
|
||
]))
|
||
) {
|
||
for (var i = e.length, n = 0; i > n; n++) {
|
||
const a = new eui.Image("plant_state" + e[n] + "_png");
|
||
((a.x = 33 * n), 3 == i && 1 == n && (a.y = -10), this.stateGroup.addChild(a));
|
||
}
|
||
const o = 33 * i;
|
||
((this.stateGroup.x = this.x - o / 2 - 13),
|
||
this.landData.status == game.PlantStatus.growup
|
||
? (this.stateGroup.y = -100 + this.y)
|
||
: (this.stateGroup.y = -70 + this.y));
|
||
}
|
||
}
|
||
updateDisease() {
|
||
const t = [];
|
||
(this.landData.stateGrass && t.push(1),
|
||
this.landData.stateBug && t.push(2),
|
||
this.landData.stateDry && t.push(3),
|
||
this.setDisease(t));
|
||
}
|
||
onNextPhaseTimerOver(e) {
|
||
(this.landData.status == game.PlantStatus.seed
|
||
? (this.landData.status = game.PlantStatus.seeding)
|
||
: this.landData.status == game.PlantStatus.seeding
|
||
? (this.landData.status = game.PlantStatus.growup)
|
||
: this.landData.status == game.PlantStatus.growup && (this.landData.status = game.PlantStatus.ripe),
|
||
this.changeData(this.landData));
|
||
}
|
||
changeData(t) {
|
||
((this.landData = t), this.renderContent());
|
||
}
|
||
onAdded(t) {
|
||
GameLayerManager.instance.plantStateLayer.addChild(this.stateGroup);
|
||
}
|
||
renderContent() {
|
||
const e = this,
|
||
i = this.landData;
|
||
this.plantImage ||
|
||
((this.landImage = new eui.Image(RES.getRes("land_manure_png"))),
|
||
(this.landImage.x = -Const.LAND_HALF_W),
|
||
(this.landImage.y = -Const.LAND_HALF_H),
|
||
this.addChild(this.landImage),
|
||
(this.landImage.visible = !1),
|
||
(this.plantImage = new eui.Image()),
|
||
this.addChild(this.plantImage),
|
||
(this.stateGroup = new eui.Group()),
|
||
(this.stateGroup.touchChildren = !1),
|
||
(this.stateGroup.touchEnabled = !1));
|
||
const n = game.URLConfig.getPlant(i.plantId, i.status);
|
||
(this.lastResURL != n &&
|
||
((this.lastResURL = n),
|
||
(this.plantImage.source = null),
|
||
RES.getResByUrl(
|
||
n,
|
||
function (n) {
|
||
e.plantImage.source = n;
|
||
const a = n.textureWidth,
|
||
o = n.textureHeight;
|
||
((e.plantImage.x = -a / 2 - 10),
|
||
i.status == game.PlantStatus.seed ? (e.plantImage.y = -o) : (e.plantImage.y = -o + 10),
|
||
(e.box = new egret.Rectangle(-a / 3, 0.75 * -o, 0.66 * a, 0.75 * o)));
|
||
},
|
||
this
|
||
)),
|
||
this.nextPhaseTimer && (this.nextPhaseTimer.reset(), this.nextPhaseTimer.stop()),
|
||
this.landData &&
|
||
game.Utils.isElinArr(this.landData.status, [
|
||
game.PlantStatus.seed,
|
||
game.PlantStatus.seeding,
|
||
game.PlantStatus.growup
|
||
]) &&
|
||
(this.nextPhaseTimer
|
||
? ((this.nextPhaseTimer.delay = this.landData.currPhaseNeedTime),
|
||
this.nextPhaseTimer.reset(),
|
||
(this.nextPhaseTimer.repeatCount = 1))
|
||
: ((this.nextPhaseTimer = new egret.Timer(this.landData.currPhaseNeedTime, 1)),
|
||
this.nextPhaseTimer.addEventListener(egret.TimerEvent.TIMER_COMPLETE, this.onNextPhaseTimerOver, this)),
|
||
this.nextPhaseTimer.start()));
|
||
}
|
||
getBoundingBox() {
|
||
return this.box
|
||
? (this.boundingBox
|
||
? ((this.boundingBox.x = this.box.x + this.x),
|
||
(this.boundingBox.y = this.box.y + this.y),
|
||
(this.boundingBox.width = this.box.width),
|
||
(this.boundingBox.height = this.box.height))
|
||
: (this.boundingBox = new egret.Rectangle(
|
||
this.box.x + this.x,
|
||
this.box.y + this.y,
|
||
this.box.width,
|
||
this.box.height
|
||
)),
|
||
this.boundingBox)
|
||
: null;
|
||
}
|
||
showReapAnim() {
|
||
const e = this,
|
||
i = game.URLConfig.getPlant(this.landData.plantId, game.PlantStatus.ripe),
|
||
n = new eui.Image(i);
|
||
(this.addChild(n),
|
||
RES.getResByUrl(
|
||
i,
|
||
function (i) {
|
||
n.source = i;
|
||
const a = i.textureWidth,
|
||
o = i.textureHeight;
|
||
((n.x = -a / 2 - 10),
|
||
(n.y = -o + 10),
|
||
egret.Tween.get(n)
|
||
.to(
|
||
{
|
||
y: n.y - 50,
|
||
alpha: 0
|
||
},
|
||
300
|
||
)
|
||
.call(game.UIUtils.removeSelf, e, [n]));
|
||
},
|
||
this
|
||
));
|
||
}
|
||
};
|
||
((game.WidgetLand = WidgetLand), __reflect(WidgetLand.prototype, "game.WidgetLand"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const LogData = class LogData {
|
||
constructor(t) {
|
||
this.uid = t.user_id;
|
||
this.buid = t.be_user_id;
|
||
this.name = t.be_user_nickname;
|
||
this.type = t.type;
|
||
this.time = t.time;
|
||
this.itemId = t.item_id;
|
||
this.itemNum = t.num;
|
||
}
|
||
toString() {
|
||
let t = TimeFormat.showDayOrDate(this.time);
|
||
return ((t += this.getUserName()), (t += this.getOptName()), (t += this.getItemValue()));
|
||
}
|
||
getUserName() {
|
||
return this.uid === Global.playerProxy.playerData.user_id ? " 我" : " " + this.name;
|
||
}
|
||
getItemValue() {
|
||
if (this.itemId) {
|
||
const t = Global.gameProxy.getItemConfig(this.itemId);
|
||
if (t) return this.itemNum ? t.name + (t.smallType == SmallType.SKIN ? "" : "x" + this.itemNum) : t.name;
|
||
}
|
||
return "";
|
||
}
|
||
getOptName() {
|
||
let t = "";
|
||
switch (this.type) {
|
||
case 0:
|
||
t = "购买";
|
||
break;
|
||
case 1:
|
||
t = "卖出";
|
||
break;
|
||
case 2:
|
||
t = "种植";
|
||
break;
|
||
case 3:
|
||
t = "收获";
|
||
break;
|
||
case 4:
|
||
t = "偷取了";
|
||
break;
|
||
case 5:
|
||
t = "对植物进行了施肥";
|
||
break;
|
||
case 6:
|
||
t = "进行了锄地";
|
||
break;
|
||
case 7:
|
||
t = "进行了土地升级";
|
||
break;
|
||
case 8:
|
||
t = "切换了农场风格";
|
||
break;
|
||
case 9:
|
||
t = "喂了狗狗";
|
||
break;
|
||
case 10:
|
||
t = "使坏放虫";
|
||
break;
|
||
case 11:
|
||
t = "使坏种草";
|
||
break;
|
||
case 12:
|
||
t = "对土地浇水";
|
||
break;
|
||
case 13:
|
||
t = "对植物除虫";
|
||
break;
|
||
case 14:
|
||
t = "对植物除草";
|
||
break;
|
||
case 15:
|
||
t = "扩建了1块土地";
|
||
break;
|
||
case 16:
|
||
t = "进行了房屋升级";
|
||
break;
|
||
case 17:
|
||
t = "被偷了";
|
||
break;
|
||
case 18:
|
||
t = "狗狗抓住";
|
||
break;
|
||
case 19:
|
||
t = "被狗狗抓住";
|
||
break;
|
||
case 21:
|
||
t = "给你种草";
|
||
break;
|
||
case 20:
|
||
t = "给你放虫";
|
||
break;
|
||
case 22:
|
||
t = "帮你浇水";
|
||
break;
|
||
case 23:
|
||
t = "帮你放虫";
|
||
break;
|
||
case 24:
|
||
t = "帮你浇水";
|
||
}
|
||
return " " + t;
|
||
}
|
||
};
|
||
((game.LogData = LogData), __reflect(LogData.prototype, "game.LogData"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const LogItemRender = class LogItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new LogItemSkin();
|
||
}
|
||
createChildren() {
|
||
super.createChildren();
|
||
}
|
||
dataChanged() {
|
||
const t = this.data;
|
||
((this.labelLog.text = t.toString()), (this.imgBg.height = this.labelLog.height + 25));
|
||
}
|
||
};
|
||
((game.LogItemRender = LogItemRender), __reflect(LogItemRender.prototype, "game.LogItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const SystemLogData = class SystemLogData {
|
||
constructor(t) {
|
||
this.message = t.message;
|
||
this.created_at = t.created_at;
|
||
}
|
||
toString() {
|
||
const t = TimeFormat.showDayOrDate(this.created_at) + " " + this.message;
|
||
return t;
|
||
}
|
||
};
|
||
((game.SystemLogData = SystemLogData), __reflect(SystemLogData.prototype, "game.SystemLogData"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ShopDogItemRender = class ShopDogItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new ShopItemSkin();
|
||
}
|
||
onAdded() {
|
||
super.onAdded();
|
||
}
|
||
onRemoved() {
|
||
super.onRemoved();
|
||
}
|
||
createChildren() {
|
||
(super.createChildren(),
|
||
game.UIUtils.addShortTouch(this.groupIcon, this.onShortTouchBegan.bind(this), this.onShortTouchEnd.bind(this)));
|
||
}
|
||
onShortTouchBegan() {
|
||
this.shopItemData &&
|
||
game.ItemTip.show(
|
||
this.shopItemData.itemData,
|
||
this.groupIcon.localToGlobal(this.groupIcon.width / 2, this.groupIcon.height / 2)
|
||
);
|
||
}
|
||
onShortTouchEnd() {
|
||
game.ItemTip.hide();
|
||
}
|
||
dataChanged() {
|
||
((this.shopItemData = this.data),
|
||
(this.imgIcon.source = game.URLConfig.getIcon(this.shopItemData.itemData.config.icon)),
|
||
(this.labelName.text = this.shopItemData.itemData.config.name),
|
||
(this.labelLv.text = "Lv." + this.shopItemData.playerLevel),
|
||
this.shopItemData.gold > 0
|
||
? ((this.imgPriceType.source = "sicon_gold_png"), (this.labelPrice.text = this.shopItemData.gold + ""))
|
||
: ((this.imgPriceType.source = "sicon_diamond_png"),
|
||
(this.labelPrice.text = this.shopItemData.diamond + "")));
|
||
const e = Global.playerProxy.playerData,
|
||
i = Global.playerProxy.getHasItemByItemId(this.shopItemData.itemData.config.id);
|
||
(i && ((this.btnBuy.enabled = !1), (this.btnBuy.label = "已拥有")),
|
||
(this.btnBuy.enabled = e.level >= this.shopItemData.playerLevel),
|
||
(this.imgLock.visible = e.level < this.shopItemData.playerLevel));
|
||
}
|
||
async onTouchTap(event) {
|
||
const target = event.target;
|
||
if (target != this.btnBuy) return;
|
||
const count = 1;
|
||
this.btnBuy.enabled = !1;
|
||
const shopMediator = game.AppFacade.getInstance().retrieveMediator(game.ShopMediator.NAME);
|
||
const buyResult = await shopMediator.buy(this.shopItemData, count);
|
||
if (0 == buyResult) {
|
||
this.btnBuy.label = "已拥有";
|
||
return;
|
||
}
|
||
this.btnBuy.enabled = !0;
|
||
}
|
||
};
|
||
((game.ShopDogItemRender = ShopDogItemRender), __reflect(ShopDogItemRender.prototype, "game.ShopDogItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ShopItemData = class ShopItemData {
|
||
constructor(e) {
|
||
this.id = e.id;
|
||
this.diamond = e.gem;
|
||
this.gold = e.gold;
|
||
this.playerLevel = e.player_level;
|
||
this.type = e.type;
|
||
this.itemData = new game.ItemData(e.item_id, 0);
|
||
}
|
||
};
|
||
((game.ShopItemData = ShopItemData), __reflect(ShopItemData.prototype, "game.ShopItemData"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ShopItemRender = class ShopItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new ShopItemSkin();
|
||
}
|
||
onAdded() {
|
||
super.onAdded();
|
||
}
|
||
onRemoved() {
|
||
super.onRemoved();
|
||
}
|
||
createChildren() {
|
||
(super.createChildren(),
|
||
game.UIUtils.addShortTouch(this.groupIcon, this.onShortTouchBegan.bind(this), this.onShortTouchEnd.bind(this)));
|
||
}
|
||
onShortTouchBegan() {
|
||
this.shopItemData &&
|
||
game.ItemTip.show(
|
||
this.shopItemData.itemData,
|
||
this.groupIcon.localToGlobal(this.groupIcon.width / 2, this.groupIcon.height / 2)
|
||
);
|
||
}
|
||
onShortTouchEnd() {
|
||
game.ItemTip.hide();
|
||
}
|
||
dataChanged() {
|
||
((this.shopItemData = this.data),
|
||
(this.imgIcon.source = game.URLConfig.getIcon(this.shopItemData.itemData.config.icon)),
|
||
(this.labelName.text = this.shopItemData.itemData.config.name),
|
||
(this.labelLv.text = "Lv." + this.shopItemData.playerLevel),
|
||
this.shopItemData.gold > 0
|
||
? ((this.imgPriceType.source = "sicon_gold_png"),
|
||
(this.labelPrice.text = game.Utils.BigNumTostring(this.shopItemData.gold)))
|
||
: ((this.imgPriceType.source = "sicon_diamond_png"),
|
||
(this.labelPrice.text = game.Utils.BigNumTostring(this.shopItemData.diamond))));
|
||
const e = Global.playerProxy.playerData;
|
||
((this.btnBuy.enabled = e.level >= this.shopItemData.playerLevel),
|
||
(this.imgLock.visible = e.level < this.shopItemData.playerLevel));
|
||
}
|
||
onTouchTap(e) {
|
||
const i = e.target;
|
||
if (i == this.btnBuy) {
|
||
let n = 1;
|
||
99 == this.shopItemData.id && (n = 100);
|
||
const a = game.AppFacade.getInstance().retrieveMediator(game.ShopMediator.NAME);
|
||
a.buy(this.shopItemData, n);
|
||
}
|
||
}
|
||
};
|
||
((game.ShopItemRender = ShopItemRender), __reflect(ShopItemRender.prototype, "game.ShopItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ShopSkinItemRender = class ShopSkinItemRender extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new ShopSkinItemSkin();
|
||
}
|
||
createChildren() {
|
||
super.createChildren();
|
||
}
|
||
dataChanged() {
|
||
((this.shopItemData = this.data),
|
||
(this.imgTitle.source = game.URLConfig.getSkinName(this.shopItemData.itemData.config.icon)),
|
||
(this.imgIcon.source = game.URLConfig.getIcon(this.shopItemData.itemData.config.icon)),
|
||
this.shopItemData.diamond > 0
|
||
? (this.labelPrice.text = this.shopItemData.diamond + "")
|
||
: ((this.wupinImage.source = "sicon_gold_png"), (this.labelPrice.text = this.shopItemData.gold + "")),
|
||
Global.playerProxy.wareHouseHas(this.shopItemData.itemData.config.id)
|
||
? ((this.btnBuy.enabled = !1), (this.imgBuyed.visible = !0))
|
||
: ((this.btnBuy.enabled = !0), (this.imgBuyed.visible = !1)));
|
||
}
|
||
onTouchTap(t) {
|
||
const e = t.target;
|
||
e == this.btnBuy && this.onBuy();
|
||
}
|
||
async onBuy() {
|
||
const playerData = Global.playerProxy.playerData;
|
||
if (playerData.gold <= this.shopItemData.gold) {
|
||
TipsUtils.showTipsDownToUp("钻石不够,请充值", !0);
|
||
return;
|
||
}
|
||
const shopMediator = game.AppFacade.getInstance().retrieveMediator(game.ShopMediator.NAME);
|
||
await shopMediator.buy(this.shopItemData, 1);
|
||
this.dataChanged();
|
||
}
|
||
};
|
||
((game.ShopSkinItemRender = ShopSkinItemRender), __reflect(ShopSkinItemRender.prototype, "game.ShopSkinItemRender"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const SkinItem = class SkinItem extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new SkinItemSkin();
|
||
}
|
||
onAdded() {
|
||
(super.onAdded(), game.EventManager.instance.addEvent(SysNotify.USER_SKIN_CHANGE, this.updateShow, this));
|
||
}
|
||
onRemoved() {
|
||
(super.onRemoved(), game.EventManager.instance.removeEvent(SysNotify.USER_SKIN_CHANGE, this.updateShow, this));
|
||
}
|
||
createChildren() {
|
||
(super.createChildren(), (this.imgTitle.visible = !1));
|
||
}
|
||
dataChanged() {
|
||
((this.itemData = this.data), this.updateShow());
|
||
}
|
||
updateShow() {
|
||
this.imgIcon.source = game.URLConfig.getIcon(this.itemData.config.icon);
|
||
const e = Global.playerProxy.playerData,
|
||
i = Global.gameProxy.getItemConfig(e.bg_image_id),
|
||
n = i.graphical_id === this.itemData.config.icon;
|
||
this.imgTitle.visible = n;
|
||
}
|
||
onTouchTap(e) {
|
||
const i = Global.playerProxy.playerData,
|
||
n = Global.gameProxy.getItemConfig(i.bg_image_id),
|
||
a = n.graphical_id === this.itemData.config.icon;
|
||
if (!a) {
|
||
const o = game.AppFacade.getInstance().retrieveMediator(game.SkinMediator.NAME);
|
||
o.changeSkin(this.itemData.config.id);
|
||
}
|
||
}
|
||
};
|
||
((game.SkinItem = SkinItem), __reflect(SkinItem.prototype, "game.SkinItem"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const SellPanel = class SellPanel extends game.BasePanel {
|
||
constructor(t) {
|
||
super();
|
||
this.exNum = 1;
|
||
this.longTouchAddEx = 0;
|
||
this.itemData = t;
|
||
this.isVisibleAnimate = !0;
|
||
this.skinName = new SellSkin();
|
||
}
|
||
createChildren() {
|
||
(super.createChildren(),
|
||
this.updateShow(),
|
||
this.inpNum.addEventListener(egret.Event.FOCUS_OUT, this.onNumInpChange, this));
|
||
}
|
||
updateShow() {
|
||
const e = this;
|
||
((this.imgIcon.source = game.URLConfig.getIcon(this.itemData.config.icon)),
|
||
(this.labelName.text = this.itemData.config.name),
|
||
(this.labelPrice.text = this.itemData.config.sellPrice + ""),
|
||
(this.inpNum.text = this.itemData.number + ""),
|
||
(this.exNum = this.itemData.number),
|
||
this.onNumInpChange(),
|
||
this.itemData.config.smallType == SmallType.MAGIC_FRUIT
|
||
? game.MCUtils.getMc("magic_eff", function (i) {
|
||
((e.mcEff && "magic_eff" == e.mcEff.name) || game.UIUtils.removeSelf(e.mcEff),
|
||
(e.mcEff = i),
|
||
(i.x = 168),
|
||
(i.y = 395),
|
||
i.play(-1),
|
||
(i.blendMode = egret.BlendMode.ADD),
|
||
e.panel.addChild(i));
|
||
})
|
||
: game.UIUtils.removeSelf(this.mcEff));
|
||
}
|
||
onNumInpChange() {
|
||
((this.exNum = parseInt(this.inpNum.text)),
|
||
(this.exNum = game.Utils.limit(this.exNum, 1, this.itemData.number)),
|
||
(this.inpNum.text = this.exNum + ""),
|
||
this.updateTotal());
|
||
}
|
||
btnCloseTouchEnded() {
|
||
this.onHide();
|
||
}
|
||
btnAddTouchEnded() {
|
||
this.changeExNumber(1);
|
||
}
|
||
btnSubTouchEnded() {
|
||
this.changeExNumber(-1);
|
||
}
|
||
btnSellTouchEnded() {
|
||
this.sell();
|
||
}
|
||
updateTotal() {
|
||
this.labelPriceTotal.text = this.exNum * this.itemData.config.sellPrice + "";
|
||
}
|
||
changeExNumber(e, i = !1) {
|
||
(i ? (this.exNum = e) : (this.exNum += e),
|
||
(this.exNum = game.Utils.limit(this.exNum, 1, this.itemData.number)),
|
||
(this.inpNum.text = this.exNum + ""),
|
||
this.updateTotal());
|
||
}
|
||
startSubExNum() {
|
||
this.longTouchAddEx = -1;
|
||
}
|
||
endSubExNum() {
|
||
this.longTouchAddEx = 0;
|
||
}
|
||
startAddExNum() {
|
||
this.longTouchAddEx = 1;
|
||
}
|
||
endAddExNum() {
|
||
this.longTouchAddEx = 0;
|
||
}
|
||
changePrice() {}
|
||
update(t) {
|
||
(this.changeExNumber(this.longTouchAddEx),
|
||
(1 == this.exNum || this.exNum == Const.EX_MAX_NUMBER) && (this.longTouchAddEx = 0));
|
||
}
|
||
sell() {
|
||
const t = this;
|
||
this.itemData.config.sellPrice > 999
|
||
? Global.alertMediator.addAlert("该物品价值较高,确认出售吗?", function () {
|
||
t.doSell();
|
||
})
|
||
: this.doSell();
|
||
}
|
||
doSell() {
|
||
const e = this,
|
||
i = game.AppFacade.getInstance().retrieveMediator(game.WareHouseMediator.NAME);
|
||
i.sellWareHouseItem(this.itemData.config, this.exNum, function () {
|
||
e.onHide();
|
||
});
|
||
}
|
||
};
|
||
((game.SellPanel = SellPanel), __reflect(SellPanel.prototype, "game.SellPanel"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const WareHouseItem = class WareHouseItem extends game.BaseItemRenderer {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new WareHouseItemSkin();
|
||
game.UIUtils.addLongTouch(this, this.onLongTouchBegan.bind(this), this.onLongTouchEnd.bind(this));
|
||
}
|
||
onLongTouchBegan() {
|
||
const e = this.data;
|
||
e && game.ItemTip.show(e, this.localToGlobal(this.width / 2, this.height / 2));
|
||
}
|
||
onLongTouchEnd() {
|
||
game.ItemTip.hide();
|
||
}
|
||
dataChanged() {
|
||
const e = this,
|
||
i = this.data;
|
||
if (i) {
|
||
((this.imgIcon.source = game.URLConfig.getIcon(i.config.icon)),
|
||
(this.labelNum.text = i.number > 0 ? "x" + i.number : ""),
|
||
(this.labelLv.text = "Lv." + i.config.lv),
|
||
(this.imgNumbg.visible = !0));
|
||
let n = "";
|
||
(i.config.smallType == SmallType.MAGIC_FRUIT
|
||
? (n = "magic_eff")
|
||
: i.config.smallType == SmallType.CRYSTAL
|
||
? (n = "crystal_eff")
|
||
: game.UIUtils.removeSelf(this.mcEff),
|
||
(this.mcEff && "magic_eff" == this.mcEff.name) || game.UIUtils.removeSelf(this.mcEff),
|
||
n &&
|
||
game.MCUtils.getMc(n, function (t) {
|
||
((e.mcEff = t),
|
||
(e.mcEff.x = e.width / 2),
|
||
(e.mcEff.y = e.height / 2 + 5),
|
||
e.mcEff.play(-1),
|
||
(e.mcEff.blendMode = egret.BlendMode.ADD),
|
||
e.addChildAt(e.mcEff, 2));
|
||
}));
|
||
} else
|
||
((this.imgIcon.source = null),
|
||
(this.labelNum.text = ""),
|
||
(this.labelLv.text = ""),
|
||
(this.imgNumbg.visible = !1),
|
||
game.UIUtils.removeSelf(this.mcEff));
|
||
}
|
||
setLabelText(t, e = 12149e3) {
|
||
((this.labelNum.textColor = e), (this.labelNum.text = t));
|
||
}
|
||
onTouchTap(e) {
|
||
if (this.data) {
|
||
const i = this.data;
|
||
if (i.config.sellPrice > 0) {
|
||
const n = new game.SellPanel(i);
|
||
GameLayerManager.instance.popLayer.addChild(n);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
((game.WareHouseItem = WareHouseItem), __reflect(WareHouseItem.prototype, "game.WareHouseItem"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const PlantCdTip = class PlantCdTip extends eui.Component {
|
||
constructor() {
|
||
super();
|
||
this.skinName = new PlantCdTipSkin();
|
||
}
|
||
static show(e, n) {
|
||
if (e && !(e.plantId <= 0)) {
|
||
let a = PlantCdTip._instance;
|
||
if (
|
||
(a || ((a = new PlantCdTip()), (PlantCdTip._instance = a)),
|
||
1 != e.is_mystery_seed || (e.status != game.PlantStatus.seeding && e.status != game.PlantStatus.seed)
|
||
? (a.labelName.text = e.plantName + " (" + game.PlantStatusCode.getName(e.status) + ")")
|
||
: (a.labelName.text = "神秘种子"),
|
||
(a.labelTime.text =
|
||
e.status == game.PlantStatus.ripe
|
||
? "剩余果实:" + e.cropNum
|
||
: e.status == game.PlantStatus.die
|
||
? "已经收获"
|
||
: game.Utils.showTimeFormat(e.currPhaseNeedTime) + "后" + game.PlantStatusCode.getName(e.status + 1)),
|
||
e.status == game.PlantStatus.ripe || e.status == game.PlantStatus.die)
|
||
)
|
||
a.barTime.value = 100;
|
||
else {
|
||
const o = e.currPhaseRunTime / e.currPhaseTotalTime;
|
||
a.barTime.value = game.Utils.limit(100 * o, 0, 100);
|
||
}
|
||
(egret.callLater(function () {
|
||
((a.anchorOffsetX = a.width / 2), (a.anchorOffsetY = a.height / 2));
|
||
let t = n.x,
|
||
e = n.y - a.height / 2 - 16;
|
||
(n.x < a.width / 2 ? (t = a.width / 2) : n.x > Const.WIN_W - a.width / 2 && (t = Const.WIN_W - a.width / 2),
|
||
n.y < 0.2 * Const.WIN_H && (e = n.y + a.height / 2 + 20),
|
||
(a.x = t),
|
||
(a.y = e));
|
||
}, this),
|
||
(a.scaleX = a.scaleY = 0),
|
||
GameLayerManager.instance.tipLayer.addChild(a),
|
||
egret.Tween.get(a).to(
|
||
{
|
||
scaleX: 1,
|
||
scaleY: 1
|
||
},
|
||
150
|
||
));
|
||
}
|
||
}
|
||
static hide() {
|
||
const e = PlantCdTip._instance;
|
||
e &&
|
||
e.stage &&
|
||
egret.Tween.get(e)
|
||
.to(
|
||
{
|
||
scaleX: 0,
|
||
scaleY: 0
|
||
},
|
||
150
|
||
)
|
||
.call(game.UIUtils.removeSelf, e, [e]);
|
||
}
|
||
};
|
||
((game.PlantCdTip = PlantCdTip), __reflect(PlantCdTip.prototype, "game.PlantCdTip"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const SimpleTip = class SimpleTip {
|
||
constructor() {}
|
||
static popTip(i, n, a, o) {
|
||
let tipLabel;
|
||
((tipLabel = SimpleTip._pool.length > 0 ? SimpleTip._pool.pop() : new eui.Label()),
|
||
(tipLabel.touchEnabled = !1),
|
||
(tipLabel.text = i),
|
||
(tipLabel.size = 30),
|
||
(tipLabel.x = n + game.Utils.rang(-o, o)),
|
||
(tipLabel.y = a + game.Utils.rang(-o, o)),
|
||
GameLayerManager.instance.tipLayer.addChild(tipLabel),
|
||
egret.Tween.get(tipLabel)
|
||
.to(
|
||
{
|
||
y: tipLabel.y - 100
|
||
},
|
||
500
|
||
)
|
||
.call(function () {
|
||
SimpleTip._pool.length < 50 && (game.UIUtils.removeSelf(tipLabel), SimpleTip._pool.push(tipLabel));
|
||
}));
|
||
}
|
||
static _pool = [];
|
||
};
|
||
((game.SimpleTip = SimpleTip), __reflect(SimpleTip.prototype, "game.SimpleTip"));
|
||
})(game || (game = {}));
|
||
var game;
|
||
!(function (game) {
|
||
const ToastTip = class ToastTip extends eui.Group {
|
||
constructor() {
|
||
super();
|
||
this.touchChildren = !1;
|
||
this.touchEnabled = !1;
|
||
const i = new eui.Image("log_itembg_png");
|
||
i.scale9Grid = new egret.Rectangle(25, 25, 1, 1);
|
||
this.addChild(i);
|
||
i.horizontalCenter = 0;
|
||
i.verticalCenter = 0;
|
||
this.bg = i;
|
||
const n = new eui.Label();
|
||
n.textAlign = "center";
|
||
n.lineSpacing = 5;
|
||
n.maxWidth = 450;
|
||
n.textColor = 16720418;
|
||
n.horizontalCenter = 0;
|
||
n.verticalCenter = 0;
|
||
this.label = n;
|
||
this.addChild(n);
|
||
}
|
||
updateTxt(t, e) {
|
||
(e ? (this.label.textFlow = FontUtils.html(t)) : (this.label.text = t),
|
||
(this.label.x = -this.label.width / 2),
|
||
(this.label.y = 20),
|
||
(this.bg.width = this.label.width + 30),
|
||
(this.bg.height = this.label.height + 24));
|
||
}
|
||
static popTip(e, n, a) {
|
||
(void 0 === n && (n = 1e3), void 0 === a && (a = !1));
|
||
let toastTip;
|
||
(ToastTip._pool.length > 0
|
||
? ((toastTip = ToastTip._pool.pop()), (toastTip.alpha = 1))
|
||
: (toastTip = new ToastTip()),
|
||
toastTip.updateTxt(e, a),
|
||
(toastTip.x = (Const.WIN_W - toastTip.bg.width) / 2),
|
||
(toastTip.y = (Const.WIN_H - toastTip.bg.height) / 2),
|
||
GameLayerManager.instance.tipLayer.addChild(toastTip),
|
||
egret.Tween.get(toastTip)
|
||
.to(
|
||
{
|
||
y: toastTip.y - 50
|
||
},
|
||
100,
|
||
egret.Ease.backOut
|
||
)
|
||
.wait(n)
|
||
.to(
|
||
{
|
||
y: toastTip.y - 180,
|
||
alpha: 0
|
||
},
|
||
200
|
||
)
|
||
.call(function () {
|
||
(game.UIUtils.removeSelf(toastTip), ToastTip._pool.length < 50 && ToastTip._pool.push(toastTip));
|
||
}));
|
||
}
|
||
static _pool = [];
|
||
};
|
||
((game.ToastTip = ToastTip), __reflect(ToastTip.prototype, "game.ToastTip"));
|
||
})(game || (game = {}));
|