mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Dynamic favorite group sizes
This commit is contained in:
@@ -3203,6 +3203,18 @@ speechSynthesis.getVoices();
|
|||||||
API.favoriteAvatarGroups = [];
|
API.favoriteAvatarGroups = [];
|
||||||
API.isFavoriteLoading = false;
|
API.isFavoriteLoading = false;
|
||||||
API.isFavoriteGroupLoading = false;
|
API.isFavoriteGroupLoading = false;
|
||||||
|
API.favoriteLimits = {
|
||||||
|
maxFavoriteGroups: {
|
||||||
|
avatar: 6,
|
||||||
|
friend: 3,
|
||||||
|
world: 4
|
||||||
|
},
|
||||||
|
maxFavoritesPerGroup: {
|
||||||
|
avatar: 50,
|
||||||
|
friend: 150,
|
||||||
|
world: 100
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
API.$on('LOGIN', function () {
|
API.$on('LOGIN', function () {
|
||||||
this.cachedFavorites.clear();
|
this.cachedFavorites.clear();
|
||||||
@@ -3484,11 +3496,12 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
API.refreshFavorites = function () {
|
API.refreshFavorites = async function () {
|
||||||
if (this.isFavoriteLoading) {
|
if (this.isFavoriteLoading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isFavoriteLoading = true;
|
this.isFavoriteLoading = true;
|
||||||
|
await this.getFavoriteLimits();
|
||||||
this.expireFavorites();
|
this.expireFavorites();
|
||||||
this.bulk({
|
this.bulk({
|
||||||
fn: 'getFavorites',
|
fn: 'getFavorites',
|
||||||
@@ -3538,28 +3551,28 @@ speechSynthesis.getVoices();
|
|||||||
API.buildFavoriteGroups = function () {
|
API.buildFavoriteGroups = function () {
|
||||||
// 450 = ['group_0', 'group_1', 'group_2'] x 150
|
// 450 = ['group_0', 'group_1', 'group_2'] x 150
|
||||||
this.favoriteFriendGroups = [];
|
this.favoriteFriendGroups = [];
|
||||||
for (var i = 0; i < 3; ++i) {
|
for (var i = 0; i < this.favoriteLimits.maxFavoriteGroups.friend; ++i) {
|
||||||
this.favoriteFriendGroups.push({
|
this.favoriteFriendGroups.push({
|
||||||
assign: false,
|
assign: false,
|
||||||
key: `friend:group_${i}`,
|
key: `friend:group_${i}`,
|
||||||
type: 'friend',
|
type: 'friend',
|
||||||
name: `group_${i}`,
|
name: `group_${i}`,
|
||||||
displayName: `Group ${i + 1}`,
|
displayName: `Group ${i + 1}`,
|
||||||
capacity: 150,
|
capacity: this.favoriteLimits.maxFavoritesPerGroup.friend,
|
||||||
count: 0,
|
count: 0,
|
||||||
visibility: 'private'
|
visibility: 'private'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 400 = ['worlds1', 'worlds2', 'worlds3', 'worlds4'] x 100
|
// 400 = ['worlds1', 'worlds2', 'worlds3', 'worlds4'] x 100
|
||||||
this.favoriteWorldGroups = [];
|
this.favoriteWorldGroups = [];
|
||||||
for (var i = 0; i < 4; ++i) {
|
for (var i = 0; i < this.favoriteLimits.maxFavoriteGroups.world; ++i) {
|
||||||
this.favoriteWorldGroups.push({
|
this.favoriteWorldGroups.push({
|
||||||
assign: false,
|
assign: false,
|
||||||
key: `world:worlds${i + 1}`,
|
key: `world:worlds${i + 1}`,
|
||||||
type: 'world',
|
type: 'world',
|
||||||
name: `worlds${i + 1}`,
|
name: `worlds${i + 1}`,
|
||||||
displayName: `Group ${i + 1}`,
|
displayName: `Group ${i + 1}`,
|
||||||
capacity: 100,
|
capacity: this.favoriteLimits.maxFavoritesPerGroup.world,
|
||||||
count: 0,
|
count: 0,
|
||||||
visibility: 'private'
|
visibility: 'private'
|
||||||
});
|
});
|
||||||
@@ -3568,14 +3581,14 @@ speechSynthesis.getVoices();
|
|||||||
// Favorite Avatars (0/50)
|
// Favorite Avatars (0/50)
|
||||||
// VRC+ Group 1..5 (0/50)
|
// VRC+ Group 1..5 (0/50)
|
||||||
this.favoriteAvatarGroups = [];
|
this.favoriteAvatarGroups = [];
|
||||||
for (var i = 0; i < 6; ++i) {
|
for (var i = 0; i < this.favoriteLimits.maxFavoriteGroups.avatar; ++i) {
|
||||||
this.favoriteAvatarGroups.push({
|
this.favoriteAvatarGroups.push({
|
||||||
assign: false,
|
assign: false,
|
||||||
key: `avatar:avatars${i + 1}`,
|
key: `avatar:avatars${i + 1}`,
|
||||||
type: 'avatar',
|
type: 'avatar',
|
||||||
name: `avatars${i + 1}`,
|
name: `avatars${i + 1}`,
|
||||||
displayName: `Group ${i + 1}`,
|
displayName: `Group ${i + 1}`,
|
||||||
capacity: 50,
|
capacity: this.favoriteLimits.maxFavoritesPerGroup.avatar,
|
||||||
count: 0,
|
count: 0,
|
||||||
visibility: 'private'
|
visibility: 'private'
|
||||||
});
|
});
|
||||||
@@ -3674,6 +3687,25 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
API.getFavoriteLimits = function () {
|
||||||
|
return this.call('auth/user/favoritelimits', {
|
||||||
|
method: 'GET'
|
||||||
|
}).then((json) => {
|
||||||
|
var args = {
|
||||||
|
json
|
||||||
|
};
|
||||||
|
this.$emit('FAVORITE:LIMITS', args);
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
API.$on('FAVORITE:LIMITS', function (args) {
|
||||||
|
this.favoriteLimits = {
|
||||||
|
...this.favoriteLimits,
|
||||||
|
...args.json
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
API.refreshFavoriteGroups = function () {
|
API.refreshFavoriteGroups = function () {
|
||||||
if (this.isFavoriteGroupLoading) {
|
if (this.isFavoriteGroupLoading) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1768,7 +1768,7 @@ html
|
|||||||
span(slot="label")
|
span(slot="label")
|
||||||
span(v-text="list[0]" style="font-weight:bold;font-size:16px")
|
span(v-text="list[0]" style="font-weight:bold;font-size:16px")
|
||||||
i.x-user-status(style="margin-left:5px" :class="userFavoriteWorldsStatus(list[1])")
|
i.x-user-status(style="margin-left:5px" :class="userFavoriteWorldsStatus(list[1])")
|
||||||
span(style="color:#909399;font-size:12px;margin-left:5px") {{ list[2].length }}/100
|
span(style="color:#909399;font-size:12px;margin-left:5px") {{ list[2].length }}/{{ API.favoriteLimits.maxFavoritesPerGroup.world }}
|
||||||
.x-friend-list(style="margin-top:10px;margin-bottom:15px;min-height:60px")
|
.x-friend-list(style="margin-top:10px;margin-bottom:15px;min-height:60px")
|
||||||
.x-friend-item(v-for="world in list[2]" :key="world.id" @click="showWorldDialog(world.id)" class="x-friend-item-border")
|
.x-friend-item(v-for="world in list[2]" :key="world.id" @click="showWorldDialog(world.id)" class="x-friend-item-border")
|
||||||
.avatar
|
.avatar
|
||||||
|
|||||||
Reference in New Issue
Block a user