mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
work stable jackpot
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="time" v-if="crashdata.Status === 'WaitingForPlayers'"><h2>{{ crashdata.WaitingTime ? crashdata.WaitingTime.toFixed(1) : '' }} сек.</h2></div>
|
<div class="time" v-if="crashdata.Status === 'WaitingForPlayers'">
|
||||||
<LineChart
|
<h2>
|
||||||
:chart-data="data"
|
{{ crashdata.WaitingTime ? crashdata.WaitingTime.toFixed(1) : "" }} сек.
|
||||||
:options="options"
|
</h2>
|
||||||
v-else
|
</div>
|
||||||
/>
|
<LineChart :chart-data="data" :options="options" v-else />
|
||||||
<h2 class="ratio" :class="{ 'lost-ratio' : crashdata.Status === 'GameEnd' }">{{ crashdata.CurrentX ? crashdata.CurrentX.toFixed(2) : '' }}x</h2>
|
<h2 class="ratio" :class="{ 'lost-ratio': crashdata.Status === 'GameEnd' }">
|
||||||
|
{{ crashdata.CurrentX ? crashdata.CurrentX.toFixed(2) : "" }}x
|
||||||
|
</h2>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -20,17 +22,17 @@ import {
|
|||||||
} from "chart.js";
|
} from "chart.js";
|
||||||
|
|
||||||
Chart.register(
|
Chart.register(
|
||||||
LineController,
|
LineController,
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
LinearScale,
|
LinearScale,
|
||||||
PointElement,
|
PointElement,
|
||||||
LineElement
|
LineElement
|
||||||
);
|
);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { LineChart },
|
components: { LineChart },
|
||||||
props: {
|
props: {
|
||||||
crashdata: Object
|
crashdata: Object,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.data = this.chartData;
|
this.data = this.chartData;
|
||||||
@@ -51,14 +53,14 @@ export default {
|
|||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
grid: {
|
grid: {
|
||||||
display: false
|
display: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
y: {
|
y: {
|
||||||
grid: {
|
grid: {
|
||||||
display: false
|
display: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
animation: false,
|
animation: false,
|
||||||
},
|
},
|
||||||
@@ -73,7 +75,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: "Foo",
|
label: "Foo",
|
||||||
data: this.dataValues,
|
data: this.dataValues,
|
||||||
borderColor: '#4E5EF2',
|
borderColor: "#4E5EF2",
|
||||||
pointStyle: "circle",
|
pointStyle: "circle",
|
||||||
pointRadius: 0,
|
pointRadius: 0,
|
||||||
pointHoverRadius: 2,
|
pointHoverRadius: 2,
|
||||||
@@ -85,43 +87,40 @@ export default {
|
|||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
crashdata: {
|
crashdata: {
|
||||||
handler: 'updateData',
|
handler: "updateData",
|
||||||
immediate: true
|
immediate: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateData() {
|
updateData() {
|
||||||
let nextDataValue
|
let nextDataValue;
|
||||||
if (this.crashdata.Status === 'WaitingForPlayers') {
|
if (this.crashdata.Status === "WaitingForPlayers") {
|
||||||
this.data = this.chartData;
|
this.data = this.chartData;
|
||||||
this.labels = [""];
|
this.labels = [""];
|
||||||
this.dataValues = [this.numberGraph, this.numberGraph];
|
this.dataValues = [this.numberGraph, this.numberGraph];
|
||||||
}
|
} else if (this.crashdata.Status === "InGame") {
|
||||||
else if (this.crashdata.Status === 'InGame') {
|
|
||||||
if (this.dataValues.length === 0) {
|
if (this.dataValues.length === 0) {
|
||||||
this.dataValues = [this.crashdata.CurrentX, this.crashdata.CurrentX]
|
this.dataValues = [this.crashdata.CurrentX, this.crashdata.CurrentX];
|
||||||
nextDataValue = this.crashdata.CurrentX
|
nextDataValue = this.crashdata.CurrentX;
|
||||||
this.numberGraph = this.crashdata.CurrentX
|
this.numberGraph = this.crashdata.CurrentX;
|
||||||
|
|
||||||
this.data = this.chartData
|
this.data = this.chartData;
|
||||||
this.labels.push("")
|
this.labels.push("");
|
||||||
this.dataValues.push(nextDataValue)
|
this.dataValues.push(nextDataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.numberGraph = this.numberGraph + .01
|
this.numberGraph = this.numberGraph + 0.01;
|
||||||
nextDataValue = this.numberGraph
|
nextDataValue = this.numberGraph;
|
||||||
|
|
||||||
this.data = this.chartData;
|
this.data = this.chartData;
|
||||||
this.labels.push("");
|
this.labels.push("");
|
||||||
this.dataValues.push(nextDataValue);
|
this.dataValues.push(nextDataValue);
|
||||||
}
|
} else if (this.crashdata.Status === "GameEnd") {
|
||||||
else if (this.crashdata.Status === 'GameEnd') {
|
this.dataValues = [];
|
||||||
this.dataValues = []
|
this.numberGraph = 1;
|
||||||
this.numberGraph = 1
|
} else {
|
||||||
}
|
console.log("Error game");
|
||||||
else {
|
|
||||||
console.log('Error game')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -204,50 +204,50 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
JackpotNumbers,
|
JackpotNumbers,
|
||||||
autoplay: 20,
|
autoplay: 0,
|
||||||
slides: [
|
// slides: [
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
// img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
||||||
nickname: "Hepatir",
|
// nickname: "Hepatir",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
// img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
||||||
nickname: "Hepatir",
|
// nickname: "Hepatir",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
// img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
||||||
nickname: "Ckutls_",
|
// nickname: "Ckutls_",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
// img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
||||||
nickname: "Ckutls_",
|
// nickname: "Ckutls_",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
// img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
||||||
nickname: "Ckutls_",
|
// nickname: "Ckutls_",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
// img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
||||||
nickname: "Hepagfdtir",
|
// nickname: "Hepagfdtir",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
// img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
||||||
nickname: "Ckutls_",
|
// nickname: "Ckutls_",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
// img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
||||||
nickname: "Ckutls_",
|
// nickname: "Ckutls_",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
// img: "https://avatar.spworlds.ru/face/55/Ckutls_.png",
|
||||||
nickname: "Ckutls_",
|
// nickname: "Ckutls_",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
// img: "https://avatar.spworlds.ru/face/55/Hepatir.png",
|
||||||
nickname: "Hepgdfatir",
|
// nickname: "Hepgdfatir",
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
// slides: [],
|
slides: [],
|
||||||
currentSlide: 0,
|
currentSlide: 0,
|
||||||
value: 0,
|
value: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
@@ -257,7 +257,8 @@ export default {
|
|||||||
isGameTimerStarted: false,
|
isGameTimerStarted: false,
|
||||||
remainingSeconds: 0,
|
remainingSeconds: 0,
|
||||||
progressBarWidth: 0,
|
progressBarWidth: 0,
|
||||||
// idCurrentGame: "",
|
idCurrentGame: "",
|
||||||
|
lastUserWinerGameId: " ",
|
||||||
lastUserWinner: "",
|
lastUserWinner: "",
|
||||||
// lastIdGame: "",
|
// lastIdGame: "",
|
||||||
};
|
};
|
||||||
@@ -269,11 +270,11 @@ export default {
|
|||||||
players.forEach((player) => {
|
players.forEach((player) => {
|
||||||
const numberOfCards = player.WinningPercentage / 10; // Предполагаем, что 10% это 1 карточка
|
const numberOfCards = player.WinningPercentage / 10; // Предполагаем, что 10% это 1 карточка
|
||||||
for (let i = 0; i < numberOfCards; i++) {
|
for (let i = 0; i < numberOfCards; i++) {
|
||||||
if (i==0) {
|
if (i == 0) {
|
||||||
this.slides.push({
|
this.slides.push({
|
||||||
img: `https://avatar.spworlds.ru/face/55/${player.UserName}.png`, // Предполагаем структуру URL из имени пользователя
|
img: `https://avatar.spworlds.ru/face/55/${player.UserName}.png`, // Предполагаем структуру URL из имени пользователя
|
||||||
nickname: player.UserName,
|
nickname: player.UserName,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.slides.push({
|
this.slides.push({
|
||||||
img: `https://avatar.spworlds.ru/face/55/${player.UserName}.png`, // Предполагаем структуру URL из имени пользователя
|
img: `https://avatar.spworlds.ru/face/55/${player.UserName}.png`, // Предполагаем структуру URL из имени пользователя
|
||||||
@@ -316,11 +317,10 @@ export default {
|
|||||||
if (diff <= 0) {
|
if (diff <= 0) {
|
||||||
this.remainingSeconds = 0;
|
this.remainingSeconds = 0;
|
||||||
this.progressBarWidth = 100; // Полный прогресс
|
this.progressBarWidth = 100; // Полный прогресс
|
||||||
|
|
||||||
// Действия после окончания таймера, если необходимо
|
// Действия после окончания таймера, если необходимо
|
||||||
} else {
|
} else {
|
||||||
this.remainingSeconds = Math.floor(diff / 1000); // Обновляем оставшееся время в секундах
|
this.remainingSeconds = Math.floor(diff / 1000); // Обновляем оставшееся время в секундах
|
||||||
const totalDuration = 30; // Допустим, обратный отсчет идет с 60 секунд
|
const totalDuration = 10; // Допустим, обратный отсчет идет с 60 секунд
|
||||||
this.progressBarWidth =
|
this.progressBarWidth =
|
||||||
((totalDuration - this.remainingSeconds) / totalDuration) * 100;
|
((totalDuration - this.remainingSeconds) / totalDuration) * 100;
|
||||||
}
|
}
|
||||||
@@ -347,25 +347,30 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSlideStart(data) {
|
handleSlideStart(data) {
|
||||||
// try {
|
try {
|
||||||
// let { slidingToIndex,currentSlideIndex } = data;
|
let { slidingToIndex, currentSlideIndex } = data;
|
||||||
// // Проверяем, существует ли слайд и имеет ли он свойство nickname
|
// Проверяем, существует ли слайд и имеет ли он свойство nickname
|
||||||
// if (this.slides[slidingToIndex] && this.slides[slidingToIndex].nickname) {
|
if (
|
||||||
// if (this.isStopButtonPressed) {
|
this.slides[slidingToIndex] &&
|
||||||
// if (this.slides[currentSlideIndex].nickname == "Hepatir") {
|
this.slides[slidingToIndex].nickname
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
this.isStopButtonPressed &&
|
||||||
|
this.idCurrentGame == this.lastUserWinerGameId
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
this.slides[currentSlideIndex].nickname == this.targetNickname
|
||||||
|
) {
|
||||||
|
// this.$refs.carousel.slideTo(this.currentSlideIndex);
|
||||||
|
|
||||||
// // this.$refs.carousel.slideTo(this.currentSlideIndex);
|
// if (this.slides[this.currentSlideIndex].nickname == this.targetNickname) {
|
||||||
|
this.stopAutoplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
// // if (this.slides[this.currentSlideIndex].nickname == this.targetNickname) {
|
}
|
||||||
// this.stopAutoplay();
|
} catch (error) {
|
||||||
// }
|
console.error("Error in handleSlideStart:", error);
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error("Error in handleSlideStart:", error);
|
|
||||||
// }
|
|
||||||
// try {
|
// try {
|
||||||
// const { slidingToIndex } = data;
|
// const { slidingToIndex } = data;
|
||||||
// this.currentSlideIndex = slidingToIndex;
|
// this.currentSlideIndex = slidingToIndex;
|
||||||
@@ -380,21 +385,19 @@ export default {
|
|||||||
// console.error("Error in handleSlideStart:", error);
|
// console.error("Error in handleSlideStart:", error);
|
||||||
// // Здесь вы можете обработать ошибку, например, остановить карусель
|
// // Здесь вы можете обработать ошибку, например, остановить карусель
|
||||||
// }
|
// }
|
||||||
try {
|
|
||||||
const { slidingToIndex } = data;
|
// try {
|
||||||
this.currentSlideIndex = slidingToIndex;
|
// const { slidingToIndex } = data;
|
||||||
if (this.isStopButtonPressed) {
|
// this.currentSlideIndex = slidingToIndex;
|
||||||
if (
|
// if (this.isStopButtonPressed) {
|
||||||
this.slides[this.currentSlideIndex].nickname ==
|
// if (this.slides[this.currentSlideIndex].nickname == "Hepatir") {
|
||||||
"Hepatir"
|
// this.stopAutoplay();
|
||||||
) {
|
// }
|
||||||
this.stopAutoplay();
|
// }
|
||||||
}
|
// } catch (error) {
|
||||||
}
|
// console.error("Error in handleSlideStart:", error);
|
||||||
} catch (error) {
|
// // Здесь вы можете обработать ошибку, например, остановить карусель
|
||||||
console.error("Error in handleSlideStart:", error);
|
// }
|
||||||
// Здесь вы можете обработать ошибку, например, остановить карусель
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
stopCarousel() {
|
stopCarousel() {
|
||||||
this.isStopButtonPressed = true;
|
this.isStopButtonPressed = true;
|
||||||
@@ -405,7 +408,9 @@ export default {
|
|||||||
this.autoplay = 0;
|
this.autoplay = 0;
|
||||||
this.isGameTimerStarted = false;
|
this.isGameTimerStarted = false;
|
||||||
this.isStopButtonPressed = false;
|
this.isStopButtonPressed = false;
|
||||||
|
this.lastUserWinerGameId = " ";
|
||||||
|
this.idCurrentGame = "";
|
||||||
|
this.lastUserWinner = "";
|
||||||
},
|
},
|
||||||
changeLastFiveImages() {
|
changeLastFiveImages() {
|
||||||
const newImage = "https://avatar.spworlds.ru/face/55/Hepatir.png";
|
const newImage = "https://avatar.spworlds.ru/face/55/Hepatir.png";
|
||||||
@@ -432,21 +437,25 @@ export default {
|
|||||||
console.log("Waiting for players");
|
console.log("Waiting for players");
|
||||||
console.log("Put there earlies cards");
|
console.log("Put there earlies cards");
|
||||||
this.lastUserWinner = dataObject.LastGame.WinnerUserName;
|
this.lastUserWinner = dataObject.LastGame.WinnerUserName;
|
||||||
|
this.lastUserWinerGameId = dataObject.LastGame.Id;
|
||||||
|
if (this.lastUserWinerGameId == this.idCurrentGame) {
|
||||||
|
this.targetNickname = this.lastUserWinner;
|
||||||
|
this.stopCarousel();
|
||||||
|
}
|
||||||
// this.mapPlayersToSlides(dataObject.LastGame.PlayerList);
|
// this.mapPlayersToSlides(dataObject.LastGame.PlayerList);
|
||||||
}
|
}
|
||||||
if (dataObject.CurrentGame.GameState == "StartGameTimer") {
|
if (dataObject.CurrentGame.GameState == "StartGameTimer") {
|
||||||
if (!this.isGameTimerStarted) {
|
if (!this.isGameTimerStarted) {
|
||||||
console.log("Set players");
|
console.log("Set players");
|
||||||
this.mapPlayersToSlides(dataObject.CurrentGame.PlayerList);
|
this.mapPlayersToSlides(dataObject.CurrentGame.PlayerList);
|
||||||
|
this.idCurrentGame = dataObject.CurrentGame.Id;
|
||||||
}
|
}
|
||||||
this.startGameTimer(dataObject.CurrentGame.StartGameUtc);
|
this.startGameTimer(dataObject.CurrentGame.StartGameUtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (dataObject.CurrentGame.GameState == "Running") {
|
||||||
dataObject.CurrentGame.GameState == "Running"
|
this.autoplay = 20;
|
||||||
) {
|
// this.checkGameEnd(dataObject.CurrentGame.EndGameUtc);
|
||||||
this.checkGameEnd(dataObject.CurrentGame.EndGameUtc);
|
|
||||||
// this.idCurrentGame = dataObject.CurrentGame.Id;
|
// this.idCurrentGame = dataObject.CurrentGame.Id;
|
||||||
}
|
}
|
||||||
// Дальнейшая обработка dataObject...
|
// Дальнейшая обработка dataObject...
|
||||||
@@ -462,64 +471,15 @@ export default {
|
|||||||
eventBus.on("gameEnded", () => {
|
eventBus.on("gameEnded", () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this.isStopButtonPressed) {
|
if (!this.isStopButtonPressed) {
|
||||||
|
// if (this.idCurrentGame == this.lastUserWinerGameId) {
|
||||||
this.targetNickname = this.lastUserWinner;
|
this.targetNickname = this.lastUserWinner;
|
||||||
this.stopCarousel();
|
this.stopCarousel();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
// this.startAutoScroll();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
amountDeposit(DepositCount) {
|
|
||||||
if (![1, 5, 10, 50, 100, parseInt(this.balance)].includes(DepositCount)) {
|
|
||||||
this.clickedBtn = null;
|
|
||||||
} else {
|
|
||||||
let index;
|
|
||||||
switch (DepositCount) {
|
|
||||||
case 1:
|
|
||||||
if (parseInt(this.balance) === DepositCount) {
|
|
||||||
index = 5;
|
|
||||||
} else {
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
if (parseInt(this.balance) === DepositCount) {
|
|
||||||
index = 5;
|
|
||||||
} else {
|
|
||||||
index = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
if (parseInt(this.balance) === DepositCount) {
|
|
||||||
index = 5;
|
|
||||||
} else {
|
|
||||||
index = 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 50:
|
|
||||||
if (parseInt(this.balance) === DepositCount) {
|
|
||||||
index = 5;
|
|
||||||
} else {
|
|
||||||
index = 3;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 100:
|
|
||||||
if (parseInt(this.balance) === DepositCount) {
|
|
||||||
index = 5;
|
|
||||||
} else {
|
|
||||||
index = 4;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case parseInt(this.balance):
|
|
||||||
index = 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.clickedBtnChoice(index, DepositCount);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
watch: {},
|
||||||
async created() {
|
async created() {
|
||||||
if (GetCookie("AUTHTOKEN") && GetCookie("SearchToken")) {
|
if (GetCookie("AUTHTOKEN") && GetCookie("SearchToken")) {
|
||||||
await GetCurrentMoney(
|
await GetCurrentMoney(
|
||||||
|
|||||||
Reference in New Issue
Block a user