@rpgjs/client 3.3.2 → 4.0.0-beta.3
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/LICENSE +19 -0
- package/lib/Components/AbstractComponent.d.ts +3 -2
- package/lib/Components/AbstractComponent.js +17 -28
- package/lib/Components/AbstractComponent.js.map +1 -1
- package/lib/Components/BarComponent.d.ts +2 -1
- package/lib/Components/BarComponent.js +32 -33
- package/lib/Components/BarComponent.js.map +1 -1
- package/lib/Components/Component.d.ts +3 -3
- package/lib/Components/Component.js +84 -96
- package/lib/Components/Component.js.map +1 -1
- package/lib/Components/DebugComponent.d.ts +2 -1
- package/lib/Components/DebugComponent.js +9 -10
- package/lib/Components/DebugComponent.js.map +1 -1
- package/lib/Components/ImageComponent.d.ts +2 -1
- package/lib/Components/ImageComponent.js +5 -7
- package/lib/Components/ImageComponent.js.map +1 -1
- package/lib/Components/ShapeComponent.d.ts +2 -1
- package/lib/Components/ShapeComponent.js +14 -14
- package/lib/Components/ShapeComponent.js.map +1 -1
- package/lib/Components/TextComponent.d.ts +3 -2
- package/lib/Components/TextComponent.js +10 -9
- package/lib/Components/TextComponent.js.map +1 -1
- package/lib/Components/TileComponent.d.ts +2 -1
- package/lib/Components/TileComponent.js +12 -16
- package/lib/Components/TileComponent.js.map +1 -1
- package/lib/Effects/Animation.d.ts +10 -9
- package/lib/Effects/Animation.js +36 -36
- package/lib/Effects/Animation.js.map +1 -1
- package/lib/Effects/AnimationCharacter.js +2 -5
- package/lib/Effects/AnimationCharacter.js.map +1 -1
- package/lib/Effects/Spinner.d.ts +3 -2
- package/lib/Effects/Spinner.js +2 -5
- package/lib/Effects/Spinner.js.map +1 -1
- package/lib/Effects/Timeline.d.ts +1 -1
- package/lib/Effects/Timeline.js +6 -10
- package/lib/Effects/Timeline.js.map +1 -1
- package/lib/Effects/TransitionScene.d.ts +2 -1
- package/lib/Effects/TransitionScene.js +3 -7
- package/lib/Effects/TransitionScene.js.map +1 -1
- package/lib/GameEngine.js +51 -26
- package/lib/GameEngine.js.map +1 -1
- package/lib/Interfaces/Character.js +1 -2
- package/lib/Interfaces/Scene.js +1 -2
- package/lib/KeyboardControls.d.ts +2 -1
- package/lib/KeyboardControls.js +47 -45
- package/lib/KeyboardControls.js.map +1 -1
- package/lib/Logger.js +1 -5
- package/lib/Logger.js.map +1 -1
- package/lib/Presets/AnimationSpritesheet.js +9 -13
- package/lib/Presets/AnimationSpritesheet.js.map +1 -1
- package/lib/Presets/Scene.js +2 -5
- package/lib/Presets/Scene.js.map +1 -1
- package/lib/Renderer.d.ts +5 -3
- package/lib/Renderer.js +68 -60
- package/lib/Renderer.js.map +1 -1
- package/lib/Resources.js +1 -5
- package/lib/Resources.js.map +1 -1
- package/lib/RpgClient.d.ts +3 -2
- package/lib/RpgClient.js +1 -2
- package/lib/RpgClientEngine.d.ts +2 -1
- package/lib/RpgClientEngine.js +192 -176
- package/lib/RpgClientEngine.js.map +1 -1
- package/lib/RpgGui.js +40 -41
- package/lib/RpgGui.js.map +1 -1
- package/lib/Scene/EventLayer.d.ts +4 -0
- package/lib/Scene/EventLayer.js +8 -0
- package/lib/Scene/EventLayer.js.map +1 -0
- package/lib/Scene/Map.d.ts +17 -3
- package/lib/Scene/Map.js +157 -113
- package/lib/Scene/Map.js.map +1 -1
- package/lib/Scene/Scene.d.ts +3 -3
- package/lib/Scene/Scene.js +24 -20
- package/lib/Scene/Scene.js.map +1 -1
- package/lib/Scene/SceneData.js +1 -5
- package/lib/Scene/SceneData.js.map +1 -1
- package/lib/Sound/RpgSound.js +8 -11
- package/lib/Sound/RpgSound.js.map +1 -1
- package/lib/Sound/Sound.d.ts +2 -2
- package/lib/Sound/Sound.js +1 -5
- package/lib/Sound/Sound.js.map +1 -1
- package/lib/Sound/Sounds.js +4 -8
- package/lib/Sound/Sounds.js.map +1 -1
- package/lib/Sprite/Character.d.ts +3 -2
- package/lib/Sprite/Character.js +15 -16
- package/lib/Sprite/Character.js.map +1 -1
- package/lib/Sprite/Player.js +2 -9
- package/lib/Sprite/Player.js.map +1 -1
- package/lib/Sprite/Spritesheet.d.ts +4 -4
- package/lib/Sprite/Spritesheet.js +1 -5
- package/lib/Sprite/Spritesheet.js.map +1 -1
- package/lib/Sprite/Spritesheets.js +4 -8
- package/lib/Sprite/Spritesheets.js.map +1 -1
- package/lib/Tilemap/CommonLayer.d.ts +2 -1
- package/lib/Tilemap/CommonLayer.js +7 -11
- package/lib/Tilemap/CommonLayer.js.map +1 -1
- package/lib/Tilemap/ImageLayer.js +5 -7
- package/lib/Tilemap/ImageLayer.js.map +1 -1
- package/lib/Tilemap/Tile.d.ts +5 -5
- package/lib/Tilemap/Tile.js +19 -21
- package/lib/Tilemap/Tile.js.map +1 -1
- package/lib/Tilemap/TileLayer.d.ts +0 -7
- package/lib/Tilemap/TileLayer.js +27 -29
- package/lib/Tilemap/TileLayer.js.map +1 -1
- package/lib/Tilemap/TileSet.d.ts +2 -1
- package/lib/Tilemap/TileSet.js +9 -12
- package/lib/Tilemap/TileSet.js.map +1 -1
- package/lib/Tilemap/index.d.ts +3 -11
- package/lib/Tilemap/index.js +22 -61
- package/lib/Tilemap/index.js.map +1 -1
- package/lib/clientEntryPoint.js +26 -28
- package/lib/clientEntryPoint.js.map +1 -1
- package/lib/index.js +21 -75
- package/lib/index.js.map +1 -1
- package/package.json +19 -19
- package/src/Components/AbstractComponent.ts +120 -0
- package/src/Components/BarComponent.ts +179 -0
- package/src/Components/Component.ts +506 -0
- package/src/Components/DebugComponent.ts +36 -0
- package/src/Components/ImageComponent.ts +30 -0
- package/src/Components/ShapeComponent.ts +64 -0
- package/src/Components/TextComponent.ts +33 -0
- package/src/Components/TileComponent.ts +43 -0
- package/src/Effects/Animation.ts +297 -0
- package/src/Effects/AnimationCharacter.ts +7 -0
- package/src/Effects/Spinner.ts +19 -0
- package/src/Effects/Timeline.ts +294 -0
- package/src/Effects/TransitionScene.ts +57 -0
- package/src/GameEngine.ts +284 -0
- package/src/Interfaces/Character.ts +7 -0
- package/src/Interfaces/Scene.ts +9 -0
- package/src/KeyboardControls.ts +552 -0
- package/src/Logger.ts +3 -0
- package/src/Presets/AnimationSpritesheet.ts +36 -0
- package/src/Presets/Scene.ts +3 -0
- package/src/Renderer.ts +263 -0
- package/src/Resources.ts +40 -0
- package/src/RpgClient.ts +333 -0
- package/src/RpgClientEngine.ts +709 -0
- package/src/RpgGui.ts +553 -0
- package/src/RpgGuiCompiled.ts +43 -0
- package/src/Scene/EventLayer.ts +9 -0
- package/src/Scene/Map.ts +393 -0
- package/src/Scene/Scene.ts +270 -0
- package/src/Scene/SceneData.ts +13 -0
- package/src/Sound/RpgSound.ts +50 -0
- package/src/Sound/Sound.ts +91 -0
- package/src/Sound/Sounds.ts +7 -0
- package/src/Sprite/Character.ts +149 -0
- package/src/Sprite/Player.ts +3 -0
- package/src/Sprite/Spritesheet.ts +392 -0
- package/src/Sprite/Spritesheets.ts +8 -0
- package/src/Tilemap/CommonLayer.ts +20 -0
- package/src/Tilemap/ImageLayer.ts +20 -0
- package/src/Tilemap/Tile.ts +80 -0
- package/src/Tilemap/TileLayer.ts +142 -0
- package/src/Tilemap/TileSet.ts +40 -0
- package/src/Tilemap/index.ts +173 -0
- package/src/clientEntryPoint.ts +141 -0
- package/src/index.ts +25 -0
- package/src/types/howler.d.ts +73 -0
- package/tsconfig.json +30 -0
- package/lib/Components/ColorComponent.d.ts +0 -9
- package/lib/Components/ColorComponent.js +0 -18
- package/lib/Components/ColorComponent.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Subscription } from "rxjs";
|
|
2
|
+
import { RpgClientEngine } from "../RpgClientEngine";
|
|
3
|
+
import { FrameOptions } from "../Sprite/Spritesheet";
|
|
4
|
+
import { Timeline } from "./Timeline";
|
|
5
|
+
import { Container } from "pixi.js"
|
|
6
|
+
|
|
7
|
+
export class TransitionScene {
|
|
8
|
+
private frameIndex: number = 0
|
|
9
|
+
private animations: FrameOptions[][] = []
|
|
10
|
+
private updateSubscription: Subscription
|
|
11
|
+
private complete: Function = () => {}
|
|
12
|
+
|
|
13
|
+
constructor(private clientEngine: RpgClientEngine, private container: Container) { }
|
|
14
|
+
|
|
15
|
+
addFadeIn() {
|
|
16
|
+
return this.addFading(1, 0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
addFadeOut() {
|
|
20
|
+
return this.addFading(0, 1)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private addFading(from: number, to: number) {
|
|
24
|
+
this.animations = new Timeline()
|
|
25
|
+
.add(15, ({ opacity }) => [{
|
|
26
|
+
opacity
|
|
27
|
+
}], {
|
|
28
|
+
opacity: {
|
|
29
|
+
from,
|
|
30
|
+
to
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
.create()
|
|
34
|
+
return this
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onComplete(cb: Function) {
|
|
38
|
+
this.complete = cb
|
|
39
|
+
return this
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
start() {
|
|
43
|
+
this.updateSubscription = this.clientEngine.tick.subscribe(() => this.update())
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private update() {
|
|
47
|
+
const animationFrame = this.animations[this.frameIndex]
|
|
48
|
+
if (!animationFrame) {
|
|
49
|
+
this.complete()
|
|
50
|
+
this.updateSubscription.unsubscribe()
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
const frame = animationFrame[0]
|
|
54
|
+
this.container.alpha = frame.opacity as number
|
|
55
|
+
this.frameIndex++
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { RpgCommonGame, RpgCommonPlayer, GameSide, RpgShape } from "@rpgjs/common";
|
|
2
|
+
import { BehaviorSubject, combineLatest, Observable, Subject, map } from "rxjs";
|
|
3
|
+
import { RpgRenderer } from "./Renderer";
|
|
4
|
+
import { RpgClientEngine } from "./RpgClientEngine";
|
|
5
|
+
import { LayoutObject, ObjectFixture, ObjectFixtureList } from "@rpgjs/types";
|
|
6
|
+
|
|
7
|
+
export class GameEngineClient extends RpgCommonGame {
|
|
8
|
+
playerId: string
|
|
9
|
+
standalone: boolean
|
|
10
|
+
clientEngine: RpgClientEngine
|
|
11
|
+
renderer: RpgRenderer
|
|
12
|
+
|
|
13
|
+
private _objects: BehaviorSubject<ObjectFixtureList> = new BehaviorSubject({})
|
|
14
|
+
private _obsObjects: {
|
|
15
|
+
[id: string]: BehaviorSubject<ObjectFixture>
|
|
16
|
+
} = {}
|
|
17
|
+
private _obsObjectsDeleteNotifier$: {
|
|
18
|
+
[id: string]: Subject<void>
|
|
19
|
+
} = {}
|
|
20
|
+
private _shapes: BehaviorSubject<ObjectFixtureList> = new BehaviorSubject({})
|
|
21
|
+
private _objectsChanged: BehaviorSubject<ObjectFixtureList> = new BehaviorSubject({})
|
|
22
|
+
|
|
23
|
+
world = {
|
|
24
|
+
getObjects: this.getObjects.bind(this),
|
|
25
|
+
getObject: (id: string): RpgCommonPlayer | null => {
|
|
26
|
+
const obj = this.getObject(id)
|
|
27
|
+
if (!obj) return null
|
|
28
|
+
return obj.object
|
|
29
|
+
},
|
|
30
|
+
getShape: (id: string): RpgShape | null => {
|
|
31
|
+
const obj = this.getShape(id)
|
|
32
|
+
if (!obj) return null
|
|
33
|
+
return obj.object
|
|
34
|
+
},
|
|
35
|
+
getAll: (id: string): RpgCommonPlayer | RpgShape | null => {
|
|
36
|
+
const obj = this.getObjectAndShape(id)
|
|
37
|
+
if (!obj) return null
|
|
38
|
+
return obj.object
|
|
39
|
+
},
|
|
40
|
+
removeObject: this.removeObject.bind(this),
|
|
41
|
+
getObjectsOfGroup: () => {
|
|
42
|
+
return {
|
|
43
|
+
...this.getObjects(),
|
|
44
|
+
...this.events
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
getShapesOfGroup: () => {
|
|
48
|
+
return this.getShapes()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
constructor() {
|
|
53
|
+
super(GameSide.Client)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private _get(prop: '_objects' | '_shapes', id: string): ObjectFixture | null {
|
|
57
|
+
const objects = this[prop].value
|
|
58
|
+
const val = objects[id]
|
|
59
|
+
if (!val) return null
|
|
60
|
+
return val
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get objectsChanged(): Observable<{ [id: string]: ObjectFixture }> {
|
|
64
|
+
return this._objectsChanged.asObservable()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setObjectsChanged(val: {
|
|
68
|
+
[playerId: string]: ObjectFixture
|
|
69
|
+
}) {
|
|
70
|
+
this._objectsChanged.next(val)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
listenObject(id: string): Observable<ObjectFixture> {
|
|
74
|
+
return this._obsObjects[id].asObservable()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get objects(): Observable<{ [id: string]: ObjectFixture }> {
|
|
78
|
+
return this._objects.asObservable()
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
get shapes(): Observable<{ [id: string]: ObjectFixture }> {
|
|
82
|
+
return this._shapes.asObservable()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
get all(): Observable<{ [id: string]: ObjectFixture }> {
|
|
86
|
+
return combineLatest([
|
|
87
|
+
this.objects,
|
|
88
|
+
this.shapes
|
|
89
|
+
]).pipe(
|
|
90
|
+
map(([objects, shapes]) => {
|
|
91
|
+
return {
|
|
92
|
+
...objects,
|
|
93
|
+
...shapes
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
getShapes(): { [id: string]: ObjectFixture } {
|
|
100
|
+
return this._shapes.value
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
getObjects(): { [id: string]: ObjectFixture } {
|
|
104
|
+
return this._objects.value
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
getObject(id: string): ObjectFixture | null {
|
|
108
|
+
return this._get('_objects', id)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
getShape(id: string): ObjectFixture | null {
|
|
112
|
+
return this._get('_shapes', id)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
getObjectAndShape(id: string): ObjectFixture | null {
|
|
116
|
+
let obj = this.getObject(id)
|
|
117
|
+
if (!obj) obj = this.getShape(id)
|
|
118
|
+
return obj
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
resetObjects() {
|
|
122
|
+
for (let id in this._obsObjectsDeleteNotifier$) {
|
|
123
|
+
this._obsObjectsDeleteNotifier$[id].next()
|
|
124
|
+
this._obsObjectsDeleteNotifier$[id].complete()
|
|
125
|
+
this._obsObjects[id].complete()
|
|
126
|
+
}
|
|
127
|
+
this._obsObjectsDeleteNotifier$ = {}
|
|
128
|
+
this._obsObjects = {}
|
|
129
|
+
this._objects.next({})
|
|
130
|
+
this._shapes.next({})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
getDeleteNotifier(id: string): Observable<void> {
|
|
134
|
+
return this._obsObjectsDeleteNotifier$[id].asObservable()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private _remove(prop: '_objects' | '_shapes', id: string) {
|
|
138
|
+
const logic = prop == '_objects' ? this.getObject(id) : this.getShape(id)
|
|
139
|
+
if (logic) {
|
|
140
|
+
const objects = { ...this[prop].value } // clone
|
|
141
|
+
delete objects[id]
|
|
142
|
+
this._obsObjectsDeleteNotifier$[id].next()
|
|
143
|
+
this._obsObjectsDeleteNotifier$[id].complete()
|
|
144
|
+
this._obsObjects[id].complete()
|
|
145
|
+
delete this._obsObjects[id]
|
|
146
|
+
this[prop].next(objects)
|
|
147
|
+
return true
|
|
148
|
+
}
|
|
149
|
+
return false
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
removeObject(id: string): boolean {
|
|
153
|
+
if (this.events[id]) {
|
|
154
|
+
delete this.events[id]
|
|
155
|
+
}
|
|
156
|
+
return this._remove('_objects', id)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
removeShape(id: string): boolean {
|
|
160
|
+
return this._remove('_shapes', id)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
removeObjectAndShape(id: string): boolean {
|
|
164
|
+
let bool = this.removeObject(id)
|
|
165
|
+
if (!bool) bool = this.removeShape(id)
|
|
166
|
+
return bool
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
static toArray(obj: any, prop: string) {
|
|
170
|
+
if (obj[prop]) obj[prop] = Object.values(obj[prop])
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
updateObject(obj) {
|
|
174
|
+
const {
|
|
175
|
+
playerId: id,
|
|
176
|
+
params,
|
|
177
|
+
localEvent,
|
|
178
|
+
paramsChanged,
|
|
179
|
+
isShape
|
|
180
|
+
} = obj
|
|
181
|
+
if (paramsChanged.components) {
|
|
182
|
+
paramsChanged.layout = {
|
|
183
|
+
center: {
|
|
184
|
+
lines: [
|
|
185
|
+
{
|
|
186
|
+
col: paramsChanged.components
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const layoutToArray = (params) => {
|
|
193
|
+
const layout = params.layout as LayoutObject<any> | undefined
|
|
194
|
+
if (layout) {
|
|
195
|
+
['center', 'top', 'right', 'bottom', 'left'].forEach((key) => {
|
|
196
|
+
if (!layout[key]) return
|
|
197
|
+
GameEngineClient.toArray(layout[key], 'lines')
|
|
198
|
+
if (!layout[key].lines) return
|
|
199
|
+
layout[key].lines.map(layout => {
|
|
200
|
+
GameEngineClient.toArray(layout, 'col')
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
layoutToArray(params)
|
|
206
|
+
GameEngineClient.toArray(params, 'polygon')
|
|
207
|
+
const isMe = () => id == this.playerId
|
|
208
|
+
let logic
|
|
209
|
+
let teleported = false
|
|
210
|
+
let propName = '_objects'
|
|
211
|
+
|
|
212
|
+
const createObsForObject = (data) => {
|
|
213
|
+
this._obsObjectsDeleteNotifier$[id] = new Subject()
|
|
214
|
+
this._obsObjects[id] = new BehaviorSubject(data)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (isShape) {
|
|
218
|
+
propName = '_shapes'
|
|
219
|
+
logic = this.world.getShape(id)
|
|
220
|
+
if (!logic) {
|
|
221
|
+
logic = this.addShape(params)
|
|
222
|
+
createObsForObject({ logic })
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
if (localEvent) {
|
|
227
|
+
logic = this.events[id]
|
|
228
|
+
if (!logic) {
|
|
229
|
+
logic = this.addEvent(RpgCommonPlayer, id)
|
|
230
|
+
createObsForObject({ logic })
|
|
231
|
+
this.events[id] = {
|
|
232
|
+
object: logic
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
logic = logic.object
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
logic = this.world.getObject(id)
|
|
241
|
+
}
|
|
242
|
+
if (!logic) {
|
|
243
|
+
logic = this.addPlayer(RpgCommonPlayer, id)
|
|
244
|
+
createObsForObject({ logic })
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
logic.prevParamsChanged = Object.assign({}, logic)
|
|
248
|
+
for (let key in params) {
|
|
249
|
+
if (!localEvent &&
|
|
250
|
+
(key == 'position' ||
|
|
251
|
+
(key == 'direction' && paramsChanged && paramsChanged.position))) {
|
|
252
|
+
if (isMe() && logic.canMove) continue
|
|
253
|
+
}
|
|
254
|
+
logic[key] = params[key]
|
|
255
|
+
}
|
|
256
|
+
if (paramsChanged) {
|
|
257
|
+
layoutToArray(paramsChanged)
|
|
258
|
+
if (paramsChanged.layout) logic.componentChanged = paramsChanged.layout
|
|
259
|
+
if (paramsChanged.teleported) {
|
|
260
|
+
teleported = true
|
|
261
|
+
logic.position = { ...params.position } // clone
|
|
262
|
+
logic.direction = params.direction
|
|
263
|
+
}
|
|
264
|
+
if (!logic.paramsChanged) logic.paramsChanged = {}
|
|
265
|
+
logic.paramsChanged = paramsChanged
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const newObject = {
|
|
269
|
+
object: logic,
|
|
270
|
+
paramsChanged
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
this[propName].next({
|
|
274
|
+
...this[propName].value,
|
|
275
|
+
...{
|
|
276
|
+
[id]: newObject
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
this._obsObjects[id].next(newObject)
|
|
281
|
+
|
|
282
|
+
return newObject
|
|
283
|
+
}
|
|
284
|
+
}
|