添加升级显示
This commit is contained in:
@@ -4,6 +4,7 @@ import IconButton from "@/components/IconButton.vue";
|
|||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
import ScreenHint from "@/components/ScreenHint.vue";
|
import ScreenHint from "@/components/ScreenHint.vue";
|
||||||
import BowData from "@/components/BowData.vue";
|
import BowData from "@/components/BowData.vue";
|
||||||
|
import UserUpgrade from "@/components/UserUpgrade.vue";
|
||||||
import { wxShare } from "@/util";
|
import { wxShare } from "@/util";
|
||||||
import { directionAdjusts } from "@/constants";
|
import { directionAdjusts } from "@/constants";
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -31,6 +32,7 @@ const props = defineProps({
|
|||||||
const showPanel = ref(true);
|
const showPanel = ref(true);
|
||||||
const showComment = ref(false);
|
const showComment = ref(false);
|
||||||
const showBowData = ref(false);
|
const showBowData = ref(false);
|
||||||
|
const showUpgrade = ref(false);
|
||||||
const finished = ref(false);
|
const finished = ref(false);
|
||||||
const totalRing = ref(0);
|
const totalRing = ref(0);
|
||||||
const closePanel = () => {
|
const closePanel = () => {
|
||||||
@@ -40,6 +42,9 @@ const closePanel = () => {
|
|||||||
}, 300);
|
}, 300);
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (props.result.lvl) {
|
||||||
|
showUpgrade.value = true;
|
||||||
|
}
|
||||||
if (props.result.arrows) {
|
if (props.result.arrows) {
|
||||||
totalRing.value = props.result.arrows.reduce(
|
totalRing.value = props.result.arrows.reduce(
|
||||||
(last, next) => last + next.ring,
|
(last, next) => last + next.ring,
|
||||||
@@ -55,7 +60,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view v-if="result.arrows" class="container">
|
<view class="container">
|
||||||
<view :class="['container-header', showPanel ? 'scale-in' : 'scale-out']">
|
<view :class="['container-header', showPanel ? 'scale-in' : 'scale-out']">
|
||||||
<image :src="tipSrc" mode="widthFix" />
|
<image :src="tipSrc" mode="widthFix" />
|
||||||
<image src="../static/finish-frame.png" mode="widthFix" />
|
<image src="../static/finish-frame.png" mode="widthFix" />
|
||||||
@@ -144,6 +149,11 @@ onMounted(() => {
|
|||||||
:show="showBowData"
|
:show="showBowData"
|
||||||
:onClose="() => (showBowData = false)"
|
:onClose="() => (showBowData = false)"
|
||||||
/>
|
/>
|
||||||
|
<UserUpgrade
|
||||||
|
:show="showUpgrade"
|
||||||
|
:onClose="() => (showUpgrade = false)"
|
||||||
|
:lvl="result.lvl"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ onUnmounted(() => {
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
transform: translateY(-10px);
|
transform: translateY(-10px);
|
||||||
}
|
}
|
||||||
|
.container > view:first-child > button:last-child {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
.container > view:first-child > button:last-child > image {
|
.container > view:first-child > button:last-child > image {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
transform: translateX(10px) translateY(-10px);
|
transform: translateX(10px) translateY(-10px);
|
||||||
|
|||||||
80
src/components/UserUpgrade.vue
Normal file
80
src/components/UserUpgrade.vue
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<script setup>
|
||||||
|
import { onMounted } from "vue";
|
||||||
|
import useStore from "@/store";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
const store = useStore();
|
||||||
|
const { user } = storeToRefs(store);
|
||||||
|
const { updateUser } = store;
|
||||||
|
const props = defineProps({
|
||||||
|
lvl: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
onClose: {
|
||||||
|
type: Function,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
onMounted(() => {
|
||||||
|
updateUser({ ...user.value, lvl: props.lvl });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="content" :style="{ display: show ? 'flex' : 'none' }">
|
||||||
|
<image src="../static/user-upgrade.png" mode="widthFix" />
|
||||||
|
<image class="" src="../static/shining-bg.png" mode="widthFix" />
|
||||||
|
<view>
|
||||||
|
<text>恭喜你升级到</text>
|
||||||
|
<text>射灵{{ lvl }}级</text>
|
||||||
|
</view>
|
||||||
|
<button @click="onClose" hover-class="none">关闭</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.content {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: #232323;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 10;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
.content > image:first-child {
|
||||||
|
width: 50vw;
|
||||||
|
position: absolute;
|
||||||
|
top: calc(50% - 30vw);
|
||||||
|
}
|
||||||
|
.content > image:nth-child(2) {
|
||||||
|
width: 80vw;
|
||||||
|
}
|
||||||
|
.content > view:nth-child(3) {
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: -6vw;
|
||||||
|
}
|
||||||
|
.content > view:nth-child(3) > text:last-child {
|
||||||
|
color: #fed847;
|
||||||
|
}
|
||||||
|
.content > button:last-child {
|
||||||
|
color: #fff9;
|
||||||
|
font-size: 20px;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
padding: 10px;
|
||||||
|
width: 50vw;
|
||||||
|
border-radius: 20px;
|
||||||
|
margin-top: 10vw;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import { ref, onMounted } from "vue";
|
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 UserUpgrade from "@/components/UserUpgrade.vue";
|
||||||
import { getGameAPI, getHomeData } from "@/apis";
|
import { getGameAPI, getHomeData } from "@/apis";
|
||||||
import { topThreeColors, getBattleResultTips } from "@/constants";
|
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
@@ -14,6 +15,7 @@ const ifWin = ref(false);
|
|||||||
const data = ref({});
|
const data = ref({});
|
||||||
const totalPoints = ref(0);
|
const totalPoints = ref(0);
|
||||||
const rank = ref(0);
|
const rank = ref(0);
|
||||||
|
const showUpgrade = ref(false);
|
||||||
|
|
||||||
// onLoad(async (options) => {
|
// onLoad(async (options) => {
|
||||||
// battleId.value = options.battleId;
|
// battleId.value = options.battleId;
|
||||||
@@ -181,6 +183,11 @@ const checkBowData = () => {
|
|||||||
<view @click="checkBowData">查看靶纸</view>
|
<view @click="checkBowData">查看靶纸</view>
|
||||||
<view @click="exit">退出</view>
|
<view @click="exit">退出</view>
|
||||||
</view>
|
</view>
|
||||||
|
<UserUpgrade
|
||||||
|
:show="showUpgrade"
|
||||||
|
:onClose="() => (showUpgrade = false)"
|
||||||
|
:lvl="data.lvl"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ watch(
|
|||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
if (options.battleId) {
|
if (options.battleId) {
|
||||||
const battleInfo = uni.getStorageSync("current-battle");
|
const battleInfo = uni.getStorageSync("current-battle");
|
||||||
console.log("----battleInfo", battleInfo);
|
// console.log("----battleInfo", battleInfo);
|
||||||
if (battleInfo) {
|
if (battleInfo) {
|
||||||
battleId.value = battleInfo.id;
|
battleId.value = battleInfo.id;
|
||||||
battleType.value = battleInfo.config.mode;
|
battleType.value = battleInfo.config.mode;
|
||||||
@@ -245,6 +245,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
// 这里会掉多次;
|
// 这里会掉多次;
|
||||||
timerSeq.value += 1;
|
timerSeq.value += 1;
|
||||||
battleId.value = msg.id;
|
battleId.value = msg.id;
|
||||||
|
startCount.value = true;
|
||||||
step.value = 2;
|
step.value = 2;
|
||||||
if (battleType.value === 1) {
|
if (battleType.value === 1) {
|
||||||
redTeam.value = msg.groupUserStatus.redTeam;
|
redTeam.value = msg.groupUserStatus.redTeam;
|
||||||
@@ -335,7 +336,6 @@ async function onReceiveMessage(messages = []) {
|
|||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||||
start.value = true;
|
start.value = true;
|
||||||
startCount.value = true;
|
|
||||||
step.value = 3;
|
step.value = 3;
|
||||||
seq.value += 1;
|
seq.value += 1;
|
||||||
timerSeq.value = 0;
|
timerSeq.value = 0;
|
||||||
@@ -424,7 +424,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||||
playersScores.value = {};
|
uni.$emit("update-ramain", 0);
|
||||||
[
|
[
|
||||||
...msg.groupUserStatus.redTeam,
|
...msg.groupUserStatus.redTeam,
|
||||||
...msg.groupUserStatus.blueTeam,
|
...msg.groupUserStatus.blueTeam,
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
// 这里会掉多次;
|
// 这里会掉多次;
|
||||||
timerSeq.value += 1;
|
timerSeq.value += 1;
|
||||||
battleId.value = msg.id;
|
battleId.value = msg.id;
|
||||||
|
startCount.value = true;
|
||||||
players.value = [
|
players.value = [
|
||||||
...msg.groupUserStatus.redTeam,
|
...msg.groupUserStatus.redTeam,
|
||||||
...msg.groupUserStatus.blueTeam,
|
...msg.groupUserStatus.blueTeam,
|
||||||
@@ -130,7 +131,6 @@ async function onReceiveMessage(messages = []) {
|
|||||||
if (msg.id !== battleId.value) return;
|
if (msg.id !== battleId.value) return;
|
||||||
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||||
start.value = true;
|
start.value = true;
|
||||||
startCount.value = true;
|
|
||||||
seq.value += 1;
|
seq.value += 1;
|
||||||
timerSeq.value = 0;
|
timerSeq.value = 0;
|
||||||
tips.value = "请连续射出6支箭";
|
tips.value = "请连续射出6支箭";
|
||||||
@@ -144,7 +144,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
playersScores.value[msg.userId].push(msg.target);
|
playersScores.value[msg.userId].push(msg.target);
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||||
playersScores.value = {};
|
uni.$emit("update-ramain", 0);
|
||||||
[...msg.groupUserStatus.redTeam, ...msg.groupUserStatus.blueTeam].forEach(
|
[...msg.groupUserStatus.redTeam, ...msg.groupUserStatus.blueTeam].forEach(
|
||||||
(player) => {
|
(player) => {
|
||||||
playersScores.value[player.id] = player.arrows;
|
playersScores.value[player.id] = player.arrows;
|
||||||
@@ -155,7 +155,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
tips.value = "准备下半场";
|
tips.value = "准备下半场";
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||||
uni.setStorageSync("last-battle", msg.endStatus);
|
uni.setStorageSync("last-battle", { ...msg.endStatus, lvl: msg.lvl });
|
||||||
if (msg.endStatus.noSaved) {
|
if (msg.endStatus.noSaved) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "游戏结束",
|
title: "游戏结束",
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
practiseResult.value = {
|
practiseResult.value = {
|
||||||
...msg.practice,
|
...msg.practice,
|
||||||
arrows: JSON.parse(msg.practice.arrows),
|
arrows: JSON.parse(msg.practice.arrows),
|
||||||
|
lvl: msg.lvl,
|
||||||
};
|
};
|
||||||
generateCanvasImage(
|
generateCanvasImage(
|
||||||
"shareCanvas",
|
"shareCanvas",
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ async function onReceiveMessage(messages = []) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||||
uni.setStorageSync("last-battle", msg.endStatus);
|
uni.setStorageSync("last-battle", { ...msg.endStatus, lvl: msg.lvl });
|
||||||
if (msg.endStatus.noSaved) {
|
if (msg.endStatus.noSaved) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "游戏结束",
|
title: "游戏结束",
|
||||||
|
|||||||
Reference in New Issue
Block a user