wasm test

This commit is contained in:
MaidOpi
2026-05-11 13:21:51 +08:00
parent 0428927f5f
commit fb9966e61a
10 changed files with 201 additions and 56 deletions
+52
View File
@@ -0,0 +1,52 @@
[preset.0]
name="Web"
platform="Web"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="leanclr/*.dll,leanclr/live_reload.txt"
exclude_filter=""
export_path="deploy/html/index.html"
patches=PackedStringArray()
patch_delta_encoding=false
patch_delta_compression_level_zstd=19
patch_delta_min_reduction=0.1
patch_delta_include_filters="*"
patch_delta_exclude_filters=""
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug="/Volumes/External/Misc/templates_4.6/web_dlink_nothreads_debug.zip"
custom_template/release="/Volumes/External/Misc/templates_4.6/web_dlink_nothreads_release.zip"
variant/extensions_support=true
variant/thread_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/ensure_cross_origin_isolation_headers=true
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)
threads/emscripten_pool_size=8
threads/godot_pool_size=4
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false
+1
View File
@@ -12,3 +12,4 @@ linux.debug.x86_64 = "res://bin/Debug/libleanclr_godot.so"
linux.release.x86_64 = "res://bin/Release/libleanclr_godot.so"
macos.debug = "res://bin/Debug/libleanclr_godot.dylib"
macos.release = "res://bin/Release/libleanclr_godot.dylib"
web.release.wasm32 = "res://bin/Release/libleanclr_godot.wasm"
+3
View File
@@ -74,5 +74,8 @@ Name = &"FlappyScript"
[node name="HotReloadInputRelay" type="Node" parent="." unique_id=394620894]
script = ExtResource("4_input_relay")
attached_assembly_name = "Game"
reload_type_name = "Game.HotReloadSmoke"
script_owner_path = NodePath("../FlappyScript")
[node name="RuntimeCSharpEditor" parent="." unique_id=56462960 instance=ExtResource("3_editor_scene")]
+36
View File
@@ -1,10 +1,46 @@
extends Node
@export var marker_path := "res://leanclr/live_reload.txt"
@export var attached_assembly_name := ""
@export var reload_type_name := ""
@export var script_owner_path: NodePath
@export var reload_poll_seconds := 0.25
@onready var hot_reload_host: Node = get_node("../LiveHotReloadHost")
var _elapsed := 0.0
func _ready() -> void:
if hot_reload_host != null:
hot_reload_host.set_script_owner_path(script_owner_path)
reload_from_marker()
set_process(reload_poll_seconds > 0.0)
set_process_input(true)
func _process(delta: float) -> void:
_elapsed += delta
if _elapsed >= reload_poll_seconds:
_elapsed = 0.0
reload_from_marker()
func _input(event: InputEvent) -> void:
if hot_reload_host != null:
hot_reload_host.forward_input(event)
func reload_from_marker() -> void:
if hot_reload_host == null:
return
var assembly_name := attached_assembly_name
if marker_path != "" and FileAccess.file_exists(marker_path):
assembly_name = FileAccess.get_file_as_string(marker_path).strip_edges()
if assembly_name == "":
assembly_name = attached_assembly_name
if assembly_name == "" or assembly_name == hot_reload_host.get_loaded_assembly_name():
return
if assembly_name == attached_assembly_name:
hot_reload_host.use_attached_script(assembly_name)
else:
hot_reload_host.reload_assembly(assembly_name, reload_type_name)
+8
View File
@@ -21,6 +21,11 @@ func _ready() -> void:
run_button.pressed.connect(compile_and_reload)
show()
if OS.has_feature("web"):
run_button.disabled = true
_set_status("Web export is read-only; runtime build is desktop only.")
return
if OS.has_environment(AUTORUN_ENVIRONMENT) and not autorun_started:
autorun_started = true
var code := editor.text
@@ -69,6 +74,9 @@ func compile_and_reload() -> void:
if editor == null:
_set_status("Editor is not ready.")
return
if OS.has_feature("web"):
_set_status("Web export is read-only; runtime build is desktop only.")
return
if not _write_text_file(EDIT_SOURCE_PATH, editor.text):
_set_status("Failed to write HotReloadSmoke.cs")