mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
user dialog get number of users in instance
This commit is contained in:
@@ -1602,6 +1602,30 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
API.getInstance = function (params) {
|
||||||
|
return this.call(`instances/${params.worldId}:${params.instanceId}`, {
|
||||||
|
method: 'GET'
|
||||||
|
}).then((json) => {
|
||||||
|
var args = {
|
||||||
|
json,
|
||||||
|
params
|
||||||
|
};
|
||||||
|
this.$emit('INSTANCE', args);
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
API.$on('INSTANCE', function (args) {
|
||||||
|
var { json } = args;
|
||||||
|
var D = $app.userDialog;
|
||||||
|
if (D.ref.location === json.id) {
|
||||||
|
D.instance = {
|
||||||
|
id: json.id,
|
||||||
|
occupants: json.n_users
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// API: Friend
|
// API: Friend
|
||||||
|
|
||||||
API.friends200 = new Set();
|
API.friends200 = new Set();
|
||||||
@@ -8011,6 +8035,7 @@ speechSynthesis.getVoices();
|
|||||||
D.loading = true;
|
D.loading = true;
|
||||||
D.avatars = [];
|
D.avatars = [];
|
||||||
D.worlds = [];
|
D.worlds = [];
|
||||||
|
D.instance = {};
|
||||||
API.getCachedUser({
|
API.getCachedUser({
|
||||||
userId
|
userId
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@@ -8080,11 +8105,10 @@ speechSynthesis.getVoices();
|
|||||||
this.getAvatarName(args);
|
this.getAvatarName(args);
|
||||||
var L = API.parseLocation(D.ref.location);
|
var L = API.parseLocation(D.ref.location);
|
||||||
if ((L.worldId) &&
|
if ((L.worldId) &&
|
||||||
(this.lastLocation.location !== L.tag) &&
|
(this.lastLocation.location !== L.tag)) {
|
||||||
((L.accessType === 'public') ||
|
API.getInstance({
|
||||||
(this.friends.has(L.userId)))) {
|
worldId: L.worldId,
|
||||||
API.getWorld({
|
instanceId: L.instanceId
|
||||||
worldId: L.worldId
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8154,7 +8178,6 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
users.sort(compareByDisplayName);
|
users.sort(compareByDisplayName);
|
||||||
D.users = users;
|
D.users = users;
|
||||||
D.instance = {};
|
|
||||||
if (!L.worldId) {
|
if (!L.worldId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -8163,31 +8186,6 @@ speechSynthesis.getVoices();
|
|||||||
id: L.tag,
|
id: L.tag,
|
||||||
occupants: this.lastLocation.playerList.length
|
occupants: this.lastLocation.playerList.length
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
var applyInstance = function (instances) {
|
|
||||||
for (var [id, occupants] of instances) {
|
|
||||||
if (id === L.instanceId) {
|
|
||||||
D.instance = {
|
|
||||||
id,
|
|
||||||
occupants
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var ref = API.cachedWorlds.get(L.worldId);
|
|
||||||
if (typeof ref === 'undefined') {
|
|
||||||
API.getWorld({
|
|
||||||
worldId: L.worldId
|
|
||||||
}).then((args) => {
|
|
||||||
if (args.ref.id === L.worldId) {
|
|
||||||
applyInstance(args.ref.instances);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
applyInstance(ref.instances);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user