调试多v多房间功能
This commit is contained in:
@@ -48,83 +48,7 @@ const updateSound = () => {
|
||||
|
||||
async function onReceiveMessage(message) {
|
||||
if (ended.value) return;
|
||||
if (Array.isArray(message)) {
|
||||
message.forEach((msg) => {
|
||||
// if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||
// if (melee.value && msg.userId !== user.value.id) return;
|
||||
// if (msg.userId === user.value.id) currentShot.value++;
|
||||
// if (msg.battleInfo && msg.userId === user.value.id) {
|
||||
// const players = [
|
||||
// ...(msg.battleInfo.blueTeam || []),
|
||||
// ...(msg.battleInfo.redTeam || []),
|
||||
// ];
|
||||
// const currentPlayer = players.find((p) => p.id === msg.userId);
|
||||
// currentShot.value = 0;
|
||||
// try {
|
||||
// if (
|
||||
// currentPlayer &&
|
||||
// currentPlayer.shotHistory &&
|
||||
// currentPlayer.shotHistory[msg.battleInfo.currentRound]
|
||||
// ) {
|
||||
// currentShot.value =
|
||||
// currentPlayer.shotHistory[msg.battleInfo.currentRound].length;
|
||||
// }
|
||||
// } catch (_) {}
|
||||
// }
|
||||
// if (!halfTime.value && msg.target) {
|
||||
// let key = [];
|
||||
// key.push(msg.target.ring ? `${msg.target.ring}环` : "未上靶");
|
||||
// if (!msg.target.ring)
|
||||
// key.push(`向${getDirectionText(msg.target.angle)}调整`);
|
||||
// audioManager.play(key);
|
||||
// }
|
||||
// } else
|
||||
// if (msg.constructor === MESSAGETYPES.InvalidShot) {
|
||||
// if (msg.userId === user.value.id) {
|
||||
// uni.showToast({
|
||||
// title: "距离不足,无效",
|
||||
// icon: "none",
|
||||
// });
|
||||
// audioManager.play("射击无效");
|
||||
// }
|
||||
// }
|
||||
// else if (msg.constructor === MESSAGETYPES.AllReady) {
|
||||
// const { config } = msg.groupUserStatus;
|
||||
// if (config && config.mode === 1) {
|
||||
// totalShot.value = config.teamSize === 2 ? 3 : 2;
|
||||
// }
|
||||
// currentRoundEnded.value = true;
|
||||
// audioManager.play("比赛开始");
|
||||
// } else if (msg.constructor === MESSAGETYPES.MeleeAllReady) {
|
||||
// melee.value = true;
|
||||
// halfTime.value = false;
|
||||
// audioManager.play("比赛开始");
|
||||
// } else if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
|
||||
// currentShot.value = 0;
|
||||
// if (msg.preRoundResult && msg.preRoundResult.currentRound) {
|
||||
// currentRound.value = msg.preRoundResult.currentRound;
|
||||
// currentRoundEnded.value = true;
|
||||
// }
|
||||
// } else if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
|
||||
// halfTime.value = true;
|
||||
// audioManager.play("中场休息");
|
||||
// } else if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
// audioManager.play("比赛结束");
|
||||
// } else if (msg.constructor === MESSAGETYPES.FinalShoot) {
|
||||
// totalShot.value = 0;
|
||||
// audioManager.play("决金箭轮");
|
||||
// tips.value = "即将开始...";
|
||||
// currentRoundEnded.value = false;
|
||||
// } else if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
// ended.value = true;
|
||||
// } else if (msg.constructor === MESSAGETYPES.BackToGame) {
|
||||
// if (msg.battleInfo) {
|
||||
// melee.value = msg.battleInfo.config.mode === 2;
|
||||
// }
|
||||
// }
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(message)) return;
|
||||
if (message.type === MESSAGETYPESV2.BattleStart) {
|
||||
melee.value = Boolean(message.mode);
|
||||
totalShot.value = message.mode === 1 ? 3 : 2;
|
||||
|
||||
Reference in New Issue
Block a user