mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-26 18:23:47 +02:00
Add vrcPlusWorld groups
This commit is contained in:
@@ -52,11 +52,13 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
maxFavoriteGroups: {
|
||||
avatar: 6,
|
||||
friend: 3,
|
||||
vrcPlusWorld: 4,
|
||||
world: 4
|
||||
},
|
||||
maxFavoritesPerGroup: {
|
||||
avatar: 50,
|
||||
friend: 150,
|
||||
vrcPlusWorld: 100,
|
||||
world: 100
|
||||
}
|
||||
});
|
||||
@@ -373,11 +375,12 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) {
|
||||
avatarDialog.isFavorite = false;
|
||||
}
|
||||
countFavoriteGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {'friend' | 'world' | 'avatar'} type
|
||||
* @param {'friend' | 'world' | 'vrcPlusWorld' | 'avatar'} type
|
||||
* @param {string} objectId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@@ -409,7 +412,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
ctx.ref = ref;
|
||||
ctx.name = ref.displayName;
|
||||
}
|
||||
} else if (type === 'world') {
|
||||
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||
ref = worldStore.cachedWorlds.get(objectId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
ctx.ref = ref;
|
||||
@@ -430,7 +433,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
isTypeChanged = true;
|
||||
if (type === 'friend') {
|
||||
removeFromArray(state.favoriteFriends_, ctx);
|
||||
} else if (type === 'world') {
|
||||
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||
removeFromArray(state.favoriteWorlds_, ctx);
|
||||
} else if (type === 'avatar') {
|
||||
removeFromArray(state.favoriteAvatars_, ctx);
|
||||
@@ -447,7 +450,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
}
|
||||
// else too bad
|
||||
} else if (type === 'world') {
|
||||
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||
ref = worldStore.cachedWorlds.get(objectId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
if (ctx.ref !== ref) {
|
||||
@@ -501,7 +504,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
if (isTypeChanged) {
|
||||
if (type === 'friend') {
|
||||
state.favoriteFriends_.push(ctx);
|
||||
} else if (type === 'world') {
|
||||
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||
state.favoriteWorlds_.push(ctx);
|
||||
} else if (type === 'avatar') {
|
||||
state.favoriteAvatars_.push(ctx);
|
||||
@@ -544,7 +547,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
function buildFavoriteGroups() {
|
||||
let group;
|
||||
let groups;
|
||||
let ref;
|
||||
let i;
|
||||
// 450 = ['group_0', 'group_1', 'group_2'] x 150
|
||||
favoriteFriendGroups.value = [];
|
||||
@@ -574,6 +576,24 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
visibility: 'private'
|
||||
});
|
||||
}
|
||||
// 400 = ['vrcPlusWorlds1', 'vrcPlusWorlds2', 'vrcPlusWorlds3', 'vrcPlusWorlds4'] x 100
|
||||
for (
|
||||
i = 0;
|
||||
i < favoriteLimits.value.maxFavoriteGroups.vrcPlusWorld;
|
||||
++i
|
||||
) {
|
||||
favoriteWorldGroups.value.push({
|
||||
assign: false,
|
||||
key: `vrcPlusWorld:vrcPlusWorlds${i + 1}`,
|
||||
type: 'vrcPlusWorld',
|
||||
name: `vrcPlusWorlds${i + 1}`,
|
||||
displayName: `VRC+ Group ${i + 1}`,
|
||||
capacity:
|
||||
favoriteLimits.value.maxFavoritesPerGroup.vrcPlusWorld,
|
||||
count: 0,
|
||||
visibility: 'private'
|
||||
});
|
||||
}
|
||||
// 350 = ['avatars1', ...] x 50
|
||||
// Favorite Avatars (0/50)
|
||||
// VRC+ Group 1..5 (0/50)
|
||||
@@ -593,6 +613,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
const types = {
|
||||
friend: favoriteFriendGroups.value,
|
||||
world: favoriteWorldGroups.value,
|
||||
vrcPlusWorld: favoriteWorldGroups.value,
|
||||
avatar: favoriteAvatarGroups.value
|
||||
};
|
||||
const assigns = new Set();
|
||||
@@ -636,10 +657,16 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
// update favorites
|
||||
countFavoriteGroups();
|
||||
}
|
||||
|
||||
for (ref of cachedFavorites.values()) {
|
||||
group = getCachedFavoriteGroupsByTypeName()[ref.$groupKey];
|
||||
function countFavoriteGroups() {
|
||||
const cachedFavoriteGroups = getCachedFavoriteGroupsByTypeName();
|
||||
for (const key in cachedFavoriteGroups) {
|
||||
cachedFavoriteGroups[key].count = 0;
|
||||
}
|
||||
for (let ref of cachedFavorites.values()) {
|
||||
let group = cachedFavoriteGroups[ref.$groupKey];
|
||||
if (typeof group === 'undefined') {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user