Open instance in-game

This commit is contained in:
Natsumi
2025-08-16 02:45:55 +12:00
parent 90c6422418
commit b3c58a8c08
11 changed files with 204 additions and 65 deletions

View File

@@ -1,24 +1,51 @@
<template>
<el-button v-show="isVisible" @click="confirmInvite" size="mini" icon="el-icon-message" circle />
<el-tooltip
v-if="!isGameRunning || isLinux || gameLogDisabled"
placement="top"
:content="t('dialog.user.info.self_invite_tooltip')"
:disabled="hideTooltips">
<el-button v-show="isVisible" @click="confirmInvite" size="mini" icon="el-icon-message" circle />
</el-tooltip>
<el-tooltip v-else placement="top" :content="t('dialog.user.info.open_in_vrchat_tooltip')" :disabled="hideTooltips">
<el-button @click="openInstance" size="mini" icon="el-icon-message" circle />
</el-tooltip>
</template>
<script setup>
import { storeToRefs } from 'pinia';
import { computed, getCurrentInstance } from 'vue';
import { useI18n } from 'vue-i18n-bridge';
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';
const props = defineProps({
location: String,
shortname: String
});
const { t } = useI18n();
const { hideTooltips } = storeToRefs(useAppearanceSettingsStore());
const { isGameRunning } = storeToRefs(useGameStore());
const { gameLogDisabled } = storeToRefs(useAdvancedSettingsStore());
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) return;
if (!L.isRealInstance) {
return;
}
instanceRequest
.selfInvite({
@@ -31,4 +58,13 @@
return args;
});
}
function openInstance() {
const L = parseLocation(props.location);
if (!L.isRealInstance) {
return;
}
tryOpenInstanceInVrc(L.tag, props.shortname);
}
</script>

View File

@@ -413,9 +413,7 @@
<div v-for="room in groupDialog.instances" :key="room.tag" style="width: 100%">
<div style="margin: 5px 0">
<Location :location="room.tag" style="display: inline-block" />
<el-tooltip placement="top" content="Invite yourself" :disabled="hideTooltips">
<InviteYourself :location="room.tag" style="margin-left: 5px" />
</el-tooltip>
<InviteYourself :location="room.tag" style="margin-left: 5px" />
<el-tooltip placement="top" content="Refresh player count" :disabled="hideTooltips">
<el-button
size="mini"

View File

@@ -66,13 +66,31 @@
@click="showInviteDialog(launchDialog.location)">
{{ t('dialog.launch.invite') }}
</el-button>
<el-button
type="primary"
size="small"
:disabled="!launchDialog.secureOrShortName"
@click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)">
{{ t('dialog.launch.launch') }}
</el-button>
<template v-if="isGameRunning">
<el-button
type="default"
size="small"
:disabled="!launchDialog.secureOrShortName"
@click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)">
{{ t('dialog.launch.launch') }}
</el-button>
<el-button
type="primary"
size="small"
:disabled="!launchDialog.secureOrShortName"
@click="handleAttachGame(launchDialog.location, launchDialog.shortName)">
{{ t('dialog.launch.open_ingame') }}
</el-button>
</template>
<template v-else>
<el-button
type="primary"
size="small"
:disabled="!launchDialog.secureOrShortName"
@click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)">
{{ t('dialog.launch.launch') }}
</el-button>
</template>
</template>
<InviteDialog :invite-dialog="inviteDialog" @closeInviteDialog="closeInviteDialog" />
</safe-dialog>
@@ -88,6 +106,7 @@
import {
useAppearanceSettingsStore,
useFriendStore,
useGameStore,
useInstanceStore,
useLaunchStore,
useLocationStore
@@ -100,9 +119,10 @@
const { friends } = storeToRefs(useFriendStore());
const { hideTooltips } = storeToRefs(useAppearanceSettingsStore());
const { lastLocation } = storeToRefs(useLocationStore());
const { launchGame } = useLaunchStore();
const { launchGame, tryOpenInstanceInVrc } = useLaunchStore();
const { launchDialogData } = storeToRefs(useLaunchStore());
const { showPreviousInstancesInfoDialog } = useInstanceStore();
const { isGameRunning } = storeToRefs(useGameStore());
const launchDialogRef = ref(null);
@@ -180,6 +200,10 @@
launchGame(location, shortName, desktop);
isVisible.value = false;
}
function handleAttachGame(location, shortName) {
tryOpenInstanceInVrc(location, shortName);
isVisible.value = false;
}
function getConfig() {
configRepository.getBool('launchAsDesktop').then((value) => (launchDialog.value.desktop = value));
}

View File

@@ -568,15 +568,10 @@
<div style="flex: none">
<template v-if="isRealInstance(userDialog.$location.tag)">
<Launch :location="userDialog.$location.tag" />
<el-tooltip
placement="top"
:content="t('dialog.user.info.self_invite_tooltip')"
:disabled="hideTooltips">
<InviteYourself
:location="userDialog.$location.tag"
:shortname="userDialog.$location.shortName"
style="margin-left: 5px" />
</el-tooltip>
<InviteYourself
:location="userDialog.$location.tag"
:shortname="userDialog.$location.shortName"
style="margin-left: 5px" />
<el-tooltip
placement="top"
:content="t('dialog.user.info.refresh_instance_info')"

View File

@@ -348,15 +348,10 @@
:currentuserid="currentUser.id"
:worlddialogshortname="worldDialog.$location.shortName" />
<Launch :location="room.tag" style="margin-left: 5px" />
<el-tooltip
placement="top"
:content="t('dialog.world.instances.self_invite_tooltip')"
:disabled="hideTooltips">
<InviteYourself
:location="room.$location.tag"
:shortname="room.$location.shortName"
style="margin-left: 5px" />
</el-tooltip>
<InviteYourself
:location="room.$location.tag"
:shortname="room.$location.shortName"
style="margin-left: 5px" />
<el-tooltip
placement="top"
:content="t('dialog.world.instances.refresh_instance_info')"