Add + 1 green color

This commit is contained in:
Hepatica
2024-03-23 18:36:12 +01:00
parent 407c535ee5
commit f5f1128da7

View File

@@ -5,8 +5,6 @@
<header-component></header-component> <header-component></header-component>
<div class="bg-gradient-left"></div> <div class="bg-gradient-left"></div>
<section class="double"> <section class="double">
<h1>double</h1>
<h2 v-if="timeToGame !== null">time to game - {{ timeToGame.toFixed(0) }}</h2>
<div class="jackpot-game"> <div class="jackpot-game">
<div class="bootstrap-wrapper"> <div class="bootstrap-wrapper">
<div class="container"> <div class="container">
@@ -32,6 +30,12 @@
</Slide> </Slide>
</Carousel> </Carousel>
</div> </div>
<div class="col-md-12">
<h1>double</h1>
<h2 v-if="timeToGame !== null">
time to game - {{ timeToGame.toFixed(0) }}
</h2>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -63,71 +67,69 @@ export default {
Slide, Slide,
}, },
setup() { setup() {
const slides = reactive([]) const slides = reactive([]);
let doubleData = reactive({}) let doubleData = reactive({});
let autoPlay = ref(0) let autoPlay = ref(0);
let targetColor = ref('') let targetColor = ref("");
let timeToGame = ref(0) let timeToGame = ref(0);
let endGame = ref(false) let endGame = ref(false);
onMounted(() => { onMounted(() => {
if (slides.length == 0) { if (slides.length == 0) {
for (let i = 1; i < 29; i++) { for (let i = 1; i < 29; i++) {
if (i === 15) { if (i === 15 || i === 28) {
slides.push({ 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 {
else {
if (i % 2 === 0) { if (i % 2 === 0) {
slides.push( 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 {
)
}
else {
slides.push({ slides.push({
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"), img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
target: "Black", target: "Black",
}) });
} }
} }
} }
} }
eventBus.on('doubleGame', (dataDouble) => { eventBus.on("doubleGame", (dataDouble) => {
const dataDoubleParse = JSON.parse(dataDouble) const dataDoubleParse = JSON.parse(dataDouble);
doubleData = Object.assign(doubleData, dataDoubleParse) doubleData = Object.assign(doubleData, dataDoubleParse);
console.log(dataDoubleParse) console.log(dataDoubleParse);
timeToGame.value = doubleData.WaitingTime timeToGame.value = doubleData.WaitingTime;
if (dataDoubleParse.Status === 'InGame') { if (dataDoubleParse.Status === "InGame") {
autoPlay.value = 500 autoPlay.value = 500;
targetColor.value = dataDoubleParse.WInColor targetColor.value = dataDoubleParse.WInColor;
} else if (dataDoubleParse.Status === "GameEnd") {
endGame.value = true;
autoPlay.value = 350;
} }
else if (dataDoubleParse.Status === 'GameEnd') { });
endGame.value = true });
autoPlay.value = 350
}
})
})
function handleStepCarousel(data) { function handleStepCarousel(data) {
try { try {
if (targetColor.value !== '') { if (targetColor.value !== "") {
let { currentSlideIndex } = data let { currentSlideIndex } = data;
if (slides[currentSlideIndex + 1].target == targetColor.value && endGame.value) { if (
stopAutoPlay() slides[currentSlideIndex + 1].target == targetColor.value &&
endGame.value
) {
stopAutoPlay();
} }
} }
} catch (error) { } catch (error) {
void(error); void error;
} }
} }
@@ -135,9 +137,17 @@ export default {
autoPlay.value = 0; autoPlay.value = 0;
} }
return { slides, autoPlay, doubleData, targetColor, timeToGame, handleStepCarousel, stopAutoPlay }; return {
slides,
autoPlay,
doubleData,
targetColor,
timeToGame,
handleStepCarousel,
stopAutoPlay,
};
}, },
} };
</script> </script>
<style scoped> <style scoped>