|
@@ -15,7 +15,7 @@ class WorldApp {
|
|
|
|
|
|
//this.worlds = {};
|
|
//this.worlds = {};
|
|
this.language = _LangManager.language;
|
|
this.language = _LangManager.language;
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -77,11 +77,11 @@ class WorldApp {
|
|
$type: "div",
|
|
$type: "div",
|
|
class: "mdc-layout-grid__inner",
|
|
class: "mdc-layout-grid__inner",
|
|
$components: Object.entries(this._states)
|
|
$components: Object.entries(this._states)
|
|
- .filter(el =>Object.keys(el[1]).length !== 0)
|
|
|
|
- .sort(function (el1, el2) {
|
|
|
|
- return parseInt(el2[1].created) - parseInt(el1[1].created)
|
|
|
|
- })
|
|
|
|
- .map(this._makeWorldCard)
|
|
|
|
|
|
+ .filter(el => Object.keys(el[1]).length !== 0)
|
|
|
|
+ .sort(function (el1, el2) {
|
|
|
|
+ return parseInt(el2[1].created) - parseInt(el1[1].created)
|
|
|
|
+ })
|
|
|
|
+ .map(this._makeWorldCard)
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
|
|
@@ -96,10 +96,10 @@ class WorldApp {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- async makeGUI(userPub){
|
|
|
|
-
|
|
|
|
|
|
+ async makeGUI(userPub) {
|
|
|
|
+
|
|
let self = this;
|
|
let self = this;
|
|
- let user = {'user': this.userAlias, pub: userPub};
|
|
|
|
|
|
+ let user = { 'user': this.userAlias, pub: userPub };
|
|
let space = this.worldName;
|
|
let space = this.worldName;
|
|
let saveName = this.saveName;
|
|
let saveName = this.saveName;
|
|
|
|
|
|
@@ -112,7 +112,7 @@ class WorldApp {
|
|
let worldStatesGUI = [];
|
|
let worldStatesGUI = [];
|
|
|
|
|
|
var info = {};
|
|
var info = {};
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
if (!saveName) {
|
|
if (!saveName) {
|
|
info = await _app.getWorldInfo(user, space);
|
|
info = await _app.getWorldInfo(user, space);
|
|
@@ -132,16 +132,17 @@ class WorldApp {
|
|
|
|
|
|
var runWorldGUI = {};
|
|
var runWorldGUI = {};
|
|
let settings = worldCardGUI._worldInfo.settings;
|
|
let settings = worldCardGUI._worldInfo.settings;
|
|
- if(settings){
|
|
|
|
- if (settings.ar){
|
|
|
|
|
|
+ if (settings) {
|
|
|
|
+ if (settings.ar) {
|
|
|
|
|
|
runWorldGUI = {
|
|
runWorldGUI = {
|
|
id: "runWorldGUI",
|
|
id: "runWorldGUI",
|
|
$type: "div",
|
|
$type: "div",
|
|
- $init: function(){
|
|
|
|
|
|
+ $init: function () {
|
|
console.log(worldCardGUI);
|
|
console.log(worldCardGUI);
|
|
},
|
|
},
|
|
_arSwitch: null,
|
|
_arSwitch: null,
|
|
|
|
+ _turnArOnSwitch: null,
|
|
$components: [
|
|
$components: [
|
|
{
|
|
{
|
|
$type: "div",
|
|
$type: "div",
|
|
@@ -150,25 +151,40 @@ class WorldApp {
|
|
_cellWidgets.switch({
|
|
_cellWidgets.switch({
|
|
'id': 'arjsView',
|
|
'id': 'arjsView',
|
|
'init': function () {
|
|
'init': function () {
|
|
- this._switch = new mdc.switchControl.MDCSwitch(this);
|
|
|
|
- this._switch.checked = false;
|
|
|
|
- this._arSwitch = this._switch;
|
|
|
|
|
|
+ this._switch = new mdc.switchControl.MDCSwitch(this);
|
|
|
|
+ this._switch.checked = false;
|
|
|
|
+ this._arSwitch = this._switch;
|
|
}
|
|
}
|
|
- }
|
|
|
|
- ),
|
|
|
|
- {
|
|
|
|
|
|
+ }
|
|
|
|
+ ),
|
|
|
|
+ {
|
|
$type: 'label',
|
|
$type: 'label',
|
|
for: 'input-forceReplace',
|
|
for: 'input-forceReplace',
|
|
$text: 'Edit mode'
|
|
$text: 'Edit mode'
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ {$type: "div", style: "margin-top: 20px"},
|
|
|
|
+ _cellWidgets.switch({
|
|
|
|
+ 'id': 'arOnView',
|
|
|
|
+ 'init': function () {
|
|
|
|
+ this._turnArOn = new mdc.switchControl.MDCSwitch(this);
|
|
|
|
+ this._turnArOn.checked = false;
|
|
|
|
+ this._turnArOnSwitch = this._turnArOn;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ),
|
|
|
|
+ {
|
|
|
|
+ $type: 'label',
|
|
|
|
+ for: 'input-forceReplace',
|
|
|
|
+ $text: 'Ar mode'
|
|
|
|
+ }
|
|
]
|
|
]
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
let actionsGUI = {
|
|
let actionsGUI = {
|
|
$cell: true,
|
|
$cell: true,
|
|
@@ -209,7 +225,7 @@ class WorldApp {
|
|
userGUI.push(
|
|
userGUI.push(
|
|
{
|
|
{
|
|
$type: "a",
|
|
$type: "a",
|
|
- class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
|
|
|
|
+ class: "mdc-button ",
|
|
$text: "Edit info",
|
|
$text: "Edit info",
|
|
//href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
//href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
onclick: function (e) {
|
|
onclick: function (e) {
|
|
@@ -223,23 +239,83 @@ class WorldApp {
|
|
}
|
|
}
|
|
//self.refresh();
|
|
//self.refresh();
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ $type: "a",
|
|
|
|
+ class: "mdc-button ",
|
|
|
|
+ $text: "Edit source",
|
|
|
|
+ //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
|
|
+ onclick: function (e) {
|
|
|
|
+ //'/:user/:type/:name/edit/:file'
|
|
|
|
+ if (desc.type == 'proto') {
|
|
|
|
+ window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
|
|
|
|
+ } else if (desc.type == 'saveState') {
|
|
|
|
+ let names = desc.worldName.split('/');
|
|
|
|
+ let filename = ('savestate_/' + names[0] + '/' + names[2] + '_vwf_json').split('/').join("~");
|
|
|
|
+ window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
|
|
|
|
+ }
|
|
|
|
+ //self.refresh();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
);
|
|
);
|
|
|
|
|
|
if (desc.type == 'proto') {
|
|
if (desc.type == 'proto') {
|
|
|
|
+
|
|
userGUI.push(
|
|
userGUI.push(
|
|
|
|
+ // {
|
|
|
|
+ // $type: "a",
|
|
|
|
+ // class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
|
|
+ // $text: "Edit proto",
|
|
|
|
+ // //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
|
|
+ // onclick: function (e) {
|
|
|
|
+ // window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ $type: "a",
|
|
|
|
+ class: "mdc-button ",
|
|
|
|
+ $text: "Edit config",
|
|
|
|
+ //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
|
|
+ onclick: function (e) {
|
|
|
|
+ window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_config_yaml'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {$type: "br"},
|
|
{
|
|
{
|
|
$type: "a",
|
|
$type: "a",
|
|
- class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
|
|
- $text: "Edit proto",
|
|
|
|
|
|
+ class: "mdc-button",
|
|
|
|
+ $text: "Edit appui.js",
|
|
//href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
//href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
onclick: function (e) {
|
|
onclick: function (e) {
|
|
- window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
|
|
|
|
|
|
+ window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/appui_js'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ $type: "a",
|
|
|
|
+ class: "mdc-button",
|
|
|
|
+ $text: "Edit assets.json",
|
|
|
|
+ //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
|
|
+ onclick: function (e) {
|
|
|
|
+ window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/assets_json'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ $type: "a",
|
|
|
|
+ class: "mdc-button",
|
|
|
|
+ $text: "Edit index.vwf.html",
|
|
|
|
+ //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
|
|
|
|
+ onclick: function (e) {
|
|
|
|
+ window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_html'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
);
|
|
);
|
|
|
|
|
|
userGUI.push(
|
|
userGUI.push(
|
|
|
|
+ {$type: "br"},
|
|
{
|
|
{
|
|
$type: "a",
|
|
$type: "a",
|
|
class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
@@ -250,11 +326,13 @@ class WorldApp {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
if (desc.type == 'saveState') {
|
|
if (desc.type == 'saveState') {
|
|
userGUI.push(
|
|
userGUI.push(
|
|
|
|
+ {$type: "br"},
|
|
{
|
|
{
|
|
$type: "a",
|
|
$type: "a",
|
|
class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
@@ -271,18 +349,38 @@ class WorldApp {
|
|
}
|
|
}
|
|
|
|
|
|
if (desc.type == 'proto') {
|
|
if (desc.type == 'proto') {
|
|
|
|
+ let worldID = window._app.helpers.GenerateInstanceID().toString();
|
|
|
|
+
|
|
userGUI.push(
|
|
userGUI.push(
|
|
{
|
|
{
|
|
- $type: "a",
|
|
|
|
- class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
|
|
- $text: self.language.t('clone proto'),//"clone",
|
|
|
|
- onclick: function (e) {
|
|
|
|
- //console.log('clone');
|
|
|
|
- _app.cloneWorldPrototype(desc.worldName, desc.userAlias);
|
|
|
|
- //self.refresh();
|
|
|
|
- }
|
|
|
|
|
|
+ $type: "div",
|
|
|
|
+ style: "margin-top: 20px;",
|
|
|
|
+ _protoName: null,
|
|
|
|
+ _protoNameField: null,
|
|
|
|
+ $components:
|
|
|
|
+ [
|
|
|
|
+ window._app.widgets.inputTextFieldOutlined({
|
|
|
|
+ "id": 'protoName',
|
|
|
|
+ "label": worldID,
|
|
|
|
+ "value": this._protoName,
|
|
|
|
+ "type": "text",
|
|
|
|
+ "init": function () {
|
|
|
|
+ this._protoNameField = new mdc.textField.MDCTextField(this);
|
|
|
|
+ }
|
|
|
|
+ }),
|
|
|
|
+ {
|
|
|
|
+ $type: "a",
|
|
|
|
+ class: "mdc-button mdc-button--raised mdc-card__action actionButton",
|
|
|
|
+ $text: self.language.t('clone proto'),//"clone",
|
|
|
|
+ onclick: function (e) {
|
|
|
|
+ //console.log('clone');
|
|
|
|
+ let newProtoName = this._protoNameField.value;
|
|
|
|
+ _app.cloneWorldPrototype(desc.worldName, desc.userAlias, newProtoName);
|
|
|
|
+ //self.refresh();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
-
|
|
|
|
)
|
|
)
|
|
} else if (desc.type == 'saveState') {
|
|
} else if (desc.type == 'saveState') {
|
|
|
|
|
|
@@ -315,7 +413,7 @@ class WorldApp {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
document.querySelector("#aboutWorld").$cell({
|
|
document.querySelector("#aboutWorld").$cell({
|
|
id: 'aboutWorld',
|
|
id: 'aboutWorld',
|
|
$cell: true,
|
|
$cell: true,
|
|
@@ -345,7 +443,7 @@ class WorldApp {
|
|
class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-4",
|
|
class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-4",
|
|
$components: [
|
|
$components: [
|
|
worldCardGUI,
|
|
worldCardGUI,
|
|
- {$type: 'p'},
|
|
|
|
|
|
+ { $type: 'p' },
|
|
runWorldGUI
|
|
runWorldGUI
|
|
]
|
|
]
|
|
},
|
|
},
|
|
@@ -376,22 +474,22 @@ class WorldApp {
|
|
|
|
|
|
async initWorldGUI() {
|
|
async initWorldGUI() {
|
|
|
|
|
|
- // _LCSDB.on('auth',
|
|
|
|
- // function (ack) {
|
|
|
|
- // if(ack.pub)
|
|
|
|
- // document.querySelector('#worldActionsGUI')._refresh();
|
|
|
|
-
|
|
|
|
- // });
|
|
|
|
|
|
+ // _LCSDB.on('auth',
|
|
|
|
+ // function (ack) {
|
|
|
|
+ // if(ack.pub)
|
|
|
|
+ // document.querySelector('#worldActionsGUI')._refresh();
|
|
|
|
+
|
|
|
|
+ // });
|
|
|
|
|
|
let self = this;
|
|
let self = this;
|
|
- let users = await _LCSDB.get('users').then();
|
|
|
|
- await _LCSDB.get('users').get(this.userAlias).get('pub').then(function(res){
|
|
|
|
|
|
+ let users = await _LCSDB.get('users').then();
|
|
|
|
+ await _LCSDB.get('users').get(this.userAlias).get('pub').then(function (res) {
|
|
|
|
|
|
self.makeGUI(res)
|
|
self.makeGUI(res)
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|