fixed some bug

This commit is contained in:
wzdwc
2021-04-23 14:56:04 +08:00
parent 10bc48eee2
commit cc36ead66c
9 changed files with 37 additions and 22 deletions
+6 -5
View File
@@ -26,16 +26,14 @@
</component>
<component name="ChangeListManager">
<list default="true" id="f9039135-aa11-4abd-ad74-f40c84e4fdb2" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<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/views/game.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/game.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/views/home.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/home.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/views/login.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/login.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/app/io/middleware/join.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/io/middleware/join.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/src/lib/baseSocketController.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/lib/baseSocketController.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/src/service/room.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/service/room.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -138,6 +136,9 @@
<workItem from="1616871635424" duration="5010000" />
<workItem from="1616902156349" duration="4139000" />
<workItem from="1616907672434" duration="3493000" />
<workItem from="1616912343465" duration="84000" />
<workItem from="1616914665901" duration="956000" />
<workItem from="1618503206086" duration="6965000" />
</task>
<servers />
</component>
+5 -1
View File
@@ -3,7 +3,7 @@
<div class="shadow"
@click="show = false"></div>
<div class="body">
<div class="title">record</div>
<div class="title">record <i>({{gameList[currGameIndex - 1].gameId}})</i></div>
<div class="record-context">
<ul class = 'td'>
<div class="lo">
@@ -150,6 +150,10 @@
height: 30px;
padding: 5px 10px;
border-bottom: 1px solid #fff;
i {
font-size: 12px;
font-style: normal;
}
}
.td{
+6 -2
View File
@@ -26,8 +26,8 @@
<div class="counter"
:class="{isAction: actionUserId === sit.player.userId,
'close-time-out': time > 0 && time < 10 && actionUserId === sit.player.userId }"
v-show="sit.player.counter || sit.player.actionCommand === 'allin'">
{{ sit.player.counter }}
v-show="sit.player.counter >= 0 || sit.player.actionCommand === 'allin'">
{{ sit.player.counter || 0 }}
</div>
<div class="action-size"
v-show="sit.player.actionSize > 0">
@@ -285,7 +285,11 @@
}
.user-name {
width: 45 / 3.75vw;
color: #fff;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.count-down {
+7 -6
View File
@@ -349,6 +349,7 @@
},
transports: ['websocket'],
});
log('#init,', this.socket);
this.socket.on('connect', () => {
const id: string = this.socket.id;
log('#connect,', id, this.socket);
@@ -481,7 +482,7 @@
// 系统事件
this.socket.on('disconnect', (msg: IMsg) => {
this.$plugin.toast('room is disconnect');
this.socketInit();
// this.socketInit();
log('#disconnect', msg);
});
@@ -599,11 +600,11 @@
} catch (e) {
console.log(e);
}
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
this.socketInit();
}
});
// document.addEventListener('visibilitychange', () => {
// if (!document.hidden) {
// this.socketInit();
// }
// });
}
}
</script>
BIN
View File
Binary file not shown.
+3 -1
View File
@@ -120,6 +120,7 @@ export class Player {
}
if (command === ECommand.ALL_IN) {
console.log('allin================', this.counter);
size = this.counter;
}
@@ -140,6 +141,7 @@ export class Player {
this.counter -= size;
this.inPot += size;
}
console.log('allin================', this.counter);
this.actionSize += size;
if (command === ECommand.RAISE) {
this.actionSize = raiseSize;
@@ -151,7 +153,7 @@ export class Player {
clearActionSize() {
this.actionSize = 0;
if (this.actionCommand !== 'fold') {
if (this.actionCommand !== 'fold' && this.actionCommand !== 'allin') {
this.actionCommand = '';
}
}
+8 -2
View File
@@ -225,6 +225,8 @@ export class PokerGame {
* Get player poker max poker style
*/
getPlayerPokerStyle() {
// test
// this.commonCard = [ 'j4', 'k4', 'l4', 'm4', 'i4', ];
this.allPlayer.map(p => {
p.pokerStyle = new PokerStyle([ ...p.getHandCard(), ...this.commonCard ], this.isShort).getPokerWeight();
return p;
@@ -440,11 +442,15 @@ export class PokerGame {
if (this.playerSize === 0) {
return true;
}
// left 1 player and not one allin player
// left 1 player and current player allin, current counter small than prev player action size
// left 1 player and has allin player, current player action size big than allin player action size
if (this.playerSize === 1
&& (this.currActionAllinPlayer.length === 0
|| (command === ECommand.ALL_IN
&& this.prevSize <= nextPlayer.actionSize
&& this.currPlayer.node.actionSize < this.prevSize))) {
&& this.currPlayer.node.actionSize < this.prevSize)
|| (command !== ECommand.ALL_IN && this.currPlayer.node.actionSize >= this.prevSize))) {
return true;
}
if (this.commonCard.length !== 0 && nextPlayer.actionSize === this.smallBlind * 2
@@ -622,7 +628,7 @@ export class PokerGame {
let roundPotCount = 0;
winnerList.forEach((winner, index) => {
const pot = winner.evPot >= this.pot ? this.pot : winner.evPot;
const leftPot = pot - prevEvPot;
const leftPot = pot - prevEvPot - roundPotCount;
let income = Math.floor(leftPot / (winnerList.length - index));
if (index === winnerList.length - 1) {
// not only one winner
+1 -4
View File
@@ -397,10 +397,7 @@ class GameController extends BaseSocketController {
delete s.player;
}
});
const sitList = roomInfo.sit;
await this.adapter('online', 'sitList', {
sitList,
});
await this.updateGameInfo();
} catch (e) {
console.log(e);
}
+1 -1
View File
@@ -31,7 +31,7 @@ export default class RoomService implements IRoomService {
return !!roomNumber;
}
async add(isShort: boolean, smallBlind: number, expires: number = 36000) {
async add(isShort: boolean, smallBlind: number, expires: number = 360000) {
const number = Math.floor(Math.random() * (1000000 - 100000)) + 100000;
const result = await this.mysql.insert('room', {
roomNumber: number,