Skip to content

Commit

Permalink
插件类新增检测到错误后将调用的虚函数
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwdit committed Jun 20, 2022
1 parent a874898 commit ab91bd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libs/core/api/Plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ func _on_process():
pass


## 在插件中覆盖此虚函数,以便定义在RainyBot检测到运行时错误后将执行的操作
## 您可以使用[method get_last_errors]函数来获取错误的详细内容
func _on_error():
pass


## 在插件中覆盖此虚函数,以便定义RainyBot在与协议后端断开建立连接后插件将执行的操作
## 可以在此处进行一些与连接状态相关的操作,例如断开连接后暂停某些任务的运行等
func _on_disconnect():
Expand Down
1 change: 1 addition & 0 deletions libs/core/modules/global_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ func check_error():
last_errors.append("脚本运行时错误: "+_text)
Console.print_error("检测到脚本运行时错误: "+_text)
last_log_text = curr_text
get_tree().call_group("Plugin","_on_error")
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ theme_override_font_sizes/font_size = 20
text = "描述: 这是一个示例插件,实际上并没有什么作用....."

[node name="PluginManagerPreview" parent="HSplitContainer/PluginInfoPanel" instance=ExtResource( "2_hev7f" )]
delimiter_strings = ["' '", "\" \""]

[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/PluginInfoPanel"]
minimum_size = Vector2(0, 50)
Expand Down

0 comments on commit ab91bd2

Please sign in to comment.