fix bug
This commit is contained in:
Generated
+25
-7
@@ -3,23 +3,36 @@
|
||||
<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/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/client/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/App.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/App.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/assets/less/base.less" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/assets/less/base.less" 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/CommonCard.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/CommonCard.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/cardList.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/cardList.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/toast.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/toast.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/components/x-input.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/x-input.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/main.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/router/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/router/index.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/service/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/service/index.ts" 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/utils/origin.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/utils/origin.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/utils/request.ts" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/utils/request.ts" 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/game.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/game.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$/client/src/views/register.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/register.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/yarn.lock" beforeDir="false" afterPath="$PROJECT_DIR$/client/yarn.lock" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/server/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/app/controller/room.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/controller/room.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/app/controller/user.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/controller/user.ts" 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/middleware/elkLogger.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/app/middleware/elkLogger.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/interface/IResult.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/interface/IResult.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/server/src/lib/baseController.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/src/lib/baseController.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/test/app/core/pokerGame.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/server/test/app/core/pokerGame.test.ts" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -93,7 +106,8 @@
|
||||
<workItem from="1588166552136" duration="2062000" />
|
||||
<workItem from="1588168659920" duration="21070000" />
|
||||
<workItem from="1589475961634" duration="559000" />
|
||||
<workItem from="1589732800789" duration="12772000" />
|
||||
<workItem from="1589732800789" duration="13203000" />
|
||||
<workItem from="1590767628109" duration="22870000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@@ -117,11 +131,15 @@
|
||||
<screen x="0" y="0" width="1440" height="900" />
|
||||
</state>
|
||||
<state x="221" y="89" key="SettingsEditor/0.0.1440.900@0.0.1440.900" timestamp="1588864041632" />
|
||||
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1588771907080">
|
||||
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1590853061364">
|
||||
<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="1587480585643" />
|
||||
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.823@0.23.1440.823" timestamp="1588771907080" />
|
||||
<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="1590851703228" />
|
||||
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.823@0.23.1440.823" timestamp="1590853061364" />
|
||||
<state x="513" y="145" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1590828749947">
|
||||
<screen x="0" y="0" width="1440" height="900" />
|
||||
</state>
|
||||
<state x="513" y="145" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1440.900@0.0.1440.900" timestamp="1590828749947" />
|
||||
<state x="378" y="207" width="683" height="486" key="find.popup" timestamp="1587207727777">
|
||||
<screen x="0" y="0" width="1440" height="900" />
|
||||
</state>
|
||||
|
||||
+74
-74
@@ -1,74 +1,74 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
|
||||
export default class App extends Vue {}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import "assets/less/base";
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
max-width: 640rem;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
}
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
body{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.container{
|
||||
.input-bd{
|
||||
line-height: 30px;
|
||||
margin: 10px;
|
||||
font-size: 0;
|
||||
.input-name{
|
||||
display: inline-block;
|
||||
min-width: 10vw;
|
||||
font-size: 14px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.input-text{
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
vertical-align: middle;
|
||||
input{
|
||||
min-height: 30px;
|
||||
min-width: 40vw;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
margin-top: 15px;
|
||||
span{
|
||||
color: #fff;
|
||||
background-color: #00976e;
|
||||
border-radius: 8px;
|
||||
padding: 5px 20px;
|
||||
display: block;
|
||||
margin: 10px;
|
||||
}
|
||||
b{
|
||||
display: inline-block;
|
||||
border: aliceblue;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
padding: 5px 20px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
|
||||
export default class App extends Vue {}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import "assets/less/base";
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
max-width: 640rem;
|
||||
overflow: hidden;
|
||||
margin: auto;
|
||||
}
|
||||
*{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
body{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.container{
|
||||
.input-bd{
|
||||
line-height: 30px;
|
||||
margin: 10px;
|
||||
font-size: 0;
|
||||
.input-name{
|
||||
display: inline-block;
|
||||
min-width: 10vw;
|
||||
font-size: 14px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.input-text{
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
vertical-align: middle;
|
||||
input{
|
||||
min-height: 30px;
|
||||
min-width: 40vw;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
margin-top: 15px;
|
||||
span{
|
||||
color: #fff;
|
||||
background-color: #00976e;
|
||||
border-radius: 8px;
|
||||
padding: 5px 20px;
|
||||
display: block;
|
||||
margin: 10px;
|
||||
}
|
||||
b{
|
||||
display: inline-block;
|
||||
border: aliceblue;
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
padding: 5px 20px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@font-face {
|
||||
font-family: 'iconfont'; /* project id 1801313 */
|
||||
src: url('//at.alicdn.com/t/font_1801313_ys37cfwp48.eot');
|
||||
src: url('//at.alicdn.com/t/font_1801313_ys37cfwp48.eot?#iefix') format('embedded-opentype'),
|
||||
url('//at.alicdn.com/t/font_1801313_ys37cfwp48.woff2') format('woff2'),
|
||||
url('//at.alicdn.com/t/font_1801313_ys37cfwp48.woff') format('woff'),
|
||||
url('//at.alicdn.com/t/font_1801313_ys37cfwp48.ttf') format('truetype'),
|
||||
url('//at.alicdn.com/t/font_1801313_ys37cfwp48.svg#iconfont') format('svg');
|
||||
src: url('//at.alicdn.com/t/font_1801313_6febq8ukb8g.eot');
|
||||
src: url('//at.alicdn.com/t/font_1801313_6febq8ukb8g.eot?#iefix') format('embedded-opentype'),
|
||||
url('//at.alicdn.com/t/font_1801313_6febq8ukb8g.woff2') format('woff2'),
|
||||
url('//at.alicdn.com/t/font_1801313_6febq8ukb8g.woff') format('woff'),
|
||||
url('//at.alicdn.com/t/font_1801313_6febq8ukb8g.ttf') format('truetype'),
|
||||
url('//at.alicdn.com/t/font_1801313_6febq8ukb8g.svg#iconfont') format('svg');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
@@ -42,6 +42,11 @@
|
||||
content: "\e615";
|
||||
}
|
||||
|
||||
.icon-msg:before{
|
||||
content: "\e781";
|
||||
}
|
||||
|
||||
|
||||
body, p,h1,h2,ul,li,input{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
@@ -1,95 +1,95 @@
|
||||
<template>
|
||||
<div class="buy-in"
|
||||
v-show="showBuyIn">
|
||||
<div class="shadow"
|
||||
@click="closeBuyIn"></div>
|
||||
<div class="buy-in-body">
|
||||
<div class="input-bd">
|
||||
<div class="input-name">buy in: {{buyInSize}}</div>
|
||||
<range :max="max"
|
||||
:min="min"
|
||||
@change="getBuyInSize"></range>
|
||||
</div>
|
||||
<div class="btn"><span @click="buyIn">buy in</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import range from '../components/range.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
range,
|
||||
},
|
||||
})
|
||||
export default class BuyIn extends Vue {
|
||||
@Prop() private showBuyIn!: boolean;
|
||||
@Prop() private min!: number;
|
||||
@Prop() private max!: number;
|
||||
private buyInSize: number = 0;
|
||||
|
||||
private getBuyInSize(val: string) {
|
||||
this.buyInSize = Number(val);
|
||||
}
|
||||
|
||||
private closeBuyIn() {
|
||||
this.$emit('update:showBuyIn', false);
|
||||
}
|
||||
|
||||
private async buyIn() {
|
||||
this.closeBuyIn();
|
||||
this.$emit('buyIn', this.buyInSize);
|
||||
}
|
||||
private mounted() {
|
||||
this.buyInSize = this.min;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.buy-in {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
|
||||
.shadow {
|
||||
position: fixed;
|
||||
z-index: 9;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.buy-in-body {
|
||||
z-index: 99;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -100px -150px;
|
||||
width: 300px;
|
||||
border-radius: 12px;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.input-text {
|
||||
input {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
.input-name{
|
||||
margin-bottom: 15px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.btn{
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<template>
|
||||
<div class="buy-in"
|
||||
v-show="showBuyIn">
|
||||
<div class="shadow"
|
||||
@click="closeBuyIn"></div>
|
||||
<div class="buy-in-body">
|
||||
<div class="input-bd">
|
||||
<div class="input-name">buy in: {{buyInSize}}</div>
|
||||
<range :max="max"
|
||||
:min="min"
|
||||
@change="getBuyInSize"></range>
|
||||
</div>
|
||||
<div class="btn"><span @click="buyIn">buy in</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import range from '../components/range.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
range,
|
||||
},
|
||||
})
|
||||
export default class BuyIn extends Vue {
|
||||
@Prop() private showBuyIn!: boolean;
|
||||
@Prop() private min!: number;
|
||||
@Prop() private max!: number;
|
||||
private buyInSize: number = 0;
|
||||
|
||||
private getBuyInSize(val: string) {
|
||||
this.buyInSize = Number(val);
|
||||
}
|
||||
|
||||
private closeBuyIn() {
|
||||
this.$emit('update:showBuyIn', false);
|
||||
}
|
||||
|
||||
private async buyIn() {
|
||||
this.closeBuyIn();
|
||||
this.$emit('buyIn', this.buyInSize);
|
||||
}
|
||||
private mounted() {
|
||||
this.buyInSize = this.min;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.buy-in {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
|
||||
.shadow {
|
||||
position: fixed;
|
||||
z-index: 9;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.buy-in-body {
|
||||
z-index: 99;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -100px -150px;
|
||||
width: 300px;
|
||||
border-radius: 12px;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.input-text {
|
||||
input {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
.input-name{
|
||||
margin-bottom: 15px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.btn{
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,158 +1,161 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="common-card-container">
|
||||
<cardList :card-list="commonCardMap" :value-cards="valueCards"></cardList>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Vue} from 'vue-property-decorator';
|
||||
import cardList from './cardList.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
cardList,
|
||||
},
|
||||
})
|
||||
export default class CommonCard extends Vue {
|
||||
@Prop() private commonCard: any;
|
||||
@Prop() private valueCards!: string[];
|
||||
get commonCardMap() {
|
||||
const arr = [];
|
||||
for(let i = 0; i < 5; i++) {
|
||||
if(this.commonCard[i]) {
|
||||
arr.push(this.commonCard[i])
|
||||
} else {
|
||||
arr.push('')
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped lang="less">
|
||||
.common-card-container {
|
||||
position: absolute;
|
||||
top: 50vh;
|
||||
left: 50%;
|
||||
margin: -38px -114px;
|
||||
|
||||
.card {
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform-style: preserve-3d;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
|
||||
i {
|
||||
background: url("../assets/poke.png");
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
background-size: 100% 100%;
|
||||
transform: rotateY(0deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
border-radius: 5px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
/*background: url("../assets/poke-icon.png");*/
|
||||
background-size: 100% 100%;
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
transform: rotateY(180deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform-style: preserve-3d;
|
||||
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
|
||||
&.red {
|
||||
color: #e8050a;
|
||||
}
|
||||
|
||||
&.black {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.number {
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
z-index: -2;
|
||||
left: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.color {
|
||||
flex: 1;
|
||||
font-size: 28px;
|
||||
line-height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
&.show {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
transition: left 1s;
|
||||
}
|
||||
|
||||
&.turn {
|
||||
animation: turnA 2s forwards;
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
&:nth-child(1) {
|
||||
&.show {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
&.show {
|
||||
left: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
&.show {
|
||||
left: 44 * 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
&.show {
|
||||
left: 44 * 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(5) {
|
||||
&.show {
|
||||
left: 44 * 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes turnA /* Safari 与 Chrome */ {
|
||||
from {
|
||||
transform: rotateY(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotateY(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="common-card-container">
|
||||
<cardList :card-list="commonCardMap"
|
||||
:value-cards="valueCards"></cardList>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import cardList from './cardList.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
cardList,
|
||||
},
|
||||
})
|
||||
export default class CommonCard extends Vue {
|
||||
@Prop() private commonCard: any;
|
||||
@Prop() private valueCards!: string[];
|
||||
|
||||
get commonCardMap() {
|
||||
const arr = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
if (this.commonCard[i]) {
|
||||
arr.push(this.commonCard[i]);
|
||||
} else {
|
||||
arr.push('');
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.common-card-container {
|
||||
position: absolute;
|
||||
top: 50vh;
|
||||
left: 50%;
|
||||
margin: -38px -114px;
|
||||
|
||||
.card {
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform-style: preserve-3d;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
|
||||
i {
|
||||
background: url("../assets/poke.png");
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
background-size: 100% 100%;
|
||||
transform: rotateY(0deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
border-radius: 5px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
/*background: url("../assets/poke-icon.png");*/
|
||||
background-size: 100% 100%;
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
transform: rotateY(180deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform-style: preserve-3d;
|
||||
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
|
||||
&.red {
|
||||
color: #e8050a;
|
||||
}
|
||||
|
||||
&.black {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.number {
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
z-index: -2;
|
||||
left: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.color {
|
||||
flex: 1;
|
||||
font-size: 28px;
|
||||
line-height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
&.show {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
transition: left 1s;
|
||||
}
|
||||
|
||||
&.turn {
|
||||
animation: turnA 2s forwards;
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
&:nth-child(1) {
|
||||
&.show {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
&.show {
|
||||
left: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
&.show {
|
||||
left: 44 * 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
&.show {
|
||||
left: 44 * 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(5) {
|
||||
&.show {
|
||||
left: 44 * 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes turnA /* Safari 与 Chrome */ {
|
||||
from {
|
||||
transform: rotateY(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotateY(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
</div>
|
||||
<div class="sit-player"
|
||||
v-if="sit.player">
|
||||
<div class="player" :class="{fold: sit.player.status === -1}">
|
||||
<div class="count-down" v-show="actionUserId === sit.player.userId">{{time}}</div>
|
||||
<div class="player"
|
||||
:class="{fold: sit.player.status === -1}">
|
||||
<div class="count-down"
|
||||
v-show="actionUserId === sit.player.userId">{{time}}
|
||||
</div>
|
||||
<div class="user-name"
|
||||
v-show="sit.player.nickName">
|
||||
{{ sit.player.nickName }}
|
||||
@@ -42,9 +45,11 @@
|
||||
v-show="!!!currPlayer || (sit.player.userId !== currPlayer.userId
|
||||
&& sit.player.handCard
|
||||
&& sit.player.handCard.length !== 0)">
|
||||
<cardList :cardList="sit.player.handCard" :valueCards="valueCards"></cardList>
|
||||
<cardList :cardList="sit.player.handCard"
|
||||
:valueCards="valueCards"></cardList>
|
||||
</div>
|
||||
<div class="card-style" v-show="!!!currPlayer || (sit.player.userId !== currPlayer.userId
|
||||
<div class="card-style"
|
||||
v-show="!!!currPlayer || (sit.player.userId !== currPlayer.userId
|
||||
&& sit.player.handCard
|
||||
&& sit.player.handCard.length !== 0)">
|
||||
{{PokeStyle(sit.player.handCard)}}
|
||||
@@ -53,7 +58,8 @@
|
||||
<div class="cards"
|
||||
v-show="showHandCard(sit)">
|
||||
<div class="hand-card">
|
||||
<cardList :cardList="handCard" :valueCards="valueCards"></cardList>
|
||||
<cardList :cardList="handCard"
|
||||
:valueCards="valueCards"></cardList>
|
||||
</div>
|
||||
<div class="ready"
|
||||
v-show="handCard && handCard.length === 0">ready
|
||||
@@ -69,7 +75,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
</div>
|
||||
<BuyIn :showBuyIn.sync="showBuyIn"
|
||||
:min="200"
|
||||
@@ -79,13 +84,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Watch, Vue} from 'vue-property-decorator';
|
||||
import {IPlayer} from '@/interface/IPlayer';
|
||||
import {ILinkNode} from '@/utils/Link';
|
||||
import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
|
||||
import { IPlayer } from '@/interface/IPlayer';
|
||||
import { ILinkNode } from '@/utils/Link';
|
||||
import ISit from '@/interface/ISit';
|
||||
import cardList from './cardList.vue';
|
||||
import BuyIn from '@/components/BuyIn.vue';
|
||||
import {PokerStyle} from '@/utils/PokerStyle';
|
||||
import { PokerStyle } from '@/utils/PokerStyle';
|
||||
import map from '../utils/map';
|
||||
|
||||
@Component({
|
||||
@@ -104,7 +109,7 @@
|
||||
@Prop() private isPlay!: boolean;
|
||||
@Prop() private actionUserId!: string;
|
||||
@Prop() private valueCards!: string;
|
||||
@Prop({ default:30, type:Number }) private time!: number;
|
||||
@Prop({ default: 30, type: Number }) private time!: number;
|
||||
|
||||
private sitLinkNode: any = '';
|
||||
private showBuyIn = false;
|
||||
@@ -269,7 +274,8 @@
|
||||
.user-name {
|
||||
color: #fff;
|
||||
}
|
||||
.count-down{
|
||||
|
||||
.count-down {
|
||||
height: 7vh;
|
||||
line-height: 9vh;
|
||||
width: 12vw;
|
||||
@@ -279,18 +285,21 @@
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
font-size: 20px;
|
||||
background-image: linear-gradient(0deg, rgba(0,0,0,0.3), transparent);
|
||||
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.3), transparent);
|
||||
}
|
||||
|
||||
.counter {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
border-radius: 2px;
|
||||
|
||||
&.isAction {
|
||||
box-shadow: 0px 0px 6px 4px;
|
||||
}
|
||||
&.close-time-out{
|
||||
|
||||
&.close-time-out {
|
||||
animation: 300ms timeOut infinite;
|
||||
}
|
||||
}
|
||||
|
||||
+191
-183
@@ -1,183 +1,191 @@
|
||||
<template>
|
||||
<div class="card-container">
|
||||
<div
|
||||
class="card"
|
||||
v-for="(card, key) in cardList"
|
||||
v-bind:class="{ show: show, turn: show && card !== '' }"
|
||||
>
|
||||
<i></i>
|
||||
<span class="card-bg red" :class="{ black : isBlack(map(card)[1])}">
|
||||
<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>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Vue} from 'vue-property-decorator';
|
||||
import { mapCard } from '@/utils/map'
|
||||
|
||||
@Component
|
||||
export default class Card extends Vue {
|
||||
@Prop() private cardList: any;
|
||||
@Prop({default: [], type: Array }) private valueCards!: string;
|
||||
|
||||
get show() {
|
||||
return this.cardList[0].length !== 0;
|
||||
}
|
||||
|
||||
private isBlack(type: string) {
|
||||
return type === '♠' || type === '♣';
|
||||
}
|
||||
|
||||
private map(card: string) {
|
||||
return mapCard(card)
|
||||
}
|
||||
|
||||
private shadow(card: string) {
|
||||
if (this.valueCards.length === 0) return false
|
||||
return this.valueCards.indexOf(card) < 0
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped lang="less">
|
||||
.card-container {
|
||||
.card {
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform-style: preserve-3d;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
z-index: 0;
|
||||
i {
|
||||
background: url("../assets/poke.png");
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
background-size: 100% 100%;
|
||||
transform: rotateY(0deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
border-radius: 5px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
/*background: url("../assets/poke-icon.png");*/
|
||||
background-size: 100% 100%;
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
transform: rotateY(180deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform-style: preserve-3d;
|
||||
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
.shadow {
|
||||
width: 40px;
|
||||
height: 60px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
border-radius: 5px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
background: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
&.red {
|
||||
color: #e8050a;
|
||||
}
|
||||
|
||||
&.black {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.number {
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
font-size: 16px;
|
||||
line-height: 25px;
|
||||
font-family: initial;
|
||||
}
|
||||
|
||||
.color {
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: -2px;
|
||||
font-size: 20px;
|
||||
line-height: 60px;
|
||||
&.big{
|
||||
left: 15px;
|
||||
font-size: 35px;
|
||||
top:12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.show {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
transition: left 1s;
|
||||
}
|
||||
|
||||
&.turn {
|
||||
animation: turnA 1s forwards;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
&:nth-child(1) {
|
||||
&.show {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
&.show {
|
||||
left: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
&.show {
|
||||
left: 44 * 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
&.show {
|
||||
left: 44 * 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(5) {
|
||||
&.show {
|
||||
left: 44 * 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes turnA /* Safari 与 Chrome */ {
|
||||
from {
|
||||
transform: rotateY(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotateY(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="card-container">
|
||||
<div
|
||||
class="card"
|
||||
v-for="(card, key) in cardList"
|
||||
v-bind:class="{ show: show, turn: show && card !== '' }"
|
||||
>
|
||||
<i></i>
|
||||
<span class="card-bg red"
|
||||
:class="{ black : isBlack(map(card)[1])}">
|
||||
<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>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { mapCard } from '@/utils/map';
|
||||
|
||||
@Component
|
||||
export default class Card extends Vue {
|
||||
@Prop() private cardList: any;
|
||||
@Prop({ default: [], type: Array }) private valueCards!: string;
|
||||
|
||||
get show() {
|
||||
return this.cardList[0].length !== 0;
|
||||
}
|
||||
|
||||
private isBlack(type: string) {
|
||||
return type === '♠' || type === '♣';
|
||||
}
|
||||
|
||||
private map(card: string) {
|
||||
return mapCard(card);
|
||||
}
|
||||
|
||||
private shadow(card: string) {
|
||||
if (this.valueCards.length === 0) {
|
||||
return false;
|
||||
}
|
||||
return this.valueCards.indexOf(card) < 0;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.card-container {
|
||||
.card {
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform-style: preserve-3d;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
z-index: 0;
|
||||
|
||||
i {
|
||||
background: url("../assets/poke.png");
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
background-size: 100% 100%;
|
||||
transform: rotateY(0deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
border-radius: 5px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.card-bg {
|
||||
/*background: url("../assets/poke-icon.png");*/
|
||||
background-size: 100% 100%;
|
||||
height: 60px;
|
||||
width: 40px;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
transform: rotateY(180deg) translate3d(0px, 0px, 0px);
|
||||
backface-visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform-style: preserve-3d;
|
||||
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
|
||||
|
||||
.shadow {
|
||||
width: 40px;
|
||||
height: 60px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
border-radius: 5px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
&.red {
|
||||
color: #e8050a;
|
||||
}
|
||||
|
||||
&.black {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.number {
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
font-size: 16px;
|
||||
line-height: 25px;
|
||||
font-family: initial;
|
||||
}
|
||||
|
||||
.color {
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: -2px;
|
||||
font-size: 20px;
|
||||
line-height: 60px;
|
||||
|
||||
&.big {
|
||||
left: 15px;
|
||||
font-size: 35px;
|
||||
top: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.show {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
transition: left 1s;
|
||||
}
|
||||
|
||||
&.turn {
|
||||
animation: turnA 1s forwards;
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
&:nth-child(1) {
|
||||
&.show {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
&.show {
|
||||
left: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
&.show {
|
||||
left: 44 * 2px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
&.show {
|
||||
left: 44 * 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(5) {
|
||||
&.show {
|
||||
left: 44 * 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes turnA /* Safari 与 Chrome */ {
|
||||
from {
|
||||
transform: rotateY(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotateY(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +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>
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="record-container"
|
||||
v-show="show">
|
||||
<div class="shadow" @click="show = false"></div>
|
||||
<div class="shadow"
|
||||
@click="show = false"></div>
|
||||
<div class="body">
|
||||
<div class="title">record</div>
|
||||
<ul>
|
||||
@@ -28,8 +29,7 @@
|
||||
import { IPlayer } from '@/interface/IPlayer';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
},
|
||||
components: {},
|
||||
})
|
||||
export default class Record extends Vue {
|
||||
@Prop() private value!: boolean;
|
||||
@@ -37,11 +37,10 @@
|
||||
|
||||
get show() {
|
||||
return this.value;
|
||||
};
|
||||
set show(val) {
|
||||
this.$emit('input', val)
|
||||
}
|
||||
private mounted() {
|
||||
|
||||
set show(val) {
|
||||
this.$emit('input', val);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -57,8 +56,10 @@
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
.shadow{
|
||||
background: rgba(0,0,0,0.3);
|
||||
z-index: 9999;
|
||||
|
||||
.shadow {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
@@ -66,21 +67,25 @@
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
}
|
||||
.body{
|
||||
|
||||
.body {
|
||||
position: relative;
|
||||
z-index: 9;
|
||||
}
|
||||
.title{
|
||||
|
||||
.title {
|
||||
color: #fff;
|
||||
text-align: left;
|
||||
line-height: 30px;
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid #fff;
|
||||
}
|
||||
ul{
|
||||
li{
|
||||
|
||||
ul {
|
||||
li {
|
||||
display: flex;
|
||||
i{
|
||||
|
||||
i {
|
||||
flex: 1;
|
||||
padding: 5px 10px;
|
||||
font-size: 16px;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div class="send-msg-container">
|
||||
<div class="send-msg-body">
|
||||
<div class="msg-name iconfont icon-msg"></div>
|
||||
<div class="msg-input">
|
||||
<input type="text"
|
||||
v-model='msg'>
|
||||
</div>
|
||||
<div class="msg-btn btn"
|
||||
@click="send"><span>send</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class SendMsg extends Vue {
|
||||
private msg: string = '';
|
||||
|
||||
private send() {
|
||||
if (this.msg !== '') {
|
||||
this.$emit('send', this.msg);
|
||||
this.msg = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped
|
||||
lang="less">
|
||||
.send-msg-container {
|
||||
position: fixed;
|
||||
.send-msg-body {
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
height: 25px;
|
||||
padding: 10px 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: #fff;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.msg-name {
|
||||
width: 40px;
|
||||
font-size: 30px;
|
||||
color: #009870;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.msg-input {
|
||||
flex: 1;
|
||||
border: 1px solid #bababa;
|
||||
text-align: left;
|
||||
|
||||
input {
|
||||
height: 20px;
|
||||
width: 90%;
|
||||
padding: 0 5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.msg-btn {
|
||||
width: 80px;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
text-align: center;
|
||||
|
||||
span {
|
||||
padding: 5px 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,24 +1,25 @@
|
||||
<template>
|
||||
<div class="toast-container">
|
||||
<div class="toast-body" v-show="showValue">
|
||||
<div class="toast-body"
|
||||
v-show="showValue">
|
||||
{{text}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Watch, Vue} from 'vue-property-decorator';
|
||||
import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class Toast extends Vue {
|
||||
@Prop() private text!: string;
|
||||
@Prop({default: false, type: Boolean}) private show!: boolean;
|
||||
@Prop({default: 1000, type: Number}) private timeOut!: number;
|
||||
@Prop({ default: false, type: Boolean }) private show!: boolean;
|
||||
@Prop({ default: 3000, type: Number }) private timeOut!: number;
|
||||
|
||||
private Time: any;
|
||||
|
||||
get showValue() {
|
||||
console.log('come in')
|
||||
console.log('come in1111', this.show);
|
||||
if (this.show) {
|
||||
this.close();
|
||||
}
|
||||
@@ -30,7 +31,7 @@
|
||||
}
|
||||
|
||||
private close() {
|
||||
console.log('come in')
|
||||
console.log('come in');
|
||||
clearTimeout(this.Time);
|
||||
this.Time = setTimeout(() => {
|
||||
this.showValue = false;
|
||||
@@ -45,8 +46,8 @@
|
||||
lang="less">
|
||||
.toast-container {
|
||||
.toast-body {
|
||||
padding: 2px 6px;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
padding: 4px 10px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
@@ -55,6 +56,7 @@
|
||||
left: 50%;
|
||||
transform: translate3d(-50%, -50%, 0);
|
||||
border-radius: 4px;
|
||||
line-height: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,14 +8,16 @@
|
||||
@focus="onFocus"
|
||||
@blur="focus = false"
|
||||
v-model="changeValue"/>
|
||||
<i class="iconfont icon-close close" v-show="value !== ''" @click="clear"></i>
|
||||
<i class="iconfont icon-close close"
|
||||
v-show="value !== ''"
|
||||
@click="clear"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Component, Prop, Vue} from 'vue-property-decorator';
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class XInput extends Vue {
|
||||
@@ -41,7 +43,7 @@
|
||||
|
||||
private onFocus() {
|
||||
this.focus = true;
|
||||
this.$emit('focus')
|
||||
this.$emit('focus');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -50,7 +52,7 @@
|
||||
<style scoped
|
||||
lang="less">
|
||||
.input-container {
|
||||
.input-name{
|
||||
.input-name {
|
||||
top: 12px;
|
||||
left: 10px;
|
||||
text-align: left;
|
||||
@@ -62,13 +64,15 @@
|
||||
z-index: 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
.input-text{
|
||||
|
||||
.input-text {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 2px;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
input{
|
||||
|
||||
input {
|
||||
width: 80vw;
|
||||
height: 20px;
|
||||
padding: 5px 10px;
|
||||
@@ -78,7 +82,8 @@
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
.input-bd{
|
||||
|
||||
.input-bd {
|
||||
margin: 4vw 0;
|
||||
border: 1px solid #bababa;
|
||||
border-radius: 4px;
|
||||
@@ -87,24 +92,30 @@
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
.move{
|
||||
.input-name{
|
||||
|
||||
.move {
|
||||
.input-name {
|
||||
transform: translate3d(-10px, -22px, 0px) scale(0.8);
|
||||
}
|
||||
}
|
||||
.focus{
|
||||
|
||||
.focus {
|
||||
border: 1px solid #00976e;
|
||||
.input-name{
|
||||
|
||||
.input-name {
|
||||
color: #00976e;
|
||||
}
|
||||
}
|
||||
.error{
|
||||
|
||||
.error {
|
||||
border: 1px solid #e8050a;
|
||||
.input-name{
|
||||
|
||||
.input-name {
|
||||
color: #e8050a;
|
||||
}
|
||||
}
|
||||
.close{
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
width: 30px;
|
||||
|
||||
+4
-1
@@ -4,18 +4,21 @@ import router from './router';
|
||||
import store from './store';
|
||||
import VConsole from 'vconsole';
|
||||
import './utils/init';
|
||||
import toastPlugin from './plugins/toast';
|
||||
// 快速点击bug
|
||||
// import fastClick from 'fastclick';
|
||||
Vue.use(toastPlugin);
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
new VConsole();
|
||||
}
|
||||
// @ts-ignore
|
||||
// fastClick.attach(document.body);
|
||||
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
import Vue from 'vue';
|
||||
import { ToastExtendConstructor, IOptions } from '../src/plugins/toast';
|
||||
|
||||
interface IPlugin {
|
||||
toast(options: string | IOptions): ToastExtendConstructor;
|
||||
}
|
||||
|
||||
declare module 'vue/types/vue' {
|
||||
interface Vue {
|
||||
$plugin: IPlugin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import Vue, { PluginObject } from 'vue';
|
||||
import Toast from '../components/toast.vue';
|
||||
|
||||
export interface IOptions {
|
||||
text?: string;
|
||||
timeOut?: number;
|
||||
}
|
||||
|
||||
const ToastConstructor = Vue.extend(Toast);
|
||||
|
||||
export class ToastExtendConstructor extends ToastConstructor {
|
||||
public close() {
|
||||
this.$props.show = false;
|
||||
this.$off('update:show');
|
||||
}
|
||||
}
|
||||
|
||||
let instance: ToastExtendConstructor;
|
||||
let defaultOptions: IOptions;
|
||||
|
||||
const getInstance = () => {
|
||||
if (instance) { return instance; }
|
||||
|
||||
instance = new ToastExtendConstructor({
|
||||
el: document.createElement('div'),
|
||||
});
|
||||
|
||||
return instance;
|
||||
};
|
||||
|
||||
const toast = (options: string | IOptions) => {
|
||||
const vm = getInstance();
|
||||
|
||||
if (!defaultOptions) {
|
||||
defaultOptions = { ...vm.$props };
|
||||
}
|
||||
|
||||
let opts: IOptions;
|
||||
if (typeof options === 'string') {
|
||||
opts = { ...defaultOptions, text: options };
|
||||
} else {
|
||||
opts = { ...defaultOptions, ...options };
|
||||
}
|
||||
|
||||
Object.keys(opts).forEach((key) => {
|
||||
vm.$props[key] = opts[key as keyof IOptions];
|
||||
});
|
||||
console.log(vm.$props);
|
||||
vm.$props.show = true;
|
||||
vm.$off('update:show');
|
||||
vm.$on('update:show', (val: boolean) => {
|
||||
vm.$props.show = val;
|
||||
});
|
||||
document.body.appendChild(vm.$el);
|
||||
|
||||
return vm;
|
||||
};
|
||||
|
||||
const plugin: PluginObject<Vue> = {
|
||||
// tslint:disable-next-line:no-shadowed-variable
|
||||
install(Vue) {
|
||||
if (!Vue.prototype.$plugin) {
|
||||
Vue.prototype.$plugin = {};
|
||||
}
|
||||
Vue.prototype.$plugin.toast = toast;
|
||||
},
|
||||
};
|
||||
|
||||
export default plugin;
|
||||
+70
-37
@@ -1,37 +1,70 @@
|
||||
import Vue from 'vue';
|
||||
import VueRouter, { RouteConfig } from 'vue-router';
|
||||
import Home from '../views/Home.vue';
|
||||
import Login from '../views/login.vue';
|
||||
import Register from '../views/register.vue';
|
||||
import Game from '../views/game.vue';
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
const routes: RouteConfig[] = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: Login,
|
||||
},
|
||||
{
|
||||
path: '/register',
|
||||
name: 'register',
|
||||
component: Register,
|
||||
},
|
||||
{
|
||||
path: '/game/:roomNumber/:isOwner?',
|
||||
name: 'game',
|
||||
component: Game,
|
||||
},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
});
|
||||
|
||||
export default router;
|
||||
import Vue from 'vue';
|
||||
import VueRouter, { RouteConfig } from 'vue-router';
|
||||
import Home from '../views/Home.vue';
|
||||
import Login from '../views/login.vue';
|
||||
import Register from '../views/register.vue';
|
||||
import Game from '../views/game.vue';
|
||||
import service from '../service';
|
||||
import origin from '../utils/origin';
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
const routes: RouteConfig[] = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
meta: {
|
||||
title: 'home',
|
||||
needLogin: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: Login,
|
||||
meta: {
|
||||
title: 'login',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/register',
|
||||
name: 'register',
|
||||
component: Register,
|
||||
meta: {
|
||||
title: 'create account',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/game/:roomNumber/:isOwner?',
|
||||
name: 'game',
|
||||
component: Game,
|
||||
meta: {
|
||||
title: 'game',
|
||||
needLogin: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
});
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title;
|
||||
}
|
||||
if (to.meta.needLogin) {
|
||||
try {
|
||||
const result = await service.checkLogin();
|
||||
console.log(result);
|
||||
next();
|
||||
} catch (e) {
|
||||
await router.replace({ name: 'login' });
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -9,10 +9,18 @@ export default {
|
||||
url: '/user/login',
|
||||
body: { userAccount, password },
|
||||
}),
|
||||
checkLogin: () => request({
|
||||
url: '/user',
|
||||
body: {},
|
||||
}),
|
||||
createRoom: () => request({
|
||||
url: '/game/room',
|
||||
body: { },
|
||||
}),
|
||||
findRoom: (roomNumber: string) => request({
|
||||
url: '/game/room/find',
|
||||
body: { roomNumber },
|
||||
}),
|
||||
buyIn: (buyInSize: number) => request({
|
||||
url: '/game/buyIn',
|
||||
body: { buyInSize },
|
||||
|
||||
+265
-265
@@ -1,265 +1,265 @@
|
||||
const POKER_STR = 'abcdefghijklm';
|
||||
|
||||
function sort(cards: string []): string[] {
|
||||
let temp = '';
|
||||
// 排序
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
for (let j = i + 1; j < cards.length; j++) {
|
||||
if (cards[i] > cards[j]) {
|
||||
temp = cards[i];
|
||||
cards[i] = cards[j];
|
||||
cards[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
interface IPokerStyle {
|
||||
init(): void;
|
||||
|
||||
isStraight(str?: string []): string;
|
||||
}
|
||||
|
||||
enum PokerStyleEnum {
|
||||
'ROYAL_FlUSH',
|
||||
'STRAIGHT_FLUSH',
|
||||
'FOUR_KIND',
|
||||
'FULL_HOUSE',
|
||||
'FLUSH',
|
||||
'STRAIGHT',
|
||||
'THREE_KIND',
|
||||
'TWO_PAIR',
|
||||
'PAIR',
|
||||
'HIGH_CARD',
|
||||
}
|
||||
export class PokerStyle implements IPokerStyle {
|
||||
private readonly cards: string[] = [];
|
||||
private flushObj: { [key: string]: any } = {
|
||||
1: [],
|
||||
2: [],
|
||||
3: [],
|
||||
4: [],
|
||||
};
|
||||
private flushColor: string = '';
|
||||
private straightArr: string[] = [];
|
||||
private styleName = [
|
||||
'ROYAL_FlUSH',
|
||||
'STRAIGHT_FLUSH',
|
||||
'FOUR_KIND',
|
||||
'FULL_HOUSE',
|
||||
'FLUSH',
|
||||
'STRAIGHT',
|
||||
'THREE_KIND',
|
||||
'TWO_PAIR',
|
||||
'PAIR',
|
||||
'HIGH_CARD'];
|
||||
private pokerStyle: string[] = [
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0'];
|
||||
private numObj: Map<string, number> = new Map(
|
||||
POKER_STR.split('').map((m) => [m, 0]));
|
||||
|
||||
constructor(cards: string[]) {
|
||||
this.cards = sort(cards);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public isStraight(str?: string []): string {
|
||||
const straightStr = str && str.join('') || [ ...new Set(this.straightArr) ].join('');
|
||||
let first = -1;
|
||||
let second = -1;
|
||||
let three = -1;
|
||||
function indexOf(str: string): number {
|
||||
return POKER_STR.indexOf(str);
|
||||
}
|
||||
if (straightStr.length === 5 && indexOf(straightStr) > -1) {
|
||||
return POKER_STR.slice(indexOf(straightStr), indexOf(straightStr) + 5);
|
||||
}
|
||||
if (straightStr.length === 6) {
|
||||
first = indexOf(straightStr.slice(0, 5));
|
||||
second = indexOf(straightStr.slice(1, 6));
|
||||
if (Math.max(first, second) > -1) {
|
||||
const max = Math.max(first, second);
|
||||
return POKER_STR.slice(max, max + 5);
|
||||
}
|
||||
}
|
||||
if (straightStr.length === 7) {
|
||||
first = indexOf(straightStr.slice(0, 5));
|
||||
second = indexOf(straightStr.slice(1, 6));
|
||||
three = indexOf(straightStr.slice(2, 7));
|
||||
if (Math.max(first, second, three) > -1) {
|
||||
const max = Math.max(first, second, three);
|
||||
return POKER_STR.slice(max, max + 5);
|
||||
}
|
||||
}
|
||||
// special straight "A2345",'m' -> A
|
||||
if (straightStr.indexOf('m') > -1 && straightStr.indexOf('abcd') > -1) {
|
||||
return 'mabcd';
|
||||
}
|
||||
return '0';
|
||||
}
|
||||
|
||||
public getPokerWeight() {
|
||||
return this.pokerStyle.join('');
|
||||
}
|
||||
|
||||
public getPokerStyleName() {
|
||||
for (let i = 0; i < this.pokerStyle.length; i++) {
|
||||
if (this.pokerStyle[i] !== '0') {
|
||||
return this.styleName[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
let i = 0;
|
||||
const isTwo = [];
|
||||
const isThree = [];
|
||||
let isFour = '0';
|
||||
let isFullHouse = '0';
|
||||
// const isStraightFlush = '0';
|
||||
let isFlush: string[] = [];
|
||||
let isRoyalFlush = '0';
|
||||
let isThreeKind = '';
|
||||
let isTowPair = '';
|
||||
let isPair = '';
|
||||
const highCard = [];
|
||||
|
||||
while (i < this.cards.length) {
|
||||
const color = this.cards[i][1];
|
||||
const num = this.cards[i][0];
|
||||
this.straightArr.push(this.cards[i][0]);
|
||||
this.flushObj[color].push(num);
|
||||
let value = this.numObj.get(num) || 0;
|
||||
value++;
|
||||
this.numObj.set(num, value);
|
||||
i++;
|
||||
}
|
||||
|
||||
// find flush
|
||||
for (const f in this.flushObj) {
|
||||
if (this.flushObj[f].length >= 5) {
|
||||
// flush is order,so flush[length - 1] is max flush card
|
||||
isFlush = this.flushObj[f];
|
||||
this.flushColor = f;
|
||||
}
|
||||
}
|
||||
|
||||
// find two,three,four
|
||||
for (const [key, value] of this.numObj) {
|
||||
// high card
|
||||
if (value === 1) {
|
||||
highCard.unshift(key);
|
||||
}
|
||||
// pairs max count 3, source is small to large
|
||||
if (value >= 2) {
|
||||
isTwo.unshift(key);
|
||||
}
|
||||
// three of kind max count 2
|
||||
if (value === 3) {
|
||||
isThree.unshift(key);
|
||||
}
|
||||
// four of kind only one
|
||||
if (value === 4) {
|
||||
isFour = key;
|
||||
}
|
||||
}
|
||||
// straight flush
|
||||
if (isFlush.length !== 0 && this.isStraight(isFlush) !== '0') {
|
||||
if (this.isStraight(isFlush) === 'ijklm') {
|
||||
isRoyalFlush = 'ijklm';
|
||||
this.pokerStyle[0] = isRoyalFlush;
|
||||
return;
|
||||
}
|
||||
this.pokerStyle[1] = this.isStraight(isFlush).split('').reverse().join('');
|
||||
return;
|
||||
}
|
||||
|
||||
// four of kind
|
||||
if (isFour !== '0') {
|
||||
isFour += highCard[0];
|
||||
this.pokerStyle[2] = isFour;
|
||||
return;
|
||||
}
|
||||
|
||||
// full house
|
||||
if (isThree.length > 0 && isTwo.length > isThree.length ||
|
||||
isThree.length === 2) {
|
||||
const maxTwoCard = isThree.length === 2 ? isThree[1] : isThree[0] ===
|
||||
isTwo[0] ? isTwo[1] : isTwo[0];
|
||||
const maxThree = isThree[0];
|
||||
isFullHouse = maxThree + maxTwoCard;
|
||||
this.pokerStyle[3] = isFullHouse;
|
||||
return;
|
||||
}
|
||||
|
||||
// flush
|
||||
if (isFlush.length !== 0) {
|
||||
isFlush.reverse().length = 5;
|
||||
this.pokerStyle[4] = isFlush.join('');
|
||||
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
|
||||
if (isTwo.length >= 2) {
|
||||
isTowPair = isTwo.join('');
|
||||
// third tow pair card big then high card
|
||||
const highCardForTowPair = isTwo[3] && isTwo[3] > highCard[0]
|
||||
? isTwo[3]
|
||||
: highCard[0];
|
||||
isTowPair += highCardForTowPair;
|
||||
this.pokerStyle[7] = isTowPair;
|
||||
return;
|
||||
}
|
||||
// pair
|
||||
if (isTwo.length === 1) {
|
||||
isPair = isTwo.join('');
|
||||
isPair += highCard[0] + highCard[1] + highCard[2];
|
||||
this.pokerStyle[8] = isPair;
|
||||
return;
|
||||
}
|
||||
// High card
|
||||
highCard.length = 5;
|
||||
this.pokerStyle[9] = highCard.join('');
|
||||
}
|
||||
public getPokerValueCard() {
|
||||
let valueStyle = '';
|
||||
let isFlush = false;
|
||||
this.pokerStyle.forEach((style, key) => {
|
||||
if (style !== '0') {
|
||||
isFlush = key === 1 || key === 4;
|
||||
valueStyle = style;
|
||||
}
|
||||
});
|
||||
const cards = this.cards.filter(card => {
|
||||
if (isFlush) {
|
||||
return valueStyle.indexOf(card[0]) > -1 && card[1] === this.flushColor;
|
||||
}
|
||||
return valueStyle.indexOf(card[0]) > -1;
|
||||
});
|
||||
cards.reverse().length = 5;
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
const POKER_STR = 'abcdefghijklm';
|
||||
|
||||
function sort(cards: string []): string[] {
|
||||
let temp = '';
|
||||
// 排序
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
for (let j = i + 1; j < cards.length; j++) {
|
||||
if (cards[i] > cards[j]) {
|
||||
temp = cards[i];
|
||||
cards[i] = cards[j];
|
||||
cards[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
interface IPokerStyle {
|
||||
init(): void;
|
||||
|
||||
isStraight(str?: string []): string;
|
||||
}
|
||||
|
||||
enum PokerStyleEnum {
|
||||
'ROYAL_FlUSH',
|
||||
'STRAIGHT_FLUSH',
|
||||
'FOUR_KIND',
|
||||
'FULL_HOUSE',
|
||||
'FLUSH',
|
||||
'STRAIGHT',
|
||||
'THREE_KIND',
|
||||
'TWO_PAIR',
|
||||
'PAIR',
|
||||
'HIGH_CARD',
|
||||
}
|
||||
export class PokerStyle implements IPokerStyle {
|
||||
private readonly cards: string[] = [];
|
||||
private flushObj: { [key: string]: any } = {
|
||||
1: [],
|
||||
2: [],
|
||||
3: [],
|
||||
4: [],
|
||||
};
|
||||
private flushColor: string = '';
|
||||
private straightArr: string[] = [];
|
||||
private styleName = [
|
||||
'ROYAL_FlUSH',
|
||||
'STRAIGHT_FLUSH',
|
||||
'FOUR_KIND',
|
||||
'FULL_HOUSE',
|
||||
'FLUSH',
|
||||
'STRAIGHT',
|
||||
'THREE_KIND',
|
||||
'TWO_PAIR',
|
||||
'PAIR',
|
||||
'HIGH_CARD'];
|
||||
private pokerStyle: string[] = [
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0',
|
||||
'0'];
|
||||
private numObj: Map<string, number> = new Map(
|
||||
POKER_STR.split('').map((m) => [m, 0]));
|
||||
|
||||
constructor(cards: string[]) {
|
||||
this.cards = sort(cards);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public isStraight(str?: string []): string {
|
||||
const straightStr = str && str.join('') || [ ...new Set(this.straightArr) ].join('');
|
||||
let first = -1;
|
||||
let second = -1;
|
||||
let three = -1;
|
||||
function indexOf(pokeString: string): number {
|
||||
return POKER_STR.indexOf(pokeString);
|
||||
}
|
||||
if (straightStr.length === 5 && indexOf(straightStr) > -1) {
|
||||
return POKER_STR.slice(indexOf(straightStr), indexOf(straightStr) + 5);
|
||||
}
|
||||
if (straightStr.length === 6) {
|
||||
first = indexOf(straightStr.slice(0, 5));
|
||||
second = indexOf(straightStr.slice(1, 6));
|
||||
if (Math.max(first, second) > -1) {
|
||||
const max = Math.max(first, second);
|
||||
return POKER_STR.slice(max, max + 5);
|
||||
}
|
||||
}
|
||||
if (straightStr.length === 7) {
|
||||
first = indexOf(straightStr.slice(0, 5));
|
||||
second = indexOf(straightStr.slice(1, 6));
|
||||
three = indexOf(straightStr.slice(2, 7));
|
||||
if (Math.max(first, second, three) > -1) {
|
||||
const max = Math.max(first, second, three);
|
||||
return POKER_STR.slice(max, max + 5);
|
||||
}
|
||||
}
|
||||
// special straight "A2345",'m' -> A
|
||||
if (straightStr.indexOf('m') > -1 && straightStr.indexOf('abcd') > -1) {
|
||||
return 'mabcd';
|
||||
}
|
||||
return '0';
|
||||
}
|
||||
|
||||
public getPokerWeight() {
|
||||
return this.pokerStyle.join('');
|
||||
}
|
||||
|
||||
public getPokerStyleName() {
|
||||
for (let i = 0; i < this.pokerStyle.length; i++) {
|
||||
if (this.pokerStyle[i] !== '0') {
|
||||
return this.styleName[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public init() {
|
||||
let i = 0;
|
||||
const isTwo = [];
|
||||
const isThree = [];
|
||||
let isFour = '0';
|
||||
let isFullHouse = '0';
|
||||
// const isStraightFlush = '0';
|
||||
let isFlush: string[] = [];
|
||||
let isRoyalFlush = '0';
|
||||
let isThreeKind = '';
|
||||
let isTowPair = '';
|
||||
let isPair = '';
|
||||
const highCard = [];
|
||||
|
||||
while (i < this.cards.length) {
|
||||
const color = this.cards[i][1];
|
||||
const num = this.cards[i][0];
|
||||
this.straightArr.push(this.cards[i][0]);
|
||||
this.flushObj[color].push(num);
|
||||
let value = this.numObj.get(num) || 0;
|
||||
value++;
|
||||
this.numObj.set(num, value);
|
||||
i++;
|
||||
}
|
||||
|
||||
// find flush
|
||||
for (const f in this.flushObj) {
|
||||
if (this.flushObj[f].length >= 5) {
|
||||
// flush is order,so flush[length - 1] is max flush card
|
||||
isFlush = this.flushObj[f];
|
||||
this.flushColor = f;
|
||||
}
|
||||
}
|
||||
|
||||
// find two,three,four
|
||||
for (const [key, value] of this.numObj) {
|
||||
// high card
|
||||
if (value === 1) {
|
||||
highCard.unshift(key);
|
||||
}
|
||||
// pairs max count 3, source is small to large
|
||||
if (value >= 2) {
|
||||
isTwo.unshift(key);
|
||||
}
|
||||
// three of kind max count 2
|
||||
if (value === 3) {
|
||||
isThree.unshift(key);
|
||||
}
|
||||
// four of kind only one
|
||||
if (value === 4) {
|
||||
isFour = key;
|
||||
}
|
||||
}
|
||||
// straight flush
|
||||
if (isFlush.length !== 0 && this.isStraight(isFlush) !== '0') {
|
||||
if (this.isStraight(isFlush) === 'ijklm') {
|
||||
isRoyalFlush = 'ijklm';
|
||||
this.pokerStyle[0] = isRoyalFlush;
|
||||
return;
|
||||
}
|
||||
this.pokerStyle[1] = this.isStraight(isFlush).split('').reverse().join('');
|
||||
return;
|
||||
}
|
||||
|
||||
// four of kind
|
||||
if (isFour !== '0') {
|
||||
isFour += highCard[0];
|
||||
this.pokerStyle[2] = isFour;
|
||||
return;
|
||||
}
|
||||
|
||||
// full house
|
||||
if (isThree.length > 0 && isTwo.length > isThree.length ||
|
||||
isThree.length === 2) {
|
||||
const maxTwoCard = isThree.length === 2 ? isThree[1] : isThree[0] ===
|
||||
isTwo[0] ? isTwo[1] : isTwo[0];
|
||||
const maxThree = isThree[0];
|
||||
isFullHouse = maxThree + maxTwoCard;
|
||||
this.pokerStyle[3] = isFullHouse;
|
||||
return;
|
||||
}
|
||||
|
||||
// flush
|
||||
if (isFlush.length !== 0) {
|
||||
isFlush.reverse().length = 5;
|
||||
this.pokerStyle[4] = isFlush.join('');
|
||||
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
|
||||
if (isTwo.length >= 2) {
|
||||
isTowPair = isTwo.join('');
|
||||
// third tow pair card big then high card
|
||||
const highCardForTowPair = isTwo[3] && isTwo[3] > highCard[0]
|
||||
? isTwo[3]
|
||||
: highCard[0];
|
||||
isTowPair += highCardForTowPair;
|
||||
this.pokerStyle[7] = isTowPair;
|
||||
return;
|
||||
}
|
||||
// pair
|
||||
if (isTwo.length === 1) {
|
||||
isPair = isTwo.join('');
|
||||
isPair += highCard[0] + highCard[1] + highCard[2];
|
||||
this.pokerStyle[8] = isPair;
|
||||
return;
|
||||
}
|
||||
// High card
|
||||
highCard.length = 5;
|
||||
this.pokerStyle[9] = highCard.join('');
|
||||
}
|
||||
public getPokerValueCard() {
|
||||
let valueStyle = '';
|
||||
let isFlush = false;
|
||||
this.pokerStyle.forEach((style, key) => {
|
||||
if (style !== '0') {
|
||||
isFlush = key === 1 || key === 4;
|
||||
valueStyle = style;
|
||||
}
|
||||
});
|
||||
const cards = this.cards.filter((card) => {
|
||||
if (isFlush) {
|
||||
return valueStyle.indexOf(card[0]) > -1 && card[1] === this.flushColor;
|
||||
}
|
||||
return valueStyle.indexOf(card[0]) > -1;
|
||||
});
|
||||
cards.reverse().length = 5;
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ const mapCard = (card: string) => {
|
||||
const cNumber = card.charCodeAt(0) - 97;
|
||||
const cColor = Number(card[1]) - 1;
|
||||
return [`${cardNumber[cNumber]}`, `${color[cColor]}`];
|
||||
}
|
||||
export { mapCard }
|
||||
};
|
||||
export { mapCard };
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export default {
|
||||
url: process.env.NODE_ENV !== 'production' ?
|
||||
process.env.NODE_ENV === 'develop' ? 'http://172.22.72.70:7001'
|
||||
: 'http://192.168.0.110:7001' : 'http://www.jojgame.com:7001',
|
||||
}
|
||||
export default {
|
||||
url: process.env.NODE_ENV !== 'production' ?
|
||||
process.env.NODE_ENV === 'develop' ? 'http://172.22.72.70:7001'
|
||||
: 'http://127.0.0.1:7001' : 'http://www.jojgame.com:7001',
|
||||
res: location.href.split('#')[0] + '#',
|
||||
};
|
||||
|
||||
+50
-18
@@ -1,19 +1,24 @@
|
||||
<template>
|
||||
<div class="home-container container">
|
||||
<div class="room-btn" v-show="showBtn">
|
||||
<div class="room-btn"
|
||||
v-show="showBtn">
|
||||
<div class="create-room btn"
|
||||
@click="createRoom"><span>create room</span>
|
||||
</div>
|
||||
<div class="btn"
|
||||
@click="joinRoom"> <span>join room</span>
|
||||
@click="joinRoom"><span>join room</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="room-number" v-show="isJoin">
|
||||
<div class="room-number"
|
||||
v-show="isJoin">
|
||||
<div class="room-input inline">
|
||||
<div class="input-bd">
|
||||
<div class="input-bd"
|
||||
:class="{error: isError}">
|
||||
<div class="input-name iconfont icon-password"></div>
|
||||
<div class="input-text">
|
||||
<input type="tel" maxlength="6"
|
||||
<input type="tel"
|
||||
maxlength="6"
|
||||
@focus="isError = false"
|
||||
v-model="roomNumber"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,11 +34,13 @@
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
import Component from 'vue-class-component';
|
||||
import service from '../service';
|
||||
|
||||
@Component
|
||||
export default class Home extends Vue {
|
||||
public roomNumber: string = '';
|
||||
private isJoin = false;
|
||||
private showBtn = true;
|
||||
private isError = false;
|
||||
|
||||
private async createRoom() {
|
||||
try {
|
||||
@@ -51,41 +58,65 @@
|
||||
this.showBtn = false;
|
||||
}
|
||||
|
||||
private go() {
|
||||
if (/^\d+$/.test(this.roomNumber)) {
|
||||
this.$router.replace({ name: 'game', params: { roomNumber: this.roomNumber } });
|
||||
private async go() {
|
||||
if (!/^\d+$/.test(this.roomNumber)) {
|
||||
this.isError = true;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { data } = await service.findRoom(this.roomNumber);
|
||||
if (data.hasRoom) {
|
||||
this.$router.replace({ name: 'game', params: { roomNumber: this.roomNumber } });
|
||||
} else {
|
||||
this.$plugin.toast('can\'t find the room');
|
||||
console.log('can\'t find the room');
|
||||
}
|
||||
} catch (e) {
|
||||
this.$plugin.toast('can\'t find the room');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
<style lang="less"
|
||||
scoped>
|
||||
.home-container {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
.room-btn{
|
||||
|
||||
.room-btn {
|
||||
flex: 1;
|
||||
.btn{
|
||||
|
||||
.btn {
|
||||
width: 50vw;
|
||||
margin:30px auto;
|
||||
margin: 30px auto;
|
||||
}
|
||||
}
|
||||
.room-number{
|
||||
|
||||
.room-number {
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
.input-bd{
|
||||
|
||||
.input-bd {
|
||||
border: 1px solid #bababa;
|
||||
border-radius: 4px;
|
||||
input{
|
||||
|
||||
input {
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
.room-btn{
|
||||
|
||||
.error {
|
||||
border: 1px solid #e8050a;
|
||||
}
|
||||
|
||||
.room-btn {
|
||||
height: 30px;
|
||||
margin-top: 0;
|
||||
span{
|
||||
|
||||
span {
|
||||
margin: 0;
|
||||
line-height: 30px;
|
||||
height: 30px;
|
||||
@@ -97,7 +128,8 @@
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.inline{
|
||||
|
||||
.inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
+74
-30
@@ -6,15 +6,16 @@
|
||||
@sit="sitDown"
|
||||
@buyIn="buyIn"
|
||||
:isPlay='isPlay'
|
||||
:valueCards = 'valueCards'
|
||||
:time = 'time'
|
||||
:valueCards='valueCards'
|
||||
:time='time'
|
||||
:winner="winner"
|
||||
:actionUserId='actionUserId'
|
||||
:hand-card="handCard"></sitList>
|
||||
<common-card
|
||||
:commonCard="commonCard"
|
||||
:valueCards = 'valueCards'
|
||||
:valueCards='valueCards'
|
||||
></common-card>
|
||||
<notice :message-list="messageList"></notice>
|
||||
<div class="winner-poke-style"
|
||||
v-show="gameOver && winner[0][0].handCard.length > 0">
|
||||
{{PokeStyle(winner[0] && winner[0][0] && winner[0][0].handCard)}} WIN!!
|
||||
@@ -90,40 +91,45 @@
|
||||
@buyIn='buyIn'></BuyIn>
|
||||
<toast :show.sync="showMsg"
|
||||
:text="msg"></toast>
|
||||
<record :players="players" v-model="showRecord"></record>
|
||||
<record :players="players"
|
||||
v-model="showRecord"></record>
|
||||
<sendMsg @send = 'sendMsgHandle'></sendMsg>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {Vue, Watch} from 'vue-property-decorator';
|
||||
import { Vue, Watch } from 'vue-property-decorator';
|
||||
import Component from 'vue-class-component';
|
||||
import io from 'socket.io-client';
|
||||
import cookie from 'js-cookie';
|
||||
import sitList from '../components/SitList.vue';
|
||||
import commonCard from '../components/CommonCard.vue';
|
||||
import {IPlayer} from '@/interface/IPlayer';
|
||||
import {ILinkNode, Link} from '@/utils/Link';
|
||||
import { IPlayer } from '@/interface/IPlayer';
|
||||
import { ILinkNode, Link } from '@/utils/Link';
|
||||
import ISit from '../interface/ISit';
|
||||
import BuyIn from '../components/BuyIn.vue';
|
||||
import range from '../components/range.vue';
|
||||
import toast from '../components/toast.vue';
|
||||
import record from '../components/record.vue';
|
||||
import notice from '../components/notice.vue';
|
||||
import sendMsg from '../components/sendMsg.vue';
|
||||
import map from '../utils/map';
|
||||
import {PokerStyle} from '@/utils/PokerStyle';
|
||||
import origin from '../utils/origin'
|
||||
import { PokerStyle } from '@/utils/PokerStyle';
|
||||
import origin from '../utils/origin';
|
||||
|
||||
export enum ECommand {
|
||||
CALL = 'call',
|
||||
CALL = 'call',
|
||||
ALL_IN = 'allin',
|
||||
RAISE = 'raise',
|
||||
CHECK = 'check',
|
||||
FOLD = 'fold',
|
||||
RAISE = 'raise',
|
||||
CHECK = 'check',
|
||||
FOLD = 'fold',
|
||||
}
|
||||
|
||||
interface IMsg {
|
||||
action: string;
|
||||
clients: string[];
|
||||
target: string;
|
||||
message?: any;
|
||||
data: any;
|
||||
}
|
||||
|
||||
@@ -136,7 +142,9 @@
|
||||
BuyIn,
|
||||
range,
|
||||
toast,
|
||||
record
|
||||
record,
|
||||
notice,
|
||||
sendMsg,
|
||||
},
|
||||
})
|
||||
export default class Game extends Vue {
|
||||
@@ -149,8 +157,9 @@
|
||||
private handCard = [];
|
||||
private commonCard = [];
|
||||
private pot = 0;
|
||||
private slidePots = [];
|
||||
private prevSize = 0;
|
||||
private isAction = false;
|
||||
// private isAction = false;
|
||||
private isRaise = false;
|
||||
private winner: IPlayer [][] = [];
|
||||
private showBuyIn = false;
|
||||
@@ -164,6 +173,7 @@
|
||||
private msg = '';
|
||||
private time = 30;
|
||||
private timeSt = 0;
|
||||
private messageList: any[] = [];
|
||||
private showRecord = false;
|
||||
private raiseSizeMap = {
|
||||
firsAction: {
|
||||
@@ -182,8 +192,9 @@
|
||||
private playerChange(players: IPlayer[]) {
|
||||
console.log('player change-------');
|
||||
this.sitList = this.sitList.map((sit: ISit) => {
|
||||
const player = players.find((p) => sit.player && p.userId === sit.player.userId && sit.player.counter > 0);
|
||||
return Object.assign({}, {}, {player, position: sit.position}) as ISit;
|
||||
const player = players.find(
|
||||
(p) => sit.player && p.userId === sit.player.userId && sit.player.counter > 0);
|
||||
return Object.assign({}, {}, { player, position: sit.position }) as ISit;
|
||||
});
|
||||
this.initSitLink();
|
||||
}
|
||||
@@ -219,6 +230,11 @@
|
||||
return this.winner.length !== 0;
|
||||
}
|
||||
|
||||
get isAction() {
|
||||
return !!(this.userInfo
|
||||
&& this.userInfo.userId === this.actionUserId)
|
||||
}
|
||||
|
||||
get valueCards() {
|
||||
if (this.gameOver && this.winner[0] && this.winner[0][0].handCard) {
|
||||
const handCards = this.winner[0][0].handCard;
|
||||
@@ -269,13 +285,18 @@
|
||||
this.pot = 0;
|
||||
this.prevSize = 0;
|
||||
this.time = 30;
|
||||
this.isAction = false;
|
||||
// this.isAction = false;
|
||||
this.isRaise = false;
|
||||
this.winner = [];
|
||||
this.showBuyIn = false;
|
||||
this.initSitLink();
|
||||
}
|
||||
|
||||
private sendMsgHandle(msgInfo: string) {
|
||||
const msg = `${this.userInfo.nickName}:${msgInfo}`;
|
||||
this.emit('broadcast', { msg });
|
||||
}
|
||||
|
||||
private showCounterRecord() {
|
||||
this.showRecord = true;
|
||||
this.showSetting = false;
|
||||
@@ -287,7 +308,7 @@
|
||||
return;
|
||||
}
|
||||
this.timeSt = setTimeout(() => {
|
||||
this.time--
|
||||
this.time--;
|
||||
this.doCountDown();
|
||||
}, 1000);
|
||||
}
|
||||
@@ -344,7 +365,7 @@
|
||||
}
|
||||
|
||||
private sitDown() {
|
||||
this.emit('sitDown', {sitList: this.sitListMap()});
|
||||
this.emit('sitDown', { sitList: this.sitListMap() });
|
||||
}
|
||||
|
||||
// private mapCard(cards: string []) {
|
||||
@@ -399,8 +420,8 @@
|
||||
if (command === 'fold') {
|
||||
clearTimeout(this.timeSt);
|
||||
}
|
||||
this.emit('action', {command});
|
||||
this.isAction = false;
|
||||
this.emit('action', { command });
|
||||
// this.isAction = false;
|
||||
this.isRaise = false;
|
||||
}
|
||||
|
||||
@@ -444,8 +465,16 @@
|
||||
this.commonCard = payload.data.commonCard;
|
||||
console.log('msg.data.currPlayer.userId', msg.data);
|
||||
this.actionUserId = payload.data.currPlayer.userId;
|
||||
this.isAction = !!(this.userInfo && this.userInfo.userId ===
|
||||
payload.data.currPlayer.userId);
|
||||
// this.isAction = !!(this.userInfo
|
||||
// && this.userInfo.userId === payload.data.currPlayer.userId);
|
||||
}
|
||||
|
||||
// room time out
|
||||
if (data.action === 'deny') {
|
||||
this.$plugin.toast('room is close');
|
||||
setTimeout(() => {
|
||||
this.$router.replace({ name: 'home' });
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -464,8 +493,9 @@
|
||||
if (msg.action === 'players') {
|
||||
this.players = msg.data.players;
|
||||
}
|
||||
if (msg.action === 'commonCard') {
|
||||
if (msg.action === 'actionComplete') {
|
||||
this.commonCard = msg.data.commonCard;
|
||||
this.slidePots = msg.data.slidePots;
|
||||
console.log('players', msg.data);
|
||||
}
|
||||
if (msg.action === 'gameInfo') {
|
||||
@@ -473,7 +503,7 @@
|
||||
this.pot = msg.data.pot || 0;
|
||||
this.prevSize = msg.data.prevSize;
|
||||
this.actionUserId = msg.data.currPlayer.userId;
|
||||
this.isAction = !!(this.userInfo && this.userInfo.userId === msg.data.currPlayer.userId);
|
||||
// this.isAction = !!(this.userInfo && this.userInfo.userId === msg.data.currPlayer.userId);
|
||||
this.sitList = msg.data.sitList;
|
||||
console.log('gameInfo', msg.data);
|
||||
console.log('handCard', this.handCard);
|
||||
@@ -484,6 +514,7 @@
|
||||
clearTimeout(this.timeSt);
|
||||
this.actionUserId = '0';
|
||||
this.winner = msg.data.winner;
|
||||
this.commonCard = msg.data.commonCard;
|
||||
const allPlayers = msg.data.allPlayers;
|
||||
allPlayers.forEach((winner: IPlayer) => {
|
||||
this.players.forEach((p) => {
|
||||
@@ -502,9 +533,18 @@
|
||||
|
||||
if (msg.action === 'pause') {
|
||||
this.players = msg.data.players;
|
||||
this.sitList = msg.data.sitList;
|
||||
console.log('players', this.players);
|
||||
this.gaming = false;
|
||||
this.init();
|
||||
}
|
||||
|
||||
if (msg.action === 'broadcast') {
|
||||
this.messageList.push({
|
||||
message: msg.message.msg || '',
|
||||
top: Math.random() * 50 + 10,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 系统事件
|
||||
@@ -526,9 +566,10 @@
|
||||
if (this.currPlayer && (!this.isPlay || !this.hasSit)) {
|
||||
this.currPlayer.counter += size;
|
||||
}
|
||||
console.log('come in buyIn ==================', size)
|
||||
console.log('come in buyIn ==================', size);
|
||||
this.showMsg = true;
|
||||
this.msg = this.hasSit && this.isPlay ? `已补充买入 ${ size }, 下局生效` : `已补充买入 ${ size }`;
|
||||
this.msg = this.hasSit && this.isPlay
|
||||
? `已补充买入 ${size},下局生效` : `已补充买入 ${size}`;
|
||||
this.emit('buyIn', {
|
||||
buyInSize: size,
|
||||
});
|
||||
@@ -597,7 +638,9 @@
|
||||
.game-container {
|
||||
background: radial-gradient(#00bf86, #006a55);
|
||||
background-size: 100% 100%;
|
||||
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
overflow: hidden;
|
||||
.winner-poke-style {
|
||||
position: absolute;
|
||||
top: 55vh;
|
||||
@@ -614,7 +657,8 @@
|
||||
left: 50%;
|
||||
transform: translate3d(-50%, -50%, 0);
|
||||
z-index: 0;
|
||||
.roomId{
|
||||
|
||||
.roomId {
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
const result = await service.login(this.userAccount, this.password);
|
||||
const { token } = result.data;
|
||||
cookie.set('token', token, {expires: 1});
|
||||
this.$router.replace({name: 'home'});
|
||||
await this.$router.push({name: 'home'});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
this.$plugin.toast('Wrong password or account.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,42 @@
|
||||
<template>
|
||||
<div class="register-container container">
|
||||
<div class="register-body">
|
||||
<div class="logo">J-POKER</div>
|
||||
<div class="title">Create Account</div>
|
||||
<div class="user-name">
|
||||
<XInput v-model='form.userAccount'
|
||||
text="account"
|
||||
@focus="removeValid('userAccount')"
|
||||
:error="errorData.indexOf('userAccount') > -1"></XInput>
|
||||
</div>
|
||||
<div class="user-name">
|
||||
<XInput v-model='form.nickName'
|
||||
text="nickName"
|
||||
@focus="removeValid('nickName')"
|
||||
:error="errorData.indexOf('nickName') > -1"></XInput>
|
||||
</div>
|
||||
<div class="password">
|
||||
<XInput v-model='form.password'
|
||||
text="password"
|
||||
type="password"
|
||||
@focus="removeValid('password')"
|
||||
:error="errorData.indexOf('password') > -1"></XInput>
|
||||
</div>
|
||||
<div class="confirm">
|
||||
<XInput v-model='form.confirm'
|
||||
text="confirm"
|
||||
type="password"
|
||||
@focus="removeValid('confirm')"
|
||||
:error="errorData.indexOf('confirm') > -1"></XInput>
|
||||
</div>
|
||||
<div class="register-btn">
|
||||
<div class="s-btn btn"><span @click="register">submit</span></div>
|
||||
</div>
|
||||
<div class="register-container container">
|
||||
<div class="register-body">
|
||||
<div class="logo">J-POKER</div>
|
||||
<div class="title">Create Account</div>
|
||||
<div class="user-name">
|
||||
<XInput v-model='form.userAccount'
|
||||
text="account"
|
||||
@focus="removeValid('userAccount')"
|
||||
:error="errorData.indexOf('userAccount') > -1"></XInput>
|
||||
</div>
|
||||
<div class="user-name">
|
||||
<XInput v-model='form.nickName'
|
||||
text="nickName"
|
||||
@focus="removeValid('nickName')"
|
||||
:error="errorData.indexOf('nickName') > -1"></XInput>
|
||||
</div>
|
||||
<div class="password">
|
||||
<XInput v-model='form.password'
|
||||
text="password"
|
||||
type="password"
|
||||
@focus="removeValid('password')"
|
||||
:error="errorData.indexOf('password') > -1"></XInput>
|
||||
</div>
|
||||
<div class="confirm">
|
||||
<XInput v-model='form.confirm'
|
||||
text="confirm"
|
||||
type="password"
|
||||
@focus="removeValid('confirm')"
|
||||
:error="errorData.indexOf('confirm') > -1"></XInput>
|
||||
</div>
|
||||
<div class="register-btn">
|
||||
<div class="s-btn btn"><span @click="register">submit</span></div>
|
||||
</div>
|
||||
<toast :show="showMsg"
|
||||
:text="msg"></toast>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import {Vue} from 'vue-property-decorator';
|
||||
import { Vue } from 'vue-property-decorator';
|
||||
import service from '../service';
|
||||
import Component from 'vue-class-component';
|
||||
import toast from '../components/toast.vue';
|
||||
@@ -56,15 +54,12 @@
|
||||
nickName: '',
|
||||
password: '',
|
||||
confirm: '',
|
||||
}
|
||||
};
|
||||
private errorData: string [] = [];
|
||||
private showMsg = false;
|
||||
private msg = '';
|
||||
|
||||
|
||||
private valid() {
|
||||
const errorArr: string[] = [];
|
||||
for (let formKey in this.form) {
|
||||
for (const formKey in this.form) {
|
||||
if (this.form[formKey] === '') {
|
||||
errorArr.push(formKey);
|
||||
}
|
||||
@@ -85,37 +80,36 @@
|
||||
try {
|
||||
this.valid();
|
||||
if (this.errorData.join('') === '') {
|
||||
const result = await service.register(this.form);
|
||||
this.msg = 'sign successful';
|
||||
this.showMsg = true;
|
||||
await service.register(this.form);
|
||||
this.$plugin.toast('sign successful');
|
||||
setTimeout(() => {
|
||||
this.$router.replace({name: 'login'});
|
||||
this.$router.replace({ name: 'login' });
|
||||
}, 2000);
|
||||
}
|
||||
} catch (e) {
|
||||
this.msg = JSON.stringify(e);
|
||||
this.showMsg = true;
|
||||
console.log(e);
|
||||
this.$plugin.toast(JSON.stringify(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.register-container{
|
||||
.register-container {
|
||||
padding: 20px;
|
||||
margin: auto;
|
||||
.logo{
|
||||
|
||||
.logo {
|
||||
text-align: left;
|
||||
margin-bottom: 10px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.title{
|
||||
|
||||
.title {
|
||||
text-align: left;
|
||||
margin-bottom: 5vh;
|
||||
}
|
||||
|
||||
.register-btn{
|
||||
.register-btn {
|
||||
width: 50vw;
|
||||
float: right;
|
||||
margin: auto;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "game-node-center",
|
||||
"name": "poke-game-server",
|
||||
"version": "1.0.0",
|
||||
"description": "node服务中心",
|
||||
"private": true,
|
||||
|
||||
Binary file not shown.
@@ -32,7 +32,7 @@ export class RoomController extends BaseController {
|
||||
const result = await this.roomService.findByRoomNumber(body.roomNumber);
|
||||
this.success({ hasRoom: result });
|
||||
} catch (e) {
|
||||
this.fail('create room error');
|
||||
this.fail('invalid room');
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,10 @@ export class UserController extends BaseController {
|
||||
@post('/')
|
||||
async index() {
|
||||
try {
|
||||
const token: string = this.ctx.get('Authorization') || '';
|
||||
const userInfo = await this.jwt.verify(token);
|
||||
const user = this.user.findByAccount(userInfo.userAccount);
|
||||
this.success(user);
|
||||
const state = this.ctx.state;
|
||||
console.log(state, 'state');
|
||||
this.success(state.user.user);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
this.fail('server error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export enum ECommand {
|
||||
}
|
||||
|
||||
export enum EPlayerType {
|
||||
DEFAULT = 'default',
|
||||
DEFAULT = '',
|
||||
DEALER = 'd',
|
||||
BIG_BLIND = 'bb',
|
||||
SMALL_BLIND = 'sb',
|
||||
|
||||
@@ -10,7 +10,7 @@ import Timeout = NodeJS.Timeout;
|
||||
interface IPokerGame {
|
||||
users: IPlayer[];
|
||||
smallBlind: number;
|
||||
updateCommonCard: () => void;
|
||||
actionRoundComplete: () => void;
|
||||
gameOverCallBack: () => void;
|
||||
autoActionCallBack: (actionType: string, userId: string) => void;
|
||||
}
|
||||
@@ -35,6 +35,7 @@ export class PokerGame {
|
||||
allPlayer: Player[] = [];
|
||||
poker = new Poker();
|
||||
pot: number;
|
||||
slidePots: number [] = [];
|
||||
status: EGameStatus;
|
||||
currPlayer: ILinkNode<Player>;
|
||||
smallBlind: number;
|
||||
@@ -44,7 +45,7 @@ export class PokerGame {
|
||||
actionTimeOut: Timeout;
|
||||
allInPlayers: Player[] = [];
|
||||
currActionAllinPlayer: Player[] = [];
|
||||
updateCommonCard: () => void;
|
||||
actionRoundComplete: () => void;
|
||||
gameOverCallBack: () => void;
|
||||
autoActionCallBack: (actionType: string, userId: string) => void;
|
||||
hasStraddle = false;
|
||||
@@ -52,7 +53,7 @@ export class PokerGame {
|
||||
|
||||
constructor(config: IPokerGame) {
|
||||
this.smallBlind = config.smallBlind;
|
||||
this.updateCommonCard = config.updateCommonCard;
|
||||
this.actionRoundComplete = config.actionRoundComplete;
|
||||
this.gameOverCallBack = config.gameOverCallBack;
|
||||
this.autoActionCallBack = config.autoActionCallBack;
|
||||
if (config.users.length < 2) {
|
||||
@@ -125,7 +126,7 @@ export class PokerGame {
|
||||
this.pot += size - this.currPlayer.node.actionSize;
|
||||
}
|
||||
if (command === ECommand.FOLD) {
|
||||
size = this.prevSize;
|
||||
// size = this.prevSize;
|
||||
this.removePlayer(this.currPlayer.node);
|
||||
// only one player,or none player,game is over
|
||||
}
|
||||
@@ -153,28 +154,42 @@ export class PokerGame {
|
||||
try {
|
||||
clearTimeout(this.actionTimeOut);
|
||||
this.currPlayer.node.action(commandString, this.prevSize);
|
||||
this.prevSize = size;
|
||||
const nextPlayer = this.currPlayer.next.node;
|
||||
// all check actionSize === -1
|
||||
// all 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
|
||||
console.log('this.currPlayer----------', this.currPlayer, nextPlayer, command);
|
||||
console.log('this.currPlayer----------', this.playerSize);
|
||||
console.log('this.currPlayer----------', this.allInPlayers);
|
||||
console.log('this.currPlayer---------- test play', this.allInPlayers);
|
||||
console.log('this.currPlayer---------- this.prevSize', this.prevSize);
|
||||
console.log('this.currPlayer---------- complete',
|
||||
nextPlayer.actionSize === this.prevSize,
|
||||
this.prevSize !== this.smallBlind * 2,
|
||||
(this.commonCard.length === 0
|
||||
&& nextPlayer.actionSize === this.smallBlind * 2
|
||||
&& (this.currPlayer.node.type === EPlayerType.BIG_BLIND
|
||||
|| (this.allPlayer.length === 2 && this.currPlayer.node.type === EPlayerType.DEALER))
|
||||
&& (command === ECommand.CHECK || command === ECommand.FOLD)));
|
||||
|
||||
if (this.playerSize === 0
|
||||
|| this.playerSize === 1 && this.currActionAllinPlayer.length === 0
|
||||
|| (nextPlayer.actionSize === size)
|
||||
|| (nextPlayer.actionSize === this.prevSize
|
||||
&& (nextPlayer.actionSize === size || command === ECommand.FOLD)
|
||||
&& this.prevSize !== this.smallBlind * 2 && this.prevSize !== 0)
|
||||
|| (this.commonCard.length === 0
|
||||
&& (nextPlayer.actionSize === this.smallBlind * 2 && this.prevSize === nextPlayer.actionSize)
|
||||
&& (this.currPlayer.node.type === EPlayerType.BIG_BLIND
|
||||
|| this.playerSize === 2 && this.currPlayer.node.type === EPlayerType.DEALER)
|
||||
|| (this.allPlayer.length === 2 && this.currPlayer.node.type === EPlayerType.DEALER))
|
||||
&& (command === ECommand.CHECK || command === ECommand.FOLD))) {
|
||||
// console.log('ccc------', this.currPlayer, nextPlayer, command, this.playerSize);
|
||||
console.log('actionComplete');
|
||||
this.actionComplete();
|
||||
return;
|
||||
}
|
||||
this.prevSize = command === ECommand.FOLD ? this.prevSize : size;
|
||||
this.currPlayer = this.currPlayer.next;
|
||||
// action time is 60s
|
||||
console.log('action auto');
|
||||
@@ -197,25 +212,26 @@ export class PokerGame {
|
||||
}
|
||||
|
||||
private actionComplete() {
|
||||
// pre flop
|
||||
if (this.commonCard.length === 0
|
||||
&& this.currPlayer.node.actionSize === this.smallBlind * 2
|
||||
&& this.currPlayer.node.type !== EPlayerType.BIG_BLIND) {
|
||||
if (this.currPlayer.next) {
|
||||
this.currPlayer = this.currPlayer.next;
|
||||
} else {
|
||||
throw 'currPlayer.next is null';
|
||||
}
|
||||
if (this.playerSize > 1) {
|
||||
this.actionTimeOut = setTimeout(() => {
|
||||
const actionType = 'fold';
|
||||
const userId = this.currPlayer.node.userId;
|
||||
this.action(actionType);
|
||||
this.autoActionCallBack(actionType, userId);
|
||||
}, ACTION_TIME);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// // pre flop
|
||||
// if (this.commonCard.length === 0
|
||||
// && this.currPlayer.node.actionSize === this.smallBlind * 2
|
||||
// && this.currPlayer.node.type !== EPlayerType.BIG_BLIND) {
|
||||
// if (this.currPlayer.next) {
|
||||
// this.currPlayer = this.currPlayer.next;
|
||||
// } else {
|
||||
// throw 'currPlayer.next is null';
|
||||
// }
|
||||
// console.log('come in test---------ets');
|
||||
// if (this.playerSize > 1) {
|
||||
// this.actionTimeOut = setTimeout(() => {
|
||||
// const actionType = 'fold';
|
||||
// const userId = this.currPlayer.node.userId;
|
||||
// this.action(actionType);
|
||||
// this.autoActionCallBack(actionType, userId);
|
||||
// }, ACTION_TIME);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// action has allin, sum the allin player ev_pot
|
||||
if (this.currActionAllinPlayer.length !== 0) {
|
||||
let currAllinPlayerPot = 0;
|
||||
@@ -231,8 +247,17 @@ export class PokerGame {
|
||||
allinPlayer.evPot = this.prevPot + currAllinPlayerPot;
|
||||
currAllinPlayerPot = 0;
|
||||
});
|
||||
console.log('currActionAllinPlayer--------------------', this.allInPlayers, this.currActionAllinPlayer);
|
||||
this.allInPlayers = [ ...this.allInPlayers, ...this.currActionAllinPlayer ];
|
||||
this.allInPlayers.sort((prev, next) => prev.evPot - next.evPot);
|
||||
console.log('currActionAllinPlayer--------------------', this.allInPlayers, this.currActionAllinPlayer);
|
||||
// slide pot
|
||||
this.allInPlayers.forEach((p, key) => {
|
||||
if (key === 0) {
|
||||
this.slidePots.push(p.evPot);
|
||||
} else {
|
||||
this.slidePots.push(p.evPot - this.allInPlayers[key - 1].evPot);
|
||||
}
|
||||
});
|
||||
}
|
||||
// action complete clear player actionSize = 0
|
||||
this.clearPlayerAction();
|
||||
@@ -240,13 +265,28 @@ export class PokerGame {
|
||||
this.prevSize = 0;
|
||||
this.prevPot = this.pot;
|
||||
// new action ring first action is sb
|
||||
this.currPlayer = this.playerLink.getNode(1);
|
||||
this.currPlayer = this.getFirstActionPlayer();
|
||||
this.setSate();
|
||||
console.log(this.playerSize, 'playerS-------3', this.playerLink);
|
||||
if (this.status === EGameStatus.GAME_SHOWDOWN || this.playerSize <= 1) {
|
||||
this.gameOver();
|
||||
setTimeout(() => {
|
||||
this.gameOver();
|
||||
}, 300);
|
||||
}
|
||||
this.updateCommonCard();
|
||||
this.actionRoundComplete();
|
||||
}
|
||||
getFirstActionPlayer() {
|
||||
const player = this.allPlayer.filter(p => p.counter > 0
|
||||
&& p.position !== 0 && p.actionCommand !== 'fold')[0];
|
||||
console.log('getFirstActionPlayer-------player', player);
|
||||
let link: ILinkNode<Player> | null = this.playerLink.link;
|
||||
for (let i = 0; i < this.playerSize; i++) {
|
||||
if (link?.node.userId === player?.userId) {
|
||||
return link;
|
||||
}
|
||||
link = link?.next as ILinkNode<Player>;
|
||||
}
|
||||
return link;
|
||||
}
|
||||
setSate() {
|
||||
if (this.status === EGameStatus.GAME_ACTION) {
|
||||
@@ -347,6 +387,14 @@ export class PokerGame {
|
||||
});
|
||||
}
|
||||
|
||||
public clearPlayer() {
|
||||
this.allPlayer.forEach(player => {
|
||||
player.type = '';
|
||||
player.actionSize = 0;
|
||||
player.actionCommand = '';
|
||||
});
|
||||
}
|
||||
|
||||
removePlayer(currPlayer: Player) {
|
||||
let playerLink = this.playerLink.link;
|
||||
let player: ILinkNode<Player>;
|
||||
@@ -459,6 +507,7 @@ export class PokerGame {
|
||||
this.getWinner();
|
||||
// todo counting
|
||||
this.counting();
|
||||
this.clearPlayer();
|
||||
this.gameOverCallBack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,27 +50,33 @@ class GameController extends BaseSocketController {
|
||||
roomInfo.game = new PokerGame({
|
||||
users: sitDownPlayer,
|
||||
smallBlind: 1,
|
||||
updateCommonCard: () => {
|
||||
actionRoundComplete: () => {
|
||||
let slidePots: number [] = [];
|
||||
if (roomInfo.game) {
|
||||
console.log('come in', roomInfo.game.status);
|
||||
if (roomInfo.game.status < 6) {
|
||||
if (roomInfo.game.status < 6 && roomInfo.game.playerSize > 1) {
|
||||
roomInfo.game.sendCard();
|
||||
roomInfo.game.startActionRound();
|
||||
// has allin,deal slide pot
|
||||
if (roomInfo.game.allInPlayers.length > 0) {
|
||||
slidePots = roomInfo.game.slidePots;
|
||||
}
|
||||
this.nsp.adapter.clients([ this.roomNumber ],
|
||||
(err: any, clients: any) => {
|
||||
if (roomInfo.game) {
|
||||
// 更新common card
|
||||
this.nsp.to(this.roomNumber).emit('online', {
|
||||
clients,
|
||||
action: 'actionComplete',
|
||||
target: 'participator',
|
||||
data: {
|
||||
slidePots,
|
||||
commonCard: roomInfo.game.commonCard,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.nsp.adapter.clients([ this.roomNumber ],
|
||||
(err: any, clients: any) => {
|
||||
if (roomInfo.game) {
|
||||
// 更新common card
|
||||
this.nsp.to(this.roomNumber).emit('online', {
|
||||
clients,
|
||||
action: 'commonCard',
|
||||
target: 'participator',
|
||||
data: {
|
||||
commonCard: roomInfo.game.commonCard,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {
|
||||
@@ -84,9 +90,16 @@ class GameController extends BaseSocketController {
|
||||
(s: ISit) => s.player?.userId === gamePlayer.userId);
|
||||
if (player && sit) {
|
||||
player.counter = gamePlayer.counter;
|
||||
player.actionCommand = '';
|
||||
player.actionSize = 0;
|
||||
player.type = '';
|
||||
sit.player.counter = gamePlayer.counter;
|
||||
sit.player.actionCommand = '';
|
||||
sit.player.actionSize = 0;
|
||||
sit.player.type = '';
|
||||
}
|
||||
});
|
||||
console.log('allPlayer =================== game over', roomInfo.game.allPlayer);
|
||||
}
|
||||
this.nsp.adapter.clients([ this.roomNumber ],
|
||||
(err: any, clients: any) => {
|
||||
@@ -112,13 +125,14 @@ class GameController extends BaseSocketController {
|
||||
data: {
|
||||
winner,
|
||||
allPlayers,
|
||||
commonCard: roomInfo.game.commonCard,
|
||||
},
|
||||
});
|
||||
}
|
||||
// new game
|
||||
setTimeout(() => {
|
||||
this.reStart();
|
||||
}, 8000);
|
||||
}, 10000);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -126,13 +140,20 @@ class GameController extends BaseSocketController {
|
||||
// fold change status: -1
|
||||
if (command === 'fold') {
|
||||
console.log('cccc', command, userId);
|
||||
console.log('roomInfo', roomInfo.players);
|
||||
roomInfo.players.forEach(p => {
|
||||
if (p.userId === userId) {
|
||||
p.status = -1;
|
||||
}
|
||||
});
|
||||
console.log('roomInfo', roomInfo.players);
|
||||
roomInfo.sit.forEach((s: ISit) => {
|
||||
if (s.player && s.player.userId === userId) {
|
||||
delete s.player;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// todo notice next player action
|
||||
await this.updateGameInfo();
|
||||
console.log('auto Action');
|
||||
@@ -165,7 +186,11 @@ class GameController extends BaseSocketController {
|
||||
async reStart() {
|
||||
try {
|
||||
const roomInfo: IRoomInfo = await this.getRoomInfo();
|
||||
const dealer = roomInfo.sitLink?.next?.node;
|
||||
const dealer = roomInfo.game?.allPlayer.filter(gamePlayer => {
|
||||
return !!roomInfo.sit.find(s => s.player?.userId === gamePlayer.userId
|
||||
&& s.player.counter > 0 && s.player?.userId !== roomInfo.sitLink?.node.userId);
|
||||
})[0];
|
||||
console.log('dealer -------', dealer);
|
||||
roomInfo.game = null;
|
||||
// init player status
|
||||
roomInfo.players.forEach(p => {
|
||||
@@ -193,10 +218,10 @@ class GameController extends BaseSocketController {
|
||||
});
|
||||
const players = roomInfo.sit.filter(s => s.player && s.player.counter > 0)
|
||||
.map(s => s.player) || [];
|
||||
let link: ILinkNode<IPlayer> | null = new Link<IPlayer>(players).link;
|
||||
if (players.length >= 2) {
|
||||
// init sit link
|
||||
console.log(players, 'players===========');
|
||||
let link: ILinkNode<IPlayer> | null = new Link<IPlayer>(players).link;
|
||||
while (link?.node.userId !== dealer?.userId) {
|
||||
link = link?.next || null;
|
||||
}
|
||||
@@ -218,8 +243,6 @@ class GameController extends BaseSocketController {
|
||||
roomInfo.sitLink = null;
|
||||
console.log('come in only one player');
|
||||
// player not enough
|
||||
// await this.updateGameInfo();
|
||||
// new game
|
||||
this.nsp.adapter.clients([ this.roomNumber ],
|
||||
async (err: any, clients: any) => {
|
||||
// 广播信息
|
||||
@@ -229,6 +252,7 @@ class GameController extends BaseSocketController {
|
||||
target: 'participator',
|
||||
data: {
|
||||
players: roomInfo.players,
|
||||
sitList: roomInfo.sit,
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -246,7 +270,7 @@ class GameController extends BaseSocketController {
|
||||
const { buyInSize } = payload;
|
||||
const player = roomInfo.players.find(
|
||||
(p: IPlayer) => p.userId === userInfo.userId);
|
||||
console.log(userInfo, 'userInfo------');
|
||||
console.log(userInfo, 'userInfo------', player);
|
||||
const isGaming = !!roomInfo.game;
|
||||
if (player) {
|
||||
if (roomInfo.game) {
|
||||
@@ -256,6 +280,7 @@ class GameController extends BaseSocketController {
|
||||
if (inTheGame) {
|
||||
player.reBuy += Number(buyInSize);
|
||||
player.buyIn += Number(buyInSize);
|
||||
console.log('come in');
|
||||
}
|
||||
} else {
|
||||
player.buyIn += Number(buyInSize);
|
||||
@@ -269,6 +294,7 @@ class GameController extends BaseSocketController {
|
||||
};
|
||||
roomInfo.players.push(player);
|
||||
}
|
||||
console.log(player, 'buy in player', roomInfo.players);
|
||||
if (!isGaming) {
|
||||
this.nsp.adapter.clients([ this.roomNumber ],
|
||||
(err: any, clients: any) => {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { Context, EggAppConfig } from 'egg';
|
||||
export default function elkLogger(options: EggAppConfig['elkLogger']): any {
|
||||
return async (ctx: Context, next: () => Promise<any>) => {
|
||||
const { match, enable } = options;
|
||||
console.log('jwt', ctx.jwt);
|
||||
// 是否符合配置规则
|
||||
if (match(ctx) && enable) {
|
||||
ctx.setLogCollection('fetchStart', Date.now());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export enum ResultCode {
|
||||
SUCCESS = '000000',
|
||||
FAILD = '100000',
|
||||
UNAUTH = '999999',
|
||||
FAIL = '100000',
|
||||
ONT_AUTH = '999999',
|
||||
}
|
||||
|
||||
export interface IResult {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { inject, Context } from 'midway';
|
||||
// import { IRequestBody } from '../interface/IRequestBody';
|
||||
import { IResult, ResultCode } from '../interface/IResult';
|
||||
|
||||
export default class BaseController {
|
||||
@@ -37,7 +36,7 @@ export default class BaseController {
|
||||
*/
|
||||
public fail(message: string) {
|
||||
const result: IResult = {
|
||||
code: ResultCode.FAILD,
|
||||
code: ResultCode.FAIL,
|
||||
data: {},
|
||||
message,
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class BaseSocketController extends Controller {
|
||||
roomInfo.players.forEach(p => {
|
||||
const currPlayer = roomInfo.game &&
|
||||
roomInfo.game.getPlayers().find(player => player.userId === p.userId);
|
||||
p.counter = currPlayer?.counter || 0;
|
||||
p.counter = currPlayer?.counter || p.counter;
|
||||
p.type = currPlayer?.type || '';
|
||||
p.status = currPlayer ? 1 : p.status === -1 ? -1 : 0;
|
||||
p.actionCommand = currPlayer && currPlayer.actionCommand || '';
|
||||
@@ -44,7 +44,7 @@ export default class BaseSocketController extends Controller {
|
||||
players: roomInfo.players.map(p => {
|
||||
const currPlayer = roomInfo.game?.allPlayer.find(player => player.userId === p.userId);
|
||||
return Object.assign({}, {
|
||||
counter: currPlayer?.counter || 0,
|
||||
counter: currPlayer?.counter || p.counter,
|
||||
actionSize: currPlayer?.actionSize || 0,
|
||||
actionCommand: currPlayer?.actionCommand || '',
|
||||
nickName: p.nickName,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PokerGame, EGameStatus } from '../../../src/app/core/PokerGame';
|
||||
import { PokerGame } from '../../../src/app/core/PokerGame';
|
||||
// @ts-ignore
|
||||
import { expect } from 'chai';
|
||||
import { IPlayer } from '../../../src/app/core/Player';
|
||||
@@ -7,7 +7,7 @@ describe('test/app/core/pokerGame.test.ts', () => {
|
||||
const users: IPlayer[] = [
|
||||
{
|
||||
userId: '1',
|
||||
counter: 200,
|
||||
counter: 1000,
|
||||
nickName: '1',
|
||||
account: '1',
|
||||
socketId: '1',
|
||||
@@ -20,7 +20,7 @@ describe('test/app/core/pokerGame.test.ts', () => {
|
||||
},
|
||||
{
|
||||
userId: '2',
|
||||
counter: 400,
|
||||
counter: 200,
|
||||
nickName: '2',
|
||||
account: '2',
|
||||
socketId: '2',
|
||||
@@ -31,291 +31,310 @@ describe('test/app/core/pokerGame.test.ts', () => {
|
||||
status: 0,
|
||||
type: '',
|
||||
},
|
||||
// {
|
||||
// userId: '3',
|
||||
// counter: 50,
|
||||
// nick_name: '3',
|
||||
// account: '3',
|
||||
// socketId: '3',
|
||||
// },
|
||||
{
|
||||
userId: '3',
|
||||
counter: 1000,
|
||||
nickName: '3',
|
||||
account: '3',
|
||||
socketId: '3',
|
||||
buyIn: 0,
|
||||
reBuy: 0,
|
||||
actionSize: 0,
|
||||
actionCommand: '',
|
||||
status: 0,
|
||||
type: '',
|
||||
},
|
||||
{
|
||||
userId: '4',
|
||||
counter: 1000,
|
||||
nickName: '4',
|
||||
account: '4',
|
||||
socketId: '4',
|
||||
buyIn: 0,
|
||||
reBuy: 0,
|
||||
actionSize: 0,
|
||||
actionCommand: '',
|
||||
status: 0,
|
||||
type: '',
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* game ready
|
||||
*/
|
||||
it('game init', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
expect(game.status).to.equal(EGameStatus.GAME_ACTION);
|
||||
expect(game.pot).to.equal(3);
|
||||
expect(game.pot).to.equal(3);
|
||||
// expect(game.playerLink.getNode(1).node.actionSize).to.equal(1);
|
||||
});
|
||||
// it('game init', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {},
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// expect(game.status).to.equal(EGameStatus.GAME_ACTION);
|
||||
// expect(game.pot).to.equal(3);
|
||||
// expect(game.pot).to.equal(3);
|
||||
// // expect(game.playerLink.getNode(1).node.actionSize).to.equal(1);
|
||||
// });
|
||||
|
||||
/**
|
||||
* game playing
|
||||
*/
|
||||
it('game play', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
game.action('raise:9');
|
||||
game.action('call');
|
||||
// game.action('call');
|
||||
// game.action('call');
|
||||
// game.action('call');
|
||||
// game.action('check');
|
||||
// game.sendCard();
|
||||
// game.action('raise:10');
|
||||
// game.action('raise:20');
|
||||
// game.action('call');
|
||||
// game.action('call');
|
||||
// game.action('raise:40');
|
||||
// game.action('call');
|
||||
// game.action('call');
|
||||
// game.action('call');
|
||||
// game.action('call');
|
||||
// game.sendCard();
|
||||
// game.action('allin');
|
||||
// game.action('allin');
|
||||
// game.action('allin');
|
||||
// game.action('fold');
|
||||
// game.action('allin');
|
||||
// console.log('cc');
|
||||
// // game.action('raise:10');
|
||||
// console.log(game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
});
|
||||
|
||||
it('raise check ', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
game.action('raise:9');
|
||||
game.action('call');
|
||||
game.action('check');
|
||||
game.action('check');
|
||||
// game.action('raise:10');
|
||||
// console.log(game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
});
|
||||
|
||||
it('raise call raise fold ', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
game.action('raise:9');
|
||||
game.action('call');
|
||||
// game.action('check');
|
||||
// game.action('check');
|
||||
game.action('raise:90');
|
||||
game.action('fold');
|
||||
// game.action('raise:10');
|
||||
// console.log(game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
});
|
||||
|
||||
it('show down', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
// pre flop
|
||||
game.action('raise:9');
|
||||
game.action('call');
|
||||
// flop
|
||||
game.action('raise:90');
|
||||
game.action('call');
|
||||
// turn
|
||||
game.action('check');
|
||||
game.action('check');
|
||||
// river
|
||||
game.action('raise:90');
|
||||
game.action('call');
|
||||
// show down
|
||||
// game.action('raise:10');
|
||||
// console.log(game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
});
|
||||
|
||||
it('all player allin for pre flop', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
// pre flop
|
||||
game.action('raise:9');
|
||||
game.action('allin');
|
||||
game.action('allin');
|
||||
// game over
|
||||
// game.action('raise:10');
|
||||
// console.log('all player ------commonCard', game.commonCard);
|
||||
// console.log('all player ------pot', game.pot);
|
||||
// console.log('all player ------getPlayers', game.getPlayers());
|
||||
// console.log('all player ------winner', game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
});
|
||||
|
||||
// it('game play', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {},
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// game.action('fold');
|
||||
// });
|
||||
//
|
||||
// it('raise check ', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {
|
||||
// if (game.status < 6) {
|
||||
// game.startActionRound();
|
||||
// game.sendCard();
|
||||
// }
|
||||
// },
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// game.action('raise:9');
|
||||
// game.action('call');
|
||||
// game.action('check');
|
||||
// game.action('check');
|
||||
// // game.action('raise:10');
|
||||
// // console.log(game.commonCard);
|
||||
// // console.log(game.pot);
|
||||
// // console.log(game.getPlayers());
|
||||
// // console.log(game.winner);
|
||||
// // console.log(game.winner[0][0], game.commonCard);
|
||||
// });
|
||||
//
|
||||
// it('raise call raise fold ', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {
|
||||
// if (game.status < 6) {
|
||||
// game.startActionRound();
|
||||
// game.sendCard();
|
||||
// }
|
||||
// },
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// game.action('raise:9');
|
||||
// game.action('call');
|
||||
// // game.action('check');
|
||||
// // game.action('check');
|
||||
// game.action('raise:90');
|
||||
// game.action('fold');
|
||||
// // game.action('raise:10');
|
||||
// // console.log(game.commonCard);
|
||||
// // console.log(game.pot);
|
||||
// // console.log(game.getPlayers());
|
||||
// // console.log(game.winner);
|
||||
// // console.log(game.winner[0][0], game.commonCard);
|
||||
// });
|
||||
//
|
||||
// it('show down', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {
|
||||
// if (game.status < 6) {
|
||||
// game.startActionRound();
|
||||
// game.sendCard();
|
||||
// }
|
||||
// },
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// // pre flop
|
||||
// game.action('raise:9');
|
||||
// game.action('call');
|
||||
// // flop
|
||||
// game.action('raise:90');
|
||||
// game.action('call');
|
||||
// // turn
|
||||
// game.action('check');
|
||||
// game.action('check');
|
||||
// // river
|
||||
// game.action('raise:90');
|
||||
// game.action('call');
|
||||
// // show down
|
||||
// // game.action('raise:10');
|
||||
// // console.log(game.commonCard);
|
||||
// // console.log(game.pot);
|
||||
// // console.log(game.getPlayers());
|
||||
// // console.log(game.winner);
|
||||
// // console.log(game.winner[0][0], game.commonCard);
|
||||
// });
|
||||
//
|
||||
// it('all player allin for pre flop', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {
|
||||
// if (game.status < 6) {
|
||||
// game.startActionRound();
|
||||
// game.sendCard();
|
||||
// }
|
||||
// },
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// // pre flop
|
||||
// game.action('raise:9');
|
||||
// game.action('allin');
|
||||
// game.action('allin');
|
||||
// // game over
|
||||
// // game.action('raise:10');
|
||||
// // console.log('all player ------commonCard', game.commonCard);
|
||||
// // console.log('all player ------pot', game.pot);
|
||||
// // console.log('all player ------getPlayers', game.getPlayers());
|
||||
// // console.log('all player ------winner', game.winner);
|
||||
// // console.log(game.winner[0][0], game.commonCard);
|
||||
// });
|
||||
//
|
||||
it('one player allin', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
actionRoundComplete: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
autoActionCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
// pre flop
|
||||
game.action('raise:9');
|
||||
game.action('call');
|
||||
// game.action('raise: 9');
|
||||
// game.action('raise: 18');
|
||||
// game.action('raise: 200');
|
||||
// game.action('allin');
|
||||
console.log('curr----------------------------1', game.currPlayer);
|
||||
game.action('call'); // utg 1000
|
||||
console.log('curr----------------------------2', game.currPlayer);
|
||||
game.action('call'); // d 100
|
||||
game.action('call'); // sb
|
||||
game.action('check'); // bb
|
||||
game.action('check'); // sb
|
||||
game.action('raise:10'); // utg
|
||||
game.action('call'); // d
|
||||
game.action('call'); // sb
|
||||
game.action('fold'); // bb
|
||||
// // console.log('curr----------------------------3', game.currPlayer);
|
||||
// game.action('check'); // BB 200
|
||||
// game.action('check'); // utg
|
||||
// game.action('raise:20'); // d
|
||||
// game.action('call'); // sb
|
||||
// game.action('fold'); // bb
|
||||
// game.action('fold'); // utg
|
||||
// game.action('allin'); // sb
|
||||
|
||||
// console.log('curr----------------------------4', game.currPlayer);
|
||||
// game.action('raise:20'); // bb 1000
|
||||
// console.log('curr----------------------------1', game.currPlayer);
|
||||
// game.action('call'); // utg
|
||||
// game.action('fold'); // sb
|
||||
// game.action('call'); // bb
|
||||
// game over
|
||||
// game.action('raise:10');
|
||||
// console.log(game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
console.log(game.commonCard);
|
||||
console.log(game.slidePots, 'slidePots');
|
||||
console.log(game.getPlayers());
|
||||
console.log(game.winner);
|
||||
});
|
||||
|
||||
it('player fold pre flop', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
// pre flop
|
||||
game.action('fold');
|
||||
// game over
|
||||
// game.action('raise:10');
|
||||
// console.log(game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// console.log(game.winner[0][0], game.commonCard);
|
||||
});
|
||||
// flop
|
||||
// turn
|
||||
// river
|
||||
// chip in
|
||||
// has Allin need separate pot
|
||||
// many allin
|
||||
|
||||
/**
|
||||
* game over
|
||||
*/
|
||||
it('game over', async () => {
|
||||
const game = new PokerGame({
|
||||
smallBlind: 1,
|
||||
users,
|
||||
updateCommonCard: () => {
|
||||
if (game.status < 6) {
|
||||
game.startActionRound();
|
||||
game.sendCard();
|
||||
}
|
||||
},
|
||||
gameOverCallBack: () => {},
|
||||
});
|
||||
game.play();
|
||||
game.action('raise:10');
|
||||
game.action('allin');
|
||||
game.action('fold');
|
||||
|
||||
// console.log('game over----------- common', game.commonCard);
|
||||
// console.log(game.pot);
|
||||
// console.log(game.getPlayers());
|
||||
// console.log(game.winner);
|
||||
// only one player
|
||||
// last player, other player fold
|
||||
|
||||
// multiple player
|
||||
// last player, has all in player
|
||||
// all player all in
|
||||
// one player all in
|
||||
// many player all in
|
||||
|
||||
// winner
|
||||
// one winner
|
||||
// multiple winner
|
||||
// bisecting pot
|
||||
// allin player winner and small pot, multiple second winner bisecting pot
|
||||
// allin player winner and small pot, one second winner
|
||||
// all player allin, winner can't win all pot,
|
||||
});
|
||||
/**
|
||||
* count
|
||||
*/
|
||||
it('count', async () => {
|
||||
|
||||
});
|
||||
// has other pot
|
||||
//
|
||||
// it('player fold pre flop', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {
|
||||
// if (game.status < 6) {
|
||||
// game.startActionRound();
|
||||
// game.sendCard();
|
||||
// }
|
||||
// },
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// // pre flop
|
||||
// game.action('fold');
|
||||
// // game over
|
||||
// // game.action('raise:10');
|
||||
// // console.log(game.commonCard);
|
||||
// // console.log(game.pot);
|
||||
// // console.log(game.getPlayers());
|
||||
// // console.log(game.winner);
|
||||
// // console.log(game.winner[0][0], game.commonCard);
|
||||
// });
|
||||
// // flop
|
||||
// // turn
|
||||
// // river
|
||||
// // chip in
|
||||
// // has Allin need separate pot
|
||||
// // many allin
|
||||
//
|
||||
// /**
|
||||
// * game over
|
||||
// */
|
||||
// it('game over', async () => {
|
||||
// const game = new PokerGame({
|
||||
// smallBlind: 1,
|
||||
// users,
|
||||
// actionRoundComplete: () => {
|
||||
// if (game.status < 6) {
|
||||
// game.startActionRound();
|
||||
// game.sendCard();
|
||||
// }
|
||||
// },
|
||||
// gameOverCallBack: () => {},
|
||||
// autoActionCallBack: () => {},
|
||||
// });
|
||||
// game.play();
|
||||
// game.action('raise:10');
|
||||
// game.action('allin');
|
||||
// game.action('fold');
|
||||
//
|
||||
// // console.log('game over----------- common', game.commonCard);
|
||||
// // console.log(game.pot);
|
||||
// // console.log(game.getPlayers());
|
||||
// // console.log(game.winner);
|
||||
// // only one player
|
||||
// // last player, other player fold
|
||||
//
|
||||
// // multiple player
|
||||
// // last player, has all in player
|
||||
// // all player all in
|
||||
// // one player all in
|
||||
// // many player all in
|
||||
//
|
||||
// // winner
|
||||
// // one winner
|
||||
// // multiple winner
|
||||
// // bisecting pot
|
||||
// // allin player winner and small pot, multiple second winner bisecting pot
|
||||
// // allin player winner and small pot, one second winner
|
||||
// // all player allin, winner can't win all pot,
|
||||
// });
|
||||
// /**
|
||||
// * count
|
||||
// */
|
||||
// it('count', async () => {
|
||||
//
|
||||
// });
|
||||
// // has other pot
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user