mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
added logic for added slides automat
This commit is contained in:
@@ -62,49 +62,49 @@ export default {
|
|||||||
Slide,
|
Slide,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const slides = reactive([
|
const slides = reactive([])
|
||||||
{
|
let autoPlay = ref(0)
|
||||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
let targetColor = ref('')
|
||||||
target: "Black",
|
let endGame = ref(false)
|
||||||
},
|
|
||||||
{
|
onMounted(() => {
|
||||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
for (let i = 1; i < 29; i++) {
|
||||||
target: "Red",
|
if (i === 15) {
|
||||||
},
|
slides.push({
|
||||||
{
|
|
||||||
img: require("@/assets/icons-games/double-game/RectangleGreenDouble.png"),
|
img: require("@/assets/icons-games/double-game/RectangleGreenDouble.png"),
|
||||||
target: "Green",
|
target: "Green",
|
||||||
},
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (i % 2 === 0) {
|
||||||
|
slides.push(
|
||||||
{
|
{
|
||||||
img: require("@/assets/icons-games/double-game/RectangleRedDouble.png"),
|
img: require("@/assets/icons-games/double-game/RectangleRedDouble.png"),
|
||||||
target: "Red",
|
target: "Red",
|
||||||
},
|
}
|
||||||
{
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
slides.push({
|
||||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
||||||
target: "Black",
|
target: "Black",
|
||||||
},
|
})
|
||||||
{
|
}
|
||||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
}
|
||||||
target: "Red",
|
}
|
||||||
},
|
|
||||||
])
|
|
||||||
let autoPlay = ref(0)
|
|
||||||
let targetColor = ref('')
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
eventBus.on('doubleGame', (dataDouble) => {
|
eventBus.on('doubleGame', (dataDouble) => {
|
||||||
console.log('data mounted')
|
|
||||||
const dataDoubleParse = JSON.parse(dataDouble)
|
const dataDoubleParse = JSON.parse(dataDouble)
|
||||||
console.log(dataDoubleParse)
|
console.log(dataDoubleParse)
|
||||||
|
|
||||||
if (dataDoubleParse.Status === 'InGame') {
|
if (dataDoubleParse.Status === 'InGame') {
|
||||||
autoPlay.value = 500
|
autoPlay.value = 500
|
||||||
targetColor.value = dataDoubleParse.WInColor
|
targetColor.value = dataDoubleParse.WInColor
|
||||||
console.log('213')
|
|
||||||
}
|
}
|
||||||
// else if (dataDoubleParse.Status === 'GameEnd') {
|
else if (dataDoubleParse.Status === 'GameEnd') {
|
||||||
// targetColor.value = dataDoubleParse.WInColor
|
endGame.value = true
|
||||||
// }
|
autoPlay.value = 200
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -112,9 +112,8 @@ export default {
|
|||||||
try {
|
try {
|
||||||
if (targetColor.value !== '') {
|
if (targetColor.value !== '') {
|
||||||
let { currentSlideIndex } = data
|
let { currentSlideIndex } = data
|
||||||
console.log(slides[currentSlideIndex].target == targetColor.value)
|
|
||||||
|
|
||||||
if (slides[currentSlideIndex + 1].target == targetColor.value) {
|
if (slides[currentSlideIndex + 1].target == targetColor.value && endGame.value) {
|
||||||
stopAutoPlay()
|
stopAutoPlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user