Toggle self invite/open in-game

This commit is contained in:
Natsumi
2025-09-04 05:39:24 +12:00
parent 307bbbbd05
commit 96f3b239f6
9 changed files with 112 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
<template>
<el-tooltip
v-if="!isGameRunning || isLinux || gameLogDisabled"
v-if="!canOpenInstanceInGame()"
placement="top"
:content="t('dialog.user.info.self_invite_tooltip')"
:disabled="hideTooltips">
@@ -18,9 +18,8 @@
import { instanceRequest } from '../api';
import { checkCanInviteSelf, parseLocation } from '../shared/utils';
import { useAppearanceSettingsStore } from '../stores/settings/appearance';
import { useGameStore } from '../stores/game';
import { useLaunchStore } from '../stores/launch';
import { useAdvancedSettingsStore } from '../stores/settings/advanced';
import { useInviteStore } from '../stores/invite';
const props = defineProps({
location: String,
@@ -30,17 +29,14 @@
const { t } = useI18n();
const { hideTooltips } = storeToRefs(useAppearanceSettingsStore());
const { isGameRunning } = storeToRefs(useGameStore());
const { gameLogDisabled } = storeToRefs(useAdvancedSettingsStore());
const { canOpenInstanceInGame } = useInviteStore();
const { tryOpenInstanceInVrc } = useLaunchStore();
const { proxy } = getCurrentInstance();
const isVisible = computed(() => checkCanInviteSelf(props.location));
const isLinux = computed(() => LINUX);
function confirmInvite() {
const L = parseLocation(props.location);
if (!L.isRealInstance) {

View File

@@ -66,7 +66,7 @@
@click="showInviteDialog(launchDialog.location)">
{{ t('dialog.launch.invite') }}
</el-button>
<template v-if="isGameRunning">
<template v-if="canOpenInstanceInGame()">
<el-button
type="default"
size="small"
@@ -106,7 +106,7 @@
import {
useAppearanceSettingsStore,
useFriendStore,
useGameStore,
useInviteStore,
useInstanceStore,
useLaunchStore,
useLocationStore
@@ -122,7 +122,7 @@
const { launchGame, tryOpenInstanceInVrc } = useLaunchStore();
const { launchDialogData } = storeToRefs(useLaunchStore());
const { showPreviousInstancesInfoDialog } = useInstanceStore();
const { isGameRunning } = storeToRefs(useGameStore());
const { canOpenInstanceInGame } = useInviteStore();
const launchDialogRef = ref(null);

View File

@@ -410,12 +410,28 @@
@click="showInviteDialog(newInstanceDialog.location)"
>{{ t('dialog.new_instance.invite') }}</el-button
>
<el-button
type="primary"
size="small"
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
>{{ t('dialog.new_instance.launch') }}</el-button
>
<template v-if="canOpenInstanceInGame()">
<el-button
type="default"
size="small"
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
>{{ t('dialog.new_instance.launch') }}</el-button
>
<el-button
type="primary"
size="small"
@click="handleAttachGame(newInstanceDialog.location, newInstanceDialog.shortName)">
{{ t('dialog.new_instance.open_ingame') }}
</el-button>
</template>
<template v-else>
<el-button
type="primary"
size="small"
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
>{{ t('dialog.new_instance.launch') }}</el-button
>
</template>
</template>
<template v-else>
<el-button type="primary" size="small" @click="handleCreateNewInstance">{{
@@ -439,12 +455,28 @@
@click="showInviteDialog(newInstanceDialog.location)"
>{{ t('dialog.new_instance.invite') }}</el-button
>
<el-button
type="primary"
size="small"
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
>{{ t('dialog.new_instance.launch') }}</el-button
>
<template v-if="canOpenInstanceInGame()">
<el-button
type="default"
size="small"
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
>{{ t('dialog.new_instance.launch') }}</el-button
>
<el-button
type="primary"
size="small"
@click="handleAttachGame(newInstanceDialog.location, newInstanceDialog.shortName)">
{{ t('dialog.new_instance.open_ingame') }}
</el-button>
</template>
<template v-else>
<el-button
type="primary"
size="small"
@click="showLaunchDialog(newInstanceDialog.location, newInstanceDialog.shortName)"
>{{ t('dialog.new_instance.launch') }}</el-button
>
</template>
</template>
<InviteDialog :invite-dialog="inviteDialog" @closeInviteDialog="closeInviteDialog" />
</safe-dialog>
@@ -472,7 +504,8 @@
useInstanceStore,
useLaunchStore,
useLocationStore,
useUserStore
useUserStore,
useInviteStore
} from '../../stores';
import InviteDialog from './InviteDialog/InviteDialog.vue';
@@ -494,6 +527,8 @@
const { showLaunchDialog } = useLaunchStore();
const { createNewInstance } = useInstanceStore();
const { currentUser } = storeToRefs(useUserStore());
const { tryOpenInstanceInVrc } = useLaunchStore();
const { canOpenInstanceInGame } = useInviteStore();
const newInstanceDialogRef = ref(null);
@@ -573,6 +608,11 @@
});
}
function handleAttachGame(location, shortName) {
tryOpenInstanceInVrc(location, shortName);
closeInviteDialog();
}
async function initNewInstanceDialog(tag) {
if (!isRealInstance(tag)) {
return;

View File

@@ -233,8 +233,8 @@
</el-dropdown-item>
<el-dropdown-item icon="el-icon-message" command="New Instance and Self Invite">
{{
isGameRunning
? t('dialog.world.actions.new_instance_and_open_in_vrchat')
canOpenInstanceInGame()
? t('dialog.world.actions.new_instance_and_open_ingame')
: t('dialog.world.actions.new_instance_and_self_invite')
}}
</el-dropdown-item>
@@ -826,7 +826,7 @@
const { worldDialog, cachedWorlds } = storeToRefs(useWorldStore());
const { showWorldDialog } = useWorldStore();
const { lastLocation } = storeToRefs(useLocationStore());
const { newInstanceSelfInvite } = useInviteStore();
const { newInstanceSelfInvite, canOpenInstanceInGame } = useInviteStore();
const { showFavoriteDialog } = useFavoriteStore();
const { showPreviousInstancesInfoDialog } = useInstanceStore();
const { instanceJoinHistory } = storeToRefs(useInstanceStore());