mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Refresh user/world players in instance count
This commit is contained in:
125
html/src/app.js
125
html/src/app.js
@@ -1621,7 +1621,8 @@ speechSynthesis.getVoices();
|
|||||||
API.$on('INSTANCE', function (args) {
|
API.$on('INSTANCE', function (args) {
|
||||||
var { json } = args;
|
var { json } = args;
|
||||||
var D = $app.userDialog;
|
var D = $app.userDialog;
|
||||||
if (D.ref.location === json.id) {
|
if (($app.userDialog.visible) &&
|
||||||
|
(D.ref.location === json.id)) {
|
||||||
D.instance = {
|
D.instance = {
|
||||||
id: json.id,
|
id: json.id,
|
||||||
occupants: json.n_users
|
occupants: json.n_users
|
||||||
@@ -1629,6 +1630,20 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
API.$on('INSTANCE', function (args) {
|
||||||
|
var { json } = args;
|
||||||
|
var D = $app.worldDialog;
|
||||||
|
if (($app.worldDialog.visible) &&
|
||||||
|
($app.worldDialog.id === json.worldId)) {
|
||||||
|
for (var instance of D.rooms) {
|
||||||
|
if (instance.id === json.instanceId) {
|
||||||
|
instance.occupants = json.n_users;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// API: Friend
|
// API: Friend
|
||||||
|
|
||||||
API.friends200 = new Set();
|
API.friends200 = new Set();
|
||||||
@@ -8209,16 +8224,11 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (L.isOffline === false) {
|
||||||
if (L.isOffline === false) {
|
for (var { ref } of this.friends.values()) {
|
||||||
for (var { ref } of this.friends.values()) {
|
if ((typeof ref !== 'undefined') &&
|
||||||
if (typeof ref !== 'undefined' &&
|
(ref.location === L.tag)) {
|
||||||
ref.location === L.tag) {
|
users.push(ref);
|
||||||
if ((ref.state === 'active') && (ref.location === 'private')) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
users.push(ref);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8470,7 +8480,56 @@ speechSynthesis.getVoices();
|
|||||||
if (D.visible === false) {
|
if (D.visible === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (command === 'Add Favorite') {
|
if (command === 'Refresh') {
|
||||||
|
D.loading = true;
|
||||||
|
API.getUser({
|
||||||
|
userId: D.id
|
||||||
|
}).catch((err) => {
|
||||||
|
D.loading = false;
|
||||||
|
D.visible = false;
|
||||||
|
throw err;
|
||||||
|
}).then((args) => {
|
||||||
|
if (D.id === args.ref.id) {
|
||||||
|
D.loading = false;
|
||||||
|
D.ref = args.ref;
|
||||||
|
D.friend = this.friends.get(D.id);
|
||||||
|
D.isFriend = Boolean(D.friend);
|
||||||
|
D.incomingRequest = false;
|
||||||
|
D.outgoingRequest = false;
|
||||||
|
D.isBlock = false;
|
||||||
|
D.isMute = false;
|
||||||
|
D.isHideAvatar = false;
|
||||||
|
for (var ref of API.cachedPlayerModerations.values()) {
|
||||||
|
if (ref.$isDeleted === false &&
|
||||||
|
ref.targetUserId === D.id &&
|
||||||
|
ref.sourceUserId === API.currentUser.id) {
|
||||||
|
if (ref.type === 'block') {
|
||||||
|
D.isBlock = true;
|
||||||
|
} else if (ref.type === 'mute') {
|
||||||
|
D.isMute = true;
|
||||||
|
} else if (ref.type === 'hideAvatar') {
|
||||||
|
D.isHideAvatar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
||||||
|
this.applyUserDialogLocation();
|
||||||
|
API.getFriendStatus({
|
||||||
|
userId: D.id
|
||||||
|
});
|
||||||
|
this.getAvatarName(args);
|
||||||
|
var L = API.parseLocation(D.ref.location);
|
||||||
|
if ((L.worldId) &&
|
||||||
|
(this.lastLocation.location !== L.tag)) {
|
||||||
|
API.getInstance({
|
||||||
|
worldId: L.worldId,
|
||||||
|
instanceId: L.instanceId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
} else if (command === 'Add Favorite') {
|
||||||
this.showFavoriteDialog('friend', D.id);
|
this.showFavoriteDialog('friend', D.id);
|
||||||
} else if (command === 'Edit Social Status') {
|
} else if (command === 'Edit Social Status') {
|
||||||
this.showSocialStatusDialog();
|
this.showSocialStatusDialog();
|
||||||
@@ -8599,6 +8658,18 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
D.ref = ref;
|
D.ref = ref;
|
||||||
$app.applyWorldDialogInstances();
|
$app.applyWorldDialogInstances();
|
||||||
|
for (var room of D.rooms) {
|
||||||
|
if (room.occupants === 0) {
|
||||||
|
API.getInstance({
|
||||||
|
worldId: D.id,
|
||||||
|
instanceId: room.id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
D.rooms.sort(function (a, b) {
|
||||||
|
return b.users.length - a.users.length ||
|
||||||
|
b.occupants - a.occupants;
|
||||||
|
});
|
||||||
if (D.fileSize === 'Loading') {
|
if (D.fileSize === 'Loading') {
|
||||||
var assetUrl = '';
|
var assetUrl = '';
|
||||||
for (var i = ref.unityPackages.length - 1; i > -1; i--) {
|
for (var i = ref.unityPackages.length - 1; i > -1; i--) {
|
||||||
@@ -8675,7 +8746,6 @@ speechSynthesis.getVoices();
|
|||||||
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
||||||
D.rooms = [];
|
D.rooms = [];
|
||||||
this.updateVRChatCache();
|
this.updateVRChatCache();
|
||||||
this.applyWorldDialogInstances();
|
|
||||||
if (args.cache) {
|
if (args.cache) {
|
||||||
API.getWorld(args.params);
|
API.getWorld(args.params);
|
||||||
}
|
}
|
||||||
@@ -8709,13 +8779,12 @@ speechSynthesis.getVoices();
|
|||||||
var instance = instances[lastLocation$.instanceId];
|
var instance = instances[lastLocation$.instanceId];
|
||||||
if (typeof instance === 'undefined') {
|
if (typeof instance === 'undefined') {
|
||||||
instance = {
|
instance = {
|
||||||
id: lastLocation$.instanceId,
|
id: lastLocation$.instanceId,
|
||||||
occupants: 1,
|
occupants: playersInInstance.length,
|
||||||
users: []
|
users: []
|
||||||
};
|
};
|
||||||
instances[instance.id] = instance;
|
instances[instance.id] = instance;
|
||||||
}
|
}
|
||||||
instances[instance.id].occupants = playersInInstance.length;
|
|
||||||
var ref = API.cachedUsers.get(API.currentUser.id);
|
var ref = API.cachedUsers.get(API.currentUser.id);
|
||||||
if (typeof ref === 'undefined') {
|
if (typeof ref === 'undefined') {
|
||||||
ref = API.currentUser;
|
ref = API.currentUser;
|
||||||
@@ -8810,14 +8879,10 @@ speechSynthesis.getVoices();
|
|||||||
throw err;
|
throw err;
|
||||||
}).then((args) => {
|
}).then((args) => {
|
||||||
if (D.id === args.ref.id) {
|
if (D.id === args.ref.id) {
|
||||||
D.loading = false;
|
D.loading = false;
|
||||||
D.ref = args.ref;
|
D.ref = args.ref;
|
||||||
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
|
||||||
D.rooms = [];
|
this.updateVRChatCache();
|
||||||
this.applyWorldDialogInstances();
|
|
||||||
if (args.cache) {
|
|
||||||
API.getWorld(args.params);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
});
|
});
|
||||||
@@ -12016,6 +12081,16 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$app.methods.refreshInstancePlayerCount = function (instance) {
|
||||||
|
var L = API.parseLocation(instance);
|
||||||
|
if (L.worldId) {
|
||||||
|
API.getInstance({
|
||||||
|
worldId: L.worldId,
|
||||||
|
instanceId: L.instanceId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$app = new Vue($app);
|
$app = new Vue($app);
|
||||||
window.$app = $app;
|
window.$app = $app;
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -868,13 +868,13 @@ html
|
|||||||
div.options-container-item
|
div.options-container-item
|
||||||
el-button(size="small" icon="el-icon-chat-square" @click="showNotyFeedFiltersDialog()") Notification Filters
|
el-button(size="small" icon="el-icon-chat-square" @click="showNotyFeedFiltersDialog()") Notification Filters
|
||||||
br
|
br
|
||||||
span.sub-header TTS Options
|
span.sub-header Text-To-Speach Options
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
span.name Notification TTS, When to play:
|
span.name Notification TTS, When to play:
|
||||||
br
|
br
|
||||||
toggle-switch(:options="whenToPlayToggleSwitchOption" group="whenToPlayNotificationTTSToggleSwitchOption" v-model="notificationTTS" class="toggle-switch")
|
toggle-switch(:options="whenToPlayToggleSwitchOption" group="whenToPlayNotificationTTSToggleSwitchOption" v-model="notificationTTS" class="toggle-switch")
|
||||||
div.options-container-item
|
div.options-container-item
|
||||||
span.name Text-to-Speech Voice
|
span.name TTS Voice
|
||||||
el-dropdown(@command="(voice) => changeTTSVoice(voice)" trigger="click" size="small")
|
el-dropdown(@command="(voice) => changeTTSVoice(voice)" trigger="click" size="small")
|
||||||
el-button(v-text="TTSvoices[notificationTTSVoice].name" size="mini" :disabled="!notificationTTS")
|
el-button(v-text="TTSvoices[notificationTTSVoice].name" size="mini" :disabled="!notificationTTS")
|
||||||
el-dropdown-menu(#default="dropdown")
|
el-dropdown-menu(#default="dropdown")
|
||||||
@@ -1076,8 +1076,9 @@ html
|
|||||||
el-dropdown(trigger="click" @command="userDialogCommand" size="small")
|
el-dropdown(trigger="click" @command="userDialogCommand" size="small")
|
||||||
el-button(:type="(userDialog.incomingRequest || userDialog.outgoingRequest) ? 'success' : (userDialog.isBlock || userDialog.isMute || userDialog.isHideAvatar) ? 'danger' : 'default'" icon="el-icon-more" circle style="margin-left:5px")
|
el-button(:type="(userDialog.incomingRequest || userDialog.outgoingRequest) ? 'success' : (userDialog.isBlock || userDialog.isMute || userDialog.isHideAvatar) ? 'danger' : 'default'" icon="el-icon-more" circle style="margin-left:5px")
|
||||||
el-dropdown-menu(#default="dropdown")
|
el-dropdown-menu(#default="dropdown")
|
||||||
|
el-dropdown-item(icon="el-icon-refresh" command="Refresh") Refresh
|
||||||
template(v-if="userDialog.ref.id === API.currentUser.id")
|
template(v-if="userDialog.ref.id === API.currentUser.id")
|
||||||
el-dropdown-item(icon="el-icon-check" command="Select Avatar") Select Avatar By ID
|
el-dropdown-item(icon="el-icon-check" command="Select Avatar" divided) Select Avatar By ID
|
||||||
el-dropdown-item(icon="el-icon-s-custom" command="Show Avatar Author") Show Avatar Author
|
el-dropdown-item(icon="el-icon-s-custom" command="Show Avatar Author") Show Avatar Author
|
||||||
el-dropdown-item(icon="el-icon-s-custom" command="Show Fallback Avatar Details") Show Fallback Avatar Details
|
el-dropdown-item(icon="el-icon-s-custom" command="Show Fallback Avatar Details") Show Fallback Avatar Details
|
||||||
el-dropdown-item(icon="el-icon-edit" command="Edit Social Status" divided) Social Status
|
el-dropdown-item(icon="el-icon-edit" command="Edit Social Status" divided) Social Status
|
||||||
@@ -1086,11 +1087,11 @@ html
|
|||||||
el-dropdown-item(icon="el-icon-switch-button" command="Logout" divided) Logout
|
el-dropdown-item(icon="el-icon-switch-button" command="Logout" divided) Logout
|
||||||
template(v-else)
|
template(v-else)
|
||||||
template(v-if="userDialog.isFriend")
|
template(v-if="userDialog.isFriend")
|
||||||
|
el-dropdown-item(icon="el-icon-postcard" command="Request Invite" divided) Request Invite
|
||||||
|
el-dropdown-item(icon="el-icon-postcard" command="Request Invite Message") Request Invite With Message
|
||||||
template(v-if="lastLocation.location && isGameRunning")
|
template(v-if="lastLocation.location && isGameRunning")
|
||||||
el-dropdown-item(icon="el-icon-message" command="Invite") Invite
|
el-dropdown-item(icon="el-icon-message" command="Invite") Invite
|
||||||
el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message
|
el-dropdown-item(icon="el-icon-message" command="Invite Message") Invite With Message
|
||||||
el-dropdown-item(icon="el-icon-postcard" command="Request Invite") Request Invite
|
|
||||||
el-dropdown-item(icon="el-icon-postcard" command="Request Invite Message") Request Invite With Message
|
|
||||||
template(v-else-if="userDialog.incomingRequest")
|
template(v-else-if="userDialog.incomingRequest")
|
||||||
el-dropdown-item(icon="el-icon-check" command="Accept Friend Request") Accept Friend Request
|
el-dropdown-item(icon="el-icon-check" command="Accept Friend Request") Accept Friend Request
|
||||||
el-dropdown-item(icon="el-icon-close" command="Decline Friend Request") Decline Friend Request
|
el-dropdown-item(icon="el-icon-close" command="Decline Friend Request") Decline Friend Request
|
||||||
@@ -1113,6 +1114,7 @@ html
|
|||||||
div(style="flex:none")
|
div(style="flex:none")
|
||||||
location(:location="userDialog.ref.location")
|
location(:location="userDialog.ref.location")
|
||||||
template(#default v-if="userDialog.instance.occupants") ({{ userDialog.instance.occupants }})
|
template(#default v-if="userDialog.instance.occupants") ({{ userDialog.instance.occupants }})
|
||||||
|
el-button(v-if="userDialog.ref.location !== lastLocation.location && userDialog.ref.location !== 'private' && userDialog.ref.location !== 'offline'" @click="refreshInstancePlayerCount(userDialog.ref.location)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle)
|
||||||
launch(:location="userDialog.ref.location" style="margin-left:5px")
|
launch(:location="userDialog.ref.location" style="margin-left:5px")
|
||||||
invite-yourself(:location="userDialog.ref.location" style="margin-left:5px")
|
invite-yourself(:location="userDialog.ref.location" style="margin-left:5px")
|
||||||
el-button(v-if="copyLocationCheck(userDialog.ref.location)" @click="copyLocation(userDialog.ref.location)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
|
el-button(v-if="copyLocationCheck(userDialog.ref.location)" @click="copyLocation(userDialog.ref.location)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
|
||||||
@@ -1287,6 +1289,7 @@ html
|
|||||||
div(style="margin:5px 0")
|
div(style="margin:5px 0")
|
||||||
span.x-link(@click="showLaunchDialog(room.$location.tag)").
|
span.x-link(@click="showLaunchDialog(room.$location.tag)").
|
||||||
\#{{ room.$location.instanceName }} {{ room.$location.accessType }} #[template(v-if="room.occupants") ({{ room.occupants }})]
|
\#{{ room.$location.instanceName }} {{ room.$location.accessType }} #[template(v-if="room.occupants") ({{ room.occupants }})]
|
||||||
|
el-button(v-if="room.$location.tag !== lastLocation.location && room.$location.tag !== 'private' && room.$location.tag !== 'offline'" @click="refreshInstancePlayerCount(room.$location.tag)" size="mini" icon="el-icon-refresh" style="margin-left:5px" circle)
|
||||||
invite-yourself(:location="room.$location.tag" style="margin-left:5px")
|
invite-yourself(:location="room.$location.tag" style="margin-left:5px")
|
||||||
el-button(v-if="copyLocationCheck(room.$location.tag)" @click="copyLocation(room.$location.tag)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
|
el-button(v-if="copyLocationCheck(room.$location.tag)" @click="copyLocation(room.$location.tag)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
|
||||||
.x-friend-list(style="margin:10px 0" v-if="room.$location.userId || room.users.length")
|
.x-friend-list(style="margin:10px 0" v-if="room.$location.userId || room.users.length")
|
||||||
|
|||||||
Reference in New Issue
Block a user