细节调整

This commit is contained in:
kron
2025-06-17 19:35:21 +08:00
parent 28e3d49e57
commit ab8aa08a35
5 changed files with 55 additions and 44 deletions

View File

@@ -38,6 +38,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
showE: {
type: Boolean,
default: true,
},
}); });
const showRoundTips = ref(false); const showRoundTips = ref(false);
@@ -84,7 +88,7 @@ function calcRealY(num) {
</view> </view>
<view class="target"> <view class="target">
<view <view
v-if="scores.length && showRoundTips && showLatestArrow" v-if="scores.length && showRoundTips && showLatestArrow && showE"
class="e-value fade-in" class="e-value fade-in"
>经验 +1</view >经验 +1</view
> >
@@ -93,9 +97,9 @@ function calcRealY(num) {
class="round-tip fade-in" class="round-tip fade-in"
>{{ scores[scores.length - 1].ring }}<text></text></view >{{ scores[scores.length - 1].ring }}<text></text></view
> >
<block v-for="(bow, index) in scores" :key="index">
<image <image
v-for="(bow, index) in scores" v-if="bow.ring > 0"
:key="index"
:src=" :src="
index === scores.length - 1 && !blueScores.length && showLatestArrow index === scores.length - 1 && !blueScores.length && showLatestArrow
? '../static/hit-icon-green.png' ? '../static/hit-icon-green.png'
@@ -111,9 +115,10 @@ function calcRealY(num) {
top: calcRealY(bow.y), top: calcRealY(bow.y),
}" }"
/> />
</block>
<block v-for="(bow, index) in blueScores" :key="index">
<image <image
v-for="(bow, index) in blueScores" v-if="bow.ring > 0"
:key="index"
src="../static/hit-icon-blue.png" src="../static/hit-icon-blue.png"
class="hit" class="hit"
:style="{ :style="{
@@ -121,6 +126,8 @@ function calcRealY(num) {
top: calcRealY(bow.y), top: calcRealY(bow.y),
}" }"
/> />
</block>
<image src="../static/bow-target.png" mode="widthFix" /> <image src="../static/bow-target.png" mode="widthFix" />
</view> </view>
<view v-if="avatar" class="footer"> <view v-if="avatar" class="footer">

View File

@@ -36,20 +36,17 @@ onLoad((options) => {
teamSize.value = options.teamSize; teamSize.value = options.teamSize;
}); });
async function startMatch() { async function startMatch() {
if (gameType.value && teamSize.value) {
await matchGameAPI(true, gameType.value, teamSize.value); await matchGameAPI(true, gameType.value, teamSize.value);
startMatch.value = true; matching.value = true;
}
} }
async function stopMatch() { async function stopMatch() {
if (gameType.value && teamSize.value) {
await matchGameAPI(false, gameType.value, teamSize.value); await matchGameAPI(false, gameType.value, teamSize.value);
startMatch.value = false; matching.value = false;
}
} }
async function readyToGo() { async function readyToGo() {
if (battleId.value) { if (battleId.value) {
await readyGameAPI(battleId.value); await readyGameAPI(battleId.value);
scores.value = [];
start.value = true; start.value = true;
timerSeq.value = 0; timerSeq.value = 0;
} }
@@ -118,7 +115,7 @@ onUnmounted(() => {
<Container title="大乱斗排位赛" :bgType="1"> <Container title="大乱斗排位赛" :bgType="1">
<view class="container"> <view class="container">
<BattleHeader v-if="!start && players.length" :players="players" /> <BattleHeader v-if="!start && players.length" :players="players" />
<Guide noBg v-if="!start"> <Guide noBg v-if="!start && matching">
<view :style="{ display: 'flex', justifyContent: 'space-between' }"> <view :style="{ display: 'flex', justifyContent: 'space-between' }">
<view :style="{ display: 'flex', flexDirection: 'column' }"> <view :style="{ display: 'flex', flexDirection: 'column' }">
<text :style="{ color: '#fed847' }">请预先射几箭测试</text> <text :style="{ color: '#fed847' }">请预先射几箭测试</text>
@@ -128,13 +125,15 @@ onUnmounted(() => {
</view> </view>
</Guide> </Guide>
<ShootProgress v-if="start" :seq="seq" :start="start" :tips="tips" /> <ShootProgress v-if="start" :seq="seq" :start="start" :tips="tips" />
<view class="infos"> <view v-if="start" class="infos">
<Avatar :src="user.avatar" :size="35" /> <Avatar :src="user.avatar" :size="35" />
<BowPower :power="power" /> <BowPower :power="power" />
</view> </view>
<BowTarget <BowTarget
v-if="matching"
:showE="start"
:currentRound="scores.length" :currentRound="scores.length"
:totalRound="12" :totalRound="start ? 12 : 0"
:scores="scores" :scores="scores"
/> />
<PlayerScore <PlayerScore

View File

@@ -25,6 +25,7 @@ const power = ref(0);
const onReady = async () => { const onReady = async () => {
await createPractiseAPI(total); await createPractiseAPI(total);
start.value = true; start.value = true;
currentRound.value = 0;
scores.value = []; scores.value = [];
}; };
@@ -82,7 +83,7 @@ onUnmounted(() => {
<BowPower :power="power" /> <BowPower :power="power" />
</view> </view>
<BowTarget <BowTarget
:totalRound="total / 4" :totalRound="start ? total / 4 : 0"
:currentRound="currentRound" :currentRound="currentRound"
:scores="scores" :scores="scores"
:tips=" :tips="

View File

@@ -18,12 +18,14 @@ const start = ref(false);
const showScore = ref(false); const showScore = ref(false);
const scores = ref([]); const scores = ref([]);
const total = 36; const total = 36;
const currentRound = ref(0);
const practiseResult = ref({}); const practiseResult = ref({});
const power = ref(0); const power = ref(0);
const onReady = async () => { const onReady = async () => {
await createPractiseAPI(total); await createPractiseAPI(total);
start.value = true; start.value = true;
currentRound.value = 0;
scores.value = []; scores.value = [];
}; };
@@ -33,6 +35,7 @@ async function onReceiveMessage(content) {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) { if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target); scores.value.push(msg.target);
power.value = msg.target.battery; power.value = msg.target.battery;
currentRound.value += 1;
if (scores.value.length === total) { if (scores.value.length === total) {
showScore.value = true; showScore.value = true;
} }
@@ -73,8 +76,8 @@ onUnmounted(() => {
<BowPower :power="power" /> <BowPower :power="power" />
</view> </view>
<BowTarget <BowTarget
:totalRound="total" :totalRound="start ? total : 0"
:currentRound="scores.length + 1" :currentRound="currentRound"
:scores="scores" :scores="scores"
:tips=" :tips="
!start && scores.length > 0 !start && scores.length > 0

View File

@@ -146,7 +146,7 @@ onUnmounted(() => {
:redTeam="redTeam" :redTeam="redTeam"
:blueTeam="blueTeam" :blueTeam="blueTeam"
/> />
<Guide noBg v-if="!start"> <Guide noBg v-if="!start && startMatch.value">
<view :style="{ display: 'flex', justifyContent: 'space-between' }"> <view :style="{ display: 'flex', justifyContent: 'space-between' }">
<view :style="{ display: 'flex', flexDirection: 'column' }"> <view :style="{ display: 'flex', flexDirection: 'column' }">
<text :style="{ color: '#fed847' }">请预先射几箭测试</text> <text :style="{ color: '#fed847' }">请预先射几箭测试</text>
@@ -163,6 +163,7 @@ onUnmounted(() => {
:redTeam="redTeam" :redTeam="redTeam"
/> />
<BowTarget <BowTarget
v-if="startMatch.value"
:showE="start && user.id === currentShooterId" :showE="start && user.id === currentShooterId"
:power="start ? power : 0" :power="start ? power : 0"
:currentRound="currentRound" :currentRound="currentRound"