mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Stickers and Focus view for world (#925)
Add required elements for stickers Add focus view tag for worlds
This commit is contained in:
161
html/src/app.js
161
html/src/app.js
@@ -15361,6 +15361,7 @@ speechSynthesis.getVoices();
|
||||
},
|
||||
layout: 'table'
|
||||
};
|
||||
$app.data.stickerTable = [];
|
||||
$app.data.emojiTable = [];
|
||||
$app.data.VRCPlusIconsTable = [];
|
||||
$app.data.galleryTable = [];
|
||||
@@ -18316,6 +18317,8 @@ speechSynthesis.getVoices();
|
||||
isQuest: false,
|
||||
isIos: false,
|
||||
avatarScalingDisabled: false,
|
||||
focusViewDisabled: false,
|
||||
stickersDisabled: false,
|
||||
inCache: false,
|
||||
cacheSize: '',
|
||||
bundleSizes: [],
|
||||
@@ -18336,6 +18339,8 @@ speechSynthesis.getVoices();
|
||||
isQuest: false,
|
||||
isIos: false,
|
||||
avatarScalingDisabled: false,
|
||||
focusViewDisabled: false,
|
||||
stickersDisabled: false,
|
||||
inCache: false,
|
||||
cacheSize: '',
|
||||
bundleSizes: [],
|
||||
@@ -18350,6 +18355,8 @@ speechSynthesis.getVoices();
|
||||
isQuest: false,
|
||||
isIos: false,
|
||||
avatarScalingDisabled: false,
|
||||
focusViewDisabled: false,
|
||||
stickersDisabled: false,
|
||||
inCache: false,
|
||||
cacheSize: '',
|
||||
bundleSizes: [],
|
||||
@@ -18369,6 +18376,10 @@ speechSynthesis.getVoices();
|
||||
this.currentInstanceWorld.isIos = isIos;
|
||||
this.currentInstanceWorld.avatarScalingDisabled =
|
||||
args.ref?.tags.includes('feature_avatar_scaling_disabled');
|
||||
this.currentInstanceWorld.focusViewDisabled =
|
||||
args.ref?.tags.includes('feature_focus_view_disabled');
|
||||
this.currentInstanceWorld.stickersDisabled =
|
||||
args.ref?.tags.includes('feature_stickers_disabled');
|
||||
this.checkVRChatCache(args.ref).then((cacheInfo) => {
|
||||
if (cacheInfo.Item1 > 0) {
|
||||
this.currentInstanceWorld.inCache = true;
|
||||
@@ -19044,6 +19055,8 @@ speechSynthesis.getVoices();
|
||||
ref: {},
|
||||
isFavorite: false,
|
||||
avatarScalingDisabled: false,
|
||||
focusViewDisabled: false,
|
||||
stickersDisabled: false,
|
||||
rooms: [],
|
||||
treeData: [],
|
||||
bundleSizes: [],
|
||||
@@ -19085,6 +19098,12 @@ speechSynthesis.getVoices();
|
||||
D.avatarScalingDisabled = ref.tags?.includes(
|
||||
'feature_avatar_scaling_disabled'
|
||||
);
|
||||
D.focusViewDisabled = ref.tags?.includes(
|
||||
'feature_focus_view_disabled'
|
||||
);
|
||||
D.stickersDisabled = ref.tags?.includes(
|
||||
'feature_stickers_disabled'
|
||||
);
|
||||
$app.applyWorldDialogInstances();
|
||||
for (var room of D.rooms) {
|
||||
if ($app.isRealInstance(room.tag)) {
|
||||
@@ -19224,6 +19243,8 @@ speechSynthesis.getVoices();
|
||||
D.timeSpent = 0;
|
||||
D.isFavorite = false;
|
||||
D.avatarScalingDisabled = false;
|
||||
D.focusViewDisabled = false;
|
||||
D.stickersDisabled = false;
|
||||
D.isPC = false;
|
||||
D.isQuest = false;
|
||||
D.isIos = false;
|
||||
@@ -19283,6 +19304,12 @@ speechSynthesis.getVoices();
|
||||
D.avatarScalingDisabled = args.ref?.tags.includes(
|
||||
'feature_avatar_scaling_disabled'
|
||||
);
|
||||
D.focusViewDisabled = args.ref?.tags.includes(
|
||||
'feature_focus_view_disabled'
|
||||
);
|
||||
D.stickersDisabled = args.ref?.tags.includes(
|
||||
'feature_stickers_disabled'
|
||||
);
|
||||
D.isPC = isPC;
|
||||
D.isQuest = isQuest;
|
||||
D.isIos = isIos;
|
||||
@@ -21109,6 +21136,8 @@ speechSynthesis.getVoices();
|
||||
contentTags: [],
|
||||
debugAllowed: false,
|
||||
avatarScalingDisabled: false,
|
||||
focusViewDisabled: false,
|
||||
stickersDisabled: false,
|
||||
contentHorror: false,
|
||||
contentGore: false,
|
||||
contentViolence: false,
|
||||
@@ -21122,6 +21151,8 @@ speechSynthesis.getVoices();
|
||||
D.visible = true;
|
||||
D.debugAllowed = false;
|
||||
D.avatarScalingDisabled = false;
|
||||
D.focusViewDisabled = false;
|
||||
D.stickersDisabled = false;
|
||||
D.contentHorror = false;
|
||||
D.contentGore = false;
|
||||
D.contentViolence = false;
|
||||
@@ -21160,6 +21191,12 @@ speechSynthesis.getVoices();
|
||||
case 'feature_avatar_scaling_disabled':
|
||||
D.avatarScalingDisabled = true;
|
||||
break;
|
||||
case 'feature_focus_view_disabled':
|
||||
D.focusViewDisabled = true;
|
||||
break;
|
||||
case 'feature_stickers_disabled':
|
||||
D.stickersDisabled = true;
|
||||
break;
|
||||
}
|
||||
});
|
||||
D.authorTags = authorTags.toString();
|
||||
@@ -21212,6 +21249,12 @@ speechSynthesis.getVoices();
|
||||
if (D.avatarScalingDisabled) {
|
||||
tags.unshift('feature_avatar_scaling_disabled');
|
||||
}
|
||||
if (D.focusViewDisabled) {
|
||||
tags.unshift('feature_focus_view_disabled');
|
||||
}
|
||||
if (D.stickersDisabled) {
|
||||
tags.unshift('feature_stickers_disabled');
|
||||
}
|
||||
API.saveWorld({
|
||||
id: this.worldDialog.id,
|
||||
tags
|
||||
@@ -25374,6 +25417,8 @@ speechSynthesis.getVoices();
|
||||
$app.data.galleryDialogVisible = false;
|
||||
$app.data.galleryDialogGalleryLoading = false;
|
||||
$app.data.galleryDialogIconsLoading = false;
|
||||
$app.data.galleryDialogEmojisLoading = false;
|
||||
$app.data.galleryDialogStickersLoading = false;
|
||||
|
||||
API.$on('LOGIN', function () {
|
||||
$app.galleryTable = [];
|
||||
@@ -25385,6 +25430,7 @@ speechSynthesis.getVoices();
|
||||
this.refreshGalleryTable();
|
||||
this.refreshVRCPlusIconsTable();
|
||||
this.refreshEmojiTable();
|
||||
this.refreshStickerTable();
|
||||
workerTimers.setTimeout(() => this.setGalleryTab(pageNum), 100);
|
||||
};
|
||||
|
||||
@@ -25537,6 +25583,117 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
});
|
||||
|
||||
// #endregion
|
||||
// #endregion
|
||||
// #region | Sticker
|
||||
API.$on('LOGIN', function () {
|
||||
$app.stickerTable = [];
|
||||
});
|
||||
|
||||
$app.methods.refreshStickerTable = function () {
|
||||
this.galleryDialogStickersLoading = true;
|
||||
var params = {
|
||||
n: 100,
|
||||
tag: 'sticker'
|
||||
};
|
||||
API.getFileList(params);
|
||||
};
|
||||
|
||||
API.$on('FILES:LIST', function (args) {
|
||||
if (args.params.tag === 'sticker') {
|
||||
$app.stickerTable = args.json.reverse();
|
||||
$app.galleryDialogStickersLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
$app.methods.deleteSticker = function (fileId) {
|
||||
API.deleteFile(fileId).then((args) => {
|
||||
API.$emit('STICKER:DELETE', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
API.$on('STICKER:DELETE', function (args) {
|
||||
var array = $app.stickerTable;
|
||||
var { length } = array;
|
||||
for (var i = 0; i < length; ++i) {
|
||||
if (args.fileId === array[i].id) {
|
||||
array.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$app.methods.onFileChangeSticker = function (e) {
|
||||
var clearFile = function () {
|
||||
if (document.querySelector('#StickerUploadButton')) {
|
||||
document.querySelector('#StickerUploadButton').value = '';
|
||||
}
|
||||
};
|
||||
var files = e.target.files || e.dataTransfer.files;
|
||||
if (!files.length) {
|
||||
return;
|
||||
}
|
||||
if (files[0].size >= 100000000) {
|
||||
// 100MB
|
||||
$app.$message({
|
||||
message: 'File size too large',
|
||||
type: 'error'
|
||||
});
|
||||
clearFile();
|
||||
return;
|
||||
}
|
||||
if (!files[0].type.match(/image.*/)) {
|
||||
$app.$message({
|
||||
message: "File isn't an image",
|
||||
type: 'error'
|
||||
});
|
||||
clearFile();
|
||||
return;
|
||||
}
|
||||
var r = new FileReader();
|
||||
r.onload = function () {
|
||||
var params = {
|
||||
tag: 'sticker',
|
||||
maskTag: 'square'
|
||||
};
|
||||
var base64Body = btoa(r.result);
|
||||
API.uploadSticker(base64Body, params).then((args) => {
|
||||
$app.$message({
|
||||
message: 'Sticker uploaded',
|
||||
type: 'success'
|
||||
});
|
||||
return args;
|
||||
});
|
||||
};
|
||||
r.readAsBinaryString(files[0]);
|
||||
clearFile();
|
||||
};
|
||||
|
||||
$app.methods.displayStickerUpload = function () {
|
||||
document.getElementById('StickerUploadButton').click();
|
||||
};
|
||||
|
||||
API.uploadSticker = function (imageData, params) {
|
||||
return this.call('file/image', {
|
||||
uploadImage: true,
|
||||
postData: JSON.stringify(params),
|
||||
imageData
|
||||
}).then((json) => {
|
||||
var args = {
|
||||
json,
|
||||
params
|
||||
};
|
||||
this.$emit('STICKER:ADD', args);
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
API.$on('STICKER:ADD', function (args) {
|
||||
if (Object.keys($app.stickerTable).length !== 0) {
|
||||
$app.stickerTable.unshift(args.json);
|
||||
}
|
||||
});
|
||||
// #endregion
|
||||
// #region | Emoji
|
||||
|
||||
@@ -25545,7 +25702,7 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
|
||||
$app.methods.refreshEmojiTable = function () {
|
||||
this.galleryDialogIconsLoading = true;
|
||||
this.galleryDialogEmojisLoading = true;
|
||||
var params = {
|
||||
n: 100,
|
||||
tag: 'emoji'
|
||||
@@ -25556,7 +25713,7 @@ speechSynthesis.getVoices();
|
||||
API.$on('FILES:LIST', function (args) {
|
||||
if (args.params.tag === 'emoji') {
|
||||
$app.emojiTable = args.json.reverse();
|
||||
$app.galleryDialogIconsLoading = false;
|
||||
$app.galleryDialogEmojisLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user