mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
added logic for get timetogame and object doubledata
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<div class="bg-gradient-left"></div>
|
||||
<section class="double">
|
||||
<h1>double</h1>
|
||||
<h2 v-if="timeToGame !== null">time to game - {{ timeToGame.toFixed(0) }}</h2>
|
||||
<div class="jackpot-game">
|
||||
<div class="bootstrap-wrapper">
|
||||
<div class="container">
|
||||
@@ -63,47 +64,55 @@ export default {
|
||||
},
|
||||
setup() {
|
||||
const slides = reactive([])
|
||||
let doubleData = reactive({})
|
||||
|
||||
let autoPlay = ref(0)
|
||||
let targetColor = ref('')
|
||||
let timeToGame = ref(0)
|
||||
let endGame = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
for (let i = 1; i < 29; i++) {
|
||||
if (i === 15) {
|
||||
slides.push({
|
||||
img: require("@/assets/icons-games/double-game/RectangleGreenDouble.png"),
|
||||
target: "Green",
|
||||
})
|
||||
}
|
||||
else {
|
||||
if (i % 2 === 0) {
|
||||
slides.push(
|
||||
{
|
||||
img: require("@/assets/icons-games/double-game/RectangleRedDouble.png"),
|
||||
target: "Red",
|
||||
}
|
||||
)
|
||||
if (slides.length == 0) {
|
||||
for (let i = 1; i < 29; i++) {
|
||||
if (i === 15) {
|
||||
slides.push({
|
||||
img: require("@/assets/icons-games/double-game/RectangleGreenDouble.png"),
|
||||
target: "Green",
|
||||
})
|
||||
}
|
||||
else {
|
||||
slides.push({
|
||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
||||
target: "Black",
|
||||
})
|
||||
if (i % 2 === 0) {
|
||||
slides.push(
|
||||
{
|
||||
img: require("@/assets/icons-games/double-game/RectangleRedDouble.png"),
|
||||
target: "Red",
|
||||
}
|
||||
)
|
||||
}
|
||||
else {
|
||||
slides.push({
|
||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
||||
target: "Black",
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eventBus.on('doubleGame', (dataDouble) => {
|
||||
const dataDoubleParse = JSON.parse(dataDouble)
|
||||
doubleData = Object.assign(doubleData, dataDoubleParse)
|
||||
console.log(dataDoubleParse)
|
||||
|
||||
timeToGame.value = doubleData.WaitingTime
|
||||
|
||||
if (dataDoubleParse.Status === 'InGame') {
|
||||
autoPlay.value = 500
|
||||
targetColor.value = dataDoubleParse.WInColor
|
||||
}
|
||||
else if (dataDoubleParse.Status === 'GameEnd') {
|
||||
endGame.value = true
|
||||
autoPlay.value = 200
|
||||
autoPlay.value = 350
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -126,7 +135,7 @@ export default {
|
||||
autoPlay.value = 0;
|
||||
}
|
||||
|
||||
return { slides, autoPlay, handleStepCarousel, stopAutoPlay, targetColor };
|
||||
return { slides, autoPlay, doubleData, targetColor, timeToGame, handleStepCarousel, stopAutoPlay };
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user