diff --git a/luckydiamond/public/sounds/start-game.mp3 b/luckydiamond/public/sounds/start-game.mp3 new file mode 100644 index 0000000..bf3be59 Binary files /dev/null and b/luckydiamond/public/sounds/start-game.mp3 differ diff --git a/luckydiamond/src/assets/css/PagesStyles/games-pages/saper.css b/luckydiamond/src/assets/css/PagesStyles/games-pages/saper.css index 4723178..514423a 100644 --- a/luckydiamond/src/assets/css/PagesStyles/games-pages/saper.css +++ b/luckydiamond/src/assets/css/PagesStyles/games-pages/saper.css @@ -337,6 +337,17 @@ input[type="number"]::-webkit-outer-spin-button { filter: blur(5px); } +.img-style-click { + position: relative; + width: 110px; + height: 110px; + top: -70px; +} + +.crystal-img { + left: -5px; +} + .game-start { pointer-events: unset !important; } @@ -520,6 +531,9 @@ input[type="number"]::-webkit-outer-spin-button { .square { width: 75px; } + .img-style-click { + left: -15px; + } .info-emeralds { margin-top: 6.5%; } diff --git a/luckydiamond/src/assets/css/global.css b/luckydiamond/src/assets/css/global.css index 1f770dd..2fa6e95 100644 --- a/luckydiamond/src/assets/css/global.css +++ b/luckydiamond/src/assets/css/global.css @@ -156,4 +156,8 @@ body, html { /*height: 96.2%;*/ } -/* /Saper */ \ No newline at end of file +/* /Saper */ + +/* Media */ + +/* /Media */ \ No newline at end of file diff --git a/luckydiamond/src/components/HeaderComponent.vue b/luckydiamond/src/components/HeaderComponent.vue index b3b47e5..e45a4b2 100644 --- a/luckydiamond/src/components/HeaderComponent.vue +++ b/luckydiamond/src/components/HeaderComponent.vue @@ -3,6 +3,9 @@ import "@/assets/css/ComponentsStyles/header.css"; import { LogIn } from "@/assets/js/authentication/AuthService.js"; import { GetCurrentMoney } from "@/assets/js/rest/RestMethods.js"; + +import {eventBus} from "@/main"; + import { SetCookie, GetCookie, @@ -17,6 +20,12 @@ export default { this.balance = 0; DeleteAllCookie(); }, + updateBalanceMethod() { + GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) + .then(response => { + this.balance = response.currentMoney + }) + } }, data() { return { @@ -26,6 +35,11 @@ export default { userName: "", }; }, + mounted() { + eventBus.on('Updatebalance', () => { + this.updateBalanceMethod() + }) + }, created() { try { let authCode = this.$route.query.code; diff --git a/luckydiamond/src/pages/games-pages/SapergamePage.vue b/luckydiamond/src/pages/games-pages/SapergamePage.vue index 039548b..3905f9b 100644 --- a/luckydiamond/src/pages/games-pages/SapergamePage.vue +++ b/luckydiamond/src/pages/games-pages/SapergamePage.vue @@ -72,35 +72,55 @@
@@ -147,6 +167,7 @@ import { GetCurrentMoney } from "@/assets/js/rest/RestMethods"; import { GetCookie } from "@/assets/js/storage/CookieStorage"; import { Howl } from 'howler'; +import {eventBus} from "@/main"; import { Swiper, SwiperSlide } from 'swiper/vue'; import 'swiper/css'; @@ -179,6 +200,8 @@ export default { amountDeposit: 0, flippedCards: [], PercentageGameSteps: [], + CorrectsClick: [], + unCorrectClick: [], ValidationPlay: { startGame: false, endGame: false, @@ -219,7 +242,7 @@ export default { async handler(value) { if (value.length < 1 || this.ValidationPlay.endGame === true) return const maxCircles = 25 - this.amountCrystals - console.log(maxCircles) + console.log(`MAXCIRLES - ${maxCircles} VALUE: ${value} GAMECIRCLE - ${this.gamesCircle}`) if (this.gameStart !== false) { this.offEventPointers = false @@ -268,11 +291,11 @@ export default { this.gamesCircle = this.gamesCircle + 1 this.offEventPointers = true if (AnswerServer === 'You dead') { + this.unCorrectClick.push(X_Cordinates) this.offEventPointers = false this.gameStart = false this.gamesCircle = 0 this.winningAmount = 0 - this.flippedCards = [] const SoundCorrect = new Howl({ src: ['/sounds/incorrect-sound.mp3'], volume: 0.5 @@ -284,12 +307,13 @@ export default { setTimeout(() => { this.ValidationPlay.endGame = false }, 1200) - return + return eventBus.emit('Updatebalance') } const SoundUncorrect = new Howl({ src: ['/sounds/correct-click.mp3'], volume: 0.5 }) + this.CorrectsClick.push(X_Cordinates) SoundUncorrect.play() } @@ -326,6 +350,17 @@ export default { this.ValidationPlay.startGame = true + this.amountCrystals = response.MinesCount + this.amountDeposit = response.PuttedMoney + this.winningAmount = response.WinningMoney + + const soundStartGame = new Howl({ + src: ['/sounds/start-game.mp3'], + volume: 5.0 + }) + + soundStartGame.play() + console.log(this.flippedCards.length) setTimeout(() => { this.ValidationPlay.startGame = false }, 2000) @@ -340,9 +375,6 @@ export default { }, methods: { clickPlayButton() { - // if(!this.validationCheck()) { - // this.errorPlayButton() - // } this.v$.$touch() if (this.v$.amountDeposit.$error) { @@ -352,9 +384,18 @@ export default { this.errorPlayButton() } else { + this.flippedCards = [] + this.unCorrectClick = [] + this.CorrectsClick = [] this.playNotification() this.gameStart = true this.offEventPointers = true + const soundStartGame = new Howl({ + src: ['/sounds/start-game.mp3'], + volume: 5.0 + }) + + soundStartGame.play() } }, getBalanceUser() { @@ -368,29 +409,24 @@ export default { console.error(e) } }, - // updatePage() { - // window.location.reload() - // }, async claimWinningAmount() { if (this.winningAmount >= 1) { try { this.offEventPointers = false this.gameStart = false this.flippedCards = [] + this.unCorrectClick = [] + this.CorrectsClick = [] this.gamesCircle = 0 await GetWinningAmount({ SearchToken: GetCookie('SearchToken'), AuthToken: GetCookie('AUTHTOKEN') }) this.winningAmount = 0 + return eventBus.emit('Updatebalance') } catch (e) { console.error(e) } } }, - // validationCheck() { - // if (this.ValidationPlay.CrystalValidate === true && this.ValidationPlay.DiamondValidate === true) { - // return true - // } - // }, playNotification() { this.ValidationPlay.startGame = true setTimeout(() => { @@ -405,9 +441,7 @@ export default { }, flipCard(index) { if (this.flippedCards.includes(index)) { - // this.flippedCards.splice(this.flippedCards.indexOf(index), 1); - // console.log(index, this.flippedCards) - return + return eventBus.emit('Updatebalance') } else { this.flippedCards.push(index); }