Browse Source

:truck: Move message panel into a dedicated scene

DricomDragon 3 years ago
parent
commit
4ebded4658

+ 11 - 0
godot/component/ui/message_panel/MessagePanel.gd

@@ -0,0 +1,11 @@
+class_name MessagePanel
+extends Panel
+
+
+export(String) var message = "Edit your message"
+
+onready var label = $Label
+
+
+func _ready():
+	label.text = message

+ 22 - 0
godot/component/ui/message_panel/MessagePanel.tscn

@@ -0,0 +1,22 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://component/ui/message_panel/MessagePanel.gd" type="Script" id=1]
+
+[node name="Panel" type="Panel"]
+margin_left = 100.0
+margin_top = 175.0
+margin_right = 300.0
+margin_bottom = 225.0
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Label" type="Label" parent="."]
+margin_left = -100.0
+margin_top = -175.0
+margin_right = 300.0
+margin_bottom = 225.0
+text = "Your message here"
+align = 1
+valign = 1

+ 6 - 35
godot/main.tscn

@@ -1,5 +1,6 @@
-[gd_scene load_steps=16 format=2]
+[gd_scene load_steps=17 format=2]
 
+[ext_resource path="res://component/ui/message_panel/MessagePanel.tscn" type="PackedScene" id=1]
 [ext_resource path="res://component/entity/launcher/TargetLine.gd" type="Script" id=2]
 [ext_resource path="res://component/entity/catcher/Catcher.gd" type="Script" id=3]
 [ext_resource path="res://component/ui/LifeContainer.gd" type="Script" id=4]
@@ -113,42 +114,12 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="GameOverPanel" type="Panel" parent="UI"]
+[node name="GameOverPanel" parent="UI" instance=ExtResource( 1 )]
 visible = false
-margin_left = 100.0
-margin_top = 175.0
-margin_right = 300.0
-margin_bottom = 225.0
-__meta__ = {
-"_edit_use_anchors_": false
-}
-
-[node name="GameOver" type="Label" parent="UI/GameOverPanel"]
-margin_left = -100.0
-margin_top = -175.0
-margin_right = 300.0
-margin_bottom = 225.0
-text = "Game Over"
-align = 1
-valign = 1
-
-[node name="TutorialPanel" type="Panel" parent="UI"]
-margin_left = 100.0
-margin_top = 175.0
-margin_right = 300.0
-margin_bottom = 225.0
-__meta__ = {
-"_edit_use_anchors_": false
-}
+message = "Game Over!"
 
-[node name="TutorialLabel" type="Label" parent="UI/TutorialPanel"]
-margin_left = -100.0
-margin_top = -175.0
-margin_right = 300.0
-margin_bottom = 225.0
-text = "Click to shoot a ball !"
-align = 1
-valign = 1
+[node name="TutorialPanel" parent="UI" instance=ExtResource( 1 )]
+message = "Click to shoot a ball!"
 
 [node name="ScoreCounter" parent="UI" instance=ExtResource( 6 )]
 margin_left = 350.0

+ 6 - 0
godot/project.godot

@@ -20,6 +20,11 @@ _global_script_classes=[ {
 "path": "res://component/entity/catcher/Catcher.gd"
 }, {
 "base": "Panel",
+"class": "MessagePanel",
+"language": "GDScript",
+"path": "res://component/ui/message_panel/MessagePanel.gd"
+}, {
+"base": "Panel",
 "class": "NumberPanel",
 "language": "GDScript",
 "path": "res://component/ui/number_panel/NumberPanel.gd"
@@ -27,6 +32,7 @@ _global_script_classes=[ {
 _global_script_class_icons={
 "Ball": "",
 "Catcher": "",
+"MessagePanel": "",
 "NumberPanel": ""
 }