fixed bug with crystals-slider

This commit is contained in:
Kostya
2024-02-11 23:40:07 +03:00
parent f489b80de8
commit 20e0baefa7

View File

@@ -284,47 +284,41 @@ export default {
} }
}, },
async amountCrystals(CrystalsCount) { async amountCrystals(CrystalsCount) {
setTimeout(async () => { this.PercentageGameSteps = [];
this.PercentageGameSteps = []
if (![1, 5, 10, 24].includes(CrystalsCount)) {
this.clickedBtnCrystal = null
}
else {
let index
switch (CrystalsCount) {
case 1:
index = 0
break
case 5:
index = 1
break
case 10:
index = 2
break
case 24:
index = 3
break
}
this.clickedBtnCrystals(index, CrystalsCount)
}
if (CrystalsCount >= 1 && CrystalsCount <= 24) { if (CrystalsCount >= 1 && CrystalsCount <= 24) {
try { try {
await GetPercentageSteps(this.amountCrystals) const response = await GetPercentageSteps(CrystalsCount);
.then((response) => { response.forEach((item) => {
response.forEach((item) => { if (item !== 'Infinity' && item !== '-Infinity') {
if (item !== 'Infinity' && item !== '-Infinity') { this.PercentageGameSteps.push(Number(item));
this.PercentageGameSteps.push(Number(item)) }
} });
}) } catch (e) {
}) console.error('Error in Percentage', e);
}
catch (e) {
console.error('Error in Percantage', e)
}
} }
}, 200) }
let index;
switch (CrystalsCount) {
case 1:
index = 0;
break;
case 5:
index = 1;
break;
case 10:
index = 2;
break;
case 24:
index = 3;
break;
default:
return
}
this.clickedBtnCrystals(index, CrystalsCount);
}, },
flippedCards: { flippedCards: {
async handler(value) { async handler(value) {
if (value.length < 1 || this.ValidationPlay.endGame === true) return if (value.length < 1 || this.ValidationPlay.endGame === true) return