mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 20:54:25 +02:00
Remove old inventory.
This commit is contained in:
parent
05feab6bc1
commit
cc3b893d74
9 changed files with 0 additions and 37595 deletions
|
@ -1,447 +0,0 @@
|
|||
//
|
||||
// index.js
|
||||
//
|
||||
// Created by kasenvr@gmail.com on 4 Apr 2020
|
||||
// Copyright 2020 Vircadia Contributors
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var vue_this;
|
||||
|
||||
function browserDevelopment() {
|
||||
if (typeof EventBridge !== 'undefined') {
|
||||
return false; // We are in the browser, probably for development purposes.
|
||||
} else {
|
||||
return true; // We are in Vircadia.
|
||||
}
|
||||
}
|
||||
|
||||
if (!browserDevelopment()) {
|
||||
|
||||
EventBridge.scriptEventReceived.connect(function(receivedCommand) {
|
||||
receivedCommand = JSON.parse(receivedCommand);
|
||||
// alert("RECEIVED COMMAND:" + receivedCommand.command)
|
||||
if (receivedCommand.app == "inventory") {
|
||||
// We route the data based on the command given.
|
||||
if (receivedCommand.command == 'script-to-web-inventory') {
|
||||
// alert("INVENTORY RECEIVED ON APP:" + JSON.stringify(receivedCommand.data));
|
||||
vue_this.receiveInventory(receivedCommand.data);
|
||||
}
|
||||
|
||||
if (receivedCommand.command == 'script-to-web-receiving-item') {
|
||||
// alert("RECEIVING ITEM OFFER:" + JSON.stringify(receivedCommand.data));
|
||||
vue_this.receivingItem(receivedCommand.data);
|
||||
}
|
||||
|
||||
if (receivedCommand.command == 'script-to-web-nearby-users') {
|
||||
// alert("RECEIVING NEARBY USERS:" + JSON.stringify(receivedCommand.data));
|
||||
vue_this.receiveNearbyUsers(receivedCommand.data);
|
||||
}
|
||||
|
||||
if (receivedCommand.command == 'script-to-web-settings') {
|
||||
// alert("RECEIVING SETTINGS:" + JSON.stringify(receivedCommand.data));
|
||||
vue_this.receiveSettings(receivedCommand.data);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
new Vue({
|
||||
el: '#inventoryApp',
|
||||
vuetify: new Vuetify(),
|
||||
data: () => ({
|
||||
items: [
|
||||
{
|
||||
"type": "script",
|
||||
"name": "VRGrabScale",
|
||||
"url": "https://gooawefaweawfgle.com/vr.js",
|
||||
"uuid": "54254354353",
|
||||
},
|
||||
{
|
||||
"folder": true,
|
||||
"name": "Test Folder",
|
||||
"items": [
|
||||
{
|
||||
"type": "script",
|
||||
"name": "TESTFOLDERSCRIPT",
|
||||
"url": "https://googfdafsgaergale.com/vr.js",
|
||||
"uuid": "54hgfhgf25fdfadf4354353",
|
||||
},
|
||||
],
|
||||
"uuid:": "54354363wgsegs45ujs",
|
||||
},
|
||||
{
|
||||
"type": "script",
|
||||
"name": "VRGrabScale",
|
||||
"url": "https://googfdafsgaergale.com/vr.js",
|
||||
"uuid": "54hgfhgf254354353",
|
||||
},
|
||||
{
|
||||
"type": "script",
|
||||
"name": "TEST",
|
||||
"url": "https://gooadfdagle.com/vr.js",
|
||||
"uuid": "542rfwat4t54354353",
|
||||
},
|
||||
{
|
||||
"type": "script",
|
||||
"name": "TESTLONGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG",
|
||||
"url": "https://googfdaffle.com/vrLONGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG.js",
|
||||
"uuid": "5425ggsrg45354353",
|
||||
},
|
||||
{
|
||||
"type": "avatar",
|
||||
"name": "AVI",
|
||||
"url": "https://googlfadfe.com/vr.fst",
|
||||
"uuid": "542gregg45s3g4354353",
|
||||
},
|
||||
{
|
||||
"type": "avatar",
|
||||
"name": "AVI",
|
||||
"url": "https://googlefdaf.com/vr.fst",
|
||||
"uuid": "5420798-087-54354353",
|
||||
},
|
||||
{
|
||||
"type": "model",
|
||||
"name": "3D MODEL",
|
||||
"url": "https://googlee.com/vr.fbx",
|
||||
"uuid": "54254354980-7667jt353",
|
||||
},
|
||||
{
|
||||
"type": "model",
|
||||
"name": "3D MODEL",
|
||||
"url": "https://googleee.com/vr.fbx",
|
||||
"uuid": "542543sg45s4gg54353",
|
||||
},
|
||||
],
|
||||
iconType: {
|
||||
"script": {
|
||||
"icon": "mdi-code-tags",
|
||||
"color": "red",
|
||||
},
|
||||
"model": {
|
||||
"icon": "mdi-video-3d",
|
||||
"color": "green",
|
||||
},
|
||||
"avatar": {
|
||||
"icon": "mdi-account-convert",
|
||||
"color": "purple",
|
||||
},
|
||||
"unknown": {
|
||||
"icon": "mdi-help",
|
||||
"color": "grey",
|
||||
}
|
||||
},
|
||||
// The URL is the key (to finding the item we want) so we want to keep track of that.
|
||||
removeDialog: {
|
||||
show: false,
|
||||
uuid: null,
|
||||
},
|
||||
createFolderDialog: {
|
||||
show: false,
|
||||
valid: false,
|
||||
data: {
|
||||
"name": null,
|
||||
},
|
||||
},
|
||||
addDialog: {
|
||||
show: false,
|
||||
valid: false,
|
||||
data: {
|
||||
"name": null,
|
||||
"url": null,
|
||||
},
|
||||
},
|
||||
editDialog: {
|
||||
show: false,
|
||||
valid: false,
|
||||
uuid: null, //
|
||||
data: {
|
||||
"type": null,
|
||||
"name": null,
|
||||
"url": null,
|
||||
},
|
||||
},
|
||||
receiveDialog: {
|
||||
show: false,
|
||||
valid: false,
|
||||
data: {
|
||||
"user": null,
|
||||
"name": null,
|
||||
"type": null,
|
||||
"url": null,
|
||||
},
|
||||
},
|
||||
shareDialog: {
|
||||
show: false,
|
||||
valid: false,
|
||||
data: {
|
||||
"uuid": null, // UUID of the item you want to share. THIS IS THE KEY.
|
||||
"url": null, // The item you want to share.
|
||||
"recipient": null,
|
||||
}
|
||||
},
|
||||
nearbyUsers: [
|
||||
{
|
||||
name: "Who",
|
||||
uuid: "{4131531653652562}",
|
||||
},
|
||||
{
|
||||
name: "Is",
|
||||
uuid: "{4131531653756756576543652562}",
|
||||
},
|
||||
{
|
||||
name: "This?",
|
||||
uuid: "{4131531676575653652562}",
|
||||
},
|
||||
],
|
||||
sortBy: "alphabetical",
|
||||
settings: {
|
||||
displayDensity: {
|
||||
"size": 1,
|
||||
"labels": [
|
||||
"List",
|
||||
"Compact",
|
||||
"Large",
|
||||
],
|
||||
},
|
||||
},
|
||||
darkTheme: true,
|
||||
drawer: false,
|
||||
}),
|
||||
created: function () {
|
||||
vue_this = this;
|
||||
this.$vuetify.theme.dark = this.darkTheme;
|
||||
|
||||
this.sendAppMessage("ready", "");
|
||||
},
|
||||
methods: {
|
||||
createUUID: function() {
|
||||
// http://www.ietf.org/rfc/rfc4122.txt
|
||||
var s = [];
|
||||
var hexDigits = "0123456789abcdef";
|
||||
for (var i = 0; i < 36; i++) {
|
||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
||||
}
|
||||
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
||||
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
||||
s[8] = s[13] = s[18] = s[23] = "-";
|
||||
|
||||
var uuid = s.join("");
|
||||
return uuid;
|
||||
},
|
||||
pushToItems: function(type, name, url) {
|
||||
var itemToPush =
|
||||
{
|
||||
"type": type,
|
||||
"name": name,
|
||||
"url": url,
|
||||
"uuid": this.createUUID(),
|
||||
};
|
||||
|
||||
this.items.push(itemToPush);
|
||||
},
|
||||
pushFolderToItems: function(name) {
|
||||
var folderToPush =
|
||||
{
|
||||
"folder": true,
|
||||
"name": name,
|
||||
"items": [],
|
||||
"uuid": this.createUUID(),
|
||||
};
|
||||
|
||||
this.items.push(folderToPush);
|
||||
},
|
||||
checkFileType: function(fileType) {
|
||||
var detectedItemType = null;
|
||||
|
||||
switch (fileType) {
|
||||
// Model Cases
|
||||
case ".fbx":
|
||||
detectedItemType = "model";
|
||||
break;
|
||||
case ".gltf":
|
||||
detectedItemType = "model";
|
||||
break;
|
||||
// Script Cases
|
||||
case ".js":
|
||||
detectedItemType = "script";
|
||||
break;
|
||||
// Avatar Cases
|
||||
case ".fst":
|
||||
detectedItemType = "avatar";
|
||||
break;
|
||||
}
|
||||
|
||||
if (detectedItemType == null) {
|
||||
// This is not a known item...
|
||||
detectedItemType = "unknown";
|
||||
}
|
||||
|
||||
return detectedItemType;
|
||||
},
|
||||
checkItemType: function(itemType) {
|
||||
var detectedItemType = null;
|
||||
|
||||
switch (itemType) {
|
||||
case "model":
|
||||
detectedItemType = "model";
|
||||
break;
|
||||
case "avatar":
|
||||
detectedItemType = "avatar";
|
||||
break;
|
||||
case "script":
|
||||
detectedItemType = "script";
|
||||
break;
|
||||
}
|
||||
|
||||
if (detectedItemType == null) {
|
||||
// This is not a known item type...
|
||||
detectedItemType = "unknown";
|
||||
}
|
||||
|
||||
return detectedItemType;
|
||||
},
|
||||
createFolder: function(name) {
|
||||
this.pushFolderToItems(name);
|
||||
},
|
||||
addItem: function(name, url) {
|
||||
var extensionRegex = /\.[0-9a-z]+$/i; // to detect the file type based on extension in the URL.
|
||||
var detectedFileType = url.match(extensionRegex);
|
||||
var itemType;
|
||||
|
||||
if (detectedFileType == null || detectedFileType[0] == null) {
|
||||
itemType = "unknown";
|
||||
} else {
|
||||
itemType = this.checkFileType(detectedFileType[0]);
|
||||
}
|
||||
|
||||
this.pushToItems(itemType, name, url);
|
||||
|
||||
this.addDialog.data.name = null;
|
||||
this.addDialog.data.url = null;
|
||||
},
|
||||
removeItem: function(uuid) {
|
||||
for (i = 0; i < this.items.length; i++) {
|
||||
if (this.items[i].uuid == uuid) {
|
||||
this.items.splice(i, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
editItem: function(uuid) {
|
||||
for (i = 0; i < this.items.length; i++) {
|
||||
if (this.items[i].uuid == uuid) {
|
||||
this.items[i].type = this.checkItemType(this.editDialog.data.type);
|
||||
this.items[i].name = this.editDialog.data.name;
|
||||
this.items[i].url = this.editDialog.data.url;
|
||||
}
|
||||
}
|
||||
},
|
||||
receivingItem: function(data) {
|
||||
if (this.receiveDialog.show != true) { // Do not accept offers if the user is already receiving an offer.
|
||||
this.receiveDialog.data.user = data.data.user;
|
||||
this.receiveDialog.data.type = data.data.type;
|
||||
this.receiveDialog.data.name = data.data.name;
|
||||
this.receiveDialog.data.url = data.data.url;
|
||||
|
||||
this.receiveDialog.show = true;
|
||||
}
|
||||
|
||||
},
|
||||
shareItem: function(uuid, url) {
|
||||
var typeToShare;
|
||||
var nameToShare;
|
||||
|
||||
for (i = 0; i < this.items.length; i++) {
|
||||
if (this.items[i].uuid == uuid) {
|
||||
typeToShare = this.items[i].type;
|
||||
nameToShare = this.items[i].name;
|
||||
}
|
||||
}
|
||||
|
||||
// alert("type" + typeToShare + "name" + nameToShare);
|
||||
this.sendAppMessage("share-item", {
|
||||
"type": typeToShare,
|
||||
"name": nameToShare,
|
||||
"url": this.shareDialog.data.url,
|
||||
"recipient": this.shareDialog.data.recipient,
|
||||
});
|
||||
},
|
||||
acceptItem: function() {
|
||||
this.pushToItems(this.checkItemType(this.receiveDialog.data.type), this.receiveDialog.data.name, this.receiveDialog.data.url);
|
||||
},
|
||||
useItem: function(type, url) {
|
||||
this.sendAppMessage("use-item", {
|
||||
"type": type,
|
||||
"url": url
|
||||
});
|
||||
},
|
||||
sendInventory: function() {
|
||||
this.sendAppMessage("web-to-script-inventory", this.items );
|
||||
},
|
||||
receiveInventory: function(receivedInventory) {
|
||||
if (!receivedInventory) {
|
||||
this.items = [];
|
||||
} else {
|
||||
this.items = receivedInventory;
|
||||
}
|
||||
},
|
||||
sendSettings: function() {
|
||||
this.sendAppMessage("web-to-script-settings", this.settings );
|
||||
},
|
||||
receiveSettings: function(receivedSettings) {
|
||||
if (!receivedSettings) {
|
||||
// Don't do anything, let the defaults stand. Otherwise, it will break the app.
|
||||
} else {
|
||||
this.settings = receivedSettings;
|
||||
}
|
||||
},
|
||||
displayIcon: function(itemType) {
|
||||
return this.iconType[itemType].icon;
|
||||
},
|
||||
getIconColor: function(itemType) {
|
||||
return this.iconType[itemType].color;
|
||||
},
|
||||
receiveNearbyUsers: function(receivedUsers) {
|
||||
if (!receivedUsers) {
|
||||
this.nearbyUsers = [];
|
||||
} else {
|
||||
this.nearbyUsers = receivedUsers;
|
||||
}
|
||||
},
|
||||
sendAppMessage: function(command, data) {
|
||||
var JSONtoSend = {
|
||||
"app": "inventory",
|
||||
"command": command,
|
||||
"data": data
|
||||
};
|
||||
|
||||
if (!browserDevelopment()) {
|
||||
EventBridge.emitWebEvent(JSON.stringify(JSONtoSend));
|
||||
} else {
|
||||
alert(JSON.stringify(JSONtoSend));
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// Whenever the item list changes, this will notice and then send it to the script to be saved.
|
||||
items: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.sendInventory();
|
||||
}
|
||||
}, // Whenever the settings change, we want to save that state.
|
||||
settings: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.sendSettings();
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
})
|
|
@ -1,34 +0,0 @@
|
|||
<!--
|
||||
//
|
||||
// inventory.html
|
||||
//
|
||||
// Created by kasenvr@gmail.com on 2 Apr 2020
|
||||
// Copyright 2020 Vircadia 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>
|
||||
<html>
|
||||
<head>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
|
||||
<!-- <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet"> -->
|
||||
<link href="./styles/vuetify.css" rel="stylesheet">
|
||||
<link href="./styles/styles.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
|
||||
</head>
|
||||
<body>
|
||||
<div id="inventoryApp">
|
||||
<v-app>
|
||||
|
||||
</v-app>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
|
||||
<script src="./index.js"></script>
|
|
@ -1,234 +0,0 @@
|
|||
//
|
||||
// inventory.js
|
||||
//
|
||||
// Created by kasenvr@gmail.com on 2 Apr 2020
|
||||
// Copyright 2020 Vircadia Contributors
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
(function () { // BEGIN LOCAL_SCOPE
|
||||
var AppUi = Script.require('appUi');
|
||||
var ui;
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
var inventoryDataSettingString = "inventoryApp.data";
|
||||
var inventoryData;
|
||||
|
||||
var inventorySettingsString = "inventoryApp.settings";
|
||||
var inventorySettings;
|
||||
|
||||
// APP EVENT AND MESSAGING ROUTING
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tablet.webEventReceived.connect(onWebAppEventReceived);
|
||||
|
||||
function sendToWeb(command, data) {
|
||||
var dataToSend = {
|
||||
"app": "inventory",
|
||||
"command": command,
|
||||
"data": data
|
||||
}
|
||||
|
||||
tablet.emitScriptEvent(JSON.stringify(dataToSend));
|
||||
}
|
||||
|
||||
var inventoryMessagesChannel = "com.vircadia.inventory";
|
||||
|
||||
function onMessageReceived(channel, message, sender, localOnly) {
|
||||
if (channel == inventoryMessagesChannel) {
|
||||
var messageJSON = JSON.parse(message);
|
||||
// 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);
|
||||
receivingItem(sender, messageJSON.type, messageJSON.name, messageJSON.url);
|
||||
}
|
||||
}
|
||||
print("Message received:");
|
||||
print("- channel: " + channel);
|
||||
print("- message: " + message);
|
||||
print("- sender: " + sender);
|
||||
print("- localOnly: " + localOnly);
|
||||
}
|
||||
|
||||
function sendMessage(dataToSend) {
|
||||
Messages.sendMessage(inventoryMessagesChannel, JSON.stringify(dataToSend));
|
||||
}
|
||||
|
||||
// END APP EVENT AND MESSAGING ROUTING
|
||||
|
||||
// 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 receivingItem(sender, type, name, url) {
|
||||
var packageRequest = {
|
||||
"sender": sender,
|
||||
"data": {
|
||||
"type": type,
|
||||
"name": name,
|
||||
"url": url
|
||||
}
|
||||
}
|
||||
|
||||
sendToWeb("script-to-web-receiving-item", packageRequest);
|
||||
}
|
||||
|
||||
function sendNearbyUsers() {
|
||||
var nearbyUsers = AvatarList.getAvatarsInRange(MyAvatar.position, 25); // Find all users within 25m.
|
||||
var nearbyUsersToSend = [];
|
||||
|
||||
nearbyUsers.forEach(function(user, i) {
|
||||
var objectToWrite;
|
||||
var aviName = AvatarList.getAvatar(user).displayName;
|
||||
// Window.alert("aviName" + aviName + "user" + user + "MyAvatar.sessionUUID" + MyAvatar.sessionUUID);
|
||||
if (user != MyAvatar.sessionUUID) { // Don't add ourselves to the list!
|
||||
objectToWrite = { "name": aviName, "uuid": user };
|
||||
nearbyUsersToSend.push(objectToWrite);
|
||||
}
|
||||
});
|
||||
|
||||
sendToWeb("script-to-web-nearby-users", nearbyUsersToSend);
|
||||
}
|
||||
|
||||
function useItem(item) {
|
||||
|
||||
//TODO: Add animation support for avatars, add JSON loading...?
|
||||
|
||||
// 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") {
|
||||
var entityID = Entities.addEntity({
|
||||
type: "Model",
|
||||
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
|
||||
rotation: MyAvatar.orientation,
|
||||
modelURL: item.url,
|
||||
collisionless: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (item.type == "avatar") {
|
||||
MyAvatar.useFullAvatarURL(item.url);
|
||||
}
|
||||
|
||||
if (item.type == "unknown") {
|
||||
// We don't know how to handle this yet.
|
||||
Window.alert("Unknown item type, unable to use.");
|
||||
}
|
||||
}
|
||||
|
||||
function shareItem(data) {
|
||||
data.command = "share-item";
|
||||
sendMessage(data);
|
||||
}
|
||||
|
||||
function initializeInventoryApp() {
|
||||
sendSettings();
|
||||
sendInventory();
|
||||
}
|
||||
|
||||
function onOpened() {
|
||||
console.log("hello world!");
|
||||
}
|
||||
|
||||
function onClosed() {
|
||||
console.log("hello world!");
|
||||
}
|
||||
|
||||
function startup() {
|
||||
|
||||
loadInventory();
|
||||
loadSettings();
|
||||
|
||||
Messages.messageReceived.connect(onMessageReceived);
|
||||
Messages.subscribe(inventoryMessagesChannel);
|
||||
|
||||
ui = new AppUi({
|
||||
buttonName: "INVENTORY",
|
||||
home: Script.resolvePath("inventory.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
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
/* .inventoryApp::-webkit-scrollbar { width: 0 !important } */
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
6
scripts/system/inventory-old/vue.min.js
vendored
6
scripts/system/inventory-old/vue.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue