add sound switch

This commit is contained in:
wuzhidewuchi@gmail.com
2022-10-18 22:17:06 +08:00
parent f4ae932984
commit 8328a259f6
5 changed files with 88 additions and 42 deletions
+24 -12
View File
@@ -26,7 +26,11 @@
</component>
<component name="ChangeListManager">
<list default="true" id="f9039135-aa11-4abd-ad74-f40c84e4fdb2" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/server/src/app/controller/foo.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/Action.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Action.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/components/Audio.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/components/Audio.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/views/game.vue" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/views/game.vue" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -137,7 +141,13 @@
<workItem from="1619848860699" duration="11720000" />
<workItem from="1622876620759" duration="234000" />
<workItem from="1625991704189" duration="1640000" />
<workItem from="1626598050251" duration="893000" />
<workItem from="1626598050251" duration="1027000" />
<workItem from="1628481482390" duration="13548000" />
<workItem from="1628783520074" duration="2544000" />
<workItem from="1629517950448" duration="175000" />
<workItem from="1629903360315" duration="5734000" />
<workItem from="1647001315115" duration="2876000" />
<workItem from="1665892838491" duration="4505000" />
</task>
<servers />
</component>
@@ -179,19 +189,21 @@
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="100" y="123" width="1240" height="622" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1616905008870">
<screen x="0" y="23" width="1440" height="822" />
<state x="100" y="100" width="1240" height="700" key="DiffContextDialog" timestamp="1647002209329">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="100" y="123" width="1240" height="622" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.23.1440.822@0.23.1440.822" timestamp="1616905008870" />
<state x="385" y="173" width="670" height="672" key="search.everywhere.popup" timestamp="1616902799000">
<screen x="0" y="23" width="1440" height="822" />
<state x="100" y="100" width="1240" height="700" key="DiffContextDialog/0.0.1440.900@0.0.1440.900" timestamp="1647002209329" />
<state x="528" y="156" key="RollbackChangesDialog" timestamp="1647068368012">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="385" y="173" width="670" height="672" key="search.everywhere.popup/0.23.1440.822@0.23.1440.822" timestamp="1616902799000" />
<state x="385" y="173" width="670" height="673" key="search.everywhere.popup/0.23.1440.823@0.23.1440.823" timestamp="1616837414379" />
<state x="450" y="359" key="vcs.readOnlyHandler.ReadOnlyStatusDialog" timestamp="1616873123947">
<screen x="0" y="23" width="1440" height="822" />
<state x="528" y="156" key="RollbackChangesDialog/0.0.1440.900@0.0.1440.900" timestamp="1647068368012" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1647068977589">
<screen x="0" y="25" width="1440" height="814" />
</state>
<state x="450" y="359" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.23.1440.822@0.23.1440.822" timestamp="1616873123947" />
<state x="450" y="360" key="vcs.readOnlyHandler.ReadOnlyStatusDialog/0.23.1440.825@0.23.1440.825" timestamp="1616839505918" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.25.1440.814@0.25.1440.814" timestamp="1647068977589" />
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup" timestamp="1647067452212">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup/0.0.1440.900@0.0.1440.900" timestamp="1647067452212" />
</component>
</project>
+12 -12
View File
@@ -20,8 +20,6 @@
@click="raise(size)"
v-show="showActionSize(size)"
> {{Math.floor(size)}}</i>
<!-- <i @click="raise(pot)">{{pot}}</i>-->
<!-- <i @click="raise(pot * 2)">{{2*pot}}</i>-->
</div>
</div>
<div class="action-other-size"
@@ -46,9 +44,11 @@
<div class="shadow"
@click="isRaise = false"></div>
</div>
<iAudio :play="playClick" type="click"></iAudio>
<iAudio :play="playFold" type="fold"></iAudio>
<iAudio :play="playRaise" type="raise"></iAudio>
<div>
<iAudio :play="playClick && audioStatus" type="click"></iAudio>
<iAudio :play="playFold && audioStatus" type="fold"></iAudio>
<iAudio :play="playRaise && audioStatus" type="raise"></iAudio>
</div>
</div>
</div>
</template>
@@ -73,6 +73,7 @@ import { IPlayer } from '@/interface/IPlayer';
@Prop() private isPreFlop!: boolean;
@Prop() private isTwoPlayer!: boolean;
@Prop() private currPlayer!: IPlayer;
@Prop() private audioStatus?: boolean;
private isRaise = false;
private raiseSize: number = 0;
@@ -123,16 +124,15 @@ import { IPlayer } from '@/interface/IPlayer';
}
private action(command: string) {
// if (command.indexOf('raise') > -1 || command === 'allin' || command === 'call' ) {
// this.playRaise = true;
// }
// if (command === 'fold' || command === 'check') {
// this.playFold = true;
// }
if (command.indexOf('raise') > -1 || command === 'allin' || command === 'call' ) {
this.playRaise = true;
}
if (command === 'fold' || command === 'check') {
this.playFold = true;
}
if (!this.actioned) {
this.actioned = true;
this.$emit('action', command);
// this.isAction = false;
this.isRaise = false;
this.actioned = false;
}
+16 -12
View File
@@ -1,17 +1,21 @@
<template>
<div class="audio-container">
<!-- <audio ref="click" controls>-->
<!-- <source src="../assets/mp3/click.mp3" type="audio/mpeg">-->
<!-- Your browser does not support the audio element.-->
<!-- </audio>-->
<!-- <audio ref="raise" controls>-->
<!-- <source src="../assets/mp3/raise.mp3" type="audio/mpeg">-->
<!-- Your browser does not support the audio element.-->
<!-- </audio>-->
<!-- <audio ref="fold" controls>-->
<!-- <source src="../assets/mp3/fold.mp3" type="audio/mpeg">-->
<!-- Your browser does not support the audio element.-->
<!-- </audio>-->
<audio ref="click" controls>
<source src="../assets/mp3/click.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio ref="raise" controls>
<source src="../assets/mp3/raise.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio ref="fold" controls>
<source src="../assets/mp3/fold.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio ref="income" controls>
<source src="../assets/mp3/income.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
</template>
+13 -6
View File
@@ -36,6 +36,7 @@
:min-action-size="minActionSize"
:is-two-player="gamePlayers.length === 2"
:pot="pot"
:audio-status="audioStatus"
:prev-size="prevSize"
@action = 'action'
></actionDialog>
@@ -47,6 +48,7 @@
<i @click="showBuyInDialog()">buy in</i>
<i @click="standUp()">stand Up</i>
<i @click="showCounterRecord">counter record</i>
<i @click="closeAudio()">audio ({{`${audioStatus ? 'open' : 'close'}`}})</i>
</div>
</div>
<BuyIn :showBuyIn.sync='showBuyIn'
@@ -58,7 +60,7 @@
<record :players="players"
v-model="showRecord"></record>
<sendMsg @send = 'sendMsgHandle' :msg-list="msgListReverse"></sendMsg>
<!-- <iAudio :play="playIncome" type="income"></iAudio>-->
<iAudio :play="playIncome && audioStatus" type="income" ></iAudio>
<gameRecord v-model="showCommandRecord"
:game-list="gameList"
@getRecord = "getRecord"
@@ -145,7 +147,7 @@
private actionUserId = '';
private showAllin = false;
private showMsg = false;
// private playIncome = false;
private playIncome = false;
private msg = '';
private time = ACTION_TIME;
private timeSt = 0;
@@ -154,6 +156,7 @@
private showCommandRecord = false;
private gameList: IGameRecord [] = [];
private currGameIndex = 0;
private audioStatus = true;
private roomConfig: IRoom = {
isShort: false,
smallBlind: 1,
@@ -441,10 +444,10 @@
});
});
// income music
// this.playIncome = true;
// setTimeout(() => {
// this.playIncome = false;
// }, 1000);
this.playIncome = true;
setTimeout(() => {
this.playIncome = false;
}, 1000);
}
if (msg.action === 'newGame') {
@@ -522,6 +525,10 @@
this.showSetting = false;
}
private closeAudio() {
this.audioStatus = !this.audioStatus
}
private play() {
if (this.players.length >= 2) {
this.gaming = true;
+23
View File
@@ -0,0 +1,23 @@
function convertBase( numberString, fromBase, toBase ) {
let numberToTen = toTen(numberString, fromBase)
let str = ''
while (numberToTen) {
let toNumber = numberToTen % toBase.base
str += toBase.map[toNumber]
numberToTen = Math.floor(numberToTen / toBase.base)
}
return str
}
function toTen(numberString, fromBase) {
let baseMap = fromBase.map.split('')
let numberArr = numberString.split('')
let sum = 0
for (let i = 0; i <= numberArr.length - 1; i++) {
let currNumber = numberArr[i]
let baseIndex = baseMap.findIndex(b => b === currNumber)
sum += ((baseIndex + 1) * fromBase.base ** (numberArr.length - 1 - i))
}
return sum
}