mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Replace XML codeblock spaces with tabs
This commit is contained in:
@@ -15,34 +15,34 @@
|
||||
|
||||
class ExampleEditorDebugger extends EditorDebuggerPlugin:
|
||||
|
||||
func _has_capture(capture):
|
||||
# Return true if you wish to handle messages with the prefix "my_plugin:".
|
||||
return capture == "my_plugin"
|
||||
func _has_capture(capture):
|
||||
# Return true if you wish to handle messages with the prefix "my_plugin:".
|
||||
return capture == "my_plugin"
|
||||
|
||||
func _capture(message, data, session_id):
|
||||
if message == "my_plugin:ping":
|
||||
get_session(session_id).send_message("my_plugin:echo", data)
|
||||
return true
|
||||
return false
|
||||
func _capture(message, data, session_id):
|
||||
if message == "my_plugin:ping":
|
||||
get_session(session_id).send_message("my_plugin:echo", data)
|
||||
return true
|
||||
return false
|
||||
|
||||
func _setup_session(session_id):
|
||||
# Add a new tab in the debugger session UI containing a label.
|
||||
var label = Label.new()
|
||||
label.name = "Example plugin" # Will be used as the tab title.
|
||||
label.text = "Example plugin"
|
||||
var session = get_session(session_id)
|
||||
# Listens to the session started and stopped signals.
|
||||
session.started.connect(func (): print("Session started"))
|
||||
session.stopped.connect(func (): print("Session stopped"))
|
||||
session.add_session_tab(label)
|
||||
func _setup_session(session_id):
|
||||
# Add a new tab in the debugger session UI containing a label.
|
||||
var label = Label.new()
|
||||
label.name = "Example plugin" # Will be used as the tab title.
|
||||
label.text = "Example plugin"
|
||||
var session = get_session(session_id)
|
||||
# Listens to the session started and stopped signals.
|
||||
session.started.connect(func (): print("Session started"))
|
||||
session.stopped.connect(func (): print("Session stopped"))
|
||||
session.add_session_tab(label)
|
||||
|
||||
var debugger = ExampleEditorDebugger.new()
|
||||
|
||||
func _enter_tree():
|
||||
add_debugger_plugin(debugger)
|
||||
add_debugger_plugin(debugger)
|
||||
|
||||
func _exit_tree():
|
||||
remove_debugger_plugin(debugger)
|
||||
remove_debugger_plugin(debugger)
|
||||
[/gdscript]
|
||||
[/codeblocks]
|
||||
To connect on the running game side, use the [EngineDebugger] singleton:
|
||||
@@ -51,15 +51,15 @@
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
EngineDebugger.register_message_capture("my_plugin", _capture)
|
||||
EngineDebugger.send_message("my_plugin:ping", ["test"])
|
||||
EngineDebugger.register_message_capture("my_plugin", _capture)
|
||||
EngineDebugger.send_message("my_plugin:ping", ["test"])
|
||||
|
||||
func _capture(message, data):
|
||||
# Note that the "my_plugin:" prefix is not used here.
|
||||
if message == "echo":
|
||||
prints("Echo received:", data)
|
||||
return true
|
||||
return false
|
||||
# Note that the "my_plugin:" prefix is not used here.
|
||||
if message == "echo":
|
||||
prints("Echo received:", data)
|
||||
return true
|
||||
return false
|
||||
[/gdscript]
|
||||
[/codeblocks]
|
||||
[b]Note:[/b] While the game is running, [method @GlobalScope.print] and similar functions [i]called in the editor[/i] do not print anything, the Output Log prints only game messages.
|
||||
|
||||
Reference in New Issue
Block a user