细节修改
This commit is contained in:
@@ -44,7 +44,6 @@ const sound = ref(true);
|
|||||||
const currentSound = ref("");
|
const currentSound = ref("");
|
||||||
const currentRound = ref(props.currentRound);
|
const currentRound = ref(props.currentRound);
|
||||||
const currentRoundEnded = ref(!props.battleId);
|
const currentRoundEnded = ref(!props.battleId);
|
||||||
const halfTimeTip = ref(false);
|
|
||||||
const ended = ref(false);
|
const ended = ref(false);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -143,11 +142,10 @@ async function onReceiveMessage(messages = []) {
|
|||||||
} else if (msg.constructor === MESSAGETYPES.AllReady) {
|
} else if (msg.constructor === MESSAGETYPES.AllReady) {
|
||||||
audioManager.play("比赛开始");
|
audioManager.play("比赛开始");
|
||||||
} else if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
} else if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||||
if (!halfTimeTip.value) audioManager.play("比赛开始");
|
audioManager.play("比赛开始");
|
||||||
} else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
|
} else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
|
||||||
currentRoundEnded.value = true;
|
currentRoundEnded.value = true;
|
||||||
} else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
} else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||||
halfTimeTip.value = true;
|
|
||||||
audioManager.play("中场休息");
|
audioManager.play("中场休息");
|
||||||
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
|
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||||
audioManager.play("比赛结束");
|
audioManager.play("比赛结束");
|
||||||
|
|||||||
@@ -88,3 +88,75 @@ export const directionAdjusts = {
|
|||||||
AdjustUpperRight: "向右上方调瞄",
|
AdjustUpperRight: "向右上方调瞄",
|
||||||
AdjustRight: "向右侧调瞄",
|
AdjustRight: "向右侧调瞄",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getBattleResultTips = (
|
||||||
|
gameMode,
|
||||||
|
mode,
|
||||||
|
{ rank = 0, score = 0, win = false }
|
||||||
|
) => {
|
||||||
|
const getRandomIndex = (len) => Math.floor(Math.random() * len);
|
||||||
|
if (gameMode === 1) {
|
||||||
|
if (mode === 1) {
|
||||||
|
if (win) {
|
||||||
|
const tests = [
|
||||||
|
"你是朋友中的佼佼者哟!",
|
||||||
|
"你成功击败好友,成为大赢家!",
|
||||||
|
"你将好友“一举拿下”,超神无疑!",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(3)];
|
||||||
|
} else {
|
||||||
|
const tests = [
|
||||||
|
"失误啦失误啦,再多来几局吧~",
|
||||||
|
"惜败好友,下次再战定能反超!",
|
||||||
|
"友谊第一,下场胜利属于你!",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(3)];
|
||||||
|
}
|
||||||
|
} else if (mode === 2) {
|
||||||
|
if (score > 0) {
|
||||||
|
const tests = [
|
||||||
|
"王者一定属于你!",
|
||||||
|
"高光时刻!继续保持!",
|
||||||
|
"射灵世界的佼佼者!",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(3)];
|
||||||
|
} else {
|
||||||
|
const tests = [
|
||||||
|
"再来一次,定能脱颖而出!",
|
||||||
|
"加强练习,争取越战越勇",
|
||||||
|
"人生走过的每一步都算数",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(3)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (gameMode === 2) {
|
||||||
|
if (mode === 1) {
|
||||||
|
if (win) {
|
||||||
|
const tests = [
|
||||||
|
"你已经奔跑在通向王者的路上了!",
|
||||||
|
"射灵星球最闪耀的前进者!",
|
||||||
|
"赞!你真是越战越勇",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(3)];
|
||||||
|
} else {
|
||||||
|
const tests = [
|
||||||
|
"失败是成功之母,儿子在等你!",
|
||||||
|
"人生得意须尽欢,不过此关心不甘!",
|
||||||
|
"这回一定是打开方式不对。再来!",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(3)];
|
||||||
|
}
|
||||||
|
} else if (mode === 2) {
|
||||||
|
if (rank <= 3) {
|
||||||
|
const tests = [
|
||||||
|
"好成绩!全国排位赛等着你!",
|
||||||
|
"持续练习,就会迎来更多高光时刻!",
|
||||||
|
];
|
||||||
|
return tests[getRandomIndex(2)];
|
||||||
|
} else {
|
||||||
|
return "每日练习打卡,争取下次脱颖而出!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ref, onMounted } from "vue";
|
|||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
import { getGameAPI, getHomeData } from "@/apis";
|
import { getGameAPI, getHomeData } from "@/apis";
|
||||||
import { topThreeColors } from "@/constants";
|
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
@@ -13,6 +13,7 @@ const { updateUser, getLvlName } = store;
|
|||||||
const ifWin = ref(false);
|
const ifWin = ref(false);
|
||||||
const data = ref({});
|
const data = ref({});
|
||||||
const totalPoints = ref(0);
|
const totalPoints = ref(0);
|
||||||
|
const rank = ref(0);
|
||||||
|
|
||||||
// onLoad(async (options) => {
|
// onLoad(async (options) => {
|
||||||
// battleId.value = options.battleId;
|
// battleId.value = options.battleId;
|
||||||
@@ -40,9 +41,11 @@ function exit() {
|
|||||||
}
|
}
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const battleInfo = uni.getStorageSync("last-battle");
|
const battleInfo = uni.getStorageSync("last-battle");
|
||||||
console.log("----battleInfo", battleInfo);
|
// console.log("----battleInfo", battleInfo);
|
||||||
data.value = battleInfo;
|
data.value = battleInfo;
|
||||||
const mine = battleInfo.playerStats.find((p) => p.id === user.value.id);
|
const mine = battleInfo.playerStats.find((p) => p.id === user.value.id);
|
||||||
|
rank.value =
|
||||||
|
battleInfo.playerStats.findIndex((p) => p.id === user.value.id) + 1;
|
||||||
if (mine) {
|
if (mine) {
|
||||||
if (battleInfo.mode === 1) {
|
if (battleInfo.mode === 1) {
|
||||||
totalPoints.value = mine.roundStats.reduce(
|
totalPoints.value = mine.roundStats.reduce(
|
||||||
@@ -172,12 +175,15 @@ const checkBowData = () => {
|
|||||||
积分 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
|
积分 {{ totalPoints > 0 ? "+" + totalPoints : totalPoints }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<text v-if="data.mode === 1" class="description">{{
|
<text class="description">
|
||||||
ifWin ? "你已经奔跑在通向王者的路上了!" : "失败是成功之母,儿子在等你!"
|
{{
|
||||||
}}</text>
|
getBattleResultTips(data.battleMode, data.mode, {
|
||||||
<text v-if="data.mode === 2" class="description"
|
win: ifWin,
|
||||||
>好成绩!全国排位赛等着你!</text
|
score: totalPoints,
|
||||||
>
|
rank,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
<view class="op-btn">
|
<view class="op-btn">
|
||||||
<view @click="checkBowData">查看靶纸</view>
|
<view @click="checkBowData">查看靶纸</view>
|
||||||
<view @click="exit">退出</view>
|
<view @click="exit">退出</view>
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ onLoad(async (options) => {
|
|||||||
if (battleInfo) {
|
if (battleInfo) {
|
||||||
battleId.value = battleInfo.id;
|
battleId.value = battleInfo.id;
|
||||||
start.value = true;
|
start.value = true;
|
||||||
|
startCount.value = true;
|
||||||
tips.value = "请连续射出6支箭";
|
tips.value = "请连续射出6支箭";
|
||||||
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
players.value = [...battleInfo.blueTeam, ...battleInfo.redTeam];
|
||||||
players.value.forEach((p) => {
|
players.value.forEach((p) => {
|
||||||
@@ -72,11 +73,8 @@ onLoad(async (options) => {
|
|||||||
}, 300);
|
}, 300);
|
||||||
} else if (remain > 90 && remain <= 110) {
|
} else if (remain > 90 && remain <= 110) {
|
||||||
halfTimeTip.value = true;
|
halfTimeTip.value = true;
|
||||||
total.value = 20;
|
startCount.value = false;
|
||||||
tips.value = "准备下半场";
|
tips.value = "准备下半场";
|
||||||
setTimeout(() => {
|
|
||||||
uni.$emit("update-ramain", 110 - remain);
|
|
||||||
}, 300);
|
|
||||||
} else if (remain > 110) {
|
} else if (remain > 110) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.$emit("update-ramain", remain - 110);
|
uni.$emit("update-ramain", remain - 110);
|
||||||
@@ -135,7 +133,6 @@ async function onReceiveMessage(messages = []) {
|
|||||||
timerSeq.value = 0;
|
timerSeq.value = 0;
|
||||||
tips.value = "请连续射出6支箭";
|
tips.value = "请连续射出6支箭";
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
total.value = 90;
|
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||||
if (msg.userId === user.value.id) {
|
if (msg.userId === user.value.id) {
|
||||||
@@ -147,7 +144,6 @@ async function onReceiveMessage(messages = []) {
|
|||||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||||
startCount.value = false;
|
startCount.value = false;
|
||||||
halfTimeTip.value = true;
|
halfTimeTip.value = true;
|
||||||
total.value = 20;
|
|
||||||
tips.value = "准备下半场";
|
tips.value = "准备下半场";
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||||
@@ -210,7 +206,7 @@ onUnmounted(() => {
|
|||||||
:currentRound="scores.length"
|
:currentRound="scores.length"
|
||||||
:totalRound="start ? 12 : 0"
|
:totalRound="start ? 12 : 0"
|
||||||
:scores="scores"
|
:scores="scores"
|
||||||
:stop="halfTimeTip && !startCount"
|
:stop="!startCount"
|
||||||
/>
|
/>
|
||||||
<view :style="{ paddingBottom: '20px' }">
|
<view :style="{ paddingBottom: '20px' }">
|
||||||
<PlayerScore
|
<PlayerScore
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ onHide(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Container title="排行赛">
|
<Container title="排位赛">
|
||||||
<view class="container" @click="() => (showSeasonList = false)">
|
<view class="container" @click="() => (showSeasonList = false)">
|
||||||
<view class="ranking-my-data" v-if="user.id">
|
<view class="ranking-my-data" v-if="user.id">
|
||||||
<view>
|
<view>
|
||||||
|
|||||||
Reference in New Issue
Block a user