Skip to content

Commit

Permalink
simple room upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
RSamaium committed Nov 19, 2023
1 parent dcefcd5 commit f60b141
Show file tree
Hide file tree
Showing 10 changed files with 15,360 additions and 1,820 deletions.
461 changes: 320 additions & 141 deletions packages/client/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rxjs": "7.8.0",
"simple-room-client": "^2.0.6",
"simple-room-client": "^3.0.0",
"vue": "^3.2.47"
},
"gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee",
Expand Down
16 changes: 10 additions & 6 deletions packages/client/src/RpgClientEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class RpgClientEngine {
const id: any = isString(sound) ? extractId(sound) : undefined
this.addSound(sound, id)
})

// obsolete
if (typeof __RPGJS_PRODUCTION__ != 'undefined' && __RPGJS_PRODUCTION__) {
if ('serviceWorker' in navigator) {
Expand Down Expand Up @@ -451,12 +451,16 @@ export class RpgClientEngine {
RpgPlugin.emit(HookClient.ConnectedError, [this, err, this.socket], true)
})

this.socket.on('preLoadScene', (name: string) => {
if (this.lastScene == name) {
this.socket.on('preLoadScene', ({ id, reconnect }: { id: string, reconnect?: boolean }) => {
if (this.lastScene == id) {
return
}
this.lastScene = name
this.renderer.transitionScene(name)
this.lastScene = id
this.renderer.transitionScene(id)
if (reconnect) {
this.roomJoin.next('')
this.roomJoin.complete()
}
})

this.socket.on(SocketEvents.GameReload, () => {
Expand Down Expand Up @@ -617,7 +621,7 @@ export class RpgClientEngine {
paramsChanged,
isShape
})

// perform actions on the sprite after creation/update
callAction(key, paramsChanged)
}
Expand Down
3 changes: 3 additions & 0 deletions packages/sample2/main/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ import { RpgClientEngine, Timeline, Ease } from "@rpgjs/client"
export default {
async onStart(engine: RpgClientEngine) {

},
onConnectError(engine, err) {
console.dir(err)
}
}
Loading

0 comments on commit f60b141

Please sign in to comment.