mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Add vrcPlusWorld groups
This commit is contained in:
@@ -145,7 +145,7 @@
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
favoriteRequest
|
favoriteRequest
|
||||||
.addFavorite({
|
.addFavorite({
|
||||||
type: D.type,
|
type: group.type,
|
||||||
favoriteId: D.objectId,
|
favoriteId: D.objectId,
|
||||||
tags: group.name
|
tags: group.name
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -52,11 +52,13 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
maxFavoriteGroups: {
|
maxFavoriteGroups: {
|
||||||
avatar: 6,
|
avatar: 6,
|
||||||
friend: 3,
|
friend: 3,
|
||||||
|
vrcPlusWorld: 4,
|
||||||
world: 4
|
world: 4
|
||||||
},
|
},
|
||||||
maxFavoritesPerGroup: {
|
maxFavoritesPerGroup: {
|
||||||
avatar: 50,
|
avatar: 50,
|
||||||
friend: 150,
|
friend: 150,
|
||||||
|
vrcPlusWorld: 100,
|
||||||
world: 100
|
world: 100
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -373,11 +375,12 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) {
|
if (avatarDialog.visible && avatarDialog.id === ref.favoriteId) {
|
||||||
avatarDialog.isFavorite = false;
|
avatarDialog.isFavorite = false;
|
||||||
}
|
}
|
||||||
|
countFavoriteGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {'friend' | 'world' | 'avatar'} type
|
* @param {'friend' | 'world' | 'vrcPlusWorld' | 'avatar'} type
|
||||||
* @param {string} objectId
|
* @param {string} objectId
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@@ -409,7 +412,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
ctx.ref = ref;
|
ctx.ref = ref;
|
||||||
ctx.name = ref.displayName;
|
ctx.name = ref.displayName;
|
||||||
}
|
}
|
||||||
} else if (type === 'world') {
|
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||||
ref = worldStore.cachedWorlds.get(objectId);
|
ref = worldStore.cachedWorlds.get(objectId);
|
||||||
if (typeof ref !== 'undefined') {
|
if (typeof ref !== 'undefined') {
|
||||||
ctx.ref = ref;
|
ctx.ref = ref;
|
||||||
@@ -430,7 +433,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
isTypeChanged = true;
|
isTypeChanged = true;
|
||||||
if (type === 'friend') {
|
if (type === 'friend') {
|
||||||
removeFromArray(state.favoriteFriends_, ctx);
|
removeFromArray(state.favoriteFriends_, ctx);
|
||||||
} else if (type === 'world') {
|
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||||
removeFromArray(state.favoriteWorlds_, ctx);
|
removeFromArray(state.favoriteWorlds_, ctx);
|
||||||
} else if (type === 'avatar') {
|
} else if (type === 'avatar') {
|
||||||
removeFromArray(state.favoriteAvatars_, ctx);
|
removeFromArray(state.favoriteAvatars_, ctx);
|
||||||
@@ -447,7 +450,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else too bad
|
// else too bad
|
||||||
} else if (type === 'world') {
|
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||||
ref = worldStore.cachedWorlds.get(objectId);
|
ref = worldStore.cachedWorlds.get(objectId);
|
||||||
if (typeof ref !== 'undefined') {
|
if (typeof ref !== 'undefined') {
|
||||||
if (ctx.ref !== ref) {
|
if (ctx.ref !== ref) {
|
||||||
@@ -501,7 +504,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
if (isTypeChanged) {
|
if (isTypeChanged) {
|
||||||
if (type === 'friend') {
|
if (type === 'friend') {
|
||||||
state.favoriteFriends_.push(ctx);
|
state.favoriteFriends_.push(ctx);
|
||||||
} else if (type === 'world') {
|
} else if (type === 'world' || type === 'vrcPlusWorld') {
|
||||||
state.favoriteWorlds_.push(ctx);
|
state.favoriteWorlds_.push(ctx);
|
||||||
} else if (type === 'avatar') {
|
} else if (type === 'avatar') {
|
||||||
state.favoriteAvatars_.push(ctx);
|
state.favoriteAvatars_.push(ctx);
|
||||||
@@ -544,7 +547,6 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
function buildFavoriteGroups() {
|
function buildFavoriteGroups() {
|
||||||
let group;
|
let group;
|
||||||
let groups;
|
let groups;
|
||||||
let ref;
|
|
||||||
let i;
|
let i;
|
||||||
// 450 = ['group_0', 'group_1', 'group_2'] x 150
|
// 450 = ['group_0', 'group_1', 'group_2'] x 150
|
||||||
favoriteFriendGroups.value = [];
|
favoriteFriendGroups.value = [];
|
||||||
@@ -574,6 +576,24 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
visibility: 'private'
|
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
|
// 350 = ['avatars1', ...] x 50
|
||||||
// Favorite Avatars (0/50)
|
// Favorite Avatars (0/50)
|
||||||
// VRC+ Group 1..5 (0/50)
|
// VRC+ Group 1..5 (0/50)
|
||||||
@@ -593,6 +613,7 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
const types = {
|
const types = {
|
||||||
friend: favoriteFriendGroups.value,
|
friend: favoriteFriendGroups.value,
|
||||||
world: favoriteWorldGroups.value,
|
world: favoriteWorldGroups.value,
|
||||||
|
vrcPlusWorld: favoriteWorldGroups.value,
|
||||||
avatar: favoriteAvatarGroups.value
|
avatar: favoriteAvatarGroups.value
|
||||||
};
|
};
|
||||||
const assigns = new Set();
|
const assigns = new Set();
|
||||||
@@ -636,10 +657,16 @@ export const useFavoriteStore = defineStore('Favorite', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// update favorites
|
countFavoriteGroups();
|
||||||
|
}
|
||||||
|
|
||||||
for (ref of cachedFavorites.values()) {
|
function countFavoriteGroups() {
|
||||||
group = getCachedFavoriteGroupsByTypeName()[ref.$groupKey];
|
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') {
|
if (typeof group === 'undefined') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,8 +426,8 @@
|
|||||||
import { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
import { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||||
import { MoreFilled, Plus, Refresh } from '@element-plus/icons-vue';
|
import { MoreFilled, Plus, Refresh } from '@element-plus/icons-vue';
|
||||||
import { Ellipsis, RefreshCcw } from 'lucide-vue-next';
|
import { Ellipsis, RefreshCcw } from 'lucide-vue-next';
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
import { InputGroupField, InputGroupSearch } from '@/components/ui/input-group';
|
import { InputGroupField, InputGroupSearch } from '@/components/ui/input-group';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
import { ElMessageBox } from 'element-plus';
|
import { ElMessageBox } from 'element-plus';
|
||||||
import { Spinner } from '@/components/ui/spinner';
|
import { Spinner } from '@/components/ui/spinner';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
@@ -1023,10 +1023,10 @@
|
|||||||
getLocalWorldFavorites();
|
getLocalWorldFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeWorldGroupVisibility(name, visibility, menuKey = null) {
|
function changeWorldGroupVisibility(group, visibility, menuKey = null) {
|
||||||
const params = {
|
const params = {
|
||||||
type: 'world',
|
type: group.type,
|
||||||
group: name,
|
group: group.name,
|
||||||
visibility
|
visibility
|
||||||
};
|
};
|
||||||
favoriteRequest.saveFavoriteGroup(params).then((args) => {
|
favoriteRequest.saveFavoriteGroup(params).then((args) => {
|
||||||
@@ -1120,7 +1120,7 @@
|
|||||||
|
|
||||||
function handleVisibilitySelection(group, visibility) {
|
function handleVisibilitySelection(group, visibility) {
|
||||||
const menuKey = remoteGroupMenuKey(group.key);
|
const menuKey = remoteGroupMenuKey(group.key);
|
||||||
changeWorldGroupVisibility(group.name, visibility, menuKey);
|
changeWorldGroupVisibility(group, visibility, menuKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRemoteRename(group) {
|
function handleRemoteRename(group) {
|
||||||
@@ -1164,7 +1164,7 @@
|
|||||||
}
|
}
|
||||||
favoriteRequest
|
favoriteRequest
|
||||||
.saveFavoriteGroup({
|
.saveFavoriteGroup({
|
||||||
type: 'world',
|
type: group.type,
|
||||||
group: group.name,
|
group: group.name,
|
||||||
displayName: newName
|
displayName: newName
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
function addFavoriteWorld(groupAPI) {
|
function addFavoriteWorld(groupAPI) {
|
||||||
return favoriteRequest
|
return favoriteRequest
|
||||||
.addFavorite({
|
.addFavorite({
|
||||||
type: 'world',
|
type: groupAPI.type,
|
||||||
favoriteId: props.currentFavorite.id,
|
favoriteId: props.currentFavorite.id,
|
||||||
tags: groupAPI.name
|
tags: groupAPI.name
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -359,7 +359,7 @@
|
|||||||
function addFavoriteWorld(ref, group, message) {
|
function addFavoriteWorld(ref, group, message) {
|
||||||
return favoriteRequest
|
return favoriteRequest
|
||||||
.addFavorite({
|
.addFavorite({
|
||||||
type: 'world',
|
type: group.type,
|
||||||
favoriteId: ref.id,
|
favoriteId: ref.id,
|
||||||
tags: group.name
|
tags: group.name
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user