-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d73626
commit 26b5d1e
Showing
5 changed files
with
119 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+12.5 KB
(120%)
addons/gdcef/doc/architecture/sequence_js_communication.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 31 additions & 37 deletions
68
addons/gdcef/doc/architecture/sequence_js_communication.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,54 @@ | ||
@startuml | ||
|
||
participant "JavaScript" as JS | ||
participant "Render Process" as RP | ||
participant "CEF" as CEF | ||
participant "GDCef\n(Main Process)" as MP | ||
participant "GDScript" as GD | ||
participant "Main Process\n(Godot)" as MP | ||
participant "Render Process\n(CEF)" as RP | ||
participant "JavaScript\n(Renderer Process)" as JS | ||
|
||
== JavaScript to GDScript == | ||
== Godot to JavaScript == | ||
|
||
JS -> RP : godot.callGodotMethod() | ||
GD -> MP : send_to_js("character_update", data) | ||
activate MP | ||
|
||
MP -> RP : SendProcessMessage("GodotToJS", ["character_update", data]) | ||
activate RP | ||
|
||
RP -> RP : GodotMethodHandler::Execute() | ||
RP -> CEF : SendProcessMessage(PID_BROWSER) | ||
activate CEF | ||
RP -> RP : OnProcessMessageReceived() | ||
RP -> JS : ExecuteJavaScript("godotEventSystem.emit()") | ||
activate JS | ||
|
||
CEF -> MP : OnProcessMessageReceived() | ||
activate MP | ||
JS -> JS : Execute registered callback | ||
note right: Registered with godotEventSystem.on() | ||
JS --> JS : Update UI | ||
deactivate JS | ||
|
||
MP -> GD : Call GDScript method | ||
activate GD | ||
GD --> MP : Return value | ||
deactivate GD | ||
RP --> MP : Message processed | ||
deactivate RP | ||
|
||
MP --> CEF : Process message result | ||
MP --> GD : Complete | ||
deactivate MP | ||
|
||
CEF --> RP : Message processed | ||
deactivate CEF | ||
== JavaScript to Godot == | ||
|
||
RP --> JS : JavaScript return value | ||
deactivate RP | ||
JS -> RP : window.godot.modify_xp(42) | ||
activate RP | ||
|
||
== GDScript to JavaScript == | ||
RP -> RP : GodotMethodHandler::Execute() | ||
note right: Convert JS args to CEF types | ||
|
||
GD -> MP : execute_javascript() | ||
RP -> MP : SendProcessMessage("callGodotMethod", ["modify_xp", 42]) | ||
activate MP | ||
|
||
MP -> CEF : ExecuteJavaScript() | ||
activate CEF | ||
MP -> MP : OnProcessMessageReceived() | ||
MP -> GD : Execute Callable("modify_xp") | ||
activate GD | ||
|
||
CEF -> RP : Execute in V8 context | ||
activate RP | ||
GD -> GD : Update game state | ||
deactivate GD | ||
|
||
RP -> JS : Execute JavaScript code | ||
activate JS | ||
JS --> RP : JavaScript result | ||
deactivate JS | ||
MP --> RP : Complete | ||
deactivate MP | ||
|
||
RP --> CEF : Execution complete | ||
deactivate RP | ||
|
||
CEF --> MP : JavaScript executed | ||
deactivate CEF | ||
|
||
MP --> GD : Execution complete | ||
deactivate MP | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.