mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 14:10:55 +03:00
Use static typing in all demos (#1063)
This leads to code that is easier to understand and runs faster thanks to GDScript's typed instructions. The untyped declaration warning is now enabled on all projects where type hints were added. All projects currently run without any untyped declration warnings. Dodge the Creeps and Squash the Creeps demos intentionally don't use type hints to match the documentation, where type hints haven't been adopted yet (given its beginner focus).
This commit is contained in:
@@ -12,10 +12,6 @@ size_flags_vertical = 3
|
||||
|
||||
[node name="PrintHello" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 460.0
|
||||
offset_top = 297.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 351.0
|
||||
text = "Print Hello
|
||||
(check Output bottom panel)"
|
||||
script = ExtResource("1")
|
||||
|
||||
@@ -3,9 +3,10 @@ extends EditorPlugin
|
||||
|
||||
const MainPanel = preload("res://addons/main_screen/main_panel.tscn")
|
||||
|
||||
var main_panel_instance
|
||||
var main_panel_instance: CenterContainer
|
||||
|
||||
func _enter_tree():
|
||||
|
||||
func _enter_tree() -> void:
|
||||
main_panel_instance = MainPanel.instantiate()
|
||||
# Add the main panel to the editor's main viewport.
|
||||
get_editor_interface().get_editor_main_screen().add_child(main_panel_instance)
|
||||
@@ -13,29 +14,28 @@ func _enter_tree():
|
||||
_make_visible(false)
|
||||
|
||||
|
||||
func _exit_tree():
|
||||
func _exit_tree() -> void:
|
||||
if main_panel_instance:
|
||||
main_panel_instance.queue_free()
|
||||
|
||||
|
||||
func _has_main_screen():
|
||||
func _has_main_screen() -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func _make_visible(visible):
|
||||
func _make_visible(visible: bool) -> void:
|
||||
if main_panel_instance:
|
||||
main_panel_instance.visible = visible
|
||||
|
||||
|
||||
# If your plugin doesn't handle any node types, you can remove this method.
|
||||
func _handles(object):
|
||||
func _handles(object: Object) -> bool:
|
||||
return is_instance_of(object, preload("res://addons/main_screen/handled_by_main_screen.gd"))
|
||||
|
||||
|
||||
func _get_plugin_name():
|
||||
func _get_plugin_name() -> String:
|
||||
return "Main Screen Plugin"
|
||||
|
||||
|
||||
func _get_plugin_icon():
|
||||
# Must return some kind of Texture2D for the icon.
|
||||
func _get_plugin_icon() -> Texture2D:
|
||||
return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@tool
|
||||
extends Button
|
||||
|
||||
func _on_PrintHello_pressed():
|
||||
|
||||
func _on_PrintHello_pressed() -> void:
|
||||
print("Hello from the main screen plugin!")
|
||||
|
||||
Reference in New Issue
Block a user