remove audio and fixed some bug
This commit is contained in:
Generated
+9
-5
@@ -27,13 +27,13 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f9039135-aa11-4abd-ad74-f40c84e4fdb2" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/components/GameRecord.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/GameRecord.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/components/SitList.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/SitList.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/components/Action.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Action.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/components/Audio.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Audio.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/views/game.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/game.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/app/core/Player.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/core/Player.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/app/core/PokerGame.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/core/PokerGame.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/app/io/controller/game.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/io/controller/game.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/service/room.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/service/room.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/interface/IPlayer.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/interface/IPlayer.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/service/player.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/service/player.ts" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -75,7 +75,7 @@
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="js.linters.configure.manually.selectedtslint" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/server/src/config" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="list.type.of.created.stylesheet" value="Less" />
|
||||
<property name="node.js.detected.package.eslint" value="true" />
|
||||
<property name="node.js.detected.package.standard" value="true" />
|
||||
@@ -139,6 +139,10 @@
|
||||
<workItem from="1616912343465" duration="84000" />
|
||||
<workItem from="1616914665901" duration="956000" />
|
||||
<workItem from="1618503206086" duration="6965000" />
|
||||
<workItem from="1619847843794" duration="477000" />
|
||||
<workItem from="1619848446975" duration="298000" />
|
||||
<workItem from="1619848860699" duration="11720000" />
|
||||
<workItem from="1622876620759" duration="234000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
@@ -123,12 +123,12 @@ import { IPlayer } from '@/interface/IPlayer';
|
||||
}
|
||||
|
||||
private action(command: string) {
|
||||
if (command.indexOf('raise') > -1 || command === 'allin' || command === 'call' ) {
|
||||
this.playRaise = true;
|
||||
}
|
||||
if (command === 'fold' || command === 'check') {
|
||||
this.playFold = true;
|
||||
}
|
||||
// if (command.indexOf('raise') > -1 || command === 'allin' || command === 'call' ) {
|
||||
// this.playRaise = true;
|
||||
// }
|
||||
// if (command === 'fold' || command === 'check') {
|
||||
// this.playFold = true;
|
||||
// }
|
||||
if (!this.actioned) {
|
||||
this.actioned = true;
|
||||
this.$emit('action', command);
|
||||
|
||||
@@ -1,46 +1,42 @@
|
||||
<template>
|
||||
<div class="audio-container">
|
||||
<audio ref="click" controls>
|
||||
<source src="../assets/mp3/click.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<audio ref="raise" controls>
|
||||
<source src="../assets/mp3/raise.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<audio ref="fold" controls>
|
||||
<source src="../assets/mp3/fold.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<audio ref="income" controls>
|
||||
<source src="../assets/mp3/income.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Vue, Watch} from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class Audio extends Vue {
|
||||
@Prop() private type!: string;
|
||||
@Prop() private play!: boolean;
|
||||
@Watch('play')
|
||||
private wPlay(val: boolean) {
|
||||
if (val) {
|
||||
(this.$refs[this.type] as HTMLAudioElement).play();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.audio-container {
|
||||
position: absolute;
|
||||
z-index: -99;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="audio-container">
|
||||
<!-- <audio ref="click" controls>-->
|
||||
<!-- <source src="../assets/mp3/click.mp3" type="audio/mpeg">-->
|
||||
<!-- Your browser does not support the audio element.-->
|
||||
<!-- </audio>-->
|
||||
<!-- <audio ref="raise" controls>-->
|
||||
<!-- <source src="../assets/mp3/raise.mp3" type="audio/mpeg">-->
|
||||
<!-- Your browser does not support the audio element.-->
|
||||
<!-- </audio>-->
|
||||
<!-- <audio ref="fold" controls>-->
|
||||
<!-- <source src="../assets/mp3/fold.mp3" type="audio/mpeg">-->
|
||||
<!-- Your browser does not support the audio element.-->
|
||||
<!-- </audio>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Vue, Watch} from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class Audio extends Vue {
|
||||
@Prop() private type!: string;
|
||||
@Prop() private play!: boolean;
|
||||
@Watch('play')
|
||||
private wPlay(val: boolean) {
|
||||
if (val) {
|
||||
(this.$refs[this.type] as HTMLAudioElement).play();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.audio-container {
|
||||
position: absolute;
|
||||
z-index: -99;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<record :players="players"
|
||||
v-model="showRecord"></record>
|
||||
<sendMsg @send = 'sendMsgHandle' :msg-list="msgListReverse"></sendMsg>
|
||||
<iAudio :play="playIncome" type="income"></iAudio>
|
||||
<!-- <iAudio :play="playIncome" type="income"></iAudio>-->
|
||||
<gameRecord v-model="showCommandRecord"
|
||||
:game-list="gameList"
|
||||
@getRecord = "getRecord"
|
||||
@@ -145,7 +145,7 @@
|
||||
private actionUserId = '';
|
||||
private showAllin = false;
|
||||
private showMsg = false;
|
||||
private playIncome = false;
|
||||
// private playIncome = false;
|
||||
private msg = '';
|
||||
private time = ACTION_TIME;
|
||||
private timeSt = 0;
|
||||
@@ -277,7 +277,6 @@
|
||||
return;
|
||||
}
|
||||
this.timeSt = setTimeout(() => {
|
||||
console.log('this.actionEndTime', this.actionEndTime)
|
||||
const now = Date.now();
|
||||
this.time = Math.floor((this.actionEndTime - now) / 1000);
|
||||
this.doCountDown();
|
||||
@@ -315,7 +314,6 @@
|
||||
}
|
||||
|
||||
private delay() {
|
||||
console.log('delay')
|
||||
this.emit('delayTime');
|
||||
}
|
||||
|
||||
@@ -443,10 +441,10 @@
|
||||
});
|
||||
});
|
||||
// income music
|
||||
this.playIncome = true;
|
||||
setTimeout(() => {
|
||||
this.playIncome = false;
|
||||
}, 1000);
|
||||
// this.playIncome = true;
|
||||
// setTimeout(() => {
|
||||
// this.playIncome = false;
|
||||
// }, 1000);
|
||||
}
|
||||
|
||||
if (msg.action === 'newGame') {
|
||||
@@ -462,7 +460,6 @@
|
||||
}
|
||||
|
||||
if (msg.action === 'delayTime') {
|
||||
console.log('delay======', msg)
|
||||
this.actionEndTime = msg.data.actionEndTime;
|
||||
const now = Date.now();
|
||||
this.time = Math.floor((this.actionEndTime - now) / 1000);
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface IPlayer {
|
||||
actionSize: number;
|
||||
actionCommand: string;
|
||||
delayCount?: number;
|
||||
id?: number;
|
||||
}
|
||||
|
||||
export enum ECommand {
|
||||
@@ -38,6 +39,7 @@ export class Player {
|
||||
position: number = 0;
|
||||
counter: number = 0;
|
||||
userId: string = '';
|
||||
playerId: number = 0;
|
||||
delayCount: number = 3;
|
||||
socketId: string = '';
|
||||
nickName: string = '';
|
||||
|
||||
@@ -56,7 +56,8 @@ class GameController extends BaseSocketController {
|
||||
counter: p.counter,
|
||||
handCard: player.getHandCard().join(',') || '',
|
||||
};
|
||||
await playerRecordService.add(playerRecord);
|
||||
const playerId = await playerRecordService.add(playerRecord);
|
||||
player.playerId = playerId.insertId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +70,7 @@ class GameController extends BaseSocketController {
|
||||
try {
|
||||
const roomInfo = await this.getRoomInfo();
|
||||
const gameService = await this.app.applicationContext.getAsync('GameService');
|
||||
const PlayerService = await this.app.applicationContext.getAsync('PlayerRecordService');
|
||||
const sitDownPlayer = await this.getSitDownPlayer(roomInfo);
|
||||
console.log('roomConfig-------------------', roomInfo.config);
|
||||
if (!roomInfo.game) {
|
||||
@@ -151,6 +153,19 @@ class GameController extends BaseSocketController {
|
||||
if (!result.succeed) {
|
||||
throw 'update game error';
|
||||
}
|
||||
|
||||
// update player counter
|
||||
if (roomInfo.game) {
|
||||
for await (const p of roomInfo.game.allPlayer) {
|
||||
const uPlayer = {
|
||||
playerId: p.playerId,
|
||||
counter: p.counter,
|
||||
userId: p.userId,
|
||||
gameId: roomInfo.gameId || 0,
|
||||
};
|
||||
PlayerService.update(uPlayer);
|
||||
}
|
||||
}
|
||||
},
|
||||
autoActionCallBack: async (command, userId) => {
|
||||
// fold change status: -1
|
||||
|
||||
@@ -7,6 +7,13 @@ export interface IPlayerDTO {
|
||||
buyIn: number;
|
||||
}
|
||||
|
||||
export interface UpdatePlayerDTO {
|
||||
userId: string;
|
||||
counter: number;
|
||||
gameId: number;
|
||||
playerId: number;
|
||||
}
|
||||
|
||||
export interface IPlayerService {
|
||||
findByRoomNumber(roomNumber: number): Promise<IPlayerDTO []>;
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { IPlayerDTO, IPlayerService } from '../interface/IPlayer';
|
||||
import {
|
||||
IPlayerDTO,
|
||||
IPlayerService,
|
||||
UpdatePlayerDTO,
|
||||
} from '../interface/IPlayer';
|
||||
import { Context, inject, plugin, provide } from 'midway';
|
||||
|
||||
@provide('PlayerRecordService')
|
||||
@@ -16,6 +20,14 @@ export class PlayerService implements IPlayerService {
|
||||
});
|
||||
}
|
||||
|
||||
async update(updatePlayer: UpdatePlayerDTO) {
|
||||
const row = {
|
||||
id: updatePlayer.playerId,
|
||||
counter: updatePlayer.counter,
|
||||
};
|
||||
return await this.mysql.update('player', row);
|
||||
}
|
||||
|
||||
async findByRoomNumber(roomNumber: number): Promise<IPlayerDTO []> {
|
||||
const result = await this.mysql.select('player', {
|
||||
where: { roomNumber },
|
||||
|
||||
Reference in New Issue
Block a user