mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
fixed bugs
This commit is contained in:
@@ -33,9 +33,9 @@
|
|||||||
<h2>{{ textError }}</h2>
|
<h2>{{ textError }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="crash-game-window__btn-start">
|
<div class="crash-game-window__btn-start">
|
||||||
<button v-if="startGame && crashObject.Status !== 'WaitingForPlayers'" @click="clickClaimDep" class="claim-btn-crash__prize">Забрать {{ prizeUser.toFixed(2) }} АР</button>
|
<button v-if="startGame && crashObject.Status !== 'WaitingForPlayers'" @click="clickClaimDep" class="claim-btn-crash__prize">Забрать {{ getUserPrize.toFixed(2) }} АР</button>
|
||||||
<button v-if="startGame && crashObject.Status === 'WaitingForPlayers'" class="waiting-btn-crash">Ожидание игроков...</button>
|
<button v-if="startGame && crashObject.Status === 'WaitingForPlayers'" class="waiting-btn-crash">Ожидание игроков...</button>
|
||||||
<button v-if="!startGame" @click="clickPlayBtn" :class="{ 'animate-start-btn': ErrorClick }">Начать игру</button>
|
<button v-if="!startGame" :disabled="offBtn" @click="clickPlayBtn" :class="{ 'animate-start-btn': ErrorClick }">Начать игру</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="crash-window__line">
|
<div class="crash-window__line">
|
||||||
<div class="line-crash">
|
<div class="line-crash">
|
||||||
@@ -106,7 +106,19 @@ export default {
|
|||||||
crashObject: '',
|
crashObject: '',
|
||||||
textError: '',
|
textError: '',
|
||||||
startGame: false,
|
startGame: false,
|
||||||
prizeUser: 0,
|
offBtn: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
getUserPrize() {
|
||||||
|
const currentUser = this.crashObject.Players.find(player => player.UserName === GetCookie('SpUserName'));
|
||||||
|
|
||||||
|
if (currentUser) {
|
||||||
|
return currentUser.Bid * this.crashObject.CurrentX
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
@@ -124,13 +136,8 @@ export default {
|
|||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.crashObject.CurrentX !== null && this.crashObject.Players.some(player => player.UserName === GetCookie('SpUserName'))) {
|
|
||||||
this.getUserPrizer()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.crashObject.Status === 'GameEnd' && this.startGame === true && this.crashObject.Players.some(player => player.UserName === GetCookie('SpUserName'))) {
|
if (this.crashObject.Status === 'GameEnd' && this.startGame === true && this.crashObject.Players.some(player => player.UserName === GetCookie('SpUserName'))) {
|
||||||
this.startGame = false
|
this.startGame = false
|
||||||
this.prizeUser = 0
|
|
||||||
this.updateUserMoney()
|
this.updateUserMoney()
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -230,22 +237,13 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getUserPrizer() {
|
|
||||||
const currentUser = this.crashObject.Players.find(player => player.UserName === GetCookie('SpUserName'));
|
|
||||||
|
|
||||||
if (currentUser) {
|
|
||||||
setTimeout(async () => {
|
|
||||||
this.prizeUser = currentUser.Bid * this.crashObject.CurrentX
|
|
||||||
}, 100)
|
|
||||||
} else {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async clickPlayBtn() {
|
async clickPlayBtn() {
|
||||||
this.v$.$touch()
|
this.v$.$touch()
|
||||||
|
this.offBtn = true
|
||||||
|
|
||||||
if (this.v$.amountDeposit.$error) {
|
if (this.v$.amountDeposit.$error) {
|
||||||
this.textError = 'Ошибка введении данных'
|
this.textError = 'Ошибка введении данных'
|
||||||
|
this.offBtn = false
|
||||||
this.errorPlayButton()
|
this.errorPlayButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +258,7 @@ export default {
|
|||||||
console.log(this.balance)
|
console.log(this.balance)
|
||||||
console.log(response)
|
console.log(response)
|
||||||
if (response === `You can't join to started or ended game` || response === 'Player alredy in the game.') {
|
if (response === `You can't join to started or ended game` || response === 'Player alredy in the game.') {
|
||||||
|
this.offBtn = false
|
||||||
|
|
||||||
if (response === `You can't join to started or ended game`) {
|
if (response === `You can't join to started or ended game`) {
|
||||||
this.textError = 'Игра уже началась или только закончилась!'
|
this.textError = 'Игра уже началась или только закончилась!'
|
||||||
@@ -273,8 +272,12 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
this.offBtn = false
|
||||||
this.startGame = true
|
this.startGame = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
this.offBtn = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
errorPlayButton() {
|
errorPlayButton() {
|
||||||
|
|||||||
Reference in New Issue
Block a user