细节调整

This commit is contained in:
kron
2025-07-11 22:21:34 +08:00
parent 81c064ba8b
commit e0807eb06a
14 changed files with 98 additions and 57 deletions

View File

@@ -225,6 +225,10 @@ async function onReceiveMessage(messages = []) {
tips.value = "请在90秒内射完12支箭";
seq.value += 1;
}
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
}
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
start.value = true;
@@ -273,11 +277,6 @@ async function onReceiveMessage(messages = []) {
msg.target
);
}
} else {
roundResults.value.push({
redArrows: isRed ? [msg.target] : [],
blueArrows: isRed ? [] : [msg.target],
});
}
}
if (room.value.battleType === 2) {
@@ -299,7 +298,13 @@ async function onReceiveMessage(messages = []) {
redPoints.value += result.redScore;
// roundResults.value = result.roundResults;
currentRound.value = result.currentRound + 1;
if (result.currentRound < 5) showRoundTip.value = true;
if (result.currentRound < 5) {
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
showRoundTip.value = true;
}
}
}
if (msg.constructor === MESSAGETYPES.FinalShoot) {
@@ -378,13 +383,19 @@ onUnmounted(() => {
<image src="../static/1v1-bg.png" mode="widthFix" />
<view>
<view class="player" :style="{ transform: 'translateY(-60px)' }">
<image :src="owner.avatar" mode="widthFix" />
<image
:src="owner.avatar || '../static/user-icon.png'"
mode="widthFix"
/>
<text>{{ owner.name }}</text>
</view>
<image src="../static/versus.png" mode="widthFix" />
<block v-if="opponent.id">
<view class="player" :style="{ transform: 'translateY(60px)' }">
<image :src="opponent.avatar" mode="widthFix" />
<image
:src="opponent.avatar || '../static/user-icon.png'"
mode="widthFix"
/>
<text v-if="opponent.name">{{ opponent.name }}</text>
</view>
</block>

View File

@@ -45,7 +45,9 @@ const createPractise = async (arrows) => {
async function onReceiveMessage(messages = []) {
messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
if (scores.value.length < total) {
scores.value.push(msg.target);
}
power.value = msg.target.battery;
// if (step.value === 2 && msg.target.dst / 100 > 5) {
// if (step.value === 2 && msg.target.dst > 5) {

View File

@@ -134,7 +134,7 @@ const backToHome = () => {
<image src="../static/bind-success.png" mode="widthFix" />
<view>
<image
:src="user.avatar"
:src="user.avatar || '../static/user-icon.png'"
mode="widthFix"
:style="{ borderRadius: '50%' }"
/>
@@ -162,7 +162,7 @@ const backToHome = () => {
<image src="../static/bind.png" mode="widthFix" />
<view>
<image
:src="user.avatar"
:src="user.avatar || '../static/user-icon.png'"
mode="widthFix"
:style="{ borderRadius: '50%' }"
/>

View File

@@ -59,7 +59,7 @@ const onPractiseLoading = async (page) => {
<Container title="我的成长脚印" overflow="hidden">
<view class="tabs">
<view
v-for="(rankType, index) in ['排位赛', '好友约战', '馆练习']"
v-for="(rankType, index) in ['排位赛', '好友约战', '馆练习']"
:key="index"
:style="{
color: index === selectedIndex ? '#000' : '#fff',

View File

@@ -36,10 +36,12 @@ const onReady = async () => {
async function onReceiveMessage(messages = []) {
messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
currentRound.value += 1;
if (currentRound.value === 4) {
currentRound.value = 1;
if (scores.value.length < total) {
scores.value.push(msg.target);
currentRound.value += 1;
if (currentRound.value === 4) {
currentRound.value = 1;
}
}
power.value = msg.target.battery;
}
@@ -125,5 +127,4 @@ onUnmounted(() => {
</Container>
</template>
<style scoped>
</style>
<style scoped></style>

View File

@@ -20,7 +20,6 @@ const { updateUser } = store;
const start = ref(false);
const scores = ref([]);
const total = 36;
const currentRound = ref(0);
const practiseResult = ref({});
const power = ref(0);
const practiseId = ref("");
@@ -28,7 +27,6 @@ const practiseId = ref("");
const onReady = async () => {
const result = await createPractiseAPI(total);
if (result) practiseId.value = result.id;
currentRound.value = 0;
scores.value = [];
start.value = true;
};
@@ -36,9 +34,10 @@ const onReady = async () => {
async function onReceiveMessage(messages = []) {
messages.forEach((msg) => {
if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
if (scores.value.length < total) {
scores.value.push(msg.target);
}
power.value = msg.target.battery;
currentRound.value += 1;
}
if (msg.constructor === MESSAGETYPES.ShootSyncMePracticeID) {
if (practiseId.value && practiseId.value === msg.practice.id) {
@@ -70,7 +69,6 @@ async function onComplete() {
practiseResult.value = {};
start.value = false;
scores.value = [];
currentRound.value = 0;
}
}
@@ -90,7 +88,7 @@ onUnmounted(() => {
<block v-if="start || practiseResult.arrows">
<ShootProgress
:start="start"
:tips="`请连续射${total}支`"
:tips="`请连续射${total}支`"
:total="120"
/>
<view class="user-row">
@@ -100,7 +98,6 @@ onUnmounted(() => {
<BowTarget
:start="start"
:totalRound="start ? total : 0"
:currentRound="currentRound"
:scores="scores"
/>
<ScorePanel
@@ -130,5 +127,4 @@ onUnmounted(() => {
</Container>
</template>
<style scoped>
</style>
<style scoped></style>

View File

@@ -117,6 +117,10 @@ async function onReceiveMessage(messages = []) {
timerSeq.value = 0;
scores.value = [];
totalRounds.value = msg.groupUserStatus.config.maxRounds;
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
}
if (msg.constructor === MESSAGETYPES.ToSomeoneShoot) {
if (currentShooterId.value !== msg.userId) {
@@ -149,11 +153,6 @@ async function onReceiveMessage(messages = []) {
msg.target
);
}
} else {
roundResults.value.push({
redArrows: isRed ? [msg.target] : [],
blueArrows: isRed ? [] : [msg.target],
});
}
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
@@ -167,7 +166,13 @@ async function onReceiveMessage(messages = []) {
redPoints.value += result.redScore;
// roundResults.value = result.roundResults;
currentRound.value = result.currentRound + 1;
if (result.currentRound < 5) showRoundTip.value = true;
if (result.currentRound < 5) {
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
showRoundTip.value = true;
}
}
if (msg.constructor === MESSAGETYPES.FinalShoot) {
if (!isFinalShoot.value) {