This commit is contained in:
wzdwc
2021-03-17 08:45:34 +08:00
parent 8fed10a4a7
commit f16496605c
15 changed files with 233 additions and 152 deletions
+24 -23
View File
@@ -16,15 +16,10 @@
<div class="raise-size">
<div class="not-allin"
v-show="showActionBtn('raise')">
<i v-for="size in raiseSizeMap.firsAction"
@click="raise(size)"
v-show="isPreFlop && pot === 3">
{{Math.floor(size * prevSize)}}
</i>
<i v-for="size in raiseSizeMap.other"
<i v-for="size in raiseSizeMap"
@click="raise(size)"
v-show="showActionSize(size)"
> {{Math.floor(size * pot)}}</i>
> {{Math.floor(size)}}</i>
<!-- <i @click="raise(pot)">{{pot}}</i>-->
<!-- <i @click="raise(pot * 2)">{{2*pot}}</i>-->
</div>
@@ -85,18 +80,18 @@ import { IPlayer } from '@/interface/IPlayer';
private playClick = false;
private playRaise = false;
private playFold = false;
private raiseSizeMap = {
firsAction: {
two: 2,
three: 3,
four: 4,
},
other: {
oneThirdPot: 0.5,
halfPot: 0.75,
pot: 1,
},
};
// private raiseSizeMap = {
// firsAction: {
// two: 2,
// three: 3,
// four: 4,
// },
// other: {
// oneThirdPot: 0.5,
// halfPot: 0.75,
// pot: 1,
// },
// };
@Watch('isAction')
private wAction(val: boolean) {
@@ -111,13 +106,20 @@ import { IPlayer } from '@/interface/IPlayer';
this.raiseSize = val > this.currPlayer.counter ? this.currPlayer.counter : val;
}
get raiseSizeMap() {
let size = this.pot > this.baseSize * 4 ? this.pot : this.baseSize * 2;
if (this.prevSize > 1) {
size = this.prevSize * 4;
}
return size === this.baseSize * 2 ? [ size, 2 * size, 3 * size ] : [ 0.5 * size, 0.75 * size, size ];
}
get canActionSize() {
return Number(this.currPlayer && this.currPlayer.counter + this.currPlayer.actionSize);
}
private raise(size: number) {
const realSize = size === 0 ? this.prevSize * 3 : size * this.pot;
this.action(`raise:${Math.floor(realSize)}`);
this.action(`raise:${Math.floor(size)}`);
}
private action(command: string) {
@@ -137,9 +139,8 @@ import { IPlayer } from '@/interface/IPlayer';
}
private showActionSize(multiple: number) {
// big then double pre-size and small then counter
return this.currPlayer
&& this.currPlayer.counter > Math.floor(multiple * this.pot)
&& this.currPlayer.counter > Math.floor(multiple)
&& this.prevSize * 2 <= Math.floor(multiple * this.pot)
&& this.baseSize * 2 <= Math.floor(multiple * this.pot);
}
+90 -80
View File
@@ -1,80 +1,90 @@
<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>
<template>
<div class="send-msg-container">
<msgList :msgList ='msgList' :show="showMsgList"></msgList>
<div class="send-msg-body">
<div class="msg-name iconfont icon-msg" @click="showMsgList = !showMsgList"></div>
<div class="msg-input">
<input type="text"
@keyup.13="send"
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';
import msgList from '@/components/msgList.vue';
@Component({
components: {
msgList,
},
})
export default class SendMsg extends Vue {
private msg: string = '';
private showMsgList: boolean = false;
@Prop({ type: Number, default: 1000 }) private max!: number;
@Prop() private msgList!: 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 -1
View File
@@ -78,7 +78,7 @@
</div>
<BuyIn :showBuyIn.sync="showBuyIn"
:min="0"
:max="roomConfig.smallBlind * 1000"
:max="roomConfig.smallBlind * 2000"
@buyIn='buyIn'></BuyIn>
</div>
</template>
+39
View File
@@ -0,0 +1,39 @@
<template >
<div class="list-container" v-show="show">
<ul>
<li v-for="msg in msgList">{{msg.message}}</li>
</ul>
</div>
</template>
<script lang="ts">
import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
@Component
export default class MsgList extends Vue {
@Prop() private msgList!: string [];
@Prop({ type: Boolean, default: false }) private show!: boolean;
}
</script>
<style lang="less" rel="stylesheet/less">
.list-container{
background: #f5f5f5;
position: absolute;
bottom: 45px;
padding: 10px 0;
ul{
height: 100px;
width: 100vw;
box-sizing: border-box;
overflow-y: auto;
padding: 0 12px;
li{
list-style: none;
line-height: 20px;
text-align: left;
font-size: 12px;
color: #2f2f2f;
}
}
}
</style>
+4 -19
View File
@@ -1,19 +1,4 @@
enum PlayerType {
READY,
SIT_DOWN,
GAMING,
}
export interface IPlayer {
counter: number;
nickName: string;
actionSize: number;
actionCommand: string;
type: string;
userId?: number;
handCard?: string[];
buyIn: number;
status: number;
income?: number;
isSit: boolean;
}
export interface IMsgList {
msg: string;
}
+2 -1
View File
@@ -268,10 +268,11 @@ export class PokerStyle implements IPokerStyle {
// tow pair
if (isTwo.length >= 2) {
const towPair = isTwo;
const threeTowPair = towPair[2] || '';
towPair.length = 2;
isTowPair = towPair.join('');
// third tow pair card big then high card
const highCardForTowPair = isTwo[3] && isTwo[3] > highCard[0] ? isTwo[3] : highCard[0];
const highCardForTowPair = threeTowPair > highCard[0] ? threeTowPair : highCard[0];
isTowPair += highCardForTowPair;
this.pokerStyle[7] = isTowPair;
return;
+12 -2
View File
@@ -50,13 +50,13 @@
</div>
<BuyIn :showBuyIn.sync='showBuyIn'
:min='0'
:max='baseSize * 1000'
:max='baseSize * 2000'
@buyIn='buyIn'></BuyIn>
<toast :show.sync="showMsg"
:text="msg"></toast>
<record :players="players"
v-model="showRecord"></record>
<sendMsg @send = 'sendMsgHandle'></sendMsg>
<sendMsg @send = 'sendMsgHandle' :msg-list="msgListReverse"></sendMsg>
<iAudio :play="playIncome" type="income"></iAudio>
<gameRecord v-model="showCommandRecord"
:game-list="gameList"
@@ -185,6 +185,11 @@
this.doCountDown();
}
get msgListReverse() {
const msg = JSON.parse(JSON.stringify(this.messageList));
return msg.reverse();
}
get isPlay() {
return this.gaming || this.pot !== 0;
}
@@ -481,6 +486,11 @@
}
}
private standUp() {
// player in the game
if (this.currPlayer && this.currPlayer.status === 1) {
this.$plugin.toast('sorry, please fold you hand!');
return;
}
this.emit('standUp');
this.showSetting = false;
}