Skip to content

Commit 497ddae

Browse files
committed
refactor(sdk): apply only needs frameInfo
1 parent 083cb6a commit 497ddae

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

engine/modules/entities/src/main/resources/view/entity-module/Command.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class CreateCommand {
4848
this.type = args[0]
4949
}
5050

51-
apply (entities, frameNumber) {
51+
apply (entities) {
5252
let entity = EntityFactory.create(this.type)
5353
entity.id = this.id
5454
entities.set(this.id, entity)
@@ -62,8 +62,8 @@ export class CreateCommands {
6262
this.type = args[0]
6363
}
6464

65-
apply (entities, frameNumber, frameInfo) {
66-
this.commands.forEach(command => command.apply(entities, frameNumber, frameInfo))
65+
apply (entities, frameInfo) {
66+
this.commands.forEach(command => command.apply(entities, frameInfo.number, frameInfo))
6767
}
6868
}
6969

@@ -143,20 +143,20 @@ export class PropertiesCommand {
143143
}
144144
}
145145

146-
apply (entities, frameNumber, frameInfo) {
146+
apply (entities, frameInfo) {
147147
let entity = entities.get(this.id)
148-
entity.addState(this.t, {values: this.params, curve: this.curve}, frameNumber, frameInfo)
148+
entity.addState(this.t, {values: this.params, curve: this.curve}, frameInfo.number, frameInfo)
149149
}
150150
}
151151
export class WorldCommitCommand {
152152
constructor (args, globalData) {
153153
this.times = args.map(v => +v)
154154
}
155155

156-
apply (entities, frameNumber, frameInfo) {
156+
apply (entities, frameInfo) {
157157
entities.forEach(entity => {
158158
this.times.forEach(time => {
159-
entity.addState(time, {values: {}, curve: {}}, frameNumber, frameInfo)
159+
entity.addState(time, {values: {}, curve: {}}, frameInfo.number, frameInfo)
160160
})
161161
})
162162
}

engine/modules/entities/src/main/resources/view/entity-module/GraphicEntityModule.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ export class GraphicEntityModule {
3636
}
3737

3838
handleFrameData (frameInfo, frameData) {
39-
const number = frameInfo.number
4039
if (frameData) {
4140
const commands = CommandParser.parse(frameData, this.globalData, frameInfo)
4241
if (commands) {
4342
commands.forEach(command => {
44-
const loadPromise = command.apply(this.entities, number, frameInfo)
43+
const loadPromise = command.apply(this.entities, frameInfo)
4544
if (loadPromise) {
4645
this.loadingAssets++
4746
loadPromise.then(() => {

0 commit comments

Comments
 (0)