Commit 7d3a7955 authored by Edwise's avatar Edwise 🍷

领取精力与刷新三文鱼自测第一版,修正刷新三文鱼显示不对的问题

parent 9047e0a9
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
"senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"], "senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"],
"energyMax":50, "energyMax":50,
"experienceMax":1000, "experienceMax":1000,
"senceGuide":true "senceGuide":true,
"updateTime":1607507495319,
"lastEnergyTime":1607507395319
} }
} }
...@@ -2047,19 +2047,19 @@ const resCanvasList = { ...@@ -2047,19 +2047,19 @@ const resCanvasList = {
'69435791-11ee-4c7f-9036-c4c3e28e1750': { '69435791-11ee-4c7f-9036-c4c3e28e1750': {
name: '经验条背景', name: '经验条背景',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png', url: 'https://yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png',
uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750' uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750'
}, },
'6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': { '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': {
name: '经验条图片', name: '经验条图片',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png', url: 'https://yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png',
uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572' uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572'
}, },
'5cc07d1e-00f8-4178-8112-44fda9c15481': { '5cc07d1e-00f8-4178-8112-44fda9c15481': {
name: 'bedroomguide3final', name: 'bedroomguide3final',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png', url: 'https://yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png',
uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481' uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481'
} }
}; };
...@@ -2197,6 +2197,7 @@ var MSG; ...@@ -2197,6 +2197,7 @@ var MSG;
MSG["UPDATE_ENERGY"] = "UPDATE_ENERGY"; MSG["UPDATE_ENERGY"] = "UPDATE_ENERGY";
MSG["SALMON_ANIM"] = "SALMON_ANIM"; MSG["SALMON_ANIM"] = "SALMON_ANIM";
MSG["FISH_COINANIM"] = "FISH_COINANIM"; MSG["FISH_COINANIM"] = "FISH_COINANIM";
MSG["SETUI_ENERGY"] = "SETUI_ENERGY";
})(MSG = exports.MSG || (exports.MSG = {})); })(MSG = exports.MSG || (exports.MSG = {}));
var CATTYPE; var CATTYPE;
(function (CATTYPE) { (function (CATTYPE) {
...@@ -2252,10 +2253,18 @@ var Ins = (function () { ...@@ -2252,10 +2253,18 @@ var Ins = (function () {
Main_1.GDispatcher.dispatchEvent({ type: "toast" }, msg); Main_1.GDispatcher.dispatchEvent({ type: "toast" }, msg);
}; };
Ins.showLoading = function () { Ins.showLoading = function () {
console.log("canvas请求加载loading");
Main_1.GDispatcher.dispatchEvent({ type: "loading" }); Main_1.GDispatcher.dispatchEvent({ type: "loading" });
if (this.stage) {
this.stage.mouseEnable = this.stage.mouseChildren = false;
}
}; };
Ins.hideLoading = function () { Ins.hideLoading = function () {
console.log("canvas请求隐藏loading");
Main_1.GDispatcher.dispatchEvent({ type: "hideloading" }); Main_1.GDispatcher.dispatchEvent({ type: "hideloading" });
if (this.stage) {
this.stage.mouseEnable = this.stage.mouseChildren = true;
}
}; };
Ins.stopLottieAnim = function (lottie) { Ins.stopLottieAnim = function (lottie) {
FYGE.Tween.removeTweens(lottie); FYGE.Tween.removeTweens(lottie);
...@@ -2403,6 +2412,7 @@ var Main = (function () { ...@@ -2403,6 +2412,7 @@ var Main = (function () {
console.log("初始化层级完成"); console.log("初始化层级完成");
Ins_1.Ins.stageW = this.stage.viewRect.width; Ins_1.Ins.stageW = this.stage.viewRect.width;
Ins_1.Ins.stageH = this.stage.viewRect.height; Ins_1.Ins.stageH = this.stage.viewRect.height;
Ins_1.Ins.stage = this.stage;
console.log("舞台宽高:", Ins_1.Ins.stageW, Ins_1.Ins.stageH); console.log("舞台宽高:", Ins_1.Ins.stageW, Ins_1.Ins.stageH);
return [4, RES_1.RES.loadSparkAssets(resloadingList_1.default)]; return [4, RES_1.RES.loadSparkAssets(resloadingList_1.default)];
case 1: case 1:
...@@ -3128,8 +3138,9 @@ var Salmon = (function (_super) { ...@@ -3128,8 +3138,9 @@ var Salmon = (function (_super) {
id: that._id, id: that._id,
energy: that.salmonCnt energy: that.salmonCnt
}; };
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.takeEnergy, { params: params }, function (s, r) { TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.takeEnergy, { id: that._id, energy: that.salmonCnt }, function (s, r) {
if (s) { if (s) {
that.mouseEnable = true;
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } }); FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } });
} }
else { else {
...@@ -3199,11 +3210,13 @@ var __extends = (this && this.__extends) || (function () { ...@@ -3199,11 +3210,13 @@ var __extends = (this && this.__extends) || (function () {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.SalmonAnim = void 0; exports.SalmonAnim = void 0;
var Module_1 = __webpack_require__(/*! ../../module/views/Module */ "./module/views/Module.ts"); var Module_1 = __webpack_require__(/*! ../../module/views/Module */ "./module/views/Module.ts");
var Enum_1 = __webpack_require__(/*! ../Enum */ "./src/Enum.ts");
var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts"); var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts");
var SalmonAnim = (function (_super) { var SalmonAnim = (function (_super) {
__extends(SalmonAnim, _super); __extends(SalmonAnim, _super);
function SalmonAnim(x, y) { function SalmonAnim(x, y, index) {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this.index = 0;
_this.t = 0; _this.t = 0;
_this.targetX = 0; _this.targetX = 0;
_this.targetY = 0; _this.targetY = 0;
...@@ -3213,6 +3226,7 @@ var SalmonAnim = (function (_super) { ...@@ -3213,6 +3226,7 @@ var SalmonAnim = (function (_super) {
_this.y = y; _this.y = y;
_this.originX = x; _this.originX = x;
_this.originY = y; _this.originY = y;
_this.index = index;
return _this; return _this;
} }
SalmonAnim.prototype.initUi = function () { SalmonAnim.prototype.initUi = function () {
...@@ -3227,6 +3241,9 @@ var SalmonAnim = (function (_super) { ...@@ -3227,6 +3241,9 @@ var SalmonAnim = (function (_super) {
this.targetX = targetX; this.targetX = targetX;
this.targetY = targetY; this.targetY = targetY;
FYGE.Tween.get(this, { onChangeObj: this, onChange: this.move }).wait(waitTime).to({ t: 1 }, 800).call(function () { FYGE.Tween.get(this, { onChangeObj: this, onChange: this.move }).wait(waitTime).to({ t: 1 }, 800).call(function () {
if (_this.index == 0) {
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.SETUI_ENERGY);
}
if (_this && _this.parent) { if (_this && _this.parent) {
_this.parent.removeChild(_this); _this.parent.removeChild(_this);
} }
...@@ -47360,6 +47377,7 @@ var MainScene = (function (_super) { ...@@ -47360,6 +47377,7 @@ var MainScene = (function (_super) {
var _this = _super.call(this, data) || this; var _this = _super.call(this, data) || this;
_this.bgUUID = []; _this.bgUUID = [];
_this.maxEnergy = 1500; _this.maxEnergy = 1500;
_this.firstSetEnergy = true;
_this.level = 0; _this.level = 0;
_this.isShow = false; _this.isShow = false;
_this.salmonArr = []; _this.salmonArr = [];
...@@ -47567,8 +47585,17 @@ var MainScene = (function (_super) { ...@@ -47567,8 +47585,17 @@ var MainScene = (function (_super) {
var that = this; var that = this;
that.energy = Ins_1.Ins.userInfo.energy; that.energy = Ins_1.Ins.userInfo.energy;
that.maxEnergy = Ins_1.Ins.userInfo.energyMax; that.maxEnergy = Ins_1.Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy); that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2; that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
}
else {
FYGE.Tween.get(that.energyImg).to({ scaleX: (that.energy / that.maxEnergy) }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * (that.energy / that.maxEnergy) - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy; that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2; that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
console.log("设置精力组数据结束"); console.log("设置精力组数据结束");
...@@ -47578,7 +47605,7 @@ var MainScene = (function (_super) { ...@@ -47578,7 +47605,7 @@ var MainScene = (function (_super) {
if (that.recoverEnergyHandler) if (that.recoverEnergyHandler)
clearInterval(that.recoverEnergyHandler); clearInterval(that.recoverEnergyHandler);
console.log("上一次恢复精力的时间", new Date(Ins_1.Ins.userInfo.lastEnergyTime).getMinutes()); console.log("上一次恢复精力的时间", new Date(Ins_1.Ins.userInfo.lastEnergyTime).getMinutes());
var time = new Date().getTime() - Ins_1.Ins.userInfo.lastEnergyTime; var time = Ins_1.Ins.userInfo.updateTime - Ins_1.Ins.userInfo.lastEnergyTime;
console.log("相差的时间", Math.floor(time % 3600 / 60)); console.log("相差的时间", Math.floor(time % 3600 / 60));
if (time <= Ins_1.Ins.recoverEnergy) { if (time <= Ins_1.Ins.recoverEnergy) {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time; that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time;
...@@ -47755,6 +47782,7 @@ var MainScene = (function (_super) { ...@@ -47755,6 +47782,7 @@ var MainScene = (function (_super) {
} }
that.isShow = false; that.isShow = false;
that.energyUp1(); that.energyUp1();
that.updateEnergy();
} }
that.setEnergy(); that.setEnergy();
that.mainUi.updateUserInfo(); that.mainUi.updateUserInfo();
...@@ -47772,7 +47800,6 @@ var MainScene = (function (_super) { ...@@ -47772,7 +47800,6 @@ var MainScene = (function (_super) {
var energyList = r.data.energyList; var energyList = r.data.energyList;
Ins_1.Ins.userInfo.energy = r.data.energy; Ins_1.Ins.userInfo.energy = r.data.energy;
e && e.data.call && e.data.call(); e && e.data.call && e.data.call();
that.setEnergy();
that.initSalmon(energyList); that.initSalmon(energyList);
Ins_1.Ins.hideLoading(); Ins_1.Ins.hideLoading();
} }
...@@ -47785,9 +47812,6 @@ var MainScene = (function (_super) { ...@@ -47785,9 +47812,6 @@ var MainScene = (function (_super) {
MainScene.prototype.initSalmon = function (list) { MainScene.prototype.initSalmon = function (list) {
var diffCnt = Math.abs(list.length - Ins_1.Ins.salmonArr.length); var diffCnt = Math.abs(list.length - Ins_1.Ins.salmonArr.length);
if (list.length >= Ins_1.Ins.salmonArr.length) { if (list.length >= Ins_1.Ins.salmonArr.length) {
for (var i = 0; i < Ins_1.Ins.salmonArr.length; i++) {
Ins_1.Ins.salmonArr[i].setCnt(list[Ins_1.Ins.salmonArr[i].index].energy);
}
var flagIndex = 0; var flagIndex = 0;
var canSetIndexArr = []; var canSetIndexArr = [];
while (flagIndex < 8) { while (flagIndex < 8) {
...@@ -47807,6 +47831,21 @@ var MainScene = (function (_super) { ...@@ -47807,6 +47831,21 @@ var MainScene = (function (_super) {
Ins_1.Ins.salmonArr.push(salmon); Ins_1.Ins.salmonArr.push(salmon);
setIndex++; setIndex++;
} }
for (var i = 1; i < this.salmonArr.length; i++) {
for (var j = 0; j < this.salmonArr.length - i; j++) {
if (this.salmonArr[i].index > this.salmonArr[i].index) {
var temp = this.salmonArr[j];
this.salmonArr[j] = this.salmonArr[j + 1];
this.salmonArr[j + 1] = temp;
}
}
}
setTimeout(function () {
for (var i = 0; i < Ins_1.Ins.salmonArr.length; i++) {
if (Ins_1.Ins.salmonArr)
Ins_1.Ins.salmonArr[i].setCnt(list[i].energy);
}
}, 100);
} }
}; };
MainScene.prototype.salmonAnim = function (e) { MainScene.prototype.salmonAnim = function (e) {
...@@ -47817,7 +47856,7 @@ var MainScene = (function (_super) { ...@@ -47817,7 +47856,7 @@ var MainScene = (function (_super) {
var index = e.data.index; var index = e.data.index;
this.salmonFlag[index] = false; this.salmonFlag[index] = false;
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
var salmonAnim = new SalmonAnim_1.SalmonAnim(x, y); var salmonAnim = new SalmonAnim_1.SalmonAnim(x, y, i);
salmonAnim.setTween(100, 1100, i * 100); salmonAnim.setTween(100, 1100, i * 100);
this.salmonGroup.addChild(salmonAnim); this.salmonGroup.addChild(salmonAnim);
} }
...@@ -47892,6 +47931,7 @@ var MainScene = (function (_super) { ...@@ -47892,6 +47931,7 @@ var MainScene = (function (_super) {
that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.SETUI_ENERGY, that.setEnergy, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that);
Main_1.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that); Main_1.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
...@@ -47908,6 +47948,7 @@ var MainScene = (function (_super) { ...@@ -47908,6 +47948,7 @@ var MainScene = (function (_super) {
that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SETUI_ENERGY, that.setEnergy, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that); Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
...@@ -48210,12 +48251,17 @@ var MainSceneBtnUi = (function (_super) { ...@@ -48210,12 +48251,17 @@ var MainSceneBtnUi = (function (_super) {
that.catExperienceBg.addChild(that.catExperience); that.catExperienceBg.addChild(that.catExperience);
var mask = new FYGE.Shape(); var mask = new FYGE.Shape();
mask.beginFill(6, 1); mask.beginFill(6, 1);
mask.drawRoundedRect(-4, 0, that.catExperience.width, that.catExperience.height, 45, 45, 45, 45); mask.drawRoundedRect(0, 0, that.catExperience.width, that.catExperience.height, 45, 45, 45, 45);
mask.endFill(); mask.endFill();
mask.x = 5; mask.x = 0;
mask.y = 0; mask.y = 0;
that.catExperienceBg.addChild(mask); that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask; that.catExperience.mask = mask;
var rect = new FYGE.Shape();
rect.beginStroke(4670787, 4);
rect.drawRoundedRect(2, 2, that.catExperienceBg.width - 4, that.catExperienceBg.height - 4, 45, 45, 45, 45);
rect.endStroke();
that.catExperienceBg.addChild(rect);
that.experience = Ins_1.Ins.initLabel({ size: 20 }); that.experience = Ins_1.Ins.initLabel({ size: 20 });
that.experience.position.set(174, 53); that.experience.position.set(174, 53);
that.experience.textWidth = 110; that.experience.textWidth = 110;
...@@ -48259,8 +48305,14 @@ var MainSceneBtnUi = (function (_super) { ...@@ -48259,8 +48305,14 @@ var MainSceneBtnUi = (function (_super) {
that.catNameLabel.text = catName; that.catNameLabel.text = catName;
that.catLevelLabel.text = "Lv." + level; that.catLevelLabel.text = "Lv." + level;
that.fishPointLabel.text = "" + happyCoin; that.fishPointLabel.text = "" + happyCoin;
that.catExperience.scaleX = experience / experienceMax;
that.experience.text = experience + "/" + experienceMax; that.experience.text = experience + "/" + experienceMax;
var percent = experience / experienceMax;
if (percent >= 1) {
that.catExperience.x = (experience / experienceMax - 1) * that.catExperience.width;
}
else {
that.catExperience.x = (experience / experienceMax - 1) * that.catExperience.width + 4;
}
}; };
MainSceneBtnUi.prototype.hideAllActBtn = function () { MainSceneBtnUi.prototype.hideAllActBtn = function () {
var that = this; var that = this;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2049,19 +2049,19 @@ const resCanvasList = { ...@@ -2049,19 +2049,19 @@ const resCanvasList = {
'69435791-11ee-4c7f-9036-c4c3e28e1750': { '69435791-11ee-4c7f-9036-c4c3e28e1750': {
name: '经验条背景', name: '经验条背景',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png', url: 'https://yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png',
uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750' uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750'
}, },
'6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': { '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': {
name: '经验条图片', name: '经验条图片',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png', url: 'https://yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png',
uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572' uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572'
}, },
'5cc07d1e-00f8-4178-8112-44fda9c15481': { '5cc07d1e-00f8-4178-8112-44fda9c15481': {
name: 'bedroomguide3final', name: 'bedroomguide3final',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png', url: 'https://yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png',
uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481' uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481'
} }
}; };
...@@ -2199,6 +2199,7 @@ var MSG; ...@@ -2199,6 +2199,7 @@ var MSG;
MSG["UPDATE_ENERGY"] = "UPDATE_ENERGY"; MSG["UPDATE_ENERGY"] = "UPDATE_ENERGY";
MSG["SALMON_ANIM"] = "SALMON_ANIM"; MSG["SALMON_ANIM"] = "SALMON_ANIM";
MSG["FISH_COINANIM"] = "FISH_COINANIM"; MSG["FISH_COINANIM"] = "FISH_COINANIM";
MSG["SETUI_ENERGY"] = "SETUI_ENERGY";
})(MSG = exports.MSG || (exports.MSG = {})); })(MSG = exports.MSG || (exports.MSG = {}));
var CATTYPE; var CATTYPE;
(function (CATTYPE) { (function (CATTYPE) {
...@@ -2254,10 +2255,18 @@ var Ins = (function () { ...@@ -2254,10 +2255,18 @@ var Ins = (function () {
Main_1.GDispatcher.dispatchEvent({ type: "toast" }, msg); Main_1.GDispatcher.dispatchEvent({ type: "toast" }, msg);
}; };
Ins.showLoading = function () { Ins.showLoading = function () {
console.log("canvas请求加载loading");
Main_1.GDispatcher.dispatchEvent({ type: "loading" }); Main_1.GDispatcher.dispatchEvent({ type: "loading" });
if (this.stage) {
this.stage.mouseEnable = this.stage.mouseChildren = false;
}
}; };
Ins.hideLoading = function () { Ins.hideLoading = function () {
console.log("canvas请求隐藏loading");
Main_1.GDispatcher.dispatchEvent({ type: "hideloading" }); Main_1.GDispatcher.dispatchEvent({ type: "hideloading" });
if (this.stage) {
this.stage.mouseEnable = this.stage.mouseChildren = true;
}
}; };
Ins.stopLottieAnim = function (lottie) { Ins.stopLottieAnim = function (lottie) {
FYGE.Tween.removeTweens(lottie); FYGE.Tween.removeTweens(lottie);
...@@ -2405,6 +2414,7 @@ var Main = (function () { ...@@ -2405,6 +2414,7 @@ var Main = (function () {
console.log("初始化层级完成"); console.log("初始化层级完成");
Ins_1.Ins.stageW = this.stage.viewRect.width; Ins_1.Ins.stageW = this.stage.viewRect.width;
Ins_1.Ins.stageH = this.stage.viewRect.height; Ins_1.Ins.stageH = this.stage.viewRect.height;
Ins_1.Ins.stage = this.stage;
console.log("舞台宽高:", Ins_1.Ins.stageW, Ins_1.Ins.stageH); console.log("舞台宽高:", Ins_1.Ins.stageW, Ins_1.Ins.stageH);
return [4, RES_1.RES.loadSparkAssets(resloadingList_1.default)]; return [4, RES_1.RES.loadSparkAssets(resloadingList_1.default)];
case 1: case 1:
...@@ -3130,8 +3140,9 @@ var Salmon = (function (_super) { ...@@ -3130,8 +3140,9 @@ var Salmon = (function (_super) {
id: that._id, id: that._id,
energy: that.salmonCnt energy: that.salmonCnt
}; };
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.takeEnergy, { params: params }, function (s, r) { TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.takeEnergy, { id: that._id, energy: that.salmonCnt }, function (s, r) {
if (s) { if (s) {
that.mouseEnable = true;
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } }); FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } });
} }
else { else {
...@@ -3201,11 +3212,13 @@ var __extends = (this && this.__extends) || (function () { ...@@ -3201,11 +3212,13 @@ var __extends = (this && this.__extends) || (function () {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.SalmonAnim = void 0; exports.SalmonAnim = void 0;
var Module_1 = __webpack_require__(/*! ../../module/views/Module */ "./module/views/Module.ts"); var Module_1 = __webpack_require__(/*! ../../module/views/Module */ "./module/views/Module.ts");
var Enum_1 = __webpack_require__(/*! ../Enum */ "./src/Enum.ts");
var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts"); var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts");
var SalmonAnim = (function (_super) { var SalmonAnim = (function (_super) {
__extends(SalmonAnim, _super); __extends(SalmonAnim, _super);
function SalmonAnim(x, y) { function SalmonAnim(x, y, index) {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this.index = 0;
_this.t = 0; _this.t = 0;
_this.targetX = 0; _this.targetX = 0;
_this.targetY = 0; _this.targetY = 0;
...@@ -3215,6 +3228,7 @@ var SalmonAnim = (function (_super) { ...@@ -3215,6 +3228,7 @@ var SalmonAnim = (function (_super) {
_this.y = y; _this.y = y;
_this.originX = x; _this.originX = x;
_this.originY = y; _this.originY = y;
_this.index = index;
return _this; return _this;
} }
SalmonAnim.prototype.initUi = function () { SalmonAnim.prototype.initUi = function () {
...@@ -3229,6 +3243,9 @@ var SalmonAnim = (function (_super) { ...@@ -3229,6 +3243,9 @@ var SalmonAnim = (function (_super) {
this.targetX = targetX; this.targetX = targetX;
this.targetY = targetY; this.targetY = targetY;
FYGE.Tween.get(this, { onChangeObj: this, onChange: this.move }).wait(waitTime).to({ t: 1 }, 800).call(function () { FYGE.Tween.get(this, { onChangeObj: this, onChange: this.move }).wait(waitTime).to({ t: 1 }, 800).call(function () {
if (_this.index == 0) {
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.SETUI_ENERGY);
}
if (_this && _this.parent) { if (_this && _this.parent) {
_this.parent.removeChild(_this); _this.parent.removeChild(_this);
} }
...@@ -47362,6 +47379,7 @@ var MainScene = (function (_super) { ...@@ -47362,6 +47379,7 @@ var MainScene = (function (_super) {
var _this = _super.call(this, data) || this; var _this = _super.call(this, data) || this;
_this.bgUUID = []; _this.bgUUID = [];
_this.maxEnergy = 1500; _this.maxEnergy = 1500;
_this.firstSetEnergy = true;
_this.level = 0; _this.level = 0;
_this.isShow = false; _this.isShow = false;
_this.salmonArr = []; _this.salmonArr = [];
...@@ -47569,8 +47587,17 @@ var MainScene = (function (_super) { ...@@ -47569,8 +47587,17 @@ var MainScene = (function (_super) {
var that = this; var that = this;
that.energy = Ins_1.Ins.userInfo.energy; that.energy = Ins_1.Ins.userInfo.energy;
that.maxEnergy = Ins_1.Ins.userInfo.energyMax; that.maxEnergy = Ins_1.Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy); that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2; that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
}
else {
FYGE.Tween.get(that.energyImg).to({ scaleX: (that.energy / that.maxEnergy) }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * (that.energy / that.maxEnergy) - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy; that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2; that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
console.log("设置精力组数据结束"); console.log("设置精力组数据结束");
...@@ -47580,7 +47607,7 @@ var MainScene = (function (_super) { ...@@ -47580,7 +47607,7 @@ var MainScene = (function (_super) {
if (that.recoverEnergyHandler) if (that.recoverEnergyHandler)
clearInterval(that.recoverEnergyHandler); clearInterval(that.recoverEnergyHandler);
console.log("上一次恢复精力的时间", new Date(Ins_1.Ins.userInfo.lastEnergyTime).getMinutes()); console.log("上一次恢复精力的时间", new Date(Ins_1.Ins.userInfo.lastEnergyTime).getMinutes());
var time = new Date().getTime() - Ins_1.Ins.userInfo.lastEnergyTime; var time = Ins_1.Ins.userInfo.updateTime - Ins_1.Ins.userInfo.lastEnergyTime;
console.log("相差的时间", Math.floor(time % 3600 / 60)); console.log("相差的时间", Math.floor(time % 3600 / 60));
if (time <= Ins_1.Ins.recoverEnergy) { if (time <= Ins_1.Ins.recoverEnergy) {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time; that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time;
...@@ -47757,6 +47784,7 @@ var MainScene = (function (_super) { ...@@ -47757,6 +47784,7 @@ var MainScene = (function (_super) {
} }
that.isShow = false; that.isShow = false;
that.energyUp1(); that.energyUp1();
that.updateEnergy();
} }
that.setEnergy(); that.setEnergy();
that.mainUi.updateUserInfo(); that.mainUi.updateUserInfo();
...@@ -47774,7 +47802,6 @@ var MainScene = (function (_super) { ...@@ -47774,7 +47802,6 @@ var MainScene = (function (_super) {
var energyList = r.data.energyList; var energyList = r.data.energyList;
Ins_1.Ins.userInfo.energy = r.data.energy; Ins_1.Ins.userInfo.energy = r.data.energy;
e && e.data.call && e.data.call(); e && e.data.call && e.data.call();
that.setEnergy();
that.initSalmon(energyList); that.initSalmon(energyList);
Ins_1.Ins.hideLoading(); Ins_1.Ins.hideLoading();
} }
...@@ -47787,9 +47814,6 @@ var MainScene = (function (_super) { ...@@ -47787,9 +47814,6 @@ var MainScene = (function (_super) {
MainScene.prototype.initSalmon = function (list) { MainScene.prototype.initSalmon = function (list) {
var diffCnt = Math.abs(list.length - Ins_1.Ins.salmonArr.length); var diffCnt = Math.abs(list.length - Ins_1.Ins.salmonArr.length);
if (list.length >= Ins_1.Ins.salmonArr.length) { if (list.length >= Ins_1.Ins.salmonArr.length) {
for (var i = 0; i < Ins_1.Ins.salmonArr.length; i++) {
Ins_1.Ins.salmonArr[i].setCnt(list[Ins_1.Ins.salmonArr[i].index].energy);
}
var flagIndex = 0; var flagIndex = 0;
var canSetIndexArr = []; var canSetIndexArr = [];
while (flagIndex < 8) { while (flagIndex < 8) {
...@@ -47809,6 +47833,21 @@ var MainScene = (function (_super) { ...@@ -47809,6 +47833,21 @@ var MainScene = (function (_super) {
Ins_1.Ins.salmonArr.push(salmon); Ins_1.Ins.salmonArr.push(salmon);
setIndex++; setIndex++;
} }
for (var i = 1; i < this.salmonArr.length; i++) {
for (var j = 0; j < this.salmonArr.length - i; j++) {
if (this.salmonArr[i].index > this.salmonArr[i].index) {
var temp = this.salmonArr[j];
this.salmonArr[j] = this.salmonArr[j + 1];
this.salmonArr[j + 1] = temp;
}
}
}
setTimeout(function () {
for (var i = 0; i < Ins_1.Ins.salmonArr.length; i++) {
if (Ins_1.Ins.salmonArr)
Ins_1.Ins.salmonArr[i].setCnt(list[i].energy);
}
}, 100);
} }
}; };
MainScene.prototype.salmonAnim = function (e) { MainScene.prototype.salmonAnim = function (e) {
...@@ -47819,7 +47858,7 @@ var MainScene = (function (_super) { ...@@ -47819,7 +47858,7 @@ var MainScene = (function (_super) {
var index = e.data.index; var index = e.data.index;
this.salmonFlag[index] = false; this.salmonFlag[index] = false;
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
var salmonAnim = new SalmonAnim_1.SalmonAnim(x, y); var salmonAnim = new SalmonAnim_1.SalmonAnim(x, y, i);
salmonAnim.setTween(100, 1100, i * 100); salmonAnim.setTween(100, 1100, i * 100);
this.salmonGroup.addChild(salmonAnim); this.salmonGroup.addChild(salmonAnim);
} }
...@@ -47894,6 +47933,7 @@ var MainScene = (function (_super) { ...@@ -47894,6 +47933,7 @@ var MainScene = (function (_super) {
that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.SETUI_ENERGY, that.setEnergy, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that);
Main_1.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that); Main_1.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
...@@ -47910,6 +47950,7 @@ var MainScene = (function (_super) { ...@@ -47910,6 +47950,7 @@ var MainScene = (function (_super) {
that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SETUI_ENERGY, that.setEnergy, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that); Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
...@@ -48212,12 +48253,17 @@ var MainSceneBtnUi = (function (_super) { ...@@ -48212,12 +48253,17 @@ var MainSceneBtnUi = (function (_super) {
that.catExperienceBg.addChild(that.catExperience); that.catExperienceBg.addChild(that.catExperience);
var mask = new FYGE.Shape(); var mask = new FYGE.Shape();
mask.beginFill(6, 1); mask.beginFill(6, 1);
mask.drawRoundedRect(-4, 0, that.catExperience.width, that.catExperience.height, 45, 45, 45, 45); mask.drawRoundedRect(0, 0, that.catExperience.width, that.catExperience.height, 45, 45, 45, 45);
mask.endFill(); mask.endFill();
mask.x = 5; mask.x = 0;
mask.y = 0; mask.y = 0;
that.catExperienceBg.addChild(mask); that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask; that.catExperience.mask = mask;
var rect = new FYGE.Shape();
rect.beginStroke(4670787, 4);
rect.drawRoundedRect(2, 2, that.catExperienceBg.width - 4, that.catExperienceBg.height - 4, 45, 45, 45, 45);
rect.endStroke();
that.catExperienceBg.addChild(rect);
that.experience = Ins_1.Ins.initLabel({ size: 20 }); that.experience = Ins_1.Ins.initLabel({ size: 20 });
that.experience.position.set(174, 53); that.experience.position.set(174, 53);
that.experience.textWidth = 110; that.experience.textWidth = 110;
...@@ -48261,8 +48307,14 @@ var MainSceneBtnUi = (function (_super) { ...@@ -48261,8 +48307,14 @@ var MainSceneBtnUi = (function (_super) {
that.catNameLabel.text = catName; that.catNameLabel.text = catName;
that.catLevelLabel.text = "Lv." + level; that.catLevelLabel.text = "Lv." + level;
that.fishPointLabel.text = "" + happyCoin; that.fishPointLabel.text = "" + happyCoin;
that.catExperience.scaleX = experience / experienceMax;
that.experience.text = experience + "/" + experienceMax; that.experience.text = experience + "/" + experienceMax;
var percent = experience / experienceMax;
if (percent >= 1) {
that.catExperience.x = (experience / experienceMax - 1) * that.catExperience.width;
}
else {
that.catExperience.x = (experience / experienceMax - 1) * that.catExperience.width + 4;
}
}; };
MainSceneBtnUi.prototype.hideAllActBtn = function () { MainSceneBtnUi.prototype.hideAllActBtn = function () {
var that = this; var that = this;
...@@ -903,19 +903,19 @@ const resCanvasList = { ...@@ -903,19 +903,19 @@ const resCanvasList = {
'69435791-11ee-4c7f-9036-c4c3e28e1750': { '69435791-11ee-4c7f-9036-c4c3e28e1750': {
name: '经验条背景', name: '经验条背景',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png', url: 'https://yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png',
uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750' uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750'
}, },
'6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': { '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': {
name: '经验条图片', name: '经验条图片',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png', url: 'https://yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png',
uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572' uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572'
}, },
'5cc07d1e-00f8-4178-8112-44fda9c15481': { '5cc07d1e-00f8-4178-8112-44fda9c15481': {
name: 'bedroomguide3final', name: 'bedroomguide3final',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png', url: 'https://yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png',
uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481' uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481'
} }
}; };
......
...@@ -11,6 +11,7 @@ export class Ins { ...@@ -11,6 +11,7 @@ export class Ins {
/**舞台宽高 */ /**舞台宽高 */
public static stageW: number; public static stageW: number;
public static stageH: number; public static stageH: number;
public static stage:FYGE.Stage;
/**猫咪是否出寝了 */ /**猫咪是否出寝了 */
public static catIsOut:boolean; public static catIsOut:boolean;
...@@ -40,8 +41,8 @@ export class Ins { ...@@ -40,8 +41,8 @@ export class Ins {
"energyMax":number, "energyMax":number,
"experienceMax":number, "experienceMax":number,
"senceGuide":boolean, "senceGuide":boolean,
"lastEnergyTime":number "lastEnergyTime":number,
"updateTime":number
} }
public static senceInfo: { public static senceInfo: {
...@@ -72,11 +73,17 @@ export class Ins { ...@@ -72,11 +73,17 @@ export class Ins {
public static showLoading(){ public static showLoading(){
console.log("canvas请求加载loading") console.log("canvas请求加载loading")
GDispatcher.dispatchEvent({type:"loading"}); GDispatcher.dispatchEvent({type:"loading"});
if(this.stage){
this.stage.mouseEnable = this.stage.mouseChildren = false;
}
} }
public static hideLoading(){ public static hideLoading(){
console.log("canvas请求隐藏loading") console.log("canvas请求隐藏loading")
GDispatcher.dispatchEvent({type:"hideloading"}); GDispatcher.dispatchEvent({type:"hideloading"});
if(this.stage){
this.stage.mouseEnable = this.stage.mouseChildren = true;
}
} }
/**删除一个lottie的所有tween,停止动效 */ /**删除一个lottie的所有tween,停止动效 */
...@@ -141,4 +148,26 @@ export class Ins { ...@@ -141,4 +148,26 @@ export class Ins {
// (1-t)^2 P0 + 2(1-t)tP1+ t^2P2 // (1-t)^2 P0 + 2(1-t)tP1+ t^2P2
return Math.pow(1 - t, 2) * p0 + 2 * (1 - t) * t * p1 + Math.pow(t, 2) * p2; return Math.pow(1 - t, 2) * p0 + 2 * (1 - t) * t * p1 + Math.pow(t, 2) * p2;
} }
//计算两个时间之间的时间差 多少天时分秒
public static intervalTime(time) {
var date3 = time; //时间差的毫秒数
//计算出相差天数
var days = Math.floor(date3 / (24 * 3600 * 1000));
//计算出小时数
var leave1 = date3 % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数
var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
var seconds = Math.round(leave3 / 1000);
// console.log(days + "天 " + hours + "小时 ")
// return days + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒"
return minutes+"分"+seconds+"秒"
}
} }
\ No newline at end of file
...@@ -82,6 +82,7 @@ export class Main { ...@@ -82,6 +82,7 @@ export class Main {
// await RES.loadGroup("common"); // await RES.loadGroup("common");
Ins.stageW = this.stage.viewRect.width; Ins.stageW = this.stage.viewRect.width;
Ins.stageH = this.stage.viewRect.height; Ins.stageH = this.stage.viewRect.height;
Ins.stage = this.stage;
console.log("舞台宽高:",Ins.stageW,Ins.stageH) console.log("舞台宽高:",Ins.stageW,Ins.stageH)
await RES.loadSparkAssets(resloadingList); await RES.loadSparkAssets(resloadingList);
console.log('resloadingList 加载完毕') console.log('resloadingList 加载完毕')
......
...@@ -80,8 +80,9 @@ export class Salmon extends Module{ ...@@ -80,8 +80,9 @@ export class Salmon extends Module{
id:that._id, id:that._id,
energy:that.salmonCnt energy:that.salmonCnt
} }
sendTbNet(TbNetName.takeEnergy,{params},(s,r)=>{ sendTbNet(TbNetName.takeEnergy,{id:that._id,energy:that.salmonCnt},(s,r)=>{
if(s){ if(s){
that.mouseEnable = true;
FYGE.GDispatcher.dispatchEvent(MSG.UPDATE_ENERGY,{call:()=>{that.getSalmonAnim()}}); FYGE.GDispatcher.dispatchEvent(MSG.UPDATE_ENERGY,{call:()=>{that.getSalmonAnim()}});
}else{ }else{
that.mouseEnable = true; that.mouseEnable = true;
......
...@@ -361,8 +361,8 @@ export class MainScene extends Scene { ...@@ -361,8 +361,8 @@ export class MainScene extends Scene {
var that = this; var that = this;
if (that.recoverEnergyHandler) clearInterval(that.recoverEnergyHandler); if (that.recoverEnergyHandler) clearInterval(that.recoverEnergyHandler);
console.log("上一次恢复精力的时间", new Date(Ins.userInfo.lastEnergyTime).getMinutes()) console.log("上一次恢复精力的时间", new Date(Ins.userInfo.lastEnergyTime).getMinutes())
let time = new Date().getTime() - Ins.userInfo.lastEnergyTime; let time = Ins.userInfo.updateTime - Ins.userInfo.lastEnergyTime;
console.log("相差的时间", Math.floor(time % 3600 / 60)) console.log("相差的时间", Ins.intervalTime(time))
if (time <= Ins.recoverEnergy) { if (time <= Ins.recoverEnergy) {
that.recoverEnergyTime = Ins.recoverEnergy - time; that.recoverEnergyTime = Ins.recoverEnergy - time;
} else { } else {
...@@ -559,6 +559,7 @@ export class MainScene extends Scene { ...@@ -559,6 +559,7 @@ export class MainScene extends Scene {
} }
that.isShow = false; that.isShow = false;
that.energyUp1(); that.energyUp1();
that.updateEnergy();
} }
that.setEnergy(); that.setEnergy();
that.mainUi.updateUserInfo(); that.mainUi.updateUserInfo();
...@@ -594,11 +595,7 @@ export class MainScene extends Scene { ...@@ -594,11 +595,7 @@ export class MainScene extends Scene {
let diffCnt = Math.abs(list.length - Ins.salmonArr.length); let diffCnt = Math.abs(list.length - Ins.salmonArr.length);
if (list.length >= Ins.salmonArr.length) { if (list.length >= Ins.salmonArr.length) {
// let index = 0; // let index = 0;
for (let i = 0; i < Ins.salmonArr.length; i++) {
if (Ins.salmonArr[i] && list[Ins.salmonArr[i].index])
Ins.salmonArr[i].setCnt(list[Ins.salmonArr[i].index].energy);
// index = i;
}
//用来获取空的三文鱼索引的index标示位 //用来获取空的三文鱼索引的index标示位
let flagIndex = 0; let flagIndex = 0;
//可以放置的空的三文鱼索引 //可以放置的空的三文鱼索引
...@@ -622,6 +619,25 @@ export class MainScene extends Scene { ...@@ -622,6 +619,25 @@ export class MainScene extends Scene {
Ins.salmonArr.push(salmon); Ins.salmonArr.push(salmon);
setIndex++; setIndex++;
} }
for(let i=1;i<this.salmonArr.length;i++){
for(let j=0;j<this.salmonArr.length-i;j++){
if(this.salmonArr[i].index>this.salmonArr[i].index){
let temp = this.salmonArr[j];
this.salmonArr[j] = this.salmonArr[j+1];
this.salmonArr[j+1] = temp;
}
}
}
setTimeout(() => {
for (let i = 0; i < Ins.salmonArr.length; i++) {
if(Ins.salmonArr)
// if (Ins.salmonArr[i] && list[Ins.salmonArr[i].index])
Ins.salmonArr[i].setCnt(list[i].energy);
// index = i;
}
},100)
} }
} }
...@@ -635,12 +651,8 @@ export class MainScene extends Scene { ...@@ -635,12 +651,8 @@ export class MainScene extends Scene {
this.salmonFlag[index] = false; this.salmonFlag[index] = false;
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
let salmonAnim = new SalmonAnim(x, y, i); let salmonAnim = new SalmonAnim(x, y, i);
// salmonAnim.x = x-salmonAnim.width*0.5;
// salmonAnim.y = y-salmonAnim.height*0.7;
salmonAnim.setTween(100, 1100, i * 100); salmonAnim.setTween(100, 1100, i * 100);
this.salmonGroup.addChild(salmonAnim); this.salmonGroup.addChild(salmonAnim);
// let obj={t:0}
// FYGE.Tween.get(obj,{onChangeObj:obj,onChange:that.salmonMove}).wait(i*300).to({t:1},1000).call(()=>{this.salmonGroup.removeChild(salmonAnim)});
} }
} }
...@@ -649,8 +661,6 @@ export class MainScene extends Scene { ...@@ -649,8 +661,6 @@ export class MainScene extends Scene {
console.log("三文鱼运动", this, salmonAnim) console.log("三文鱼运动", this, salmonAnim)
} }
/**召回猫咪 */ /**召回猫咪 */
recallCat() { recallCat() {
console.log("找回猫咪,刷新用户信息,刷新出勤状态") console.log("找回猫咪,刷新用户信息,刷新出勤状态")
......
...@@ -23,7 +23,7 @@ export class StartScene extends Scene { ...@@ -23,7 +23,7 @@ export class StartScene extends Scene {
if (s) { if (s) {
if (r.data) { if (r.data) {
Ins.userInfo = r.data; Ins.userInfo = r.data;
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */ /**判断猫咪是否出寝,只在用户进入游戏时判断,使用接口判断*/
that.judgeCatIsOutAChangeMainScene(); that.judgeCatIsOutAChangeMainScene();
} else { } else {
sceneBg.visible = true; sceneBg.visible = true;
...@@ -46,7 +46,7 @@ export class StartScene extends Scene { ...@@ -46,7 +46,7 @@ export class StartScene extends Scene {
console.log("选择完猫咪",r) console.log("选择完猫咪",r)
Ins.showLoading(); Ins.showLoading();
Ins.userInfo = r.data.data; Ins.userInfo = r.data.data;
/**判断猫咪是否出寝,只在用户进入游戏时判断,后面要根据接口改写,现在先做测试 */ /**判断猫咪是否出寝,只在用户进入游戏时判断,使用接口判断 */
this.judgeCatIsOutAChangeMainScene(); this.judgeCatIsOutAChangeMainScene();
} }
......
import cloud from '@tbmp/mp-cloud-sdk'; import cloud from '@tbmp/mp-cloud-sdk';
import tbcc from './tbcc-sdk'; import tbcc from './tbcc-sdk';
const env = 'online' // 云函数环境 test 测试环境 online 线上环境 const env = 'test' // 云函数环境 test 测试环境 online 线上环境
cloud.init({ cloud.init({
env: env env: env
}); });
...@@ -9,7 +9,7 @@ cloud.init({ ...@@ -9,7 +9,7 @@ cloud.init({
App({ App({
env, env,
requestType: 'cloud', // yapi,cloud: 云函数 requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'local', // yapi,cloud: 云函数 // requestType: 'local', // yapi,cloud: 云函数
cloudName: 'tmallCat', // 主云函数项目名 tmallCat cloudName: 'tmallCat', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat // cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud, cloud,
...@@ -29,8 +29,8 @@ App({ ...@@ -29,8 +29,8 @@ App({
const { activityId } = query; const { activityId } = query;
// this.activityId = activityId || '5f81841def5071b132fd5e21'; //赵然 // this.activityId = activityId || '5f81841def5071b132fd5e21'; //赵然
// this.activityId = activityId || '5f8022919da671f3b6d5fb14'; //小婷1 // this.activityId = activityId || '5f8022919da671f3b6d5fb14'; //小婷1
this.activityId = activityId || '5f8d47218e6a0888fc426fad'; //小婷2zhengshi // this.activityId = activityId || '5f8d47218e6a0888fc426fad'; //小婷2zhengshi
// this.activityId = activityId || '5f87e8a29897b4e0ce0ada02'; //ceshi this.activityId = activityId || '5f87e8a29897b4e0ce0ada02'; //ceshi
} }
......
.my-prize-page { .my-prize-page {
width: 750rpx; width: 100vw;
height: 1624rpx; height: 100vh;
opacity: 1; opacity: 1;
position: absolute; position: absolute;
top: 0; top: 0;
......
...@@ -2049,19 +2049,19 @@ const resCanvasList = { ...@@ -2049,19 +2049,19 @@ const resCanvasList = {
'69435791-11ee-4c7f-9036-c4c3e28e1750': { '69435791-11ee-4c7f-9036-c4c3e28e1750': {
name: '经验条背景', name: '经验条背景',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png', url: 'https://yun.duiba.com.cn/spark/assets/37804e762d5d95f33fbc8aaf74e15a7f80914696.png',
uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750' uuid: '69435791-11ee-4c7f-9036-c4c3e28e1750'
}, },
'6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': { '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572': {
name: '经验条图片', name: '经验条图片',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png', url: 'https://yun.duiba.com.cn/spark/assets/b6ec2760d1cefdff179e9b9cfdaa6d7505b69102.png',
uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572' uuid: '6ecc2b1c-52bf-471a-b03e-3f3f5f9fc572'
}, },
'5cc07d1e-00f8-4178-8112-44fda9c15481': { '5cc07d1e-00f8-4178-8112-44fda9c15481': {
name: 'bedroomguide3final', name: 'bedroomguide3final',
ext: '.png', ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png', url: 'https://yun.duiba.com.cn/spark/assets/e468a8228ec70023b4f395ac880e840ce8875250.png',
uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481' uuid: '5cc07d1e-00f8-4178-8112-44fda9c15481'
} }
}; };
...@@ -2199,6 +2199,7 @@ var MSG; ...@@ -2199,6 +2199,7 @@ var MSG;
MSG["UPDATE_ENERGY"] = "UPDATE_ENERGY"; MSG["UPDATE_ENERGY"] = "UPDATE_ENERGY";
MSG["SALMON_ANIM"] = "SALMON_ANIM"; MSG["SALMON_ANIM"] = "SALMON_ANIM";
MSG["FISH_COINANIM"] = "FISH_COINANIM"; MSG["FISH_COINANIM"] = "FISH_COINANIM";
MSG["SETUI_ENERGY"] = "SETUI_ENERGY";
})(MSG = exports.MSG || (exports.MSG = {})); })(MSG = exports.MSG || (exports.MSG = {}));
var CATTYPE; var CATTYPE;
(function (CATTYPE) { (function (CATTYPE) {
...@@ -2254,10 +2255,18 @@ var Ins = (function () { ...@@ -2254,10 +2255,18 @@ var Ins = (function () {
Main_1.GDispatcher.dispatchEvent({ type: "toast" }, msg); Main_1.GDispatcher.dispatchEvent({ type: "toast" }, msg);
}; };
Ins.showLoading = function () { Ins.showLoading = function () {
console.log("canvas请求加载loading");
Main_1.GDispatcher.dispatchEvent({ type: "loading" }); Main_1.GDispatcher.dispatchEvent({ type: "loading" });
if (this.stage) {
this.stage.mouseEnable = this.stage.mouseChildren = false;
}
}; };
Ins.hideLoading = function () { Ins.hideLoading = function () {
console.log("canvas请求隐藏loading");
Main_1.GDispatcher.dispatchEvent({ type: "hideloading" }); Main_1.GDispatcher.dispatchEvent({ type: "hideloading" });
if (this.stage) {
this.stage.mouseEnable = this.stage.mouseChildren = true;
}
}; };
Ins.stopLottieAnim = function (lottie) { Ins.stopLottieAnim = function (lottie) {
FYGE.Tween.removeTweens(lottie); FYGE.Tween.removeTweens(lottie);
...@@ -2405,6 +2414,7 @@ var Main = (function () { ...@@ -2405,6 +2414,7 @@ var Main = (function () {
console.log("初始化层级完成"); console.log("初始化层级完成");
Ins_1.Ins.stageW = this.stage.viewRect.width; Ins_1.Ins.stageW = this.stage.viewRect.width;
Ins_1.Ins.stageH = this.stage.viewRect.height; Ins_1.Ins.stageH = this.stage.viewRect.height;
Ins_1.Ins.stage = this.stage;
console.log("舞台宽高:", Ins_1.Ins.stageW, Ins_1.Ins.stageH); console.log("舞台宽高:", Ins_1.Ins.stageW, Ins_1.Ins.stageH);
return [4, RES_1.RES.loadSparkAssets(resloadingList_1.default)]; return [4, RES_1.RES.loadSparkAssets(resloadingList_1.default)];
case 1: case 1:
...@@ -3130,8 +3140,9 @@ var Salmon = (function (_super) { ...@@ -3130,8 +3140,9 @@ var Salmon = (function (_super) {
id: that._id, id: that._id,
energy: that.salmonCnt energy: that.salmonCnt
}; };
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.takeEnergy, { params: params }, function (s, r) { TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.takeEnergy, { id: that._id, energy: that.salmonCnt }, function (s, r) {
if (s) { if (s) {
that.mouseEnable = true;
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } }); FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } });
} }
else { else {
...@@ -3201,11 +3212,13 @@ var __extends = (this && this.__extends) || (function () { ...@@ -3201,11 +3212,13 @@ var __extends = (this && this.__extends) || (function () {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.SalmonAnim = void 0; exports.SalmonAnim = void 0;
var Module_1 = __webpack_require__(/*! ../../module/views/Module */ "./module/views/Module.ts"); var Module_1 = __webpack_require__(/*! ../../module/views/Module */ "./module/views/Module.ts");
var Enum_1 = __webpack_require__(/*! ../Enum */ "./src/Enum.ts");
var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts"); var Ins_1 = __webpack_require__(/*! ../Ins */ "./src/Ins.ts");
var SalmonAnim = (function (_super) { var SalmonAnim = (function (_super) {
__extends(SalmonAnim, _super); __extends(SalmonAnim, _super);
function SalmonAnim(x, y) { function SalmonAnim(x, y, index) {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this.index = 0;
_this.t = 0; _this.t = 0;
_this.targetX = 0; _this.targetX = 0;
_this.targetY = 0; _this.targetY = 0;
...@@ -3215,6 +3228,7 @@ var SalmonAnim = (function (_super) { ...@@ -3215,6 +3228,7 @@ var SalmonAnim = (function (_super) {
_this.y = y; _this.y = y;
_this.originX = x; _this.originX = x;
_this.originY = y; _this.originY = y;
_this.index = index;
return _this; return _this;
} }
SalmonAnim.prototype.initUi = function () { SalmonAnim.prototype.initUi = function () {
...@@ -3229,6 +3243,9 @@ var SalmonAnim = (function (_super) { ...@@ -3229,6 +3243,9 @@ var SalmonAnim = (function (_super) {
this.targetX = targetX; this.targetX = targetX;
this.targetY = targetY; this.targetY = targetY;
FYGE.Tween.get(this, { onChangeObj: this, onChange: this.move }).wait(waitTime).to({ t: 1 }, 800).call(function () { FYGE.Tween.get(this, { onChangeObj: this, onChange: this.move }).wait(waitTime).to({ t: 1 }, 800).call(function () {
if (_this.index == 0) {
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.SETUI_ENERGY);
}
if (_this && _this.parent) { if (_this && _this.parent) {
_this.parent.removeChild(_this); _this.parent.removeChild(_this);
} }
...@@ -47362,6 +47379,7 @@ var MainScene = (function (_super) { ...@@ -47362,6 +47379,7 @@ var MainScene = (function (_super) {
var _this = _super.call(this, data) || this; var _this = _super.call(this, data) || this;
_this.bgUUID = []; _this.bgUUID = [];
_this.maxEnergy = 1500; _this.maxEnergy = 1500;
_this.firstSetEnergy = true;
_this.level = 0; _this.level = 0;
_this.isShow = false; _this.isShow = false;
_this.salmonArr = []; _this.salmonArr = [];
...@@ -47569,8 +47587,17 @@ var MainScene = (function (_super) { ...@@ -47569,8 +47587,17 @@ var MainScene = (function (_super) {
var that = this; var that = this;
that.energy = Ins_1.Ins.userInfo.energy; that.energy = Ins_1.Ins.userInfo.energy;
that.maxEnergy = Ins_1.Ins.userInfo.energyMax; that.maxEnergy = Ins_1.Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy); that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2; that.energyDeco.x = that.energyImgW * that.energyImg.scaleX - that.energyDeco.width * 0.2;
}
else {
FYGE.Tween.get(that.energyImg).to({ scaleX: (that.energy / that.maxEnergy) }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * (that.energy / that.maxEnergy) - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy; that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2; that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
console.log("设置精力组数据结束"); console.log("设置精力组数据结束");
...@@ -47580,7 +47607,7 @@ var MainScene = (function (_super) { ...@@ -47580,7 +47607,7 @@ var MainScene = (function (_super) {
if (that.recoverEnergyHandler) if (that.recoverEnergyHandler)
clearInterval(that.recoverEnergyHandler); clearInterval(that.recoverEnergyHandler);
console.log("上一次恢复精力的时间", new Date(Ins_1.Ins.userInfo.lastEnergyTime).getMinutes()); console.log("上一次恢复精力的时间", new Date(Ins_1.Ins.userInfo.lastEnergyTime).getMinutes());
var time = new Date().getTime() - Ins_1.Ins.userInfo.lastEnergyTime; var time = Ins_1.Ins.userInfo.updateTime - Ins_1.Ins.userInfo.lastEnergyTime;
console.log("相差的时间", Math.floor(time % 3600 / 60)); console.log("相差的时间", Math.floor(time % 3600 / 60));
if (time <= Ins_1.Ins.recoverEnergy) { if (time <= Ins_1.Ins.recoverEnergy) {
that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time; that.recoverEnergyTime = Ins_1.Ins.recoverEnergy - time;
...@@ -47757,6 +47784,7 @@ var MainScene = (function (_super) { ...@@ -47757,6 +47784,7 @@ var MainScene = (function (_super) {
} }
that.isShow = false; that.isShow = false;
that.energyUp1(); that.energyUp1();
that.updateEnergy();
} }
that.setEnergy(); that.setEnergy();
that.mainUi.updateUserInfo(); that.mainUi.updateUserInfo();
...@@ -47774,7 +47802,6 @@ var MainScene = (function (_super) { ...@@ -47774,7 +47802,6 @@ var MainScene = (function (_super) {
var energyList = r.data.energyList; var energyList = r.data.energyList;
Ins_1.Ins.userInfo.energy = r.data.energy; Ins_1.Ins.userInfo.energy = r.data.energy;
e && e.data.call && e.data.call(); e && e.data.call && e.data.call();
that.setEnergy();
that.initSalmon(energyList); that.initSalmon(energyList);
Ins_1.Ins.hideLoading(); Ins_1.Ins.hideLoading();
} }
...@@ -47787,9 +47814,6 @@ var MainScene = (function (_super) { ...@@ -47787,9 +47814,6 @@ var MainScene = (function (_super) {
MainScene.prototype.initSalmon = function (list) { MainScene.prototype.initSalmon = function (list) {
var diffCnt = Math.abs(list.length - Ins_1.Ins.salmonArr.length); var diffCnt = Math.abs(list.length - Ins_1.Ins.salmonArr.length);
if (list.length >= Ins_1.Ins.salmonArr.length) { if (list.length >= Ins_1.Ins.salmonArr.length) {
for (var i = 0; i < Ins_1.Ins.salmonArr.length; i++) {
Ins_1.Ins.salmonArr[i].setCnt(list[Ins_1.Ins.salmonArr[i].index].energy);
}
var flagIndex = 0; var flagIndex = 0;
var canSetIndexArr = []; var canSetIndexArr = [];
while (flagIndex < 8) { while (flagIndex < 8) {
...@@ -47809,6 +47833,21 @@ var MainScene = (function (_super) { ...@@ -47809,6 +47833,21 @@ var MainScene = (function (_super) {
Ins_1.Ins.salmonArr.push(salmon); Ins_1.Ins.salmonArr.push(salmon);
setIndex++; setIndex++;
} }
for (var i = 1; i < this.salmonArr.length; i++) {
for (var j = 0; j < this.salmonArr.length - i; j++) {
if (this.salmonArr[i].index > this.salmonArr[i].index) {
var temp = this.salmonArr[j];
this.salmonArr[j] = this.salmonArr[j + 1];
this.salmonArr[j + 1] = temp;
}
}
}
setTimeout(function () {
for (var i = 0; i < Ins_1.Ins.salmonArr.length; i++) {
if (Ins_1.Ins.salmonArr)
Ins_1.Ins.salmonArr[i].setCnt(list[i].energy);
}
}, 100);
} }
}; };
MainScene.prototype.salmonAnim = function (e) { MainScene.prototype.salmonAnim = function (e) {
...@@ -47819,7 +47858,7 @@ var MainScene = (function (_super) { ...@@ -47819,7 +47858,7 @@ var MainScene = (function (_super) {
var index = e.data.index; var index = e.data.index;
this.salmonFlag[index] = false; this.salmonFlag[index] = false;
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
var salmonAnim = new SalmonAnim_1.SalmonAnim(x, y); var salmonAnim = new SalmonAnim_1.SalmonAnim(x, y, i);
salmonAnim.setTween(100, 1100, i * 100); salmonAnim.setTween(100, 1100, i * 100);
this.salmonGroup.addChild(salmonAnim); this.salmonGroup.addChild(salmonAnim);
} }
...@@ -47894,6 +47933,7 @@ var MainScene = (function (_super) { ...@@ -47894,6 +47933,7 @@ var MainScene = (function (_super) {
that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.addEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.SETUI_ENERGY, that.setEnergy, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that);
FYGE.GDispatcher.addEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that); FYGE.GDispatcher.addEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that);
Main_1.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that); Main_1.GDispatcher.addEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
...@@ -47910,6 +47950,7 @@ var MainScene = (function (_super) { ...@@ -47910,6 +47950,7 @@ var MainScene = (function (_super) {
that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that); that.letter && that.letter.removeEventListener(FYGE.MouseEvent.CLICK, that.openLetter, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.CHANGE_SCENE, function () { that.changeMainScene(Enum_1.SCENETYPE.BEADROOM); }, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_ENERGY, function (data) { that.updateEnergy(data); }, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SETUI_ENERGY, that.setEnergy, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.SALMON_ANIM, that.salmonAnim, that);
FYGE.GDispatcher.removeEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that); FYGE.GDispatcher.removeEventListener(Enum_1.MSG.FISH_COINANIM, that.coinAnim, that);
Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that); Main_1.GDispatcher.removeEventListener(Enum_1.MSG.UPDATE_USERINFO, that.updateUserInfo, that);
...@@ -48212,12 +48253,17 @@ var MainSceneBtnUi = (function (_super) { ...@@ -48212,12 +48253,17 @@ var MainSceneBtnUi = (function (_super) {
that.catExperienceBg.addChild(that.catExperience); that.catExperienceBg.addChild(that.catExperience);
var mask = new FYGE.Shape(); var mask = new FYGE.Shape();
mask.beginFill(6, 1); mask.beginFill(6, 1);
mask.drawRoundedRect(-4, 0, that.catExperience.width, that.catExperience.height, 45, 45, 45, 45); mask.drawRoundedRect(0, 0, that.catExperience.width, that.catExperience.height, 45, 45, 45, 45);
mask.endFill(); mask.endFill();
mask.x = 5; mask.x = 0;
mask.y = 0; mask.y = 0;
that.catExperienceBg.addChild(mask); that.catExperienceBg.addChild(mask);
that.catExperience.mask = mask; that.catExperience.mask = mask;
var rect = new FYGE.Shape();
rect.beginStroke(4670787, 4);
rect.drawRoundedRect(2, 2, that.catExperienceBg.width - 4, that.catExperienceBg.height - 4, 45, 45, 45, 45);
rect.endStroke();
that.catExperienceBg.addChild(rect);
that.experience = Ins_1.Ins.initLabel({ size: 20 }); that.experience = Ins_1.Ins.initLabel({ size: 20 });
that.experience.position.set(174, 53); that.experience.position.set(174, 53);
that.experience.textWidth = 110; that.experience.textWidth = 110;
...@@ -48261,8 +48307,14 @@ var MainSceneBtnUi = (function (_super) { ...@@ -48261,8 +48307,14 @@ var MainSceneBtnUi = (function (_super) {
that.catNameLabel.text = catName; that.catNameLabel.text = catName;
that.catLevelLabel.text = "Lv." + level; that.catLevelLabel.text = "Lv." + level;
that.fishPointLabel.text = "" + happyCoin; that.fishPointLabel.text = "" + happyCoin;
that.catExperience.scaleX = experience / experienceMax;
that.experience.text = experience + "/" + experienceMax; that.experience.text = experience + "/" + experienceMax;
var percent = experience / experienceMax;
if (percent >= 1) {
that.catExperience.x = (experience / experienceMax - 1) * that.catExperience.width;
}
else {
that.catExperience.x = (experience / experienceMax - 1) * that.catExperience.width + 4;
}
}; };
MainSceneBtnUi.prototype.hideAllActBtn = function () { MainSceneBtnUi.prototype.hideAllActBtn = function () {
var that = this; var that = this;
...@@ -101,12 +101,12 @@ Page({ ...@@ -101,12 +101,12 @@ Page({
console.log('on ready') console.log('on ready')
//授权和登录先搞 //授权和登录先搞
await this.getAuth(); // await this.getAuth();
setTimeout(()=>{ // setTimeout(()=>{
my.navigateTo({ // my.navigateTo({
url: `/pages/myprize/myprize` // url: `/pages/pageshop/pageshop`
}); // });
},1000) // },1000)
// this.initCanvas(); // this.initCanvas();
my.__onMessage__ = (e) => { my.__onMessage__ = (e) => {
this.onMessage(e) this.onMessage(e)
......
.shop-page { .shop-page {
width: 750rpx; width: 100vw;
height: 1624rpx; height: 100vh;
opacity: 1; opacity: 1;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
bottom: 0; bottom: 0;
top: 464rpx; top: 464rpx;
padding-left: 54rpx; padding-left: 54rpx;
right:0; right: 0;
overflow-x: auto; overflow-x: auto;
} }
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
} }
.shop .shopitem .shopitem_avatar { .shop .shopitem .shopitem_avatar {
width: 161rpx; width: 161rpx;
height: 161rpx; height: 161rpx;
...@@ -135,12 +136,18 @@ ...@@ -135,12 +136,18 @@
.shop .shop_gold { .shop .shop_gold {
opacity: 1; opacity: 1;
height: 54rpx;
left: 370rpx; left: 370rpx;
top: 326rpx; top: 320rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
font-size: 23.47394rpx; font-size: 23.47394rpx;
color: #7b644e; color: #7b644e;
vertical-align: middle;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
} }
.shop .shop_backbtn { .shop .shop_backbtn {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment