@woosh/meep-engine 2.46.29 → 2.46.30
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/editor/Editor.js +793 -0
- package/editor/SelectionVisualizer.js +148 -0
- package/editor/actions/concrete/ActionUpdateTexture.js +21 -0
- package/editor/actions/concrete/ArrayCopyAction.js +39 -0
- package/editor/actions/concrete/ComponentAddAction.js +47 -0
- package/editor/actions/concrete/ComponentRemoveAction.js +38 -0
- package/editor/actions/concrete/EntityCreateAction.js +47 -0
- package/editor/actions/concrete/EntityRemoveAction.js +51 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +118 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.spec.js +30 -0
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.js +182 -0
- package/editor/actions/concrete/PaintTerrainOverlayAction.js +45 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.js +67 -0
- package/editor/actions/concrete/PatchTerrainTextureAction.js +152 -0
- package/editor/actions/concrete/SelectionAddAction.js +36 -0
- package/editor/actions/concrete/SelectionClearAction.js +22 -0
- package/editor/actions/concrete/SelectionRemoveAction.js +30 -0
- package/editor/actions/concrete/TransformModifyAction.js +46 -0
- package/editor/actions/concrete/WriteGridValueAction.js +46 -0
- package/editor/ecs/EditorEntity.js +12 -0
- package/editor/ecs/EditorEntitySystem.js +14 -0
- package/editor/ecs/component/FieldDescriptor.js +34 -0
- package/editor/ecs/component/FieldValueAdapter.js +20 -0
- package/editor/ecs/component/TypeEditor.js +33 -0
- package/editor/ecs/component/TypeSchema.d.ts +38 -0
- package/editor/ecs/component/createFieldEditor.js +92 -0
- package/editor/ecs/component/createObjectEditor.js +361 -0
- package/editor/ecs/component/editors/ColorEditor.js +39 -0
- package/editor/ecs/component/editors/HTMLElementEditor.js +17 -0
- package/editor/ecs/component/editors/ImagePathEditor.js +82 -0
- package/editor/ecs/component/editors/LargeStrongEditor.js +107 -0
- package/editor/ecs/component/editors/NumericIntervalEditor.js +86 -0
- package/editor/ecs/component/editors/ObservedBooleanEditor.js +13 -0
- package/editor/ecs/component/editors/ObservedEnumEditor.js +32 -0
- package/editor/ecs/component/editors/ObservedIntegerEditor.js +43 -0
- package/editor/ecs/component/editors/ObservedStringEditor.js +51 -0
- package/editor/ecs/component/editors/Sampler2DEditor.js +221 -0
- package/editor/ecs/component/editors/collection/ListEditor.js +83 -0
- package/editor/ecs/component/editors/common/BitFlagsEditor.js +80 -0
- package/editor/ecs/component/editors/common/EnumEditor.js +41 -0
- package/editor/ecs/component/editors/common/makeV3_editor.js +85 -0
- package/editor/ecs/component/editors/common/noEditor.js +9 -0
- package/editor/ecs/component/editors/ecs/GridObstacleEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/MinimapMarkerEditor.js +16 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +225 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/Trail2DEditor.js +33 -0
- package/editor/ecs/component/editors/ecs/TransformEditor.js +23 -0
- package/editor/ecs/component/editors/ecs/terrain/SplatMappingEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.js +95 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayerEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayersEditor.js +22 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainOverlayEditor.js +20 -0
- package/editor/ecs/component/editors/geom/QuaternionEditor.js +63 -0
- package/editor/ecs/component/editors/geom/Vector1Editor.js +57 -0
- package/editor/ecs/component/editors/geom/Vector2Editor.js +11 -0
- package/editor/ecs/component/editors/geom/Vector3Editor.js +13 -0
- package/editor/ecs/component/editors/geom/Vector4Editor.js +12 -0
- package/editor/ecs/component/editors/primitive/ArrayEditor.js +46 -0
- package/editor/ecs/component/editors/primitive/BooleanEditor.js +27 -0
- package/editor/ecs/component/editors/primitive/FunctionEditor.js +29 -0
- package/editor/ecs/component/editors/primitive/NumberEditor.js +60 -0
- package/editor/ecs/component/editors/primitive/ObjectEditor.js +12 -0
- package/editor/ecs/component/editors/primitive/StringEditor.js +31 -0
- package/editor/ecs/component/editors/three/BufferGeometryEditor.js +28 -0
- package/editor/ecs/component/editors/three/MaterialEditor.js +27 -0
- package/editor/ecs/component/editors/three/MeshEditor.js +35 -0
- package/editor/ecs/component/editors/three/TextureEditor.js +112 -0
- package/editor/ecs/component/findNearestRegisteredType.js +59 -0
- package/editor/ecs/component/prototypeObjectEditor.js +379 -0
- package/editor/enableEditor.js +85 -0
- package/editor/library/MeshLibrary.js +33 -0
- package/editor/process/DisableGameUIProcess.js +43 -0
- package/editor/process/EditorProcess.js +35 -0
- package/editor/process/ObstacleGridDisplayProcess.js +120 -0
- package/editor/process/ProcessEngine.js +123 -0
- package/editor/process/SymbolicDisplayProcess.js +132 -0
- package/editor/process/symbolic/ComponentSymbolicDisplay.js +34 -0
- package/editor/process/symbolic/SymbolicDisplayInternalAPI.js +159 -0
- package/editor/process/symbolic/buildThreeJSHelperEntity.js +36 -0
- package/editor/process/symbolic/make3DSymbolicDisplay.js +91 -0
- package/editor/process/symbolic/makeCameraSymbolicDisplay.js +32 -0
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +176 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/process/symbolic/makeHelperSphereGeometry.js +73 -0
- package/editor/process/symbolic/makeLightSymbolicDisplay.js +77 -0
- package/editor/process/symbolic/makeParticleEmitterSymbolicDisplay.js +146 -0
- package/editor/process/symbolic/makePathSymbolicDisplay.js +105 -0
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +74 -0
- package/editor/process/symbolic/makeSocketsSymbolicDisplay.js +153 -0
- package/editor/process/symbolic/makeSolidArrowGeometry.js +391 -0
- package/editor/process/symbolic/makeSoundEmitterSymbolicDisplay.js +89 -0
- package/editor/process/symbolic/makeStoryTriggerSetAreaDisplay.js +114 -0
- package/editor/process/symbolic/synchronizeTransform.js +50 -0
- package/editor/tools/FoliagePaintTool.js +168 -0
- package/editor/tools/GridPaintTool.js +247 -0
- package/editor/tools/SelectionTool.js +407 -0
- package/editor/tools/TopDownCameraControlTool.js +59 -0
- package/editor/tools/TransformTool.js +370 -0
- package/editor/tools/engine/Tool.js +121 -0
- package/editor/tools/engine/ToolEngine.js +193 -0
- package/editor/tools/engine/ToolState.js +9 -0
- package/editor/tools/engine/ToolStateMachine.js +53 -0
- package/editor/tools/paint/TerrainHeightPaintTool.js +297 -0
- package/editor/tools/paint/TerrainPaintTool.js +211 -0
- package/editor/tools/paint/TerrainTexturePaintTool.js +193 -0
- package/editor/tools/paint/prototypeTerrainEditor.js +135 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.d.ts +50 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +500 -0
- package/editor/tools/v2/TransformControls.d.ts +20 -0
- package/editor/tools/v2/TransformControls.js +1782 -0
- package/editor/tools/v2/prototypeTransformControls.js +92 -0
- package/editor/view/EditorView.js +462 -0
- package/editor/view/GridPickCoordinateView.js +88 -0
- package/editor/view/ecs/ComponentControlFactory.js +48 -0
- package/editor/view/ecs/ComponentControlView.js +214 -0
- package/editor/view/ecs/EntityEditor.js +258 -0
- package/editor/view/ecs/EntityList.js +258 -0
- package/editor/view/ecs/components/BlackboardController.js +50 -0
- package/editor/view/ecs/components/DatGuiController.js +216 -0
- package/editor/view/ecs/components/FogOfWarController.js +78 -0
- package/editor/view/ecs/components/FogOfWarRevealerController.js +44 -0
- package/editor/view/ecs/components/GeneratedArmyController.js +42 -0
- package/editor/view/ecs/components/GridObstacleController.js +72 -0
- package/editor/view/ecs/components/GridPositionController.js +40 -0
- package/editor/view/ecs/components/HeadsUpDisplayController.js +30 -0
- package/editor/view/ecs/components/HighlightController.js +47 -0
- package/editor/view/ecs/components/MeshController.js +125 -0
- package/editor/view/ecs/components/PathFollowerController.js +87 -0
- package/editor/view/ecs/components/TagController.js +80 -0
- package/editor/view/ecs/components/TerrainController.js +225 -0
- package/editor/view/ecs/components/TransformController.js +103 -0
- package/editor/view/ecs/components/UnitShopController.js +112 -0
- package/editor/view/ecs/components/army/ArmyController.js +130 -0
- package/editor/view/ecs/components/color/GaugeView.js +107 -0
- package/editor/view/ecs/components/common/AutoCanvasView.js +53 -0
- package/editor/view/ecs/components/common/LineView.js +17 -0
- package/editor/view/ecs/components/common/NumberController.js +112 -0
- package/editor/view/ecs/components/common/NumericIntervalController.js +64 -0
- package/editor/view/ecs/components/gui/GUIElementController.js +117 -0
- package/editor/view/ecs/components/items/ItemContainerController.js +132 -0
- package/editor/view/ecs/components/items/ItemContainerController.stories.js +50 -0
- package/editor/view/ecs/components/items/ItemController.js +52 -0
- package/editor/view/ecs/components/particles/ColorParameterLUTController.js +444 -0
- package/editor/view/ecs/components/particles/ParameterTrackController.js +51 -0
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +213 -0
- package/editor/view/ecs/components/particles/ParticleLayerController.js +213 -0
- package/editor/view/ecs/components/particles/ScalarParameterLUTController.js +401 -0
- package/editor/view/ecs/components/sockets/AttachmentSocketsController.js +51 -0
- package/editor/view/ecs/components/sound/SoundEmitterController.js +137 -0
- package/editor/view/ecs/components/story/StoryTriggerSetController.js +214 -0
- package/editor/view/ecs/components/unit/AuraController.js +45 -0
- package/editor/view/library/MeshLibraryView.js +164 -0
- package/editor/view/node-graph/NodeGraphEditorView.js +170 -0
- package/editor/view/node-graph/NodeGraphView.js +453 -0
- package/editor/view/node-graph/NodeView.js +135 -0
- package/editor/view/node-graph/PortView.js +69 -0
- package/editor/view/process/ProcessView.js +63 -0
- package/editor/view/tools/ToolSettingsView.js +143 -0
- package/editor/view/tools/ToolView.js +58 -0
- package/package.json +2 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import View from "../../../../../src/view/View.js";
|
|
2
|
+
import ObservedValue from "../../../../../src/core/model/ObservedValue.js";
|
|
3
|
+
import DatGuiController from "../DatGuiController.js";
|
|
4
|
+
import EmptyView from "../../../../../src/view/elements/EmptyView.js";
|
|
5
|
+
import ButtonView from "../../../../../src/view/elements/button/ButtonView.js";
|
|
6
|
+
import { NativeListController } from "../../../../../src/view/controller/controls/NativeListController.js";
|
|
7
|
+
import {
|
|
8
|
+
SoundEmitterChannels,
|
|
9
|
+
SoundEmitterSystem
|
|
10
|
+
} from "../../../../../src/engine/sound/ecs/emitter/SoundEmitterSystem.js";
|
|
11
|
+
import { SoundTrack } from "../../../../../src/engine/sound/ecs/emitter/SoundTrack.js";
|
|
12
|
+
import { SoundAttenuationFunction } from "../../../../../src/engine/sound/ecs/emitter/SoundAttenuationFunction.js";
|
|
13
|
+
import { SoundEmitterFlags } from "../../../../../src/engine/sound/ecs/emitter/SoundEmitterFlags.js";
|
|
14
|
+
|
|
15
|
+
class SoundTrackController extends EmptyView {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {SoundTrack} track
|
|
19
|
+
* @param engine
|
|
20
|
+
*/
|
|
21
|
+
constructor(track, engine) {
|
|
22
|
+
super({ classList: ['sound-track-controller'] });
|
|
23
|
+
|
|
24
|
+
let audio = new Audio(track.url);
|
|
25
|
+
|
|
26
|
+
this.addChild(
|
|
27
|
+
new ButtonView({
|
|
28
|
+
name: 'play',
|
|
29
|
+
action() {
|
|
30
|
+
|
|
31
|
+
//play the sound
|
|
32
|
+
audio.play();
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
this.on.unlinked.add(() => {
|
|
40
|
+
audio.pause();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const dat = new DatGuiController();
|
|
44
|
+
|
|
45
|
+
dat.add(track, 'url').onChange((v) => {
|
|
46
|
+
audio.pause();
|
|
47
|
+
|
|
48
|
+
audio = new Audio(v);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (track.channel === null) {
|
|
52
|
+
track.channel = "";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dat.add(track, 'loop');
|
|
56
|
+
dat.add(track, 'time');
|
|
57
|
+
dat.add(track, 'volume').step(0.001);
|
|
58
|
+
dat.add(track, 'startWhenReady');
|
|
59
|
+
|
|
60
|
+
this.addChild(dat);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class SoundEmitterController extends View {
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param {Engine} engine
|
|
68
|
+
*/
|
|
69
|
+
constructor(engine) {
|
|
70
|
+
super();
|
|
71
|
+
|
|
72
|
+
this.el = document.createElement('div');
|
|
73
|
+
|
|
74
|
+
this.addClass('ui-sound-emitter-controller');
|
|
75
|
+
|
|
76
|
+
this.model = new ObservedValue(null);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @param {SoundEmitter} soundEmitter
|
|
81
|
+
*/
|
|
82
|
+
const update = soundEmitter => {
|
|
83
|
+
this.removeAllChildren();
|
|
84
|
+
|
|
85
|
+
const d = new DatGuiController();
|
|
86
|
+
|
|
87
|
+
if (soundEmitter.channel === null) {
|
|
88
|
+
soundEmitter.channel = SoundEmitterChannels.Effects;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const channel_enum = {};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
* @type {SoundEmitterSystem}
|
|
96
|
+
*/
|
|
97
|
+
const soundEmitterSystem = engine.entityManager.getSystem(SoundEmitterSystem);
|
|
98
|
+
|
|
99
|
+
for (const channelName in soundEmitterSystem.channels) {
|
|
100
|
+
channel_enum[channelName] = channelName;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
d.addEnumRaw(soundEmitter, 'channel', channel_enum);
|
|
104
|
+
|
|
105
|
+
d.add(soundEmitter, 'volume');
|
|
106
|
+
|
|
107
|
+
d.addControl(soundEmitter, 'distanceMin');
|
|
108
|
+
d.addControl(soundEmitter, 'distanceMax');
|
|
109
|
+
|
|
110
|
+
d.addEnumRaw(soundEmitter, 'attenuation', SoundAttenuationFunction);
|
|
111
|
+
|
|
112
|
+
d.addBitFlag(soundEmitter, 'flags', SoundEmitterFlags.Spatialization, 'spatialization');
|
|
113
|
+
d.addBitFlag(soundEmitter, 'flags', SoundEmitterFlags.Attenuation, 'attenuation');
|
|
114
|
+
|
|
115
|
+
this.addChild(d);
|
|
116
|
+
|
|
117
|
+
this.addChild(
|
|
118
|
+
new NativeListController({
|
|
119
|
+
model: soundEmitter.tracks,
|
|
120
|
+
classList: ['tracks'],
|
|
121
|
+
elementFactory() {
|
|
122
|
+
const track = new SoundTrack();
|
|
123
|
+
|
|
124
|
+
track.url = "";
|
|
125
|
+
|
|
126
|
+
return track;
|
|
127
|
+
},
|
|
128
|
+
elementViewFactory(track) {
|
|
129
|
+
return new SoundTrackController(track, engine);
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
this.model.onChanged.add(update);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import DatGuiController from "../DatGuiController.js";
|
|
2
|
+
import { StoryTrigger } from "../../../../../../model/game/story/triggers/StoryTrigger.js";
|
|
3
|
+
import { StoryActionType } from "../../../../../../model/game/story/action/StoryActionType.js";
|
|
4
|
+
import ObservedValue from "../../../../../src/core/model/ObservedValue.js";
|
|
5
|
+
import EmptyView from "../../../../../src/view/elements/EmptyView.js";
|
|
6
|
+
import { StoryAction } from "../../../../../../model/game/story/action/StoryAction.js";
|
|
7
|
+
import { NativeListController } from "../../../../../src/view/controller/controls/NativeListController.js";
|
|
8
|
+
|
|
9
|
+
const storyActionControllerParamFactories = {
|
|
10
|
+
[StoryActionType.Delay]: {
|
|
11
|
+
duration: 1,
|
|
12
|
+
},
|
|
13
|
+
[StoryActionType.AddItem]: {
|
|
14
|
+
id: "",
|
|
15
|
+
count: 1
|
|
16
|
+
},
|
|
17
|
+
[StoryActionType.RemoveItem]: {
|
|
18
|
+
id: "",
|
|
19
|
+
count: 1
|
|
20
|
+
},
|
|
21
|
+
[StoryActionType.AddMoney]: {
|
|
22
|
+
amount: 0
|
|
23
|
+
},
|
|
24
|
+
[StoryActionType.RemoveMoney]: {
|
|
25
|
+
amount: 0
|
|
26
|
+
},
|
|
27
|
+
[StoryActionType.ShowStoryPage]: {
|
|
28
|
+
id: ""
|
|
29
|
+
},
|
|
30
|
+
[StoryActionType.IncrementVariable]: {
|
|
31
|
+
variable: ""
|
|
32
|
+
},
|
|
33
|
+
[StoryActionType.DecrementVariable]: {
|
|
34
|
+
variable: ""
|
|
35
|
+
},
|
|
36
|
+
[StoryActionType.SetBooleanVariable]: {
|
|
37
|
+
variable: "",
|
|
38
|
+
value: false
|
|
39
|
+
},
|
|
40
|
+
[StoryActionType.SetNumberVariable]: {
|
|
41
|
+
variable: "",
|
|
42
|
+
value: 0
|
|
43
|
+
},
|
|
44
|
+
[StoryActionType.CameraFocusEntity]: {
|
|
45
|
+
entity: 0,
|
|
46
|
+
distance: 40,
|
|
47
|
+
duration: 0
|
|
48
|
+
},
|
|
49
|
+
[StoryActionType.CameraFocusPoint]: {
|
|
50
|
+
x: 0,
|
|
51
|
+
y: 0,
|
|
52
|
+
distance: 0
|
|
53
|
+
},
|
|
54
|
+
[StoryActionType.UnitAdd]: {
|
|
55
|
+
id: "",
|
|
56
|
+
level: 1,
|
|
57
|
+
target: 0
|
|
58
|
+
},
|
|
59
|
+
[StoryActionType.ScenePush]: {
|
|
60
|
+
id: ""
|
|
61
|
+
},
|
|
62
|
+
[StoryActionType.SceneDestroy]: {
|
|
63
|
+
id: ""
|
|
64
|
+
},
|
|
65
|
+
[StoryActionType.FogRevealCircle]: {
|
|
66
|
+
x: 0,
|
|
67
|
+
y: 0,
|
|
68
|
+
radius: 0
|
|
69
|
+
},
|
|
70
|
+
[StoryActionType.FogConcealCircle]: {
|
|
71
|
+
x: 0,
|
|
72
|
+
y: 0,
|
|
73
|
+
radius: 0
|
|
74
|
+
},
|
|
75
|
+
[StoryActionType.GridPositionSet]: {
|
|
76
|
+
x: 0,
|
|
77
|
+
y: 0
|
|
78
|
+
},
|
|
79
|
+
[StoryActionType.ActionPointRemove]: {
|
|
80
|
+
value: 1
|
|
81
|
+
},
|
|
82
|
+
[StoryActionType.RotationEulerSetDegrees]: {
|
|
83
|
+
angleX: 0,
|
|
84
|
+
angleY: 0,
|
|
85
|
+
angleZ: 0,
|
|
86
|
+
ignoreX: false,
|
|
87
|
+
ignoreY: false,
|
|
88
|
+
ignoreZ: false,
|
|
89
|
+
duration: 0
|
|
90
|
+
},
|
|
91
|
+
[StoryActionType.Effect]: {
|
|
92
|
+
id: "",
|
|
93
|
+
parameters: ""
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
class StoryActionController extends DatGuiController {
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param {StoryAction} action
|
|
101
|
+
*/
|
|
102
|
+
constructor(action) {
|
|
103
|
+
super();
|
|
104
|
+
|
|
105
|
+
this.addClass('story-action');
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
const control = this.addControl(action, 'type', StoryActionType);
|
|
109
|
+
|
|
110
|
+
//disable control
|
|
111
|
+
control.domElement.style.pointerEvents = "none";
|
|
112
|
+
|
|
113
|
+
//build parameters based on type
|
|
114
|
+
const params = storyActionControllerParamFactories[action.type];
|
|
115
|
+
|
|
116
|
+
const paramClone = Object.assign({}, params);
|
|
117
|
+
|
|
118
|
+
//merge default parameters with actual ones
|
|
119
|
+
const paramProxy = Object.assign({}, Object.assign(paramClone, action.parameters));
|
|
120
|
+
|
|
121
|
+
for (let propName in paramProxy) {
|
|
122
|
+
const parameterName = propName;
|
|
123
|
+
this.addControl(paramProxy, propName).onFinishChange(v => {
|
|
124
|
+
action.parameters[parameterName] = v;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
class StoryTriggerController extends EmptyView {
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param {StoryTrigger} trigger
|
|
135
|
+
*/
|
|
136
|
+
constructor(trigger) {
|
|
137
|
+
super({ classList: ['story-trigger'] });
|
|
138
|
+
|
|
139
|
+
const proxy = {
|
|
140
|
+
actionType: StoryActionType.Unknown,
|
|
141
|
+
active: trigger.active.getValue(),
|
|
142
|
+
addAction() {
|
|
143
|
+
|
|
144
|
+
const action = new StoryAction();
|
|
145
|
+
|
|
146
|
+
action.type = proxy.actionType;
|
|
147
|
+
|
|
148
|
+
trigger.actions.add(action);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
const dat = new DatGuiController();
|
|
154
|
+
dat.addControl(trigger, "code").onFinishChange(() => trigger.compile());
|
|
155
|
+
dat.addControl(proxy, 'active').onChange(() => trigger.active.set(proxy.active));
|
|
156
|
+
|
|
157
|
+
dat.addControl(proxy, 'actionType', StoryActionType);
|
|
158
|
+
dat.addControl(proxy, 'addAction').name('+action');
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
this.addChild(dat);
|
|
162
|
+
|
|
163
|
+
this.addChild(new NativeListController({
|
|
164
|
+
model:trigger.actions,
|
|
165
|
+
classList: ["actions"],
|
|
166
|
+
elementFactory() {
|
|
167
|
+
return new StoryAction();
|
|
168
|
+
},
|
|
169
|
+
elementViewFactory(action){
|
|
170
|
+
return new StoryActionController(action);
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export class StoryTriggerSetController extends EmptyView {
|
|
177
|
+
/**
|
|
178
|
+
*
|
|
179
|
+
*/
|
|
180
|
+
constructor() {
|
|
181
|
+
super({ classList: ['story-trigger-set-controller'] });
|
|
182
|
+
|
|
183
|
+
const model = new ObservedValue(null);
|
|
184
|
+
|
|
185
|
+
this.model = model;
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
this.model.onChanged.add((triggers) => {
|
|
189
|
+
this.removeAllChildren();
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
if (triggers !== null) {
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @type {List<StoryTrigger>}
|
|
196
|
+
*/
|
|
197
|
+
const list = triggers.elements;
|
|
198
|
+
|
|
199
|
+
const view = new NativeListController({
|
|
200
|
+
model: list,
|
|
201
|
+
elementFactory() {
|
|
202
|
+
return new StoryTrigger();
|
|
203
|
+
},
|
|
204
|
+
elementViewFactory(trigger) {
|
|
205
|
+
return new StoryTriggerController(trigger);
|
|
206
|
+
},
|
|
207
|
+
classList: ['triggers']
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
this.addChild(view);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import View from "../../../../../src/view/View.js";
|
|
2
|
+
import ImageView from "../../../../../src/view/elements/image/ImageView.js";
|
|
3
|
+
import ButtonView from "../../../../../src/view/elements/button/ButtonView.js";
|
|
4
|
+
import { LocalizedLabelView } from "../../../../../src/view/common/LocalizedLabelView.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @extends {View}
|
|
8
|
+
*/
|
|
9
|
+
export class AuraController extends View {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {Aura} aura
|
|
13
|
+
* @param {function} requestRemoval
|
|
14
|
+
* @param {Localization} localization
|
|
15
|
+
*/
|
|
16
|
+
constructor({ aura, requestRemoval, localization }) {
|
|
17
|
+
super();
|
|
18
|
+
|
|
19
|
+
this.model = aura;
|
|
20
|
+
|
|
21
|
+
this.el = document.createElement('div');
|
|
22
|
+
this.addClass('ui-aura-controller');
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {AfflictionDescription}
|
|
27
|
+
*/
|
|
28
|
+
const affliction = aura.affliction;
|
|
29
|
+
|
|
30
|
+
const iconView = new ImageView(affliction.icon);
|
|
31
|
+
iconView.addClass('icon');
|
|
32
|
+
|
|
33
|
+
this.addChild(iconView);
|
|
34
|
+
|
|
35
|
+
this.addChild(new ButtonView({ action: requestRemoval, name: '', classList: ['remove'] }));
|
|
36
|
+
|
|
37
|
+
const lName = new LocalizedLabelView({
|
|
38
|
+
id: affliction.getLocalizationIdForName(),
|
|
39
|
+
localization,
|
|
40
|
+
classList: ["name"]
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.addChild(lName);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import View from "../../../src/view/View.js";
|
|
2
|
+
import { makeModelView } from "../../../src/view/renderModel.js";
|
|
3
|
+
import Vector2 from "../../../src/core/geom/Vector2.js";
|
|
4
|
+
import domify from "../../../src/view/DOM.js";
|
|
5
|
+
import LabelView from "../../../src/view/common/LabelView.js";
|
|
6
|
+
import List from "../../../src/core/collection/list/List.js";
|
|
7
|
+
import AABB2 from "../../../src/core/geom/AABB2.js";
|
|
8
|
+
import { DragEvents } from "../../../src/engine/input/devices/events/DragEvents.js";
|
|
9
|
+
import { MouseEvents } from "../../../src/engine/input/devices/events/MouseEvents.js";
|
|
10
|
+
import { TouchEvents } from "../../../src/engine/input/devices/events/TouchEvents.js";
|
|
11
|
+
import { computePathBase } from "../../../src/core/path/computePathBase.js";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const ICON_SIZE = 50;
|
|
15
|
+
|
|
16
|
+
class MeshAssetView extends View {
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {string} url
|
|
20
|
+
* @param {Promise.<AssetManager>} assetManager
|
|
21
|
+
* @param {Promise.<WebGLRenderer>} renderer
|
|
22
|
+
* @constructor
|
|
23
|
+
*/
|
|
24
|
+
constructor({ url, assetManager, renderer }) {
|
|
25
|
+
super();
|
|
26
|
+
|
|
27
|
+
const $el = domify();
|
|
28
|
+
|
|
29
|
+
$el.addClass('ui-mesh-library-asset-view');
|
|
30
|
+
|
|
31
|
+
this.el = $el.el;
|
|
32
|
+
|
|
33
|
+
Promise.all([assetManager, renderer])
|
|
34
|
+
.then(function ([assetManager, renderer]) {
|
|
35
|
+
const imagePromise = makeModelView(url, assetManager, new Vector2(ICON_SIZE, ICON_SIZE), renderer, new AABB2(0, 0, 1, 1));
|
|
36
|
+
|
|
37
|
+
imagePromise.then(function (image) {
|
|
38
|
+
$el.append(image);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const pathBase = computePathBase(url);
|
|
43
|
+
|
|
44
|
+
const lastIndexOfDot = pathBase.lastIndexOf('.');
|
|
45
|
+
|
|
46
|
+
let fileName;
|
|
47
|
+
if (lastIndexOfDot !== -1) {
|
|
48
|
+
fileName = pathBase.substring(0, lastIndexOfDot);
|
|
49
|
+
} else {
|
|
50
|
+
fileName = pathBase;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const vName = new LabelView(fileName);
|
|
54
|
+
|
|
55
|
+
this.addChild(vName);
|
|
56
|
+
|
|
57
|
+
$el.attr({ draggable: true });
|
|
58
|
+
|
|
59
|
+
$el.on(DragEvents.DragStart, function (event) {
|
|
60
|
+
console.log('dragstart', event);
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
|
|
63
|
+
event.dataTransfer.setData('text/json', JSON.stringify({
|
|
64
|
+
type: "Mesh",
|
|
65
|
+
url
|
|
66
|
+
}));
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
$el.on(MouseEvents.Down, function (event) {
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
$el.on(TouchEvents.Start, function (event) {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
$el.on(MouseEvents.Move, function (event) {
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
$el.on(TouchEvents.Move, function (event) {
|
|
82
|
+
event.stopPropagation();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class MeshLibraryView extends View {
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param {MeshLibrary} library
|
|
92
|
+
* @param {Promise.<AssetManager>} assetManager
|
|
93
|
+
* @param {Promise.<WebGLRenderer>} renderer
|
|
94
|
+
* @constructor
|
|
95
|
+
*/
|
|
96
|
+
constructor(library, assetManager, renderer) {
|
|
97
|
+
super();
|
|
98
|
+
|
|
99
|
+
const $el = domify();
|
|
100
|
+
|
|
101
|
+
$el.addClass('ui-mesh-library-view');
|
|
102
|
+
|
|
103
|
+
this.el = $el.el;
|
|
104
|
+
|
|
105
|
+
this.assets = new List();
|
|
106
|
+
|
|
107
|
+
const self = this;
|
|
108
|
+
|
|
109
|
+
function layout() {
|
|
110
|
+
const width = self.size.x;
|
|
111
|
+
|
|
112
|
+
const columnSpacing = 16;
|
|
113
|
+
|
|
114
|
+
const minRowSpacing = 8;
|
|
115
|
+
|
|
116
|
+
const rowLength = Math.floor(width / (ICON_SIZE + minRowSpacing));
|
|
117
|
+
|
|
118
|
+
const spareRowWidth = width - ICON_SIZE * rowLength;
|
|
119
|
+
|
|
120
|
+
const rowSpacing = spareRowWidth / Math.max(1, rowLength - 1);
|
|
121
|
+
|
|
122
|
+
const assets = self.assets;
|
|
123
|
+
|
|
124
|
+
const numAssets = assets.length;
|
|
125
|
+
|
|
126
|
+
let rowIndex = 0;
|
|
127
|
+
let columnIndex = 0;
|
|
128
|
+
for (let i = 0; i < numAssets; i++) {
|
|
129
|
+
const assetView = assets.get(i);
|
|
130
|
+
|
|
131
|
+
assetView.position.set(rowIndex * (ICON_SIZE + rowSpacing), columnIndex * (ICON_SIZE + columnSpacing));
|
|
132
|
+
|
|
133
|
+
rowIndex++;
|
|
134
|
+
if (rowIndex >= rowLength) {
|
|
135
|
+
//start new row
|
|
136
|
+
rowIndex = 0;
|
|
137
|
+
columnIndex++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function addAsset(url) {
|
|
143
|
+
const assetView = new MeshAssetView({ url, assetManager, renderer });
|
|
144
|
+
|
|
145
|
+
self.assets.add(assetView);
|
|
146
|
+
|
|
147
|
+
self.addChild(assetView);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
library.assets.forEach(addAsset);
|
|
151
|
+
library.assets.on.added.add(addAsset);
|
|
152
|
+
|
|
153
|
+
this.layout = layout;
|
|
154
|
+
|
|
155
|
+
this.bindSignal(this.size.onChanged, layout);
|
|
156
|
+
|
|
157
|
+
this.on.linked.add(layout);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
export default MeshLibraryView;
|