-
Notifications
You must be signed in to change notification settings - Fork 0
/
functionCall-data-behavior.html
72 lines (68 loc) · 2.66 KB
/
functionCall-data-behavior.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<link rel="import" href="constants.html"><link rel="import" href="constants-conditionals.html"><script>
"use strict";
var FunctionCallBehavior = {
properties: {
fullFunction: { // referenz aus den constants-conditionals.html
type: Object,
value: function() { return {}; }
},
parameter: {
type: Array,
value: function() { return []; }
},
wasShown: Boolean
},
show: function() {
if(this.wasShown !== true) {
this.wasShown = true;
this.$$('functionCall-element').show();
}
},
functionCallFromXML: function(xml) {
var data;
for (var x = 0; x < xml.childNodes.length; x++) {
data = xml.childNodes[x];
if (data.nodeName == "FullName") {
this.fullFunction = PoeQuestEditor.Conditionals.get(data.textContent);
if(this.fullFunction === undefined) {
this.fullFunction = PoeQuestEditor.Scripts.get(data.textContent);
}
}
if (data.nodeName == "Parameters") {
for (var p = 0; p < data.childNodes.length; p++) {
if((this.fullFunction.param0 !== undefined && this.fullFunction.param0.type == "Guid") ||
(this.fullFunction.param1 !== undefined && this.fullFunction.param1.type == "Guid") ||
(this.fullFunction.param2 !== undefined && this.fullFunction.param2.type == "Guid") ||
(this.fullFunction.param3 !== undefined && this.fullFunction.param3.type == "Guid") ||
(this.fullFunction.param4 !== undefined && this.fullFunction.param4.type == "Guid") ||
(this.fullFunction.param5 !== undefined && this.fullFunction.param5.type == "Guid") ||
(this.fullFunction.param6 !== undefined && this.fullFunction.param6.type == "Guid")) {
var known = PoeQuestEditor.GUIDS.get(data.childNodes[p].textContent);
if(known === undefined) {
PoeQuestEditor.GUIDS.set(data.childNodes[p].textContent, {instanceTag: data.childNodes[p].textContent, files: []});
PoeQuestEditor.GUIDS_NameList.push(data.childNodes[p].textContent);
PoeQuestEditor.GUIDS_byDisplayName.set(data.childNodes[p].textContent, data.childNodes[p].textContent);
}
}
this.push('parameter', data.childNodes[p].textContent);
}
}
}
},
functionCallToXML: function() {
var xml = '<Data><FullName>';
var functionxml = PoeQuestEditor.Conditionals_fromDisplayName.get(this.fullFunction.name);
if(functionxml === undefined) {
functionxml = PoeQuestEditor.Scripts_fromDisplayName.get(this.fullFunction.name);
}
xml += functionxml;
xml += '</FullName>' + '<Parameters>';
this.parameter.forEach(function (parameter) {
xml += '<string>' + parameter + '</string>';
});
xml += '</Parameters></Data>';
return xml;
}
// remember: never name a function 'get' it will break polymer
};
</script>