Add serverless item support.

This commit is contained in:
Kasen IO 2020-04-09 03:12:51 -04:00
parent aa526445a6
commit 3ebdc59071
2 changed files with 31 additions and 13 deletions

View file

@ -165,12 +165,15 @@ function useItem(item) {
//TODO: Add animation support for avatars, add JSON loading...?
// 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") {
if (item.type == "SCRIPT") {
ScriptDiscoveryService.loadScript(item.url, true, false, false, true, false); // See SDS.loadScript in APIDocs for more.
}
if (item.type == "model") {
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 })),
@ -180,11 +183,15 @@ function useItem(item) {
});
}
if (item.type == "avatar") {
if (item.type == "AVATAR") {
MyAvatar.useFullAvatarURL(item.url);
}
if (item.type == "unknown") {
if (item.type == "SERVERLESS") {
location.handleLookupString(item.url, true); // https://apidocs.vircadia.dev/location.html#.handleLookupString
}
if (item.type == "UNKNOWN") {
// We don't know how to handle this yet.
Window.alert("Unknown item type, unable to use.");
}

View file

@ -1,4 +1,4 @@
<!--
getIcon<!--
//
// App.vue
//
@ -119,7 +119,7 @@
dark
v-on="on"
>
<v-icon>{{displayIcon(item.type)}}</v-icon>
<v-icon>{{getIcon(item.type)}}</v-icon>
</v-btn>
<!-- settings.displayDensity.size < 1 -->
<v-btn
@ -130,7 +130,7 @@
dark
v-on="on"
>
<v-icon>{{displayIcon(item.type)}}</v-icon>
<v-icon>{{getIcon(item.type)}}</v-icon>
</v-btn>
</template>
@ -256,7 +256,7 @@
dark
v-on="on"
>
<v-icon>{{displayIcon(item.type)}}</v-icon>
<v-icon>{{getIcon(item.type)}}</v-icon>
</v-btn>
<!-- settings.displayDensity.size < 1 -->
<v-btn
@ -267,7 +267,7 @@
dark
v-on="on"
>
<v-icon>{{displayIcon(item.type)}}</v-icon>
<v-icon>{{getIcon(item.type)}}</v-icon>
</v-btn>
</template>
@ -895,8 +895,8 @@ export default {
"uuid": "54254354980-7667jt353",
},
{
"type": "model",
"name": "3D MODEL",
"type": "serverless",
"name": "SERVERLESS DOMAIN",
"url": "https://googleee.com/vr.fbx",
"uuid": "542543sg45s4gg54353",
},
@ -914,6 +914,10 @@ export default {
"icon": "mdi-account-convert",
"color": "purple",
},
"serverless": {
"icon": "mdi-earth",
"color": "#0097A7", // cyan darken-2
},
"unknown": {
"icon": "mdi-help",
"color": "grey",
@ -1092,6 +1096,9 @@ export default {
case "script":
detectedItemType = "script";
break;
case "serverless":
detectedItemType = "serverless";
break;
}
if (detectedItemType == null) {
@ -1207,7 +1214,11 @@ export default {
});
},
acceptItem: function() {
this.pushToItems(this.checkItemType(this.receiveDialog.data.type), this.receiveDialog.data.name, this.receiveDialog.data.url);
this.pushToItems(
this.checkItemType(this.receiveDialog.data.type),
this.receiveDialog.data.name,
this.receiveDialog.data.url
);
},
useItem: function(type, url) {
this.sendAppMessage("use-item", {
@ -1271,7 +1282,7 @@ export default {
this.settings = receivedSettings;
}
},
displayIcon: function(itemType) {
getIcon: function(itemType) {
return this.iconType[itemType].icon;
},
getIconColor: function(itemType) {