fixed bug

This commit is contained in:
wzdwc
2021-01-21 00:04:57 +08:00
parent 70ecee7d87
commit f8d86528a7
24 changed files with 304 additions and 190 deletions
+62 -12
View File
@@ -20,12 +20,36 @@
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="BRANCH:bk" type="e8cecc67:BranchNodeDescriptor" />
<item name="BRANCH:master" type="e8cecc67:BranchNodeDescriptor" />
</path>
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="f9039135-aa11-4abd-ad74-f40c84e4fdb2" name="Default Changelist" comment="" />
<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/Action.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Action.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/BuyIn.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/BuyIn.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/audio.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Audio.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/cardList.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/CardList.vue" 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/notice.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Notice.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/player.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Player.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/range.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Range.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/record.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Record.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/sendMsg.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/SendMsg.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/toast.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Toast.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/utils/PokerStyle.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/utils/PokerStyle.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/utils/map.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/utils/map.ts" 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.zip" beforeDir="false" afterPath="$PROJECT_DIR$/server/src.zip" 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/core/PokerStyle.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/core/PokerStyle.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/app/router.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/router.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server/src/lib/baseSocketController.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/lib/baseSocketController.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -37,6 +61,7 @@
<option value="Vue" />
<option value="Less File" />
<option value="TypeScript File" />
<option value="Vue Single File Component" />
</list>
</option>
</component>
@@ -47,7 +72,7 @@
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="RESET_MODE" value="MIXED" />
<option name="RESET_MODE" value="SOFT" />
</component>
<component name="JsFlowSettings">
<service-enabled>true</service-enabled>
@@ -81,9 +106,6 @@
<property name="ts.external.directory.path" value="$PROJECT_DIR$/server/node_modules/typescript/lib" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/server" />
@@ -91,6 +113,9 @@
<recent name="$PROJECT_DIR$/client/src/interface" />
<recent name="$PROJECT_DIR$/server/src/service" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
</component>
<component name="SvnConfiguration">
<configuration />
@@ -129,6 +154,16 @@
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" />
</component>
<component name="Vcs.Log.History.Properties">
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="2" />
<option value="3" />
<option value="1" />
</list>
</option>
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
@@ -154,15 +189,21 @@
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="100" y="100" width="1240" height="700" key="DiffContextDialog" timestamp="1593348545499">
<screen x="0" y="23" width="1440" height="828" />
<state x="184" y="98" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1600508433832">
<screen x="0" y="23" width="1440" height="827" />
</state>
<state x="184" y="98" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.23.1440.827@0.23.1440.827" timestamp="1600508433832" />
<state x="100" y="100" width="1240" height="696" key="DiffContextDialog" timestamp="1607254387585">
<screen x="0" y="23" width="1440" height="823" />
</state>
<state x="100" y="100" width="1240" height="700" key="DiffContextDialog/0.0.1440.900@0.0.1440.900" timestamp="1593070402308" />
<state x="100" y="100" width="1240" height="696" key="DiffContextDialog/0.23.1440.823@0.23.1440.823" timestamp="1607254387585" />
<state x="100" y="100" width="1240" height="700" key="DiffContextDialog/0.23.1440.828@0.23.1440.828" timestamp="1593348545499" />
<state x="100" y="100" width="1240" height="702" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1599912309818">
<screen x="0" y="23" width="1440" height="832" />
<state x="100" y="99" width="1240" height="695" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1607254387585">
<screen x="0" y="23" width="1440" height="823" />
</state>
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1593351376798" />
<state x="100" y="99" width="1240" height="695" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.823@0.23.1440.823" timestamp="1607254387585" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.827@0.23.1440.827" timestamp="1593358666478" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.828@0.23.1440.828" timestamp="1599741084335" />
<state x="100" y="100" width="1240" height="702" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.832@0.23.1440.832" timestamp="1599912309818" />
@@ -170,10 +211,19 @@
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="378" y="207" width="683" height="490" key="find.popup/0.0.1440.900@0.0.1440.900" timestamp="1593070201850" />
<state x="450" y="362" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1599740214397">
<screen x="0" y="23" width="1440" height="828" />
<state x="385" y="197" key="run.anything.popup" timestamp="1605708588099">
<screen x="0" y="23" width="1440" height="823" />
</state>
<state x="385" y="197" key="run.anything.popup/0.23.1440.823@0.23.1440.823" timestamp="1605708588099" />
<state x="385" y="174" width="670" height="676" key="search.everywhere.popup" timestamp="1600510032147">
<screen x="0" y="23" width="1440" height="827" />
</state>
<state x="385" y="174" width="670" height="676" key="search.everywhere.popup/0.23.1440.827@0.23.1440.827" timestamp="1600510032147" />
<state x="450" y="362" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1600495902702">
<screen x="0" y="23" width="1440" height="829" />
</state>
<state x="450" y="369" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.0.1440.900@0.0.1440.900" timestamp="1591504016729" />
<state x="450" y="362" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.23.1440.828@0.23.1440.828" timestamp="1599740214397" />
<state x="450" y="362" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.23.1440.829@0.23.1440.829" timestamp="1600495902702" />
</component>
</project>
+9 -7
View File
@@ -40,7 +40,7 @@
v-show="currPlayer && raiseSize === currPlayer.counter">Allin
</div>
<range :max="currPlayer && currPlayer.counter"
:min="minActionSize"
:min="0"
:is-horizontal="true"
v-model="raiseSize"
@change="getActionSize"></range>
@@ -108,9 +108,7 @@ import { IPlayer } from '@/interface/IPlayer';
@Watch('raiseSize')
private wRaiseSize(val: number) {
this.raiseSize = val > this.currPlayer.counter ? this.currPlayer.counter : val < this.minActionSize
? this.minActionSize
: val;
this.raiseSize = val > this.currPlayer.counter ? this.currPlayer.counter : val;
}
get canActionSize() {
@@ -152,7 +150,11 @@ import { IPlayer } from '@/interface/IPlayer';
}
private getActionSize(size: number) {
this.raiseSize = size;
if (size > this.minActionSize) {
this.raiseSize = size;
} else {
this.$plugin.toast('raise size too small');
}
}
private addSize() {
@@ -170,8 +172,8 @@ import { IPlayer } from '@/interface/IPlayer';
|| (this.isPreFlop
&& this.isTwoPlayer
&& this.currPlayer?.type === 'd'
&& this.prevSize === 2)
|| (this.currPlayer?.type === 'bb' && this.prevSize === 2 &&
&& this.prevSize === this.baseSize * 2)
|| (this.currPlayer?.type === 'bb' && this.prevSize === this.baseSize * 2 &&
this.isPreFlop);
}
// raise
+1 -1
View File
@@ -94,7 +94,7 @@
font-size: 20px;
text-align: center;
input{
width: 50px;
width: 70px;
font-size: 20px;
}
}
@@ -11,8 +11,12 @@
<div class="shadow"
v-show="shadow(card)"></div>
<b class="number">{{ map(card)[0] }}</b>
<b class="color">{{ map(card)[1] }}</b>
<b class="color big">{{ map(card)[1] }}</b>
<b class="color">
<cardStyle size="small" :type="map(card)[1]"></cardStyle>
</b>
<b class="color big">
<cardStyle size="big" :type="map(card)[1]"></cardStyle>
</b>
</span>
</div>
</div>
@@ -21,8 +25,13 @@
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { mapCard } from '@/utils/map';
import cardStyle from '@/components/CardStyle.vue';
@Component
@Component({
components: {
cardStyle,
},
})
export default class Card extends Vue {
@Prop() private cardList: any;
@Prop({ default: () => [], type: Array }) private valueCards!: string[];
@@ -32,7 +41,7 @@
}
private isBlack(type: string) {
return type === '' || type === '';
return type === 's' || type === 'c';
}
private map(card: string) {
+49
View File
@@ -0,0 +1,49 @@
<template>
<div class="card-style-container">
<div class="svg">
<svg viewBox="0 0 100 100" :width="`${sizeValue}px`" :height="`${sizeValue}px`" xmlns="http://www.w3.org/2000/svg">
<path :d="path" :fill="color"/>
</svg>
</div>
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
@Component
export default class CardStyle extends Vue {
@Prop() private type: any;
@Prop() private size!: string;
private pathObj: any = {
h: 'M 0,25 A 25,25 0,0,1 50,25 A 25,25 0,0,1 100,25 C 100,60 70,60 50,100 C 30,60 0,60 0,25',
c: 'M25,25 A25,25 0,0,1 75,25 A25,25 0,1,1 52,65 A35,35 0,0,0 75,100 L25,100 A35,35 0,0,0 48,65 A25,25 0,1,1 25,25',
s: 'M 4,65 A 22,22 0,0,0 48,65 Q 50,90 30,100 L 70,100 Q 50,90 52,65 A 22,22 0,0,0 96,65 C 96,40 70,40 50,0 C 30,40 4,40 4,65',
d: 'M 50,0 Q50,15 15,50 Q50,85 50,100 Q50,85 85,50 Q50,15 50,0',
};
private sizeObj: any = {
big: 22,
small: 12,
default: 20,
};
get sizeValue() {
return this.sizeObj[this.size];
}
get path() {
return this.pathObj[this.type];
}
get color() {
return this.type === 'h' || this.type === 'd' ? 'red' : 'black';
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped
lang="less">
.card-style-container {
.svg {
position: relative;
}
}
</style>
@@ -1,59 +1,59 @@
<template>
<div class="notice-container">
<div class="notice-body">
<i v-for="message in messageList"
v-if="message !== ''"
:style="{top: `${message.top}vh`}"
>{{message.message}}</i>
</div>
</div>
</template>
<script lang="ts">
import {Component, Prop, Watch, Vue} from 'vue-property-decorator';
@Component
export default class Notice extends Vue {
@Prop() private messageList!: any[];
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped
lang="less">
.notice-container {
.notice-body{
position: fixed;
top: 0;
left: 0;
width: 100vw;
i{
position: absolute;
top: 20px;
left: 0;
transform: translate3d(100vw,0,0);
z-index: 10;
animation: 4s move linear forwards;
color: #fff;
padding: 4px;
font-size: 12px;
font-style: normal;
border-radius: 2px;
background-color: rgba(0,0,0,0.4);
}
}
@-webkit-keyframes move /* Safari 与 Chrome */ {
0% {
transform: translate3d(100vw,0,0);
}
99%{
transform: translate3d(-198px, 0px, 0px);
opacity: 1;
}
100% {
transform: translate3d(-200px, 0px, 0px);
opacity: 0;
}
}
}
</style>
<template>
<div class="notice-container">
<div class="notice-body">
<i v-for="message in messageList"
v-if="message !== ''"
:style="{top: `${message.top}vh`}"
>{{message.message}}</i>
</div>
</div>
</template>
<script lang="ts">
import {Component, Prop, Watch, Vue} from 'vue-property-decorator';
@Component
export default class Notice extends Vue {
@Prop() private messageList!: any[];
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped
lang="less">
.notice-container {
.notice-body{
position: fixed;
top: 0;
left: 0;
width: 100vw;
i{
position: absolute;
top: 20px;
left: 0;
transform: translate3d(100vw,0,0);
z-index: 10;
animation: 8s move linear forwards;
color: #fff;
padding: 4px;
font-size: 12px;
font-style: normal;
border-radius: 2px;
background-color: rgba(0,0,0,0.4);
}
}
@-webkit-keyframes move /* Safari 与 Chrome */ {
0% {
transform: translate3d(100vw,0,0);
}
99%{
transform: translate3d(-198px, 0px, 0px);
opacity: 1;
}
100% {
transform: translate3d(-200px, 0px, 0px);
opacity: 0;
}
}
}
</style>
@@ -4,7 +4,6 @@
<div class="range-body">
<input type="range"
v-model="rangeSize"
:class="{horizontal: !!isHorizontal}">
</div>
</div>
+2 -3
View File
@@ -78,7 +78,7 @@
</div>
<BuyIn :showBuyIn.sync="showBuyIn"
:min="0"
:max="1000"
:max="roomConfig.smallBlind * 1000"
@buyIn='buyIn'></BuyIn>
</div>
</template>
@@ -123,9 +123,8 @@
}
private buyIn(size: number) {
console.log('ccc');
this.showBuyIn = false;
this.currPlayer.counter += size;
this.currPlayer.counter += Number(size);
this.$emit('buyIn', Number(size));
this.sitDown(this.currSit);
}
+13 -29
View File
@@ -40,8 +40,8 @@ enum ShortPokerStyleEnum {
'FOUR_KIND',
'FLUSH',
'FULL_HOUSE',
'THREE_KIND',
'STRAIGHT',
'THREE_KIND',
'TWO_PAIR',
'PAIR',
'HIGH_CARD',
@@ -93,8 +93,8 @@ export class PokerStyle implements IPokerStyle {
'FOUR_KIND',
'FLUSH',
'FULL_HOUSE',
'THREE_KIND',
'STRAIGHT',
'THREE_KIND',
'TWO_PAIR',
'PAIR',
'HIGH_CARD',
@@ -250,35 +250,19 @@ export class PokerStyle implements IPokerStyle {
}
return;
}
if (this.isShort) {
// three of kind
if (isThree.length > 0) {
isThreeKind = isThree.join('');
isThreeKind += highCard[0] + highCard[1];
this.pokerStyle[5] = isThreeKind;
return;
}
// straight
if (this.isStraight() !== '0') {
this.pokerStyle[6] = `${this.isStraight()}`;
return;
}
// straight
if (this.isStraight() !== '0') {
this.pokerStyle[5] = `${this.isStraight()}`;
return;
}
} else {
// straight
if (this.isStraight() !== '0') {
this.pokerStyle[5] = `${this.isStraight()}`;
return;
}
// three of kind
if (isThree.length > 0) {
isThreeKind = isThree.join('');
isThreeKind += highCard[0] + highCard[1];
this.pokerStyle[6] = isThreeKind;
return;
}
// three of kind
if (isThree.length > 0) {
isThreeKind = isThree.join('');
isThreeKind += highCard[0] + highCard[1];
this.pokerStyle[6] = isThreeKind;
return;
}
// tow pair
+18 -18
View File
@@ -1,18 +1,18 @@
export default (cards: string []) => {
const cardNumber = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K', 'A'];
const color = ['♦', '♣', '♥', '♠'];
return cards?.map((c: string) => {
const cNumber = c.charCodeAt(0) - 97;
const cColor = Number(c[1]) - 1;
return [`${cardNumber[cNumber]}`, `${color[cColor]}`];
});
};
const mapCard = (card: string) => {
const cardNumber = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K', 'A'];
const color = ['', '', '', ''];
const cNumber = card.charCodeAt(0) - 97;
const cColor = Number(card[1]) - 1;
return [`${cardNumber[cNumber]}`, `${color[cColor]}`];
};
export { mapCard };
export default (cards: string []) => {
const cardNumber = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K', 'A'];
const color = ['♦', '♣', '♥', '♠'];
return cards?.map((c: string) => {
const cNumber = c.charCodeAt(0) - 97;
const cColor = Number(c[1]) - 1;
return [`${cardNumber[cNumber]}`, `${color[cColor]}`];
});
};
const mapCard = (card: string) => {
const cardNumber = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K', 'A'];
const color = ['d', 'c', 'h', 's'];
const cNumber = card.charCodeAt(0) - 97;
const cColor = Number(card[1]) - 1;
return [`${cardNumber[cNumber]}`, `${color[cColor]}`];
};
export { mapCard };
+16 -6
View File
@@ -44,12 +44,13 @@
<div class="setting-body"
:class="{show: showSetting}">
<i @click="showBuyInDialog()">buy in</i>
<i @click="standUp()">stand Up</i>
<i @click="showCounterRecord">counter record</i>
</div>
</div>
<BuyIn :showBuyIn.sync='showBuyIn'
:min='0'
:max='1000'
:max='baseSize * 1000'
@buyIn='buyIn'></BuyIn>
<toast :show.sync="showMsg"
:text="msg"></toast>
@@ -106,6 +107,7 @@
}
const GAME_BASE_SIZE = 1;
const ACTION_TIME = 60;
@Component({
components: {
@@ -142,10 +144,9 @@
private actionUserId = '';
private showAllin = false;
private showMsg = false;
private baseSize = GAME_BASE_SIZE;
private playIncome = false;
private msg = '';
private time = 30;
private time = ACTION_TIME;
private timeSt = 0;
private commandRecordList = [];
private showCommandRecord = false;
@@ -179,7 +180,7 @@
@Watch('actionUserId')
private actionUserIdChange() {
this.time = 30;
this.time = ACTION_TIME;
clearTimeout(this.timeSt);
this.doCountDown();
}
@@ -230,7 +231,11 @@
}
get minActionSize() {
return this.prevSize <= 0 ? GAME_BASE_SIZE * 2 : this.prevSize * 2;
return this.prevSize <= 0 ? this.baseSize * 2 : this.prevSize * 2;
}
get baseSize() {
return this.roomConfig.smallBlind || GAME_BASE_SIZE;
}
private init() {
@@ -239,7 +244,7 @@
this.commonCard = [];
this.pot = 0;
this.prevSize = 0;
this.time = 30;
this.time = ACTION_TIME;
this.winner = [];
this.showBuyIn = false;
this.initSitLink();
@@ -391,6 +396,7 @@
if (msg.action === 'gameInfo') {
this.players = msg.data.players;
this.pot = msg.data.pot || 0;
this.roomConfig.smallBlind = msg.data.smallBlind;
this.prevSize = msg.data.prevSize;
this.actionUserId = msg.data.currPlayer.userId;
// this.isAction = !!(this.userInfo && this.userInfo.userId === msg.data.currPlayer.userId);
@@ -474,6 +480,10 @@
console.log(e);
}
}
private standUp() {
this.emit('standUp');
this.showSetting = false;
}
private play() {
if (this.players.length >= 2) {
BIN
View File
Binary file not shown.
+22 -13
View File
@@ -45,7 +45,7 @@ export enum EGameStatus {
* Action time
* @type {number}
*/
const ACTION_TIME = 30 * 1000;
const ACTION_TIME = 60 * 1000;
/**
* Class representing a poker game
@@ -387,12 +387,15 @@ export class PokerGame {
&& this.prevSize !== this.smallBlind * 2 && this.prevSize !== 0), 'tst', size, nextPlayer.actionSize, this.prevSize);
// all check actionSize === -1
// all player allin
// only 2 player, curr player fold, next player alrecommand add errorady action
// only one player ,one player fold,other player allin
// only 2 player, curr player fold, next player already action
// only one player,one player fold,other player allin
// pre flop big blind check and other player call
// pre flop big blind fold and other player call
if (this.playerSize === 0
|| (this.playerSize === 1 && this.currActionAllinPlayer.length === 0)
|| (this.playerSize === 1
&& (this.currActionAllinPlayer.length === 0
|| (command === ECommand.ALL_IN
&& this.currPlayer.node.actionSize < this.prevSize)))
|| (this.commonCard.length !== 0 && nextPlayer.actionSize === this.smallBlind * 2
&& nextPlayer.actionSize === size && size === this.prevSize)
|| (nextPlayer.actionSize === this.prevSize
@@ -571,18 +574,24 @@ export class PokerGame {
counting() {
let prevEvPot = 0;
this.winner.forEach((winnerList, key) => {
if (key !== 0) {
prevEvPot = this.winner[key - 1][0].evPot;
}
winnerList.sort((prev, next) => prev.inPot - next.inPot);
let roundPotCount = 0;
winnerList.forEach((winner, index) => {
const pot = winner.evPot === Infinity ? this.pot : winner.evPot;
const pot = winner.evPot >= this.pot ? this.pot : winner.evPot;
const leftPot = pot - prevEvPot;
const isDivide = leftPot % winnerList.length;
let income = leftPot / winnerList.length;
if (index === 0 && winnerList.length > 1 && isDivide > 0) {
income = ((leftPot - isDivide) / winnerList.length) + isDivide;
let income = leftPot / (winnerList.length - index);
if (index === winnerList.length - 1) {
// not only one winner
if (index !== 0) {
income = pot - roundPotCount;
}
winner.setIncome(income);
prevEvPot = winner.evPot;
} else {
roundPotCount += income;
winner.setIncome(income);
}
winner.setIncome(income);
console.log('winner----------', winnerList, roundPotCount, pot, leftPot);
});
});
}
+12 -31
View File
@@ -137,36 +137,17 @@ export class PokerStyle implements IPokerStyle {
}
console.log('come in -------', isThree);
if (this.isShort) {
// three of kind
if (isThree.length > 0) {
isThreeKind = isThree.join('');
isThreeKind += highCard[0] + highCard[1];
this.pokerStyle[5] = isThreeKind;
return;
}
// straight
if (this.isStraight() !== '0') {
this.pokerStyle[6] = `${this.isStraight()}`;
return;
}
} else {
// straight
if (this.isStraight() !== '0') {
this.pokerStyle[5] = `${this.isStraight()}`;
return;
}
// three of kind
if (isThree.length > 0) {
isThreeKind = isThree.join('');
isThreeKind += highCard[0] + highCard[1];
this.pokerStyle[6] = isThreeKind;
return;
}
// straight
if (this.isStraight() !== '0') {
this.pokerStyle[5] = `${this.isStraight()}`;
return;
}
// three of kind
if (isThree.length > 0) {
isThreeKind = isThree.join('');
isThreeKind += highCard[0] + highCard[1];
this.pokerStyle[6] = isThreeKind;
return;
}
// tow pair
@@ -240,7 +221,7 @@ export class PokerStyle implements IPokerStyle {
let isFlush = false;
this.pokerStyle.forEach((style, key) => {
if (style !== '0') {
isFlush = key === 1 || key === 4;
isFlush = key === 1 || this.isShort ? key === 3 : key === 4;
valueStyle = style;
}
});
+24 -6
View File
@@ -76,7 +76,7 @@ class GameController extends BaseSocketController {
roomInfo.game = new PokerGame({
users: sitDownPlayer,
isShort: roomInfo.config.isShort,
smallBlind: 1,
smallBlind: roomInfo.config.smallBlind,
actionRoundComplete: async () => {
let slidePots: number [] = [];
if (roomInfo.game) {
@@ -197,9 +197,9 @@ class GameController extends BaseSocketController {
userId: BB.userId,
type: BB.type,
gameStatus: 0,
pot: 3,
pot: roomInfo.config.smallBlind * 3,
commonCard: '',
command: 'bb:2',
command: `bb:${roomInfo.config.smallBlind * 2}`,
gameId: result.id,
counter: BB.counter,
};
@@ -208,9 +208,9 @@ class GameController extends BaseSocketController {
userId: SB.userId,
type: SB.type,
gameStatus: 0,
pot: 1,
pot: roomInfo.config.smallBlind,
commonCard: '',
command: 'sb:1',
command: `sb:${roomInfo.config.smallBlind}`,
gameId: result.id,
counter: SB.counter,
};
@@ -370,6 +370,7 @@ class GameController extends BaseSocketController {
const { payload } = this.message;
const sitList = payload.sitList;
const roomInfo = await this.getRoomInfo();
console.log('sitList=============', sitList);
roomInfo.sit = sitList;
await this.adapter('online', 'sitList', {
sitList,
@@ -378,7 +379,24 @@ class GameController extends BaseSocketController {
console.log(e);
}
}
async standUp() {
try {
console.log('come in');
const userInfo: IPlayer = await this.getUserInfo();
const roomInfo = await this.getRoomInfo();
roomInfo.sit.forEach((s: ISit) => {
if (s.player && s.player.userId === userInfo.userId) {
delete s.player;
}
});
const sitList = roomInfo.sit;
await this.adapter('online', 'sitList', {
sitList,
});
} catch (e) {
console.log(e);
}
}
async action() {
try {
const { payload } = this.message;
+1
View File
@@ -111,6 +111,7 @@ export default function join(): any {
currPlayer: {
userId: roomInfo.game?.currPlayer.node.userId,
},
smallBlind: roomInfo.config.smallBlind,
};
const game = ctx.helper.parseMsg('gameInfo', {
data: gameInfo,
+2
View File
@@ -7,4 +7,6 @@ export default function (app: Application) {
app.io.of('/socket').route('playGame', app.io.controller.game.playGame);
app.io.of('/socket').route('action', app.io.controller.game.action);
app.io.of('/socket').route('sitDown', app.io.controller.game.sitDown);
app.io.of('/socket').route('standUp', app.io.controller.game.standUp);
}
+1
View File
@@ -75,6 +75,7 @@ export default class BaseSocketController extends Controller {
currPlayer: {
userId: roomInfo.game.currPlayer.node.userId,
},
smallBlind: roomInfo.config.smallBlind,
};
await this.adapter('online', 'gameInfo', gameInfo);
}