mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-14 02:28:22 +02:00
Perform CR updates.
This commit is contained in:
parent
c074f7573c
commit
343f883ac3
11 changed files with 379 additions and 338 deletions
31
unpublishedScripts/package-manager/inventory/.eslintrc.js
Normal file
31
unpublishedScripts/package-manager/inventory/.eslintrc.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 5
|
||||||
|
},
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
|
||||||
|
"camelcase": ["error"],
|
||||||
|
"comma-dangle": ["error", "never"],
|
||||||
|
"curly": ["error", "all"],
|
||||||
|
"eqeqeq": ["error", "always"],
|
||||||
|
"indent": ["error", 4, { "SwitchCase": 1 }],
|
||||||
|
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }],
|
||||||
|
"keyword-spacing": ["error", { "before": true, "after": true }],
|
||||||
|
"max-len": ["error", 128, 4],
|
||||||
|
"new-cap": ["error"],
|
||||||
|
"no-console": ["off"],
|
||||||
|
"no-floating-decimal": ["error"],
|
||||||
|
"no-magic-numbers": ["error", { "ignore": [0.5, -1, 0, 1, 2], "ignoreArrayIndexes": true }],
|
||||||
|
"no-multi-spaces": ["error"],
|
||||||
|
"no-multiple-empty-lines": ["error"],
|
||||||
|
"no-unused-vars": ["error", { "args": "none", "vars": "local" }],
|
||||||
|
"semi": ["error", "always"],
|
||||||
|
"space-before-blocks": ["error"],
|
||||||
|
"space-before-function-paren": ["error", { "anonymous": "ignore", "named": "never" }],
|
||||||
|
"spaced-comment": ["error", "always", { "line": { "markers": ["/"] } }]
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
|
@ -1,6 +1,5 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/dist
|
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
<!--
|
||||||
|
//
|
||||||
|
// index.html
|
||||||
|
//
|
||||||
|
// Created by kasenvr@gmail.com on 7 Apr 2020
|
||||||
|
// Copyright 2020 Vircadia and contributors.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
-->
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -8,286 +8,294 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/* global AvatarList Clipboard console Controller Entities location Messages MyAvatar Script ScriptDiscoveryService Settings
|
||||||
|
Tablet Vec3 Window */
|
||||||
|
|
||||||
(function () { // BEGIN LOCAL_SCOPE
|
(function () { // BEGIN LOCAL_SCOPE
|
||||||
var AppUi = Script.require('appUi');
|
"use strict";
|
||||||
var ui;
|
var AppUi = Script.require('appUi');
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var ui;
|
||||||
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
||||||
// VARIABLES
|
// VARIABLES
|
||||||
var inventoryDataSettingString = "inventoryApp.data";
|
var inventoryDataSettingString = "inventoryApp.data";
|
||||||
var inventoryData;
|
var inventoryData;
|
||||||
|
|
||||||
var inventorySettingsString = "inventoryApp.settings";
|
var inventorySettingsString = "inventoryApp.settings";
|
||||||
var inventorySettings;
|
var inventorySettings;
|
||||||
|
|
||||||
var RECEIVING_ITEM_QUEUE_LIMIT = 5;
|
var RECEIVING_ITEM_QUEUE_LIMIT = 5;
|
||||||
var receivingItemQueue = [];
|
var receivingItemQueue = [];
|
||||||
|
|
||||||
// APP EVENT AND MESSAGING ROUTING
|
var NEARBY_USERS_SEARCH_RADIUS = 25;
|
||||||
|
|
||||||
function onWebAppEventReceived(event) {
|
|
||||||
var eventJSON = JSON.parse(event);
|
|
||||||
if (eventJSON.app == "inventory") { // This is our web app!
|
|
||||||
// print("inventory.js received a web event: " + event);
|
|
||||||
|
|
||||||
if (eventJSON.command == "ready") {
|
|
||||||
initializeInventoryApp();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "web-to-script-inventory") {
|
|
||||||
receiveInventory(eventJSON.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "web-to-script-settings") {
|
|
||||||
receiveSettings(eventJSON.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "use-item") {
|
|
||||||
useItem(eventJSON.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "share-item") {
|
|
||||||
shareItem(eventJSON.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "web-to-script-request-nearby-users") {
|
|
||||||
sendNearbyUsers();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "web-to-script-request-receiving-item-queue") {
|
|
||||||
sendReceivingItemQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventJSON.command == "web-to-script-update-receiving-item-queue") {
|
|
||||||
updateReceivingItemQueue(eventJSON.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tablet.webEventReceived.connect(onWebAppEventReceived);
|
// APP EVENT AND MESSAGING ROUTING
|
||||||
|
|
||||||
function sendToWeb(command, data) {
|
function onWebAppEventReceived(event) {
|
||||||
var dataToSend = {
|
var eventJSON = JSON.parse(event);
|
||||||
"app": "inventory",
|
if (eventJSON.app === "inventory") { // This is our web app!
|
||||||
"command": command,
|
// print("inventory.js received a web event: " + event);
|
||||||
"data": data
|
|
||||||
}
|
if (eventJSON.command === "ready") {
|
||||||
|
initializeInventoryApp();
|
||||||
tablet.emitScriptEvent(JSON.stringify(dataToSend));
|
}
|
||||||
}
|
|
||||||
|
if (eventJSON.command === "web-to-script-inventory") {
|
||||||
var inventoryMessagesChannel = "com.vircadia.inventory";
|
receiveInventory(eventJSON.data);
|
||||||
|
}
|
||||||
function onMessageReceived(channel, message, sender, localOnly) {
|
|
||||||
if (channel == inventoryMessagesChannel) {
|
if (eventJSON.command === "web-to-script-settings") {
|
||||||
var messageJSON = JSON.parse(message);
|
receiveSettings(eventJSON.data);
|
||||||
// Window.alert("Passed 0 " + messageJSON.recipient + " vs " + MyAvatar.sessionUUID);
|
}
|
||||||
if (messageJSON.command == "share-item" && messageJSON.recipient == MyAvatar.sessionUUID) { // We are receiving an item.
|
|
||||||
// Window.alert("Passed 1 " + messageJSON.recipient + " vs " + MyAvatar.sessionUUID);
|
if (eventJSON.command === "use-item") {
|
||||||
pushReceivedItemToQueue(sender, messageJSON.type, messageJSON.name, messageJSON.url);
|
useItem(eventJSON.data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// print("Message received:");
|
if (eventJSON.command === "share-item") {
|
||||||
// print("- channel: " + channel);
|
shareItem(eventJSON.data);
|
||||||
// print("- message: " + message);
|
}
|
||||||
// print("- sender: " + sender);
|
|
||||||
// print("- localOnly: " + localOnly);
|
if (eventJSON.command === "web-to-script-request-nearby-users") {
|
||||||
}
|
sendNearbyUsers();
|
||||||
|
}
|
||||||
function sendMessage(dataToSend) {
|
|
||||||
Messages.sendMessage(inventoryMessagesChannel, JSON.stringify(dataToSend));
|
if (eventJSON.command === "web-to-script-request-receiving-item-queue") {
|
||||||
}
|
sendReceivingItemQueue();
|
||||||
|
}
|
||||||
// END APP EVENT AND MESSAGING ROUTING
|
|
||||||
|
if (eventJSON.command === "web-to-script-update-receiving-item-queue") {
|
||||||
// SEND AND RECEIVE INVENTORY STATE
|
updateReceivingItemQueue(eventJSON.data);
|
||||||
|
}
|
||||||
function receiveInventory(receivedInventoryData) {
|
|
||||||
inventoryData = receivedInventoryData;
|
|
||||||
saveInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendInventory() {
|
|
||||||
sendToWeb("script-to-web-inventory", inventoryData);
|
|
||||||
}
|
|
||||||
|
|
||||||
// END SEND AND RECEIVE INVENTORY STATE
|
|
||||||
|
|
||||||
// SEND AND RECEIVE SETTINGS STATE
|
|
||||||
|
|
||||||
function receiveSettings(receivedSettingsData) {
|
|
||||||
inventorySettings = receivedSettingsData;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendSettings() {
|
|
||||||
sendToWeb("script-to-web-settings", inventorySettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
// END SEND AND RECEIVE SETTINGS STATE
|
|
||||||
|
|
||||||
function saveInventory() {
|
|
||||||
Settings.setValue(inventoryDataSettingString, inventoryData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadInventory() {
|
|
||||||
inventoryData = Settings.getValue(inventoryDataSettingString);
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveSettings() {
|
|
||||||
Settings.setValue(inventorySettingsString, inventorySettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadSettings() {
|
|
||||||
inventorySettings = Settings.getValue(inventorySettingsString);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushReceivedItemToQueue(senderUUID, type, name, url) {
|
|
||||||
console.info("Receiving an item:", name, "from:", senderUUID);
|
|
||||||
var getAvatarData = AvatarList.getAvatar(senderUUID);
|
|
||||||
var senderName = getAvatarData.sessionDisplayName;
|
|
||||||
var senderDistance = Vec3.distance(MyAvatar.position, getAvatarData.position);
|
|
||||||
|
|
||||||
var packageRequest = {
|
|
||||||
"senderUUID": senderUUID,
|
|
||||||
"senderName": senderName,
|
|
||||||
"senderDistance": senderDistance,
|
|
||||||
"data": {
|
|
||||||
"type": type,
|
|
||||||
"name": name,
|
|
||||||
"url": url
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivingItemQueue.length === RECEIVING_ITEM_QUEUE_LIMIT) {
|
tablet.webEventReceived.connect(onWebAppEventReceived);
|
||||||
receivingItemQueue = receivingItemQueue.slice(1, 5);
|
|
||||||
|
function sendToWeb(command, data) {
|
||||||
|
var dataToSend = {
|
||||||
|
"app": "inventory",
|
||||||
|
"command": command,
|
||||||
|
"data": data
|
||||||
|
};
|
||||||
|
|
||||||
|
tablet.emitScriptEvent(JSON.stringify(dataToSend));
|
||||||
}
|
}
|
||||||
|
|
||||||
receivingItemQueue.push(packageRequest);
|
|
||||||
ui.messagesWaiting(receivingItemQueue.length > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendReceivingItemQueue() {
|
var inventoryMessagesChannel = "com.vircadia.inventory";
|
||||||
sendToWeb("script-to-web-receiving-item-queue", receivingItemQueue);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateReceivingItemQueue(data) {
|
function onMessageReceived(channel, message, sender, localOnly) {
|
||||||
receivingItemQueue = data;
|
if (channel === inventoryMessagesChannel) {
|
||||||
ui.messagesWaiting(receivingItemQueue.length > 0);
|
var messageJSON = JSON.parse(message);
|
||||||
}
|
// Window.alert("Passed 0 " + messageJSON.recipient + " vs " + MyAvatar.sessionUUID);
|
||||||
|
if (messageJSON.command === "share-item"
|
||||||
function sendNearbyUsers() {
|
&& messageJSON.recipient === MyAvatar.sessionUUID) { // We are receiving an item.
|
||||||
var nearbyUsers = AvatarList.getAvatarsInRange(MyAvatar.position, 25); // Find all users within 25m.
|
// Window.alert("Passed 1 " + messageJSON.recipient + " vs " + MyAvatar.sessionUUID);
|
||||||
var nearbyUsersToSend = [];
|
pushReceivedItemToQueue(sender, messageJSON.type, messageJSON.name, messageJSON.url);
|
||||||
|
}
|
||||||
nearbyUsers.forEach(function(user, i) {
|
}
|
||||||
var objectToWrite;
|
// print("Message received:");
|
||||||
var aviDetails = AvatarList.getAvatar(user)
|
// print("- channel: " + channel);
|
||||||
var aviName = aviDetails.displayName;
|
// print("- message: " + message);
|
||||||
var aviDistance = Vec3.distance(MyAvatar.position, aviDetails.position);
|
// print("- sender: " + sender);
|
||||||
// Window.alert("aviName" + aviName + "user" + user + "MyAvatar.sessionUUID" + MyAvatar.sessionUUID);
|
// print("- localOnly: " + localOnly);
|
||||||
if (user != MyAvatar.sessionUUID || Controller.getValue(Controller.Hardware.Keyboard.Shift)) { // Don't add ourselves to the list!
|
|
||||||
objectToWrite = { "name": aviName, "distance": aviDistance, "uuid": user };
|
|
||||||
nearbyUsersToSend.push(objectToWrite);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
sendToWeb("script-to-web-nearby-users", nearbyUsersToSend);
|
|
||||||
}
|
|
||||||
|
|
||||||
function useItem(item) {
|
|
||||||
|
|
||||||
//TODO: Add animation support for avatars...?
|
|
||||||
|
|
||||||
// Convert the item.type before checking it...
|
|
||||||
item.type = item.type.toUpperCase();
|
|
||||||
|
|
||||||
// Depending on the type, we decide how to load this item.
|
|
||||||
if (item.type == "SCRIPT") {
|
|
||||||
ScriptDiscoveryService.loadScript(item.url, true, false, false, true, false); // See SDS.loadScript in APIDocs for more.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.type == "MODEL") {
|
function sendMessage(dataToSend) {
|
||||||
var entityID = Entities.addEntity({
|
Messages.sendMessage(inventoryMessagesChannel, JSON.stringify(dataToSend));
|
||||||
type: "Model",
|
}
|
||||||
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -1.5 })),
|
|
||||||
rotation: MyAvatar.orientation,
|
// END APP EVENT AND MESSAGING ROUTING
|
||||||
modelURL: item.url,
|
|
||||||
collisionless: true,
|
// SEND AND RECEIVE INVENTORY STATE
|
||||||
|
|
||||||
|
function receiveInventory(receivedInventoryData) {
|
||||||
|
inventoryData = receivedInventoryData;
|
||||||
|
saveInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendInventory() {
|
||||||
|
sendToWeb("script-to-web-inventory", inventoryData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// END SEND AND RECEIVE INVENTORY STATE
|
||||||
|
|
||||||
|
// SEND AND RECEIVE SETTINGS STATE
|
||||||
|
|
||||||
|
function receiveSettings(receivedSettingsData) {
|
||||||
|
inventorySettings = receivedSettingsData;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendSettings() {
|
||||||
|
sendToWeb("script-to-web-settings", inventorySettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// END SEND AND RECEIVE SETTINGS STATE
|
||||||
|
|
||||||
|
function saveInventory() {
|
||||||
|
Settings.setValue(inventoryDataSettingString, inventoryData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadInventory() {
|
||||||
|
inventoryData = Settings.getValue(inventoryDataSettingString);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveSettings() {
|
||||||
|
Settings.setValue(inventorySettingsString, inventorySettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadSettings() {
|
||||||
|
inventorySettings = Settings.getValue(inventorySettingsString);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushReceivedItemToQueue(senderUUID, type, name, url) {
|
||||||
|
console.info("Receiving an item:", name, "from:", senderUUID);
|
||||||
|
var getAvatarData = AvatarList.getAvatar(senderUUID);
|
||||||
|
var senderName = getAvatarData.sessionDisplayName;
|
||||||
|
var senderDistance = Vec3.distance(MyAvatar.position, getAvatarData.position);
|
||||||
|
|
||||||
|
var packageRequest = {
|
||||||
|
"senderUUID": senderUUID,
|
||||||
|
"senderName": senderName,
|
||||||
|
"senderDistance": senderDistance,
|
||||||
|
"data": {
|
||||||
|
"type": type,
|
||||||
|
"name": name,
|
||||||
|
"url": url
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (receivingItemQueue.length === RECEIVING_ITEM_QUEUE_LIMIT) {
|
||||||
|
receivingItemQueue = receivingItemQueue.slice(1, RECEIVING_ITEM_QUEUE_LIMIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
receivingItemQueue.push(packageRequest);
|
||||||
|
ui.messagesWaiting(receivingItemQueue.length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendReceivingItemQueue() {
|
||||||
|
sendToWeb("script-to-web-receiving-item-queue", receivingItemQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateReceivingItemQueue(data) {
|
||||||
|
receivingItemQueue = data;
|
||||||
|
ui.messagesWaiting(receivingItemQueue.length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendNearbyUsers() {
|
||||||
|
var nearbyUsers = AvatarList.getAvatarsInRange(MyAvatar.position, NEARBY_USERS_SEARCH_RADIUS);
|
||||||
|
var nearbyUsersToSend = [];
|
||||||
|
|
||||||
|
nearbyUsers.forEach(function(user) {
|
||||||
|
var objectToWrite;
|
||||||
|
var aviDetails = AvatarList.getAvatar(user);
|
||||||
|
var aviName = aviDetails.displayName;
|
||||||
|
var aviDistance = Vec3.distance(MyAvatar.position, aviDetails.position);
|
||||||
|
// Window.alert("aviName" + aviName + "user" + user + "MyAvatar.sessionUUID" + MyAvatar.sessionUUID);
|
||||||
|
if (user !== MyAvatar.sessionUUID
|
||||||
|
|| Controller.getValue(Controller.Hardware.Keyboard.Shift)) { // Don't add ourselves to the list!
|
||||||
|
objectToWrite = { "name": aviName, "distance": aviDistance, "uuid": user };
|
||||||
|
nearbyUsersToSend.push(objectToWrite);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sendToWeb("script-to-web-nearby-users", nearbyUsersToSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.type == "AVATAR") {
|
function useItem(item) {
|
||||||
MyAvatar.useFullAvatarURL(item.url);
|
|
||||||
}
|
//TODO: Add animation support for avatars...?
|
||||||
|
|
||||||
if (item.type == "PLACE") {
|
// Convert the item.type before checking it...
|
||||||
location.handleLookupString(item.url, true); // https://apidocs.vircadia.dev/location.html#.handleLookupString
|
item.type = item.type.toUpperCase();
|
||||||
}
|
|
||||||
|
// Depending on the type, we decide how to load this item.
|
||||||
if (item.type == "JSON") {
|
if (item.type === "SCRIPT") {
|
||||||
// https://apidocs.vircadia.dev/Clipboard.html#.importEntities
|
ScriptDiscoveryService.loadScript(item.url, true, false, false, true, false);
|
||||||
var jsonToLoad = item.url;
|
}
|
||||||
if (jsonToLoad) {
|
|
||||||
if (Clipboard.importEntities(jsonToLoad)) {
|
if (item.type === "MODEL") {
|
||||||
Clipboard.pasteEntities(
|
Entities.addEntity({
|
||||||
Vec3.sum(
|
type: "Model",
|
||||||
MyAvatar.position,
|
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -1.5 })),
|
||||||
Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -1.5 })
|
rotation: MyAvatar.orientation,
|
||||||
)
|
modelURL: item.url,
|
||||||
);
|
collisionless: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.type === "AVATAR") {
|
||||||
|
MyAvatar.useFullAvatarURL(item.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.type === "PLACE") {
|
||||||
|
location.handleLookupString(item.url, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.type === "JSON") {
|
||||||
|
var jsonToLoad = item.url;
|
||||||
|
if (jsonToLoad) {
|
||||||
|
if (Clipboard.importEntities(jsonToLoad)) {
|
||||||
|
Clipboard.pasteEntities(
|
||||||
|
Vec3.sum(
|
||||||
|
MyAvatar.position,
|
||||||
|
Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -1.5 })
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.type === "UNKNOWN") {
|
||||||
|
// We don't know how to handle this yet.
|
||||||
|
Window.alert("Unknown item type, unable to use.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.type == "UNKNOWN") {
|
function shareItem(data) {
|
||||||
// We don't know how to handle this yet.
|
data.command = "share-item";
|
||||||
Window.alert("Unknown item type, unable to use.");
|
sendMessage(data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function shareItem(data) {
|
function initializeInventoryApp() {
|
||||||
data.command = "share-item";
|
sendSettings();
|
||||||
sendMessage(data);
|
sendInventory();
|
||||||
}
|
sendReceivingItemQueue();
|
||||||
|
}
|
||||||
|
|
||||||
function initializeInventoryApp() {
|
function onOpened() {
|
||||||
sendSettings();
|
console.log("hello world!");
|
||||||
sendInventory();
|
}
|
||||||
sendReceivingItemQueue();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onOpened() {
|
function onClosed() {
|
||||||
console.log("hello world!");
|
console.log("hello world!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClosed() {
|
function startup() {
|
||||||
console.log("hello world!");
|
|
||||||
}
|
loadInventory();
|
||||||
|
loadSettings();
|
||||||
|
|
||||||
|
Messages.messageReceived.connect(onMessageReceived);
|
||||||
|
Messages.subscribe(inventoryMessagesChannel);
|
||||||
|
|
||||||
|
ui = new AppUi({
|
||||||
|
buttonName: "INVENTORY",
|
||||||
|
home: Script.resolvePath("index.html"),
|
||||||
|
graphicsDirectory: Script.resolvePath("./"), // Where your button icons are located
|
||||||
|
onOpened: onOpened,
|
||||||
|
onClosed: onClosed
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function startup() {
|
startup();
|
||||||
|
|
||||||
loadInventory();
|
Script.scriptEnding.connect(function () {
|
||||||
loadSettings();
|
Messages.messageReceived.disconnect(onMessageReceived);
|
||||||
|
Messages.unsubscribe(inventoryMessagesChannel);
|
||||||
Messages.messageReceived.connect(onMessageReceived);
|
|
||||||
Messages.subscribe(inventoryMessagesChannel);
|
|
||||||
|
|
||||||
ui = new AppUi({
|
|
||||||
buttonName: "INVENTORY",
|
|
||||||
home: Script.resolvePath("index.html"),
|
|
||||||
graphicsDirectory: Script.resolvePath("./"), // Where your button icons are located
|
|
||||||
onOpened: onOpened,
|
|
||||||
onClosed: onClosed
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
startup();
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
|
||||||
Messages.messageReceived.disconnect(onMessageReceived);
|
|
||||||
Messages.unsubscribe(inventoryMessagesChannel);
|
|
||||||
});
|
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
|
@ -702,24 +702,24 @@ if (!browserDevelopment()) {
|
||||||
EventBridge.scriptEventReceived.connect(function(receivedCommand) {
|
EventBridge.scriptEventReceived.connect(function(receivedCommand) {
|
||||||
receivedCommand = JSON.parse(receivedCommand);
|
receivedCommand = JSON.parse(receivedCommand);
|
||||||
// alert("RECEIVED COMMAND:" + receivedCommand.command)
|
// alert("RECEIVED COMMAND:" + receivedCommand.command)
|
||||||
if (receivedCommand.app == "inventory") {
|
if (receivedCommand.app === "inventory") {
|
||||||
// We route the data based on the command given.
|
// We route the data based on the command given.
|
||||||
if (receivedCommand.command == 'script-to-web-inventory') {
|
if (receivedCommand.command === 'script-to-web-inventory') {
|
||||||
// alert("INVENTORY RECEIVED ON APP:" + JSON.stringify(receivedCommand.data));
|
// alert("INVENTORY RECEIVED ON APP:" + JSON.stringify(receivedCommand.data));
|
||||||
vue_this.receiveInventory(receivedCommand.data);
|
vue_this.receiveInventory(receivedCommand.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivedCommand.command == 'script-to-web-receiving-item-queue') {
|
if (receivedCommand.command === 'script-to-web-receiving-item-queue') {
|
||||||
// alert("RECEIVING ITEM QUEUE:" + JSON.stringify(receivedCommand.data));
|
// alert("RECEIVING ITEM QUEUE:" + JSON.stringify(receivedCommand.data));
|
||||||
vue_this.receiveReceivingItemQueue(receivedCommand.data);
|
vue_this.receiveReceivingItemQueue(receivedCommand.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivedCommand.command == 'script-to-web-nearby-users') {
|
if (receivedCommand.command === 'script-to-web-nearby-users') {
|
||||||
// alert("RECEIVING NEARBY USERS:" + JSON.stringify(receivedCommand.data));
|
// alert("RECEIVING NEARBY USERS:" + JSON.stringify(receivedCommand.data));
|
||||||
vue_this.receiveNearbyUsers(receivedCommand.data);
|
vue_this.receiveNearbyUsers(receivedCommand.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivedCommand.command == 'script-to-web-settings') {
|
if (receivedCommand.command === 'script-to-web-settings') {
|
||||||
// alert("RECEIVING SETTINGS:" + JSON.stringify(receivedCommand.data));
|
// alert("RECEIVING SETTINGS:" + JSON.stringify(receivedCommand.data));
|
||||||
vue_this.receiveSettings(receivedCommand.data);
|
vue_this.receiveSettings(receivedCommand.data);
|
||||||
}
|
}
|
||||||
|
@ -875,11 +875,8 @@ export default {
|
||||||
case ".json":
|
case ".json":
|
||||||
detectedItemType = "JSON";
|
detectedItemType = "JSON";
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
|
detectedItemType = "UNKNOWN";
|
||||||
if (detectedItemType == null) {
|
|
||||||
// This is not a known item...
|
|
||||||
detectedItemType = "UNKNOWN";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return detectedItemType;
|
return detectedItemType;
|
||||||
|
@ -889,12 +886,12 @@ export default {
|
||||||
itemType = itemType.toUpperCase();
|
itemType = itemType.toUpperCase();
|
||||||
|
|
||||||
this.$store.state.supportedItemTypes.forEach(function (itemTypeInList) {
|
this.$store.state.supportedItemTypes.forEach(function (itemTypeInList) {
|
||||||
if (itemTypeInList == itemType) {
|
if (itemTypeInList === itemType) {
|
||||||
detectedItemType = itemTypeInList;
|
detectedItemType = itemTypeInList;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (detectedItemType == null) {
|
if (detectedItemType === null) {
|
||||||
// This is not a known item type...
|
// This is not a known item type...
|
||||||
detectedItemType = "UNKNOWN";
|
detectedItemType = "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
@ -917,8 +914,8 @@ export default {
|
||||||
if (findFolder) {
|
if (findFolder) {
|
||||||
findFolder.returnedItem.name = this.$store.state.editFolderDialog.data.name;
|
findFolder.returnedItem.name = this.$store.state.editFolderDialog.data.name;
|
||||||
|
|
||||||
if (this.$store.state.editFolderDialog.data.folder !== null && this.$store.state.editFolderDialog.data.folder !== "No Change") {
|
if (this.$store.state.editFolderDialog.data.folder !=== null && this.$store.state.editFolderDialog.data.folder !=== "No Change") {
|
||||||
if (findFolder.returnedItem.folder !== this.$store.state.editFolderDialog.data.folder && this.$store.state.editFolderDialog.data.folder !== "No Folder") {
|
if (findFolder.returnedItem.folder !=== this.$store.state.editFolderDialog.data.folder && this.$store.state.editFolderDialog.data.folder !=== "No Folder") {
|
||||||
this.moveFolder(uuid, this.$store.state.editFolderDialog.data.folder);
|
this.moveFolder(uuid, this.$store.state.editFolderDialog.data.folder);
|
||||||
} else if (this.$store.state.editFolderDialog.data.folder === "No Folder") {
|
} else if (this.$store.state.editFolderDialog.data.folder === "No Folder") {
|
||||||
this.moveFolder(uuid, "top");
|
this.moveFolder(uuid, "top");
|
||||||
|
@ -1069,7 +1066,7 @@ export default {
|
||||||
var generateList;
|
var generateList;
|
||||||
this.recursiveFolderHoldingList = []; // Clear that list before we do anything.
|
this.recursiveFolderHoldingList = []; // Clear that list before we do anything.
|
||||||
|
|
||||||
if (request == "edit") {
|
if (request === "edit") {
|
||||||
this.folderList = [
|
this.folderList = [
|
||||||
{
|
{
|
||||||
"name": "No Change",
|
"name": "No Change",
|
||||||
|
@ -1083,7 +1080,7 @@ export default {
|
||||||
|
|
||||||
generateList = this.recursiveFolderPopulate(this.itemsStore, null);
|
generateList = this.recursiveFolderPopulate(this.itemsStore, null);
|
||||||
|
|
||||||
} else if (request == "add") {
|
} else if (request === "add") {
|
||||||
this.folderList = [
|
this.folderList = [
|
||||||
{
|
{
|
||||||
"name": "No Folder",
|
"name": "No Folder",
|
||||||
|
@ -1093,7 +1090,7 @@ export default {
|
||||||
|
|
||||||
generateList = this.recursiveFolderPopulate(this.itemsStore, null);
|
generateList = this.recursiveFolderPopulate(this.itemsStore, null);
|
||||||
|
|
||||||
} else if (request == "editFolder") {
|
} else if (request === "editFolder") {
|
||||||
this.folderList = [
|
this.folderList = [
|
||||||
{
|
{
|
||||||
"name": "No Change",
|
"name": "No Change",
|
||||||
|
@ -1165,7 +1162,7 @@ export default {
|
||||||
},
|
},
|
||||||
recursiveSingularSearch: function(uuid, indexToSearch) {
|
recursiveSingularSearch: function(uuid, indexToSearch) {
|
||||||
for (var i = 0; i < indexToSearch.length; i++) {
|
for (var i = 0; i < indexToSearch.length; i++) {
|
||||||
if (indexToSearch[i].uuid == uuid) {
|
if (indexToSearch[i].uuid === uuid) {
|
||||||
var foundItem = {
|
var foundItem = {
|
||||||
"returnedItem": indexToSearch[i],
|
"returnedItem": indexToSearch[i],
|
||||||
"iteration": i,
|
"iteration": i,
|
||||||
|
@ -1424,7 +1421,7 @@ export default {
|
||||||
},
|
},
|
||||||
receivingItemQueue: {
|
receivingItemQueue: {
|
||||||
handler: function() {
|
handler: function() {
|
||||||
|
// Do nothing.
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
|
/*
|
||||||
|
styles.css
|
||||||
|
|
||||||
|
Created by Kalila L. on 7 Apr 2020
|
||||||
|
Copyright 2020 Vircadia and contributors.
|
||||||
|
|
||||||
|
Distributed under the Apache License, Version 2.0.
|
||||||
|
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
/* Top Level */
|
/* Top Level */
|
||||||
|
|
||||||
.draggable-card {
|
.draggable-card {
|
||||||
background-color: rgba(39,39,39, 1.0);
|
background-color: rgba(39, 39, 39, 1.0);
|
||||||
margin: 5px 0px;
|
margin: 5px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +20,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-level-folder {
|
.top-level-folder {
|
||||||
background-color: rgba(39,39,39, 1.0);
|
background-color: rgba(39, 39, 39, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-level-folder .v-list-group__header__prepend-icon {
|
.top-level-folder .v-list-group__header__prepend-icon {
|
||||||
background-color: rgba(0,0,0, 0.3);
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
margin: 5px 5px 7px 0px !important;
|
margin: 5px 5px 7px 0px !important;
|
||||||
|
@ -42,7 +52,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-list-group .draggable-card {
|
.v-list-group .draggable-card {
|
||||||
background-color: rgba(0,0,0, 0.3);
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
padding-left: 0px !important;
|
padding-left: 0px !important;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +72,7 @@
|
||||||
/* Universal */
|
/* Universal */
|
||||||
|
|
||||||
.handle {
|
.handle {
|
||||||
background-color: rgba(0,0,0, 0.3);
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.inventoryApp::-webkit-scrollbar { width: 0 !important }
|
.inventoryApp::-webkit-scrollbar { width: 0 !important }
|
|
@ -1,3 +1,13 @@
|
||||||
|
<!--
|
||||||
|
NotUsing.vue
|
||||||
|
|
||||||
|
Created by Kalila L. on 7 Apr 2020
|
||||||
|
Copyright 2020 Vircadia and contributors.
|
||||||
|
|
||||||
|
Distributed under the Apache License, Version 2.0.
|
||||||
|
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
-->
|
||||||
|
|
||||||
<template v-if="!disabledProp">
|
<template v-if="!disabledProp">
|
||||||
<v-data-iterator
|
<v-data-iterator
|
||||||
:items="items"
|
:items="items"
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
|
/*
|
||||||
|
main.js
|
||||||
|
|
||||||
|
Created by Kalila L. on 7 Apr 2020
|
||||||
|
Copyright 2020 Vircadia and contributors.
|
||||||
|
|
||||||
|
Distributed under the Apache License, Version 2.0.
|
||||||
|
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import vuetify from './plugins/vuetify';
|
import vuetify from './plugins/vuetify';
|
||||||
import { store } from './plugins/store';
|
import { store } from './plugins/store';
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
window.vm = new Vue({
|
window.vm = new Vue({
|
||||||
vuetify,
|
vuetify,
|
||||||
store,
|
store,
|
||||||
render: h => h(App)
|
render: h => h(App)
|
||||||
}).$mount('#app')
|
}).$mount('#app');
|
||||||
|
|
|
@ -17,6 +17,7 @@ export const store = new Vuex.Store({
|
||||||
devtools: true,
|
devtools: true,
|
||||||
state: {
|
state: {
|
||||||
items: [
|
items: [
|
||||||
|
// This is test data and is primarily used for in browser development.
|
||||||
{
|
{
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "VRGrabScale",
|
"name": "VRGrabScale",
|
||||||
|
@ -52,62 +53,6 @@ export const store = new Vuex.Store({
|
||||||
],
|
],
|
||||||
"uuid": "sdfsdf",
|
"uuid": "sdfsdf",
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// "hasChildren": true,
|
|
||||||
// "name": "Test Folder",
|
|
||||||
// "folder": "No Folder",
|
|
||||||
// "items": [
|
|
||||||
// {
|
|
||||||
// "hasChildren": false,
|
|
||||||
// "type": "script",
|
|
||||||
// "name": "TESTFOLDERSCRIPT",
|
|
||||||
// "url": "https://googfdafsgaergale.com/vr.js",
|
|
||||||
// "folder": "Test Folder",
|
|
||||||
// "uuid": "54hgfhgf25fdfadf4354353",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "hasChildren": false,
|
|
||||||
// "type": "script",
|
|
||||||
// "name": "FOLDERSCRIPT2",
|
|
||||||
// "url": "https://googfdafsgaergale.com/vr.js",
|
|
||||||
// "folder": "Test Folder",
|
|
||||||
// "uuid": "54hgfhgf25ffdafddfadf4354353",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "hasChildren": true,
|
|
||||||
// "name": "FolderWithinAFolder",
|
|
||||||
// "folder": "Test Folder",
|
|
||||||
// "items": [
|
|
||||||
// {
|
|
||||||
// "hasChildren": false,
|
|
||||||
// "type": "script",
|
|
||||||
// "name": "inception1",
|
|
||||||
// "url": "https://googfdafsgaergale.com/vr.js",
|
|
||||||
// "folder": "FolderWithinAFolder",
|
|
||||||
// "uuid": "54hgfhgf25fdfadeqwqeqf4354353",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "hasChildren": false,
|
|
||||||
// "type": "script",
|
|
||||||
// "name": "123what",
|
|
||||||
// "url": "https://googfdafsgaergale.com/vr.js",
|
|
||||||
// "folder": "FolderWithinAFolder",
|
|
||||||
// "uuid": "54hgfhgf25ffdafdWDQDdsadasQWWQdfadf4354353",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "hasChildren": false,
|
|
||||||
// "type": "script",
|
|
||||||
// "name": "inception432",
|
|
||||||
// "url": "https://googfdafsgaergale.com/vr.js",
|
|
||||||
// "folder": "FolderWithinAFolder",
|
|
||||||
// "uuid": "54hgfhgf25ffdafdWDQDQWWQdfadf4354353",
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// "uuid": "54354363wgtrhtrhegs45ujs"
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// "uuid": "54354363wgsegs45ujs",
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "VRGrabScale",
|
"name": "VRGrabScale",
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*
|
||||||
|
vuetify.js
|
||||||
|
|
||||||
|
Created by Kalila L. on 7 Apr 2020
|
||||||
|
Copyright 2020 Vircadia and contributors.
|
||||||
|
|
||||||
|
Distributed under the Apache License, Version 2.0.
|
||||||
|
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Vuetify from 'vuetify/lib';
|
import Vuetify from 'vuetify/lib';
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*
|
||||||
|
vue.config.js
|
||||||
|
|
||||||
|
Created by Kalila L. on 7 Apr 2020
|
||||||
|
Copyright 2020 Vircadia and contributors.
|
||||||
|
|
||||||
|
Distributed under the Apache License, Version 2.0.
|
||||||
|
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
publicPath: "./",
|
publicPath: "./",
|
||||||
assetsDir: "./",
|
assetsDir: "./",
|
||||||
|
|
Loading…
Reference in a new issue