wgge 0.1.35 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +9 -9
- package/bin/deploy.cmd +1 -1
- package/core/ActivatedTreeNode.js +187 -187
- package/core/Collection.js +156 -156
- package/core/Dictionary.js +83 -83
- package/core/animation/AnimatedRotation.js +44 -44
- package/core/animation/AnimatedValue.js +33 -33
- package/core/animation/AnimatedVector2.js +35 -35
- package/core/animation/ProgressRotation.js +40 -40
- package/core/animation/ProgressValue.js +30 -30
- package/core/animation/ProgressVector2.js +23 -23
- package/core/audio/AudioModel.js +36 -36
- package/core/audio/AudioRenderer.js +120 -120
- package/core/audio/global/GlobalAudioModel.js +88 -88
- package/core/audio/global/GlobalAudioRenderer.js +108 -108
- package/core/controller/AnimationController.js +37 -37
- package/core/controller/AnimationDelayController.js +56 -56
- package/core/controller/AnimationFloatController.js +39 -39
- package/core/controller/AnimationRotationVector2Controller.js +45 -45
- package/core/controller/AnimationVector2Controller.js +39 -39
- package/core/controller/CollectionController.js +47 -47
- package/core/controller/ConditionalNodeController.js +51 -51
- package/core/controller/ControllerBase.js +64 -64
- package/core/controller/ControllerWithSaveGame.js +27 -27
- package/core/controller/ControllerWithTimeout.js +10 -10
- package/core/controller/NullableNodeController.js +35 -35
- package/core/controller/TimeoutController.js +26 -26
- package/core/helper/ArrayHelper.js +19 -19
- package/core/helper/DOMHelper.js +167 -167
- package/core/helper/HttpHelper.js +41 -41
- package/core/helper/ImageHelper.js +36 -36
- package/core/helper/NumberHelper.js +28 -28
- package/core/helper/ObjectHelper.js +10 -10
- package/core/helper/StringHelper.js +59 -59
- package/core/model/ModelBase.js +99 -99
- package/core/model/ObjectModel.js +100 -100
- package/core/model/collection/ModelNodeCollection.js +238 -238
- package/core/model/collection/table/IdentifiedModelNode.js +24 -24
- package/core/model/collection/table/ModelNodeTable.js +53 -53
- package/core/model/event/ChangeEvent.js +24 -24
- package/core/model/event/NodeWithEvents.js +37 -37
- package/core/model/template/TemplateNode.js +45 -45
- package/core/model/value/BoolValue.js +17 -17
- package/core/model/value/CapacityValue.js +49 -49
- package/core/model/value/DirtyValue.js +66 -66
- package/core/model/value/FloatValue.js +12 -12
- package/core/model/value/IntValue.js +32 -32
- package/core/model/value/NullableNode.js +71 -71
- package/core/model/vector/Quaternion.js +86 -86
- package/core/model/vector/Rotation.js +61 -61
- package/core/model/vector/Vector2.js +178 -178
- package/core/renderer/RendererBase.js +46 -46
- package/core/renderer/canvas/CanvasRenderer.js +132 -132
- package/core/renderer/canvas/ImageCanvasRenderer.js +59 -59
- package/core/renderer/canvas/ImageViewRenderer.js +42 -42
- package/core/renderer/dom/DirtyValueRenderer.js +36 -36
- package/core/renderer/dom/DomRenderer.js +32 -32
- package/core/renderer/dom/ImageDomRenderer.js +41 -41
- package/core/renderer/dom/Vector2Renderer.js +36 -36
- package/core/renderer/generic/CollectionRenderer.js +50 -50
- package/core/renderer/generic/ConditionalNodeRenderer.js +57 -57
- package/core/renderer/generic/NullableNodeRenderer.js +43 -43
- package/core/renderer/generic/SwitchController.js +34 -34
- package/core/renderer/generic/SwitchRenderer.js +34 -34
- package/editor/EditorController.js +134 -134
- package/editor/EditorModel.js +38 -38
- package/editor/EditorRenderer.js +116 -116
- package/editor/form/NodeFormRenderer.js +180 -180
- package/editor/material/MaterialPreviewRenderer.js +136 -136
- package/editor/table/TableRenderer.js +123 -123
- package/editor/table/lookup/TableLookupRenderer.js +120 -120
- package/editor/table/row/TableRowRenderer.js +98 -98
- package/game/GameController.js +136 -136
- package/game/GameModel.js +73 -73
- package/game/GameRenderer.js +108 -108
- package/game/controls/ControlsController.js +92 -92
- package/game/controls/ControlsModel.js +64 -64
- package/game/menu/MainMenuRenderer.js +37 -37
- package/game/menu/MenuModel.js +25 -25
- package/game/menu/MenuRenderer.js +34 -34
- package/game/menu/item/MenuItemModel.js +31 -31
- package/game/menu/item/MenuItemRenderer.js +48 -48
- package/game/resources/ResourcesModel.js +26 -26
- package/game/resources/assets/AssetCache.js +203 -203
- package/game/resources/assets/loader/AssetLoader.js +56 -56
- package/game/resources/assets/loader/AudioLoader.js +15 -15
- package/game/resources/assets/loader/GlbLoader.js +16 -16
- package/game/resources/assets/loader/ImageLoader.js +15 -15
- package/game/resources/assets/loader/MaterialLoader.js +50 -50
- package/game/resources/assets/loader/Model3dAnimationLoader.js +28 -28
- package/game/resources/assets/loader/Model3dLoader.js +26 -26
- package/game/resources/assets/loader/SpriteLoader.js +40 -40
- package/game/resources/image/DualImageModel.js +34 -34
- package/game/resources/image/ImageModel.js +24 -24
- package/game/resources/image/ImageViewModel.js +106 -106
- package/game/resources/material/MaterialModel.js +69 -69
- package/game/save/SaveGameController.js +21 -21
- package/game/save/SaveGameModel.js +5 -5
- package/game/save/SaveGameRenderer.js +17 -17
- package/game/save/editor/SaveGameEditorRenderer.js +17 -17
- package/index.html +42 -42
- package/index.js +72 -73
- package/package.json +28 -35
- package/style/basic/editor.less +290 -290
- package/style/basic/game.less +171 -171
- package/style/style.less +3 -3
- package/webpack.config.js +29 -29
- package/core/animation/3d/AnimatedVector3.js +0 -35
- package/core/animation/3d/AnimationHelper.js +0 -103
- package/core/animation/3d/ProgressVector3.js +0 -26
- package/core/helper/GUIHelper.js +0 -53
- package/core/model/vector/Vector3.js +0 -107
- package/core/particles/ParticleController.js +0 -35
- package/core/particles/ParticleModel.js +0 -68
- package/core/particles/ParticleRenderer.js +0 -53
- package/core/particles/generator/ParticleGeneratorController.js +0 -70
- package/core/particles/generator/ParticleGeneratorModel.js +0 -76
- package/core/particles/generator/ParticleGeneratorRenderer.js +0 -27
- package/core/renderer/svg/SvgRenderer.js +0 -139
- package/core/renderer/three/ThreeRenderer.js +0 -17
- package/game/resources/3d/3DModel.js +0 -30
package/README.MD
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# WEGGE
|
|
2
|
-
|
|
3
|
-
## Publish
|
|
4
|
-
|
|
5
|
-
Change version in `package.json`.
|
|
6
|
-
|
|
7
|
-
Then run:
|
|
8
|
-
|
|
9
|
-
npm publish
|
|
1
|
+
# WEGGE
|
|
2
|
+
|
|
3
|
+
## Publish
|
|
4
|
+
|
|
5
|
+
Change version in `package.json`.
|
|
6
|
+
|
|
7
|
+
Then run:
|
|
8
|
+
|
|
9
|
+
npm publish
|
package/bin/deploy.cmd
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
npm publish
|
|
1
|
+
npm publish
|
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
import NumberHelper from "./helper/NumberHelper";
|
|
2
|
-
|
|
3
|
-
export default class ActivatedTreeNode {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @type ActivatedTreeNode[]
|
|
7
|
-
*/
|
|
8
|
-
children;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @type ActivatedTreeNode
|
|
12
|
-
*/
|
|
13
|
-
parent;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @type boolean
|
|
17
|
-
*/
|
|
18
|
-
isActivated;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @type {[{param}]}
|
|
23
|
-
* @type param.node {ModelNode}
|
|
24
|
-
* @type param.event {string}
|
|
25
|
-
* @type param.handler {(ep) => any}
|
|
26
|
-
*/
|
|
27
|
-
autoRegisterEvents = null;
|
|
28
|
-
|
|
29
|
-
constructor() {
|
|
30
|
-
this.isActivated = false;
|
|
31
|
-
this.parent = null;
|
|
32
|
-
this.children = [];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
isRoot() {
|
|
36
|
-
return (this.parent === null);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
findRoot() {
|
|
40
|
-
return (this.isRoot()) ? this : this.parent.findRoot();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param node ActivatedTreeNode
|
|
46
|
-
* @returns ActivatedTreeNode
|
|
47
|
-
*/
|
|
48
|
-
addChild(node) {
|
|
49
|
-
node.parent = this;
|
|
50
|
-
this.children.push(node);
|
|
51
|
-
if (this.isActivated) {
|
|
52
|
-
node.activate();
|
|
53
|
-
}
|
|
54
|
-
return node;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
hasChildren() {
|
|
58
|
-
return this.children.length > 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
removeChild(node) {
|
|
62
|
-
const index = this.children.indexOf(node);
|
|
63
|
-
if (index >= 0) {
|
|
64
|
-
this.children.splice(index, 1);
|
|
65
|
-
node.deactivate();
|
|
66
|
-
node.parent = null;
|
|
67
|
-
return node;
|
|
68
|
-
}
|
|
69
|
-
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
70
|
-
const child = this.children[i];
|
|
71
|
-
const result = child.removeChild(node);
|
|
72
|
-
if (result) {
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
removeMyself() {
|
|
79
|
-
if (this.parent) {
|
|
80
|
-
this.parent.removeChild(this);
|
|
81
|
-
} else {
|
|
82
|
-
this.deactivate();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
resetChildren() {
|
|
87
|
-
this.children.forEach((child) => child.deactivate());
|
|
88
|
-
this.children = [];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
forEach(func) {
|
|
92
|
-
func(this);
|
|
93
|
-
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
94
|
-
const child = this.children[i];
|
|
95
|
-
child.forEach(func);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
activate() {
|
|
100
|
-
if (!this.isActivated) {
|
|
101
|
-
this.activateInternal();
|
|
102
|
-
|
|
103
|
-
if (this.autoRegisterEvents) {
|
|
104
|
-
this.autoRegisterEvents.forEach((event) => {
|
|
105
|
-
event.node.addEventListener(event.name, event.handler);
|
|
106
|
-
if (event.runOnActivate) {
|
|
107
|
-
event.handler();
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this.children.forEach((c) => c.activate());
|
|
113
|
-
this.isActivated = true;
|
|
114
|
-
|
|
115
|
-
this.afterActivatedInternal();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
activateInternal() {
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
afterActivatedInternal() {
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
deactivate() {
|
|
128
|
-
if (this.isActivated) {
|
|
129
|
-
if (this.autoRegisterEvents) {
|
|
130
|
-
this.autoRegisterEvents.forEach((event) => {
|
|
131
|
-
event.node.removeEventListener(event.name, event.handler);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
this.children.forEach((c) => c.deactivate());
|
|
136
|
-
this.deactivateInternal();
|
|
137
|
-
this.isActivated = false;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
deactivateInternal() {
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @param node ModelNode
|
|
148
|
-
* @param event string
|
|
149
|
-
* @param handler (param) => any
|
|
150
|
-
* @param runOnActivate bool
|
|
151
|
-
*/
|
|
152
|
-
addAutoEvent(node, event, handler, runOnActivate = false) {
|
|
153
|
-
if ((!node) || typeof node.addEventListener !== 'function') {
|
|
154
|
-
console.error('Node with addEventListener was not provided!', node);
|
|
155
|
-
}
|
|
156
|
-
if (!this.autoRegisterEvents) {
|
|
157
|
-
this.autoRegisterEvents = [];
|
|
158
|
-
}
|
|
159
|
-
this.autoRegisterEvents.push({node: node, name: event, handler: handler, runOnActivate: runOnActivate});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
addAutoEvents(node, events, handler, runOnActivate = false) {
|
|
163
|
-
events.forEach((event) => this.addAutoEvent(node, event, handler, runOnActivate));
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
addAutoEventMultiple(nodes, event, handler, runOnActivate = false) {
|
|
167
|
-
if (!Array.isArray(nodes)) {
|
|
168
|
-
console.error('Node array was not provided!');
|
|
169
|
-
}
|
|
170
|
-
nodes.forEach((n, i) => this.addAutoEvent(n, event, handler, i === 0 && runOnActivate));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
addAutoEventsMultiple(nodes, events, handler, runOnActivate = false) {
|
|
174
|
-
events.forEach((event) => this.addAutoEventMultiple(nodes, event, handler, runOnActivate));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
removeAutoEvent(node, name, handler) {
|
|
178
|
-
if (!this.autoRegisterEvents) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
const event = this.autoRegisterEvents.find((e) => e.handler === handler && e.name === name && e.node === node);
|
|
182
|
-
if (event) {
|
|
183
|
-
NumberHelper.arrayRemove(this.autoRegisterEvents, event);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
}
|
|
1
|
+
import NumberHelper from "./helper/NumberHelper";
|
|
2
|
+
|
|
3
|
+
export default class ActivatedTreeNode {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @type ActivatedTreeNode[]
|
|
7
|
+
*/
|
|
8
|
+
children;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @type ActivatedTreeNode
|
|
12
|
+
*/
|
|
13
|
+
parent;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type boolean
|
|
17
|
+
*/
|
|
18
|
+
isActivated;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {[{param}]}
|
|
23
|
+
* @type param.node {ModelNode}
|
|
24
|
+
* @type param.event {string}
|
|
25
|
+
* @type param.handler {(ep) => any}
|
|
26
|
+
*/
|
|
27
|
+
autoRegisterEvents = null;
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
this.isActivated = false;
|
|
31
|
+
this.parent = null;
|
|
32
|
+
this.children = [];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
isRoot() {
|
|
36
|
+
return (this.parent === null);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
findRoot() {
|
|
40
|
+
return (this.isRoot()) ? this : this.parent.findRoot();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param node ActivatedTreeNode
|
|
46
|
+
* @returns ActivatedTreeNode
|
|
47
|
+
*/
|
|
48
|
+
addChild(node) {
|
|
49
|
+
node.parent = this;
|
|
50
|
+
this.children.push(node);
|
|
51
|
+
if (this.isActivated) {
|
|
52
|
+
node.activate();
|
|
53
|
+
}
|
|
54
|
+
return node;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
hasChildren() {
|
|
58
|
+
return this.children.length > 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
removeChild(node) {
|
|
62
|
+
const index = this.children.indexOf(node);
|
|
63
|
+
if (index >= 0) {
|
|
64
|
+
this.children.splice(index, 1);
|
|
65
|
+
node.deactivate();
|
|
66
|
+
node.parent = null;
|
|
67
|
+
return node;
|
|
68
|
+
}
|
|
69
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
70
|
+
const child = this.children[i];
|
|
71
|
+
const result = child.removeChild(node);
|
|
72
|
+
if (result) {
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
removeMyself() {
|
|
79
|
+
if (this.parent) {
|
|
80
|
+
this.parent.removeChild(this);
|
|
81
|
+
} else {
|
|
82
|
+
this.deactivate();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
resetChildren() {
|
|
87
|
+
this.children.forEach((child) => child.deactivate());
|
|
88
|
+
this.children = [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
forEach(func) {
|
|
92
|
+
func(this);
|
|
93
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
94
|
+
const child = this.children[i];
|
|
95
|
+
child.forEach(func);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
activate() {
|
|
100
|
+
if (!this.isActivated) {
|
|
101
|
+
this.activateInternal();
|
|
102
|
+
|
|
103
|
+
if (this.autoRegisterEvents) {
|
|
104
|
+
this.autoRegisterEvents.forEach((event) => {
|
|
105
|
+
event.node.addEventListener(event.name, event.handler);
|
|
106
|
+
if (event.runOnActivate) {
|
|
107
|
+
event.handler();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.children.forEach((c) => c.activate());
|
|
113
|
+
this.isActivated = true;
|
|
114
|
+
|
|
115
|
+
this.afterActivatedInternal();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
activateInternal() {
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
afterActivatedInternal() {
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
deactivate() {
|
|
128
|
+
if (this.isActivated) {
|
|
129
|
+
if (this.autoRegisterEvents) {
|
|
130
|
+
this.autoRegisterEvents.forEach((event) => {
|
|
131
|
+
event.node.removeEventListener(event.name, event.handler);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
this.children.forEach((c) => c.deactivate());
|
|
136
|
+
this.deactivateInternal();
|
|
137
|
+
this.isActivated = false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
deactivateInternal() {
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* @param node ModelNode
|
|
148
|
+
* @param event string
|
|
149
|
+
* @param handler (param) => any
|
|
150
|
+
* @param runOnActivate bool
|
|
151
|
+
*/
|
|
152
|
+
addAutoEvent(node, event, handler, runOnActivate = false) {
|
|
153
|
+
if ((!node) || typeof node.addEventListener !== 'function') {
|
|
154
|
+
console.error('Node with addEventListener was not provided!', node);
|
|
155
|
+
}
|
|
156
|
+
if (!this.autoRegisterEvents) {
|
|
157
|
+
this.autoRegisterEvents = [];
|
|
158
|
+
}
|
|
159
|
+
this.autoRegisterEvents.push({node: node, name: event, handler: handler, runOnActivate: runOnActivate});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
addAutoEvents(node, events, handler, runOnActivate = false) {
|
|
163
|
+
events.forEach((event) => this.addAutoEvent(node, event, handler, runOnActivate));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
addAutoEventMultiple(nodes, event, handler, runOnActivate = false) {
|
|
167
|
+
if (!Array.isArray(nodes)) {
|
|
168
|
+
console.error('Node array was not provided!');
|
|
169
|
+
}
|
|
170
|
+
nodes.forEach((n, i) => this.addAutoEvent(n, event, handler, i === 0 && runOnActivate));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
addAutoEventsMultiple(nodes, events, handler, runOnActivate = false) {
|
|
174
|
+
events.forEach((event) => this.addAutoEventMultiple(nodes, event, handler, runOnActivate));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
removeAutoEvent(node, name, handler) {
|
|
178
|
+
if (!this.autoRegisterEvents) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const event = this.autoRegisterEvents.find((e) => e.handler === handler && e.name === name && e.node === node);
|
|
182
|
+
if (event) {
|
|
183
|
+
NumberHelper.arrayRemove(this.autoRegisterEvents, event);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
}
|