1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Remove NotificationLabel.tscn, use class_name for notification labels

This commit is contained in:
Emmanouil Papadeas 2023-01-15 17:08:42 +02:00
parent facabc1143
commit 7001f3a28b
4 changed files with 10 additions and 22 deletions

View file

@ -124,6 +124,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/UI/Timeline/LayerButton.gd"
}, {
"base": "Label",
"class": "NotificationLabel",
"language": "GDScript",
"path": "res://src/UI/Nodes/NotificationLabel.gd"
}, {
"base": "Resource",
"class": "Palette",
"language": "GDScript",
@ -238,6 +243,7 @@ _global_script_class_icons={
"Guide": "",
"ImageEffect": "",
"LayerButton": "",
"NotificationLabel": "",
"Palette": "",
"PaletteColor": "",
"PaletteGrid": "",

View file

@ -148,7 +148,6 @@ var onion_skinning_blue_red := false
var palettes := {}
# Nodes
var notification_label_node := preload("res://src/UI/NotificationLabel/NotificationLabel.tscn")
var pixel_layer_button_node: PackedScene = preload("res://src/UI/Timeline/PixelLayerButton.tscn")
var group_layer_button_node: PackedScene = preload("res://src/UI/Timeline/GroupLayerButton.tscn")
var pixel_cel_button_node: PackedScene = preload("res://src/UI/Timeline/PixelCelButton.tscn")
@ -411,7 +410,7 @@ func _initialize_keychain() -> void:
func notification_label(text: String) -> void:
var notification: Label = notification_label_node.instance()
var notification := NotificationLabel.new()
notification.text = tr(text)
notification.rect_position = main_viewport.rect_global_position
notification.rect_position.y += main_viewport.rect_size.y

View file

@ -1,3 +1,4 @@
class_name NotificationLabel
extends Label
@ -5,7 +6,8 @@ func _ready() -> void:
var tw := create_tween().set_parallel().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
tw.tween_property(self, "rect_position", Vector2(rect_position.x, rect_position.y - 100), 1)
tw.tween_property(self, "modulate", Color(modulate.r, modulate.g, modulate.b, 0), 1)
tw.connect("finished", self, "_on_tween_finished")
func _on_Timer_timeout() -> void:
func _on_tween_finished() -> void:
queue_free()

View file

@ -1,19 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/UI/NotificationLabel/NotificationLabel.gd" type="Script" id=1]
[node name="NotificationLabel" type="Label"]
margin_right = 116.0
margin_bottom = 14.0
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
text = "Undo: Notification"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Timer" type="Timer" parent="."]
one_shot = true
autostart = true
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]