mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 09:15:07 +02:00
Receive functionality enabled.
This commit is contained in:
parent
e8027ac6a2
commit
00d388d94d
1 changed files with 80 additions and 44 deletions
|
@ -109,11 +109,11 @@
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item
|
<v-list-item
|
||||||
@click="
|
@click="
|
||||||
editDialog.show = true;
|
editDialog.show = true;
|
||||||
editDialog.url = item.url;
|
editDialog.url = item.url;
|
||||||
editDialog.data.type = item.type;
|
editDialog.data.type = item.type;
|
||||||
editDialog.data.name = item.name;
|
editDialog.data.name = item.name;
|
||||||
editDialog.data.url = item.url;
|
editDialog.data.url = item.url;
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<v-list-item-title>Edit</v-list-item-title>
|
<v-list-item-title>Edit</v-list-item-title>
|
||||||
|
@ -215,7 +215,6 @@
|
||||||
required
|
required
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
|
@ -223,7 +222,7 @@
|
||||||
class="px-3"
|
class="px-3"
|
||||||
@click="editDialog.show = false"
|
@click="editDialog.show = false"
|
||||||
>
|
>
|
||||||
No
|
Cancel
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
|
@ -303,16 +302,29 @@
|
||||||
<v-card-title class="headline">Receiving Item</v-card-title>
|
<v-card-title class="headline">Receiving Item</v-card-title>
|
||||||
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
[User] is sending you an item
|
{{receiveDialog.data.user}} is sending you an item.
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|
||||||
<v-card-text>
|
<v-text-field
|
||||||
[lol] [Script]
|
class="px-2"
|
||||||
</v-card-text>
|
label="Type"
|
||||||
|
v-model="receiveDialog.data.url"
|
||||||
|
required
|
||||||
|
></v-text-field>
|
||||||
|
|
||||||
<v-card-text>
|
<v-text-field
|
||||||
[https://google.com/lol.js]
|
class="px-2"
|
||||||
</v-card-text>
|
label="Name"
|
||||||
|
v-model="receiveDialog.data.name"
|
||||||
|
required
|
||||||
|
></v-text-field>
|
||||||
|
|
||||||
|
<v-text-field
|
||||||
|
class="px-2"
|
||||||
|
label="URL"
|
||||||
|
v-model="receiveDialog.data.url"
|
||||||
|
required
|
||||||
|
></v-text-field>
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
|
||||||
|
@ -329,7 +341,7 @@
|
||||||
<v-btn
|
<v-btn
|
||||||
color="blue"
|
color="blue"
|
||||||
class="px-3"
|
class="px-3"
|
||||||
@click="receiveDialog.show = false"
|
@click="receiveDialog.show = false; acceptItem();"
|
||||||
>
|
>
|
||||||
Accept
|
Accept
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -436,10 +448,12 @@ new Vue({
|
||||||
},
|
},
|
||||||
receiveDialog: {
|
receiveDialog: {
|
||||||
show: false,
|
show: false,
|
||||||
user: null,
|
data: {
|
||||||
name: null,
|
"user": null,
|
||||||
type: null,
|
"name": null,
|
||||||
url: null,
|
"type": null,
|
||||||
|
"url": null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
sortBy: "alphabetical",
|
sortBy: "alphabetical",
|
||||||
darkTheme: true,
|
darkTheme: true,
|
||||||
|
@ -452,6 +466,34 @@ new Vue({
|
||||||
this.sendAppMessage("ready", "");
|
this.sendAppMessage("ready", "");
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
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;
|
||||||
|
},
|
||||||
addItem: function(name, url) {
|
addItem: function(name, url) {
|
||||||
var extensionRegex = /\.[0-9a-z]+$/i; // to detect the file type based on extension in the URL.
|
var extensionRegex = /\.[0-9a-z]+$/i; // to detect the file type based on extension in the URL.
|
||||||
var detectedFileType = url.match(extensionRegex);
|
var detectedFileType = url.match(extensionRegex);
|
||||||
|
@ -460,28 +502,7 @@ new Vue({
|
||||||
if (detectedFileType == null || detectedFileType[0] == null) {
|
if (detectedFileType == null || detectedFileType[0] == null) {
|
||||||
itemType = "unknown";
|
itemType = "unknown";
|
||||||
} else {
|
} else {
|
||||||
switch (detectedFileType[0]) {
|
itemType = this.checkFileType(detectedFileType[0]);
|
||||||
// Model Cases
|
|
||||||
case ".fbx":
|
|
||||||
itemType = "model";
|
|
||||||
break;
|
|
||||||
case ".gltf":
|
|
||||||
itemType = "model";
|
|
||||||
break;
|
|
||||||
// Script Cases
|
|
||||||
case ".js":
|
|
||||||
itemType = "script";
|
|
||||||
break;
|
|
||||||
// Avatar Cases
|
|
||||||
case ".fst":
|
|
||||||
itemType = "avatar";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemType == null) {
|
|
||||||
// This is not a known item...
|
|
||||||
itemType = "unknown";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemToPush =
|
var itemToPush =
|
||||||
|
@ -503,20 +524,35 @@ new Vue({
|
||||||
editItem: function(url) {
|
editItem: function(url) {
|
||||||
for (i = 0; i < this.items.length; i++) {
|
for (i = 0; i < this.items.length; i++) {
|
||||||
if (this.items[i].url == url) {
|
if (this.items[i].url == url) {
|
||||||
this.items[i].type = this.editDialog.data.type;
|
this.items[i].type = this.checkFileType(this.editDialog.data.type);
|
||||||
this.items[i].name = this.editDialog.data.name;
|
this.items[i].name = this.editDialog.data.name;
|
||||||
this.items[i].url = this.editDialog.data.url;
|
this.items[i].url = this.editDialog.data.url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
receivingItem: function(name, 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.user;
|
||||||
|
this.receiveDialog.data.type = data.type;
|
||||||
|
this.receiveDialog.data.name = data.name;
|
||||||
|
this.receiveDialog.data.url = data.url;
|
||||||
|
|
||||||
|
this.receiveDialog.show = true;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
shareItem: function(url) {
|
shareItem: function(url) {
|
||||||
|
|
||||||
},
|
},
|
||||||
acceptItem: function(url) {
|
acceptItem: function() {
|
||||||
|
var itemToPush =
|
||||||
|
{
|
||||||
|
"type": this.checkFileType(this.receiveDialog.data.type),
|
||||||
|
"name": this.receiveDialog.data.name,
|
||||||
|
"url": this.receiveDialog.data.url,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.items.push(itemToPush);
|
||||||
},
|
},
|
||||||
useItem: function(url) {
|
useItem: function(url) {
|
||||||
alert(url);
|
alert(url);
|
||||||
|
|
Loading…
Reference in a new issue