mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-01 20:53:45 +02:00
Small fixes, fix open instance game crash
This commit is contained in:
+32
-11
@@ -9,6 +9,7 @@ import { parseLocation } from '../shared/utils';
|
||||
export const useLaunchStore = defineStore('Launch', () => {
|
||||
const state = reactive({
|
||||
isLaunchOptionsDialogVisible: false,
|
||||
isOpeningInstance: false,
|
||||
launchDialogData: {
|
||||
visible: false,
|
||||
loading: false,
|
||||
@@ -24,6 +25,13 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const isOpeningInstance = computed({
|
||||
get: () => state.isOpeningInstance,
|
||||
set: (value) => {
|
||||
state.isOpeningInstance = value;
|
||||
}
|
||||
});
|
||||
|
||||
const launchDialogData = computed({
|
||||
get: () => state.launchDialogData,
|
||||
set: (value) => {
|
||||
@@ -102,9 +110,14 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function tryOpenInstanceInVrc(location, shortName) {
|
||||
const launchUrl = await getLaunchUrl(location, shortName);
|
||||
if (state.isOpeningInstance) {
|
||||
return;
|
||||
}
|
||||
state.isOpeningInstance = true;
|
||||
let launchUrl = '';
|
||||
let result = false;
|
||||
try {
|
||||
launchUrl = await getLaunchUrl(location, shortName);
|
||||
result = await AppApi.TryOpenInstanceInVrc(launchUrl);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -117,17 +130,24 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
type: 'warning'
|
||||
});
|
||||
// self invite fallback
|
||||
const L = parseLocation(location);
|
||||
await instanceRequest.selfInvite({
|
||||
instanceId: L.instanceId,
|
||||
worldId: L.worldId,
|
||||
shortName
|
||||
});
|
||||
ElMessage({
|
||||
message: 'Self invite sent',
|
||||
type: 'success'
|
||||
});
|
||||
try {
|
||||
const L = parseLocation(location);
|
||||
await instanceRequest.selfInvite({
|
||||
instanceId: L.instanceId,
|
||||
worldId: L.worldId,
|
||||
shortName
|
||||
});
|
||||
ElMessage({
|
||||
message: 'Self invite sent',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
setTimeout(() => {
|
||||
state.isOpeningInstance = false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +212,7 @@ export const useLaunchStore = defineStore('Launch', () => {
|
||||
state,
|
||||
|
||||
isLaunchOptionsDialogVisible,
|
||||
isOpeningInstance,
|
||||
launchDialogData,
|
||||
showLaunchOptions,
|
||||
showLaunchDialog,
|
||||
|
||||
Reference in New Issue
Block a user