canOpenInstanceInGame

This commit is contained in:
pa
2025-10-28 13:04:25 +09:00
committed by Natsumi
parent 737bcdd03d
commit a8c9fdd1a0
8 changed files with 19 additions and 22 deletions
+1 -4
View File
@@ -1,9 +1,6 @@
<template> <template>
<div v-if="isVisible" :class="['inline-block']"> <div v-if="isVisible" :class="['inline-block']">
<el-tooltip <el-tooltip v-if="!canOpenInstanceInGame" placement="top" :content="t('dialog.user.info.self_invite_tooltip')">
v-if="!canOpenInstanceInGame()"
placement="top"
:content="t('dialog.user.info.self_invite_tooltip')">
<el-button v-show="isVisible" @click="confirmInvite" size="small" :icon="Message" circle /> <el-button v-show="isVisible" @click="confirmInvite" size="small" :icon="Message" circle />
</el-tooltip> </el-tooltip>
<el-tooltip v-else placement="top" :content="t('dialog.user.info.open_in_vrchat_tooltip')"> <el-tooltip v-else placement="top" :content="t('dialog.user.info.open_in_vrchat_tooltip')">
+1 -1
View File
@@ -65,7 +65,7 @@
@click="showInviteDialog(launchDialog.location)"> @click="showInviteDialog(launchDialog.location)">
{{ t('dialog.launch.invite') }} {{ t('dialog.launch.invite') }}
</el-button> </el-button>
<template v-if="canOpenInstanceInGame()"> <template v-if="canOpenInstanceInGame">
<el-button <el-button
:disabled="!launchDialog.secureOrShortName" :disabled="!launchDialog.secureOrShortName"
@click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)"> @click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)">
+2 -2
View File
@@ -417,7 +417,7 @@
@click="showInviteDialog(newInstanceDialog.location)" @click="showInviteDialog(newInstanceDialog.location)"
>{{ t('dialog.new_instance.invite') }}</el-button >{{ t('dialog.new_instance.invite') }}</el-button
> >
<template v-if="canOpenInstanceInGame()"> <template v-if="canOpenInstanceInGame">
<el-button @click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)">{{ <el-button @click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)">{{
t('dialog.new_instance.launch') t('dialog.new_instance.launch')
}}</el-button> }}</el-button>
@@ -454,7 +454,7 @@
@click="showInviteDialog(newInstanceDialog.location)" @click="showInviteDialog(newInstanceDialog.location)"
>{{ t('dialog.new_instance.invite') }}</el-button >{{ t('dialog.new_instance.invite') }}</el-button
> >
<template v-if="canOpenInstanceInGame()"> <template v-if="canOpenInstanceInGame">
<el-button @click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)">{{ <el-button @click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)">{{
t('dialog.new_instance.launch') t('dialog.new_instance.launch')
}}</el-button> }}</el-button>
@@ -224,7 +224,7 @@
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item :icon="Message" command="New Instance and Self Invite"> <el-dropdown-item :icon="Message" command="New Instance and Self Invite">
{{ {{
canOpenInstanceInGame() canOpenInstanceInGame
? t('dialog.world.actions.new_instance_and_open_ingame') ? t('dialog.world.actions.new_instance_and_open_ingame')
: t('dialog.world.actions.new_instance_and_self_invite') : t('dialog.world.actions.new_instance_and_self_invite')
}} }}
+10 -10
View File
@@ -1,4 +1,4 @@
import { ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
@@ -71,6 +71,14 @@ export const useInviteStore = defineStore('Invite', () => {
{ flush: 'sync' } { flush: 'sync' }
); );
const canOpenInstanceInGame = computed(() => {
return (
!LINUX &&
gameStore.isGameRunning &&
!advancedSettingsStore.selfInviteOverride
);
});
/** /**
* *
* @param {'message' | 'request' | 'response' | 'requestResponse'} mode * @param {'message' | 'request' | 'response' | 'requestResponse'} mode
@@ -99,14 +107,6 @@ export const useInviteStore = defineStore('Invite', () => {
}); });
} }
function canOpenInstanceInGame() {
return (
!LINUX &&
gameStore.isGameRunning &&
!advancedSettingsStore.selfInviteOverride
);
}
function newInstanceSelfInvite(worldId) { function newInstanceSelfInvite(worldId) {
instanceStore.createNewInstance(worldId).then((args) => { instanceStore.createNewInstance(worldId).then((args) => {
const location = args?.json?.location; const location = args?.json?.location;
@@ -122,7 +122,7 @@ export const useInviteStore = defineStore('Invite', () => {
if (!L.isRealInstance) { if (!L.isRealInstance) {
return; return;
} }
if (canOpenInstanceInGame()) { if (canOpenInstanceInGame.value) {
const secureOrShortName = const secureOrShortName =
args.json.shortName || args.json.secureName; args.json.shortName || args.json.secureName;
launchStore.tryOpenInstanceInVrc(location, secureOrShortName); launchStore.tryOpenInstanceInVrc(location, secureOrShortName);
@@ -56,7 +56,7 @@
<el-tooltip placement="left" :teleported="false"> <el-tooltip placement="left" :teleported="false">
<template #content> <template #content>
{{ {{
canOpenInstanceInGame() canOpenInstanceInGame
? t('dialog.world.actions.new_instance_and_open_ingame') ? t('dialog.world.actions.new_instance_and_open_ingame')
: t('dialog.world.actions.new_instance_and_self_invite') : t('dialog.world.actions.new_instance_and_self_invite')
}} }}
@@ -38,7 +38,7 @@
<el-tooltip placement="left"> <el-tooltip placement="left">
<template #content> <template #content>
{{ {{
canOpenInstanceInGame() canOpenInstanceInGame
? t('dialog.world.actions.new_instance_and_open_ingame') ? t('dialog.world.actions.new_instance_and_open_ingame')
: t('dialog.world.actions.new_instance_and_self_invite') : t('dialog.world.actions.new_instance_and_self_invite')
}} }}
@@ -117,13 +117,13 @@
:class="{ 'is-editing': editFavoritesMode }" :class="{ 'is-editing': editFavoritesMode }"
style="margin-top: 10px"> style="margin-top: 10px">
<el-scrollbar height="700px" @end-reached="worldFavoritesLoadMore"> <el-scrollbar height="700px" @end-reached="worldFavoritesLoadMore">
<FavoritesWorldItem <!-- <FavoritesWorldItem
v-for="favorite in sliceWorldFavorites(group.key)" v-for="favorite in sliceWorldFavorites(group.key)"
:key="favorite.id" :key="favorite.id"
:group="group" :group="group"
:favorite="favorite" :favorite="favorite"
@click="showWorldDialog(favorite.id)" @click="showWorldDialog(favorite.id)"
@handle-select="favorite.$selected = $event" /> @handle-select="favorite.$selected = $event" /> -->
</el-scrollbar> </el-scrollbar>
</div> </div>
<div <div