mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
added if-block for over game, added vision players bid, fixed styles
This commit is contained in:
@@ -124,26 +124,29 @@
|
|||||||
height: 474px;
|
height: 474px;
|
||||||
background: #30364F;
|
background: #30364F;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -415px;
|
top: -342px;
|
||||||
left: 10%;
|
left: 10%;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.crash-content .error-block {
|
.crash-content .error-block {
|
||||||
top: 500px;
|
top: 420px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* /Crash-Window */
|
/* /Crash-Window */
|
||||||
|
|
||||||
/* Crash-Graph */
|
/* Crash-Graph */
|
||||||
|
|
||||||
.chart-container {
|
.crash-game__graph {
|
||||||
width: 800px;
|
width: 800px;
|
||||||
top: 10%;
|
top: 200px;
|
||||||
left: 10%;
|
left: 600px;
|
||||||
|
position: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.chart-container canvas {
|
.chart-container canvas {
|
||||||
|
background-color: transparent !important;
|
||||||
width: 800px !important;
|
width: 800px !important;
|
||||||
height: 400px !important;
|
height: 400px !important;
|
||||||
transition: .3s ease;
|
transition: .3s ease;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export async function ExitAndTakeMoneyFromCrashGame(userData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${BackendApiUrl}/GameCrash/ExitAndTakeMoneyFromCrash`, {
|
const response = await fetch(`${BackendApiUrl}/GameCrash/ExitAndTakeMoneyFromCrashGame`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
|||||||
@@ -48,8 +48,18 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
|
x: {
|
||||||
|
grid: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
animation: false, // Отключаем анимацию
|
y: {
|
||||||
|
grid: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
animation: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,22 +28,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="crash-ratio">
|
|
||||||
<h3 class="crash-label">Автовывод</h3>
|
|
||||||
<div class="crash-input-ratio">
|
|
||||||
<input class="input-style-crash input-style-crash__text" type="number" v-model="autoRatio" placeholder="Введите коэффициент">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="error-block" v-if="ErrorClick">
|
<div class="error-block" v-if="ErrorClick">
|
||||||
<h2>Ошибка при заполнении</h2>
|
<h2>{{ textError }}</h2>
|
||||||
</div>
|
|
||||||
<div class="error-block" v-if="ErrorJoin">
|
|
||||||
<h2>Игра уже начата или только закончилась</h2>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="crash-game-window__btn-start">
|
<div class="crash-game-window__btn-start">
|
||||||
<button @click="clickPlayBtn" :class="{ 'animate-start-btn': ErrorClick }">Начать игру</button>
|
<button v-if="startGame && crashObject.Status !== 'WaitingForPlayers'" @click="clickClaimDep">Забрать</button>
|
||||||
<button>Забрать</button>
|
<button v-else @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">
|
||||||
@@ -57,9 +48,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="crash-game__players">
|
<section class="crash-game__players" v-if="crashObject && crashObject.Players">
|
||||||
<div class="crash-game-players__content">
|
<div class="crash-game-players__content">
|
||||||
|
<ul v-if="crashObject.Players.length">
|
||||||
|
<li v-for="(player, index) in crashObject.Players" :key="index">
|
||||||
|
<h2>{{ player.UserName }}</h2>
|
||||||
|
<h2>{{ player.Bid }}</h2>
|
||||||
|
<div class="win" v-if="player.UserGameState === 'Win'">
|
||||||
|
<h2>{{ player.WinningMoney }}</h2>
|
||||||
|
<h2>{{ player.WinningX }}</h2>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@@ -82,7 +82,7 @@ import SaperNumbers from "@/mocks/SaperNumbers";
|
|||||||
import {GetCurrentMoney} from "@/assets/js/rest/RestMethods";
|
import {GetCurrentMoney} from "@/assets/js/rest/RestMethods";
|
||||||
import {GetCookie} from "@/assets/js/storage/CookieStorage";
|
import {GetCookie} from "@/assets/js/storage/CookieStorage";
|
||||||
import {eventBus} from "@/main";
|
import {eventBus} from "@/main";
|
||||||
import {JoinCrashGame} from "@/assets/js/games/crash/CrashAPI";
|
import {ExitAndTakeMoneyFromCrashGame, JoinCrashGame} from "@/assets/js/games/crash/CrashAPI";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { HeaderComponent, AsideBarComponent, ChatComponent, CrashGraphComponent },
|
components: { HeaderComponent, AsideBarComponent, ChatComponent, CrashGraphComponent },
|
||||||
@@ -94,9 +94,9 @@ export default {
|
|||||||
ErrorJoin: false,
|
ErrorJoin: false,
|
||||||
balance: 0,
|
balance: 0,
|
||||||
amountDeposit: 0,
|
amountDeposit: 0,
|
||||||
autoRatio: '',
|
|
||||||
crashObject: '',
|
crashObject: '',
|
||||||
startGame: false
|
textError: '',
|
||||||
|
startGame: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
@@ -108,16 +108,19 @@ export default {
|
|||||||
const dataCrashParse = JSON.parse(dataCrash)
|
const dataCrashParse = JSON.parse(dataCrash)
|
||||||
|
|
||||||
this.crashObject = dataCrashParse
|
this.crashObject = dataCrashParse
|
||||||
|
console.log(this.crashObject)
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
if (this.crashObject.Status === 'GameEnd' && this.crashObject.Players.some(player => player.UserName === GetCookie('SpUserName'))) {
|
||||||
|
this.startGame = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
amountDeposit: { required, numeric, minValue: minValue(1), maxValue: maxValue(this.balance), integer },
|
amountDeposit: { required, numeric, minValue: minValue(1), maxValue: maxValue(this.balance), integer },
|
||||||
autoRatio: { numeric, minValue: minValue(1.01) }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -190,12 +193,10 @@ export default {
|
|||||||
this.v$.$touch()
|
this.v$.$touch()
|
||||||
|
|
||||||
if (this.v$.amountDeposit.$error) {
|
if (this.v$.amountDeposit.$error) {
|
||||||
|
this.textError = 'Ошибка введении данных'
|
||||||
this.errorPlayButton()
|
this.errorPlayButton()
|
||||||
}
|
}
|
||||||
// if (this.v$.autoRatio.$error) {
|
|
||||||
// this.errorPlayButton()
|
|
||||||
// }
|
|
||||||
// && this.v$.autoRatio.$error
|
|
||||||
if (!this.v$.amountDeposit.$error) {
|
if (!this.v$.amountDeposit.$error) {
|
||||||
const userData = {
|
const userData = {
|
||||||
searchToken: GetCookie('SearchToken'),
|
searchToken: GetCookie('SearchToken'),
|
||||||
@@ -205,12 +206,18 @@ export default {
|
|||||||
await JoinCrashGame(userData, this.amountDeposit)
|
await JoinCrashGame(userData, this.amountDeposit)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response)
|
console.log(response)
|
||||||
if (response === `You can't join to started or ended game`) {
|
if (response === `You can't join to started or ended game` || response === 'Player alredy in the game.') {
|
||||||
this.ErrorJoin = true
|
|
||||||
|
|
||||||
setTimeout(() => {
|
if (response === `You can't join to started or ended game`) {
|
||||||
this.ErrorJoin = false
|
this.textError = 'Игра уже началась или только закончилась!'
|
||||||
}, 2000)
|
this.errorPlayButton()
|
||||||
|
}
|
||||||
|
else if (response === 'Player alredy in the game.') {
|
||||||
|
this.textError = 'Вы уже в игре!'
|
||||||
|
this.errorPlayButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
this.startGame = true
|
this.startGame = true
|
||||||
})
|
})
|
||||||
@@ -220,8 +227,24 @@ export default {
|
|||||||
this.ErrorClick = true
|
this.ErrorClick = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.ErrorClick = false
|
this.ErrorClick = false
|
||||||
|
this.textError = ''
|
||||||
}, 2000)
|
}, 2000)
|
||||||
},
|
},
|
||||||
|
async clickClaimDep() {
|
||||||
|
if (this.startGame === true) {
|
||||||
|
const userData = {
|
||||||
|
searchToken: GetCookie('SearchToken'),
|
||||||
|
authtoken: GetCookie('AUTHTOKEN')
|
||||||
|
}
|
||||||
|
|
||||||
|
await ExitAndTakeMoneyFromCrashGame(userData)
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response)
|
||||||
|
this.startGame = false
|
||||||
|
return eventBus.emit('Updatebalance')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
async clickedBtnChoice(index, content) {
|
async clickedBtnChoice(index, content) {
|
||||||
this.clickedBtn = index
|
this.clickedBtn = index
|
||||||
if (content === 'max') {
|
if (content === 'max') {
|
||||||
|
|||||||
Reference in New Issue
Block a user