mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 17:53:48 +02:00
Open instance in-game
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user