浏览代码

refactored class initialization to take into account es6

Null 6 年之前
父节点
当前提交
1a69b5d017
共有 3 个文件被更改,包括 2 次插入57 次删除
  1. 0 54
      gui/src/2D/controls/control.ts
  2. 0 1
      gui/src/2D/controls/virtualKeyboard.ts
  3. 2 2
      gui/src/2D/xmlLoader.ts

+ 0 - 54
gui/src/2D/controls/control.ts

@@ -1834,60 +1834,6 @@ export class Control {
         this._fontOffset = Control._GetFontOffset(this._font);
     }
 
-    public _parseFromXml(node : any, parent: any, linkParent: any) {
-        if (parent && linkParent) {
-            parent.addControl(guiNode);
-        }
-
-        for (let i = 0; i < node.attributes.length; i++) {
-
-            if (node.attributes[i].name.toLowerCase().includes("datasource")) {
-                continue;
-            }
-
-            if (node.attributes[i].name.toLowerCase().includes("observable")) {
-
-                let element = this._getChainElement(node.attributes[i].value);
-                guiNode[node.attributes[i].name].add(element);
-
-                continue;
-            } else if (node.attributes[i].name == "linkWithMesh") {
-                if (this._parentClass) {
-                    guiNode.linkWithMesh(this._parentClass[node.attributes[i].value]);
-                } else {
-                    guiNode.linkWithMesh(window[node.attributes[i].value]);
-                }
-            } else if (node.attributes[i].value.startsWith("{{") && node.attributes[i].value.endsWith("}}")) {
-                let element = this._getChainElement(node.attributes[i].value.substring(2, node.attributes[i].value.length - 2));
-                guiNode[node.attributes[i].name] = element;
-            } else if (!this._objectAttributes[node.attributes[i].name]) {
-                if (node.attributes[i].value == "true" || node.attributes[i].value == "false") {
-                    guiNode[node.attributes[i].name] = (node.attributes[i].value == 'true');
-                } else {
-                    guiNode[node.attributes[i].name] = !isNaN(Number(node.attributes[i].value)) ? Number(node.attributes[i].value) : node.attributes[i].value;
-                }
-            } else {
-                guiNode[node.attributes[i].name] = this._getClassAttribute(node.attributes[i].value);
-            }
-        }
-
-        if (!node.attributes.getNamedItem("id")) {
-            this._nodes[node.nodeName + Object.keys(this._nodes).length + "_gen"] = guiNode;
-            return guiNode;
-        }
-
-        if (!this._nodes[node.attributes.getNamedItem("id").nodeValue]) {
-            this._nodes[node.attributes.getNamedItem("id").nodeValue] = guiNode;
-        } else {
-            throw "XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";
-        }
-        return guiNode;
-
-    } catch (e) {
-        throw "XmlLoader Exception : Error parsing Control " + node.nodeName + "," + e + ".";
-    }
-    }
-
     /** Releases associated resources */
     public dispose() {
         this.onDirtyObservable.clear();

+ 0 - 1
gui/src/2D/controls/virtualKeyboard.ts

@@ -8,7 +8,6 @@ import { TextBlock } from "./textBlock";
 import { InputText } from "./inputText";
 import { _TypeStore } from 'babylonjs/Misc/typeStore';
 
-
 /**
  * Class used to store key control properties
  */

+ 2 - 2
gui/src/2D/xmlLoader.ts

@@ -1,8 +1,8 @@
+import { _TypeStore } from 'babylonjs/Misc/typeStore';
+
 /**
 * Class used to load GUI via XML.
 */
-import { _TypeStore } from 'babylonjs/Misc/typeStore';
-
 export class XmlLoader {
     private _nodes: any = {};