添加升级显示
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { ref, onMounted } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import UserUpgrade from "@/components/UserUpgrade.vue";
|
||||
import { getGameAPI, getHomeData } from "@/apis";
|
||||
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||
import useStore from "@/store";
|
||||
@@ -14,6 +15,7 @@ const ifWin = ref(false);
|
||||
const data = ref({});
|
||||
const totalPoints = ref(0);
|
||||
const rank = ref(0);
|
||||
const showUpgrade = ref(false);
|
||||
|
||||
// onLoad(async (options) => {
|
||||
// battleId.value = options.battleId;
|
||||
@@ -181,6 +183,11 @@ const checkBowData = () => {
|
||||
<view @click="checkBowData">查看靶纸</view>
|
||||
<view @click="exit">退出</view>
|
||||
</view>
|
||||
<UserUpgrade
|
||||
:show="showUpgrade"
|
||||
:onClose="() => (showUpgrade = false)"
|
||||
:lvl="data.lvl"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ watch(
|
||||
onLoad(async (options) => {
|
||||
if (options.battleId) {
|
||||
const battleInfo = uni.getStorageSync("current-battle");
|
||||
console.log("----battleInfo", battleInfo);
|
||||
// console.log("----battleInfo", battleInfo);
|
||||
if (battleInfo) {
|
||||
battleId.value = battleInfo.id;
|
||||
battleType.value = battleInfo.config.mode;
|
||||
@@ -245,6 +245,7 @@ async function onReceiveMessage(messages = []) {
|
||||
// 这里会掉多次;
|
||||
timerSeq.value += 1;
|
||||
battleId.value = msg.id;
|
||||
startCount.value = true;
|
||||
step.value = 2;
|
||||
if (battleType.value === 1) {
|
||||
redTeam.value = msg.groupUserStatus.redTeam;
|
||||
@@ -335,7 +336,6 @@ async function onReceiveMessage(messages = []) {
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||
start.value = true;
|
||||
startCount.value = true;
|
||||
step.value = 3;
|
||||
seq.value += 1;
|
||||
timerSeq.value = 0;
|
||||
@@ -424,7 +424,7 @@ async function onReceiveMessage(messages = []) {
|
||||
}
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
playersScores.value = {};
|
||||
uni.$emit("update-ramain", 0);
|
||||
[
|
||||
...msg.groupUserStatus.redTeam,
|
||||
...msg.groupUserStatus.blueTeam,
|
||||
|
||||
@@ -117,6 +117,7 @@ async function onReceiveMessage(messages = []) {
|
||||
// 这里会掉多次;
|
||||
timerSeq.value += 1;
|
||||
battleId.value = msg.id;
|
||||
startCount.value = true;
|
||||
players.value = [
|
||||
...msg.groupUserStatus.redTeam,
|
||||
...msg.groupUserStatus.blueTeam,
|
||||
@@ -130,7 +131,6 @@ async function onReceiveMessage(messages = []) {
|
||||
if (msg.id !== battleId.value) return;
|
||||
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||
start.value = true;
|
||||
startCount.value = true;
|
||||
seq.value += 1;
|
||||
timerSeq.value = 0;
|
||||
tips.value = "请连续射出6支箭";
|
||||
@@ -144,7 +144,7 @@ async function onReceiveMessage(messages = []) {
|
||||
playersScores.value[msg.userId].push(msg.target);
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
playersScores.value = {};
|
||||
uni.$emit("update-ramain", 0);
|
||||
[...msg.groupUserStatus.redTeam, ...msg.groupUserStatus.blueTeam].forEach(
|
||||
(player) => {
|
||||
playersScores.value[player.id] = player.arrows;
|
||||
@@ -155,7 +155,7 @@ async function onReceiveMessage(messages = []) {
|
||||
tips.value = "准备下半场";
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
uni.setStorageSync("last-battle", msg.endStatus);
|
||||
uni.setStorageSync("last-battle", { ...msg.endStatus, lvl: msg.lvl });
|
||||
if (msg.endStatus.noSaved) {
|
||||
uni.showToast({
|
||||
title: "游戏结束",
|
||||
|
||||
@@ -63,6 +63,7 @@ async function onReceiveMessage(messages = []) {
|
||||
practiseResult.value = {
|
||||
...msg.practice,
|
||||
arrows: JSON.parse(msg.practice.arrows),
|
||||
lvl: msg.lvl,
|
||||
};
|
||||
generateCanvasImage(
|
||||
"shareCanvas",
|
||||
|
||||
@@ -225,7 +225,7 @@ async function onReceiveMessage(messages = []) {
|
||||
}
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
uni.setStorageSync("last-battle", msg.endStatus);
|
||||
uni.setStorageSync("last-battle", { ...msg.endStatus, lvl: msg.lvl });
|
||||
if (msg.endStatus.noSaved) {
|
||||
uni.showToast({
|
||||
title: "游戏结束",
|
||||
|
||||
Reference in New Issue
Block a user