Commit 3e5bc83b authored by Edwise's avatar Edwise 🍷

搞定精力值上限与精力值根据后端改变

parent 45ea2a0a
......@@ -12,11 +12,13 @@
"sence": 1,
"catName": "哈哈哈",
"senceTips":["1说话说话说话说话说话说话说话说话说话说话说话","2说话说话说话说话说话说话说话说话说话说话说话说话","3说话说话说话说话说话说话说话说话说话说话说话说话"],
"energyMax":50,
"energyMax":20,
"experienceMax":1000,
"senceGuide":true,
"updateTime":1607507495319,
"lastEnergyTime":1607507395319,
"serverTime":1607507495319
"serverTime":1607507495319,
"recoveryTime":1200000,
"limitEnergyCount":5
}
}
......@@ -2324,6 +2324,7 @@ var Ins = (function () {
return minutes + "分" + seconds + "秒";
};
Ins.recoverEnergy = 10 * 60 * 1000;
Ins.canGetSalmon = true;
Ins.salmonArr = [];
return Ins;
}());
......@@ -3146,6 +3147,10 @@ var Salmon = (function (_super) {
this.removeEventListener(FYGE.MouseEvent.CLICK, this.getEnegry, this);
};
Salmon.prototype.getEnegry = function () {
if (!Ins_1.Ins.canGetSalmon)
return;
Ins_1.Ins.canGetSalmon = false;
Ins_1.Ins.showLoading();
var that = this;
that.mouseEnable = false;
console.log("收取精力值:", that.salmonCnt);
......@@ -3159,6 +3164,7 @@ var Salmon = (function (_super) {
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } });
}
else {
Ins_1.Ins.canGetSalmon = true;
that.mouseEnable = true;
Ins_1.Ins.showToast(r && r.message);
Ins_1.Ins.hideLoading();
......@@ -3166,6 +3172,7 @@ var Salmon = (function (_super) {
});
};
Salmon.prototype.getSalmonAnim = function () {
Ins_1.Ins.canGetSalmon = true;
console.log("开始三文鱼动效");
var index = Ins_1.Ins.salmonArr.indexOf(this);
Ins_1.Ins.salmonArr.splice(index, 1);
......@@ -47412,38 +47419,47 @@ var MainScene = (function (_super) {
that.initSceneEle();
};
MainScene.prototype.initSceneEle = function () {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.salmonArr = [];
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins_1.Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins_1.Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new mainSceneBtnUi_1.MainSceneBtnUi({ uiType: Ins_1.Ins.curScene == 4 ? 3 : Ins_1.Ins.curScene, callF: function () { that.initGuide(Ins_1.Ins.curScene > 3 ? 3 : Ins_1.Ins.curScene); } });
that.addChild(that.mainUi);
that.outTips = Ins_1.Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins_1.Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束");
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(function () {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100);
try {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.canGetSalmon = true;
Ins_1.Ins.salmonArr = [];
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
Ins_1.Ins.recoverEnergy = Ins_1.Ins.userInfo.recoveryTime || 20 * 60 * 1000;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins_1.Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins_1.Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new mainSceneBtnUi_1.MainSceneBtnUi({ uiType: Ins_1.Ins.curScene == 4 ? 3 : Ins_1.Ins.curScene, callF: function () { that.initGuide(Ins_1.Ins.curScene > 3 ? 3 : Ins_1.Ins.curScene); } });
that.addChild(that.mainUi);
that.outTips = Ins_1.Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins_1.Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束");
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(function () {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100);
}
catch (_a) {
(function (e) {
console.log("fgggg----->", e);
});
}
};
MainScene.prototype.initDialog = function () {
this.dialogGroup = new FYGE.Sprite();
......@@ -47586,7 +47602,8 @@ var MainScene = (function (_super) {
that.energyGroup.addChild(that.energyDeco);
that.energyDialog = Ins_1.Ins.initSprite("69009eb9-4593-4a43-a9d7-a6356ebd6d04", 174, -60);
that.energyGroup.addChild(that.energyDialog);
that.energyDialogLabel = Ins_1.Ins.initLabel({ size: 26, text: "每10分钟恢复1点精力" });
var recoverTime = Math.floor(Ins_1.Ins.recoverEnergy / 1000 / 60);
that.energyDialogLabel = Ins_1.Ins.initLabel({ size: 26, text: "\u6BCF" + recoverTime + "\u5206\u949F\u6062\u590D1\u70B9\u7CBE\u529B" });
that.energyDialog.addChild(that.energyDialogLabel);
that.energyDialogLabel.x = (that.energyDialog.width - that.energyDialogLabel.textWidth) * 0.5;
that.energyDialogLabel.y = (that.energyDialog.height - that.energyDialogLabel.textHeight) * 0.5 - 6;
......@@ -47609,14 +47626,15 @@ var MainScene = (function (_super) {
that.maxEnergy = Ins_1.Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
var scaleX = (that.energy / that.maxEnergy) > 1 ? 1 : (that.energy / that.maxEnergy);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyImg.scaleX = scaleX;
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);
FYGE.Tween.get(that.energyImg).to({ scaleX: scaleX }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * scaleX - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
......@@ -47851,7 +47869,10 @@ var MainScene = (function (_super) {
if (list.length >= Ins_1.Ins.salmonArr.length) {
var flagIndex = 0;
var canSetIndexArr = [];
while (flagIndex < 8) {
var maxEnergy = Ins_1.Ins.userInfo.energyMax;
var limitEnergy = Ins_1.Ins.userInfo.limitEnergyCount || 5;
var salmonMaxCnt = list.length >= 8 ? list.length : Math.ceil(maxEnergy / limitEnergy);
while (flagIndex < salmonMaxCnt) {
if (!this.salmonFlag[flagIndex]) {
canSetIndexArr.push({ index: flagIndex });
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2326,6 +2326,7 @@ var Ins = (function () {
return minutes + "分" + seconds + "秒";
};
Ins.recoverEnergy = 10 * 60 * 1000;
Ins.canGetSalmon = true;
Ins.salmonArr = [];
return Ins;
}());
......@@ -3148,6 +3149,10 @@ var Salmon = (function (_super) {
this.removeEventListener(FYGE.MouseEvent.CLICK, this.getEnegry, this);
};
Salmon.prototype.getEnegry = function () {
if (!Ins_1.Ins.canGetSalmon)
return;
Ins_1.Ins.canGetSalmon = false;
Ins_1.Ins.showLoading();
var that = this;
that.mouseEnable = false;
console.log("收取精力值:", that.salmonCnt);
......@@ -3161,6 +3166,7 @@ var Salmon = (function (_super) {
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } });
}
else {
Ins_1.Ins.canGetSalmon = true;
that.mouseEnable = true;
Ins_1.Ins.showToast(r && r.message);
Ins_1.Ins.hideLoading();
......@@ -3168,6 +3174,7 @@ var Salmon = (function (_super) {
});
};
Salmon.prototype.getSalmonAnim = function () {
Ins_1.Ins.canGetSalmon = true;
console.log("开始三文鱼动效");
var index = Ins_1.Ins.salmonArr.indexOf(this);
Ins_1.Ins.salmonArr.splice(index, 1);
......@@ -47414,38 +47421,47 @@ var MainScene = (function (_super) {
that.initSceneEle();
};
MainScene.prototype.initSceneEle = function () {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.salmonArr = [];
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins_1.Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins_1.Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new mainSceneBtnUi_1.MainSceneBtnUi({ uiType: Ins_1.Ins.curScene == 4 ? 3 : Ins_1.Ins.curScene, callF: function () { that.initGuide(Ins_1.Ins.curScene > 3 ? 3 : Ins_1.Ins.curScene); } });
that.addChild(that.mainUi);
that.outTips = Ins_1.Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins_1.Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束");
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(function () {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100);
try {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.canGetSalmon = true;
Ins_1.Ins.salmonArr = [];
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
Ins_1.Ins.recoverEnergy = Ins_1.Ins.userInfo.recoveryTime || 20 * 60 * 1000;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins_1.Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins_1.Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new mainSceneBtnUi_1.MainSceneBtnUi({ uiType: Ins_1.Ins.curScene == 4 ? 3 : Ins_1.Ins.curScene, callF: function () { that.initGuide(Ins_1.Ins.curScene > 3 ? 3 : Ins_1.Ins.curScene); } });
that.addChild(that.mainUi);
that.outTips = Ins_1.Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins_1.Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束");
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(function () {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100);
}
catch (_a) {
(function (e) {
console.log("fgggg----->", e);
});
}
};
MainScene.prototype.initDialog = function () {
this.dialogGroup = new FYGE.Sprite();
......@@ -47588,7 +47604,8 @@ var MainScene = (function (_super) {
that.energyGroup.addChild(that.energyDeco);
that.energyDialog = Ins_1.Ins.initSprite("69009eb9-4593-4a43-a9d7-a6356ebd6d04", 174, -60);
that.energyGroup.addChild(that.energyDialog);
that.energyDialogLabel = Ins_1.Ins.initLabel({ size: 26, text: "每10分钟恢复1点精力" });
var recoverTime = Math.floor(Ins_1.Ins.recoverEnergy / 1000 / 60);
that.energyDialogLabel = Ins_1.Ins.initLabel({ size: 26, text: "\u6BCF" + recoverTime + "\u5206\u949F\u6062\u590D1\u70B9\u7CBE\u529B" });
that.energyDialog.addChild(that.energyDialogLabel);
that.energyDialogLabel.x = (that.energyDialog.width - that.energyDialogLabel.textWidth) * 0.5;
that.energyDialogLabel.y = (that.energyDialog.height - that.energyDialogLabel.textHeight) * 0.5 - 6;
......@@ -47611,14 +47628,15 @@ var MainScene = (function (_super) {
that.maxEnergy = Ins_1.Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
var scaleX = (that.energy / that.maxEnergy) > 1 ? 1 : (that.energy / that.maxEnergy);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyImg.scaleX = scaleX;
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);
FYGE.Tween.get(that.energyImg).to({ scaleX: scaleX }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * scaleX - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
......@@ -47853,7 +47871,10 @@ var MainScene = (function (_super) {
if (list.length >= Ins_1.Ins.salmonArr.length) {
var flagIndex = 0;
var canSetIndexArr = [];
while (flagIndex < 8) {
var maxEnergy = Ins_1.Ins.userInfo.energyMax;
var limitEnergy = Ins_1.Ins.userInfo.limitEnergyCount || 5;
var salmonMaxCnt = list.length >= 8 ? list.length : Math.ceil(maxEnergy / limitEnergy);
while (flagIndex < salmonMaxCnt) {
if (!this.salmonFlag[flagIndex]) {
canSetIndexArr.push({ index: flagIndex });
}
......@@ -22,6 +22,9 @@ export class Ins {
/**多长时间恢复精力(ms) */
public static recoverEnergy:number = 10*60*1000;
/**可以收取三文鱼 */
public static canGetSalmon = true;
/**当前游戏中的三文鱼 */
public static salmonArr:Salmon[] = [];
......@@ -43,7 +46,9 @@ export class Ins {
"senceGuide":boolean,
"lastEnergyTime":number,
"updateTime":number,
"serverTime":number
"serverTime":number,
"recoveryTime":number,
"limitEnergyCount":number
}
public static senceInfo: {
......
......@@ -73,6 +73,9 @@ export class Salmon extends Module{
/**收取精力 */
getEnegry(){
if(!Ins.canGetSalmon) return;
Ins.canGetSalmon = false;
Ins.showLoading();
var that = this;
that.mouseEnable = false;
console.log("收取精力值:",that.salmonCnt);
......@@ -85,6 +88,7 @@ export class Salmon extends Module{
that.mouseEnable = true;
FYGE.GDispatcher.dispatchEvent(MSG.UPDATE_ENERGY,{call:()=>{that.getSalmonAnim()}});
}else{
Ins.canGetSalmon = true;
that.mouseEnable = true;
Ins.showToast(r&&r.message);
Ins.hideLoading();
......@@ -94,6 +98,7 @@ export class Salmon extends Module{
/**收取三文鱼时候的动效 */
getSalmonAnim(){
Ins.canGetSalmon = true;
console.log("开始三文鱼动效")
let index = Ins.salmonArr.indexOf(this);
Ins.salmonArr.splice(index,1);
......
......@@ -100,50 +100,59 @@ export class MainScene extends Scene {
/**初始化场景元素 */
initSceneEle() {
var that = this;
try {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins.canGetSalmon = true;
Ins.salmonArr = [];
Ins.curScene = Ins.senceInfo.sence;
Ins.recoverEnergy = Ins.userInfo.recoveryTime||20*60*1000;
console.log("当前场景", Ins.curScene);
//0:教室,1:操场,2:寝室
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
//生成默认场景,后面要改成根据接口值判断
that.sceneBg = Ins.initSprite(that.bgUUID[Ins.curScene == 4 ? 2 : Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new MainSceneBtnUi({ uiType: Ins.curScene == 4 ? 3 : Ins.curScene, callF: () => { that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene) } });
that.addChild(that.mainUi);
that.outTips = Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束")
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(() => {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100)
// that.initSalmon();
// that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene);
// var a = Ins.initLabel({text:"ergergergergerg",x:300,y:800});
// this.addChildAt(a,999);
} catch {
(e) => {
console.log("fgggg----->", e)
}
}
console.log(that.y);
that.mouseChildren = true;
Ins.salmonArr = [];
Ins.curScene = Ins.senceInfo.sence;
console.log("当前场景", Ins.curScene);
//0:教室,1:操场,2:寝室
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
//生成默认场景,后面要改成根据接口值判断
that.sceneBg = Ins.initSprite(that.bgUUID[Ins.curScene == 4 ? 2 : Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new MainSceneBtnUi({ uiType: Ins.curScene == 4 ? 3 : Ins.curScene, callF: () => { that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene) } });
that.addChild(that.mainUi);
that.outTips = Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束")
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(() => {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100)
// that.initSalmon();
// that.initGuide(Ins.curScene > 3 ? 3 : Ins.curScene);
// var a = Ins.initLabel({text:"ergergergergerg",x:300,y:800});
// this.addChildAt(a,999);
}
/**初始化对话框 */
......@@ -321,7 +330,8 @@ export class MainScene extends Scene {
that.energyGroup.addChild(that.energyDeco);
that.energyDialog = Ins.initSprite("69009eb9-4593-4a43-a9d7-a6356ebd6d04", 174, -60);
that.energyGroup.addChild(that.energyDialog);
that.energyDialogLabel = Ins.initLabel({ size: 26, text: "每10分钟恢复1点精力" });
let recoverTime = Math.floor(Ins.recoverEnergy/1000/60);
that.energyDialogLabel = Ins.initLabel({ size: 26, text: `每${recoverTime}分钟恢复1点精力` });
that.energyDialog.addChild(that.energyDialogLabel);
that.energyDialogLabel.x = (that.energyDialog.width - that.energyDialogLabel.textWidth) * 0.5;
that.energyDialogLabel.y = (that.energyDialog.height - that.energyDialogLabel.textHeight) * 0.5 - 6;
......@@ -347,13 +357,14 @@ export class MainScene extends Scene {
that.maxEnergy = Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
let scaleX = (that.energy / that.maxEnergy)>1?1:(that.energy / that.maxEnergy);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyImg.scaleX = scaleX
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);
FYGE.Tween.get(that.energyImg).to({ scaleX: scaleX }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * scaleX - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2
......@@ -416,13 +427,13 @@ export class MainScene extends Scene {
if (s) {
that.recoverEnergyTime = Ins.recoverEnergy;
console.log("设置恢复时间", that.recoverEnergyTime)
let energyList = r.data.energyList;
that.initSalmon(energyList);
// if (r.data.energy != Ins.userInfo.energy) {
Ins.userInfo.energy = r.data.energy;
// that.recoverEnergyTime = Ins.recoverEnergy;
// console.log("设置恢复时间",that.recoverEnergyTime)
that.setEnergy();
let energyList = r.data.energyList;
that.initSalmon(energyList);
// if (r.data.energy != Ins.userInfo.energy) {
Ins.userInfo.energy = r.data.energy;
// that.recoverEnergyTime = Ins.recoverEnergy;
// console.log("设置恢复时间",that.recoverEnergyTime)
that.setEnergy();
return;
// } else {
// if (r.data.energy != Ins.userInfo.energyMax) {
......@@ -620,7 +631,10 @@ export class MainScene extends Scene {
let flagIndex = 0;
//可以放置的空的三文鱼索引
let canSetIndexArr = [];
while (flagIndex < 8) {
let maxEnergy = Ins.userInfo.energyMax;
let limitEnergy = Ins.userInfo.limitEnergyCount||5;
let salmonMaxCnt = list.length >= 8 ? list.length : Math.ceil(maxEnergy / limitEnergy)
while (flagIndex < salmonMaxCnt) {
if (!this.salmonFlag[flagIndex]) {
canSetIndexArr.push({ index: flagIndex });
}
......
......@@ -2326,6 +2326,7 @@ var Ins = (function () {
return minutes + "分" + seconds + "秒";
};
Ins.recoverEnergy = 10 * 60 * 1000;
Ins.canGetSalmon = true;
Ins.salmonArr = [];
return Ins;
}());
......@@ -3148,6 +3149,10 @@ var Salmon = (function (_super) {
this.removeEventListener(FYGE.MouseEvent.CLICK, this.getEnegry, this);
};
Salmon.prototype.getEnegry = function () {
if (!Ins_1.Ins.canGetSalmon)
return;
Ins_1.Ins.canGetSalmon = false;
Ins_1.Ins.showLoading();
var that = this;
that.mouseEnable = false;
console.log("收取精力值:", that.salmonCnt);
......@@ -3161,6 +3166,7 @@ var Salmon = (function (_super) {
FYGE.GDispatcher.dispatchEvent(Enum_1.MSG.UPDATE_ENERGY, { call: function () { that.getSalmonAnim(); } });
}
else {
Ins_1.Ins.canGetSalmon = true;
that.mouseEnable = true;
Ins_1.Ins.showToast(r && r.message);
Ins_1.Ins.hideLoading();
......@@ -3168,6 +3174,7 @@ var Salmon = (function (_super) {
});
};
Salmon.prototype.getSalmonAnim = function () {
Ins_1.Ins.canGetSalmon = true;
console.log("开始三文鱼动效");
var index = Ins_1.Ins.salmonArr.indexOf(this);
Ins_1.Ins.salmonArr.splice(index, 1);
......@@ -47414,38 +47421,47 @@ var MainScene = (function (_super) {
that.initSceneEle();
};
MainScene.prototype.initSceneEle = function () {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.salmonArr = [];
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins_1.Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins_1.Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new mainSceneBtnUi_1.MainSceneBtnUi({ uiType: Ins_1.Ins.curScene == 4 ? 3 : Ins_1.Ins.curScene, callF: function () { that.initGuide(Ins_1.Ins.curScene > 3 ? 3 : Ins_1.Ins.curScene); } });
that.addChild(that.mainUi);
that.outTips = Ins_1.Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins_1.Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束");
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(function () {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100);
try {
var that = this;
console.log(that.y);
that.mouseChildren = true;
Ins_1.Ins.canGetSalmon = true;
Ins_1.Ins.salmonArr = [];
Ins_1.Ins.curScene = Ins_1.Ins.senceInfo.sence;
Ins_1.Ins.recoverEnergy = Ins_1.Ins.userInfo.recoveryTime || 20 * 60 * 1000;
console.log("当前场景", Ins_1.Ins.curScene);
that.bgUUID = ["c6d699b0-b276-4985-b3ea-47bcef13f2ea", "efaf990e-5392-49ad-94d8-25c04f651ede", "b3c8c187-e5c9-4968-9a00-a118d18ab2fc"];
that.sceneBg = Ins_1.Ins.initSprite(that.bgUUID[Ins_1.Ins.curScene == 4 ? 2 : Ins_1.Ins.curScene - 1]);
that.addChild(that.sceneBg);
that.x = (Ins_1.Ins.stageW - that.sceneBg.width) >> 1;
that.y = (Ins_1.Ins.stageH - that.sceneBg.height) >> 1;
that.mainUi = new mainSceneBtnUi_1.MainSceneBtnUi({ uiType: Ins_1.Ins.curScene == 4 ? 3 : Ins_1.Ins.curScene, callF: function () { that.initGuide(Ins_1.Ins.curScene > 3 ? 3 : Ins_1.Ins.curScene); } });
that.addChild(that.mainUi);
that.outTips = Ins_1.Ins.initSprite("25abb1fa-58a8-4fed-a962-ab7fb7eed528", (Ins_1.Ins.stageW - 388) * 0.5, 460);
that.addChild(that.outTips);
that.outTips.visible = false;
that.initTlBtnGroup();
that.initCat();
that.initEnergy();
that.energyUp1();
that.initMxqBtnGroup();
that.setSceneTips(1);
console.log("初始化结束");
that.updateEnergy();
that.salmonGroup = new FYGE.Sprite();
that.addChild(that.salmonGroup);
that.salmonGroup.mouseChildren = true;
setTimeout(function () {
that.initDialog();
that.coinAnimGroup = new FYGE.Sprite();
that.addChild(that.coinAnimGroup);
}, 100);
}
catch (_a) {
(function (e) {
console.log("fgggg----->", e);
});
}
};
MainScene.prototype.initDialog = function () {
this.dialogGroup = new FYGE.Sprite();
......@@ -47588,7 +47604,8 @@ var MainScene = (function (_super) {
that.energyGroup.addChild(that.energyDeco);
that.energyDialog = Ins_1.Ins.initSprite("69009eb9-4593-4a43-a9d7-a6356ebd6d04", 174, -60);
that.energyGroup.addChild(that.energyDialog);
that.energyDialogLabel = Ins_1.Ins.initLabel({ size: 26, text: "每10分钟恢复1点精力" });
var recoverTime = Math.floor(Ins_1.Ins.recoverEnergy / 1000 / 60);
that.energyDialogLabel = Ins_1.Ins.initLabel({ size: 26, text: "\u6BCF" + recoverTime + "\u5206\u949F\u6062\u590D1\u70B9\u7CBE\u529B" });
that.energyDialog.addChild(that.energyDialogLabel);
that.energyDialogLabel.x = (that.energyDialog.width - that.energyDialogLabel.textWidth) * 0.5;
that.energyDialogLabel.y = (that.energyDialog.height - that.energyDialogLabel.textHeight) * 0.5 - 6;
......@@ -47611,14 +47628,15 @@ var MainScene = (function (_super) {
that.maxEnergy = Ins_1.Ins.userInfo.energyMax;
FYGE.Tween.removeTweens(that.energyImg);
FYGE.Tween.removeTweens(that.energyDeco);
var scaleX = (that.energy / that.maxEnergy) > 1 ? 1 : (that.energy / that.maxEnergy);
if (that.firstSetEnergy) {
that.firstSetEnergy = false;
that.energyImg.scaleX = (that.energy / that.maxEnergy);
that.energyImg.scaleX = scaleX;
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);
FYGE.Tween.get(that.energyImg).to({ scaleX: scaleX }, 1000, FYGE.Ease.quadOut);
FYGE.Tween.get(that.energyDeco).to({ x: (that.energyImgW * scaleX - that.energyDeco.width * 0.2) }, 1000, FYGE.Ease.quadOut);
}
that.energyLabel.text = "精力" + that.energy + "/" + that.maxEnergy;
that.energyLabel.x = (that.energyGroup.width - that.energyLabel.textWidth) / 2;
......@@ -47853,7 +47871,10 @@ var MainScene = (function (_super) {
if (list.length >= Ins_1.Ins.salmonArr.length) {
var flagIndex = 0;
var canSetIndexArr = [];
while (flagIndex < 8) {
var maxEnergy = Ins_1.Ins.userInfo.energyMax;
var limitEnergy = Ins_1.Ins.userInfo.limitEnergyCount || 5;
var salmonMaxCnt = list.length >= 8 ? list.length : Math.ceil(maxEnergy / limitEnergy);
while (flagIndex < salmonMaxCnt) {
if (!this.salmonFlag[flagIndex]) {
canSetIndexArr.push({ index: flagIndex });
}
......@@ -367,11 +367,11 @@ Page({
if (success) {
my.hideLoading();
app.openId = data.openId;
if(data.customValue != 1){
if(data.loadValue != 1){
this.initCanvas();
}
this.setData({
customValue:data.customValue
customValue:data.loadValue
})
this.getActivityBaseInfoById();
}
......
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