-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented notification system for save/load and settings updates.
- Loading branch information
Showing
12 changed files
with
414 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://b8m5sfw05s6ty"] | ||
[gd_scene load_steps=7 format=3 uid="uid://b8m5sfw05s6ty"] | ||
|
||
[ext_resource type="Script" path="res://src/main/main.gd" id="1_ui10i"] | ||
[ext_resource type="PackedScene" uid="uid://bv2v88irqyogj" path="res://src/ui/ui.tscn" id="2_06dc6"] | ||
[ext_resource type="Script" path="res://src/utilities/save_system.gd" id="3_vaodl"] | ||
[ext_resource type="Script" path="res://src/utilities/notification_system.gd" id="4_caoxb"] | ||
|
||
[sub_resource type="Animation" id="Animation_pjprj"] | ||
resource_name = "show_notification" | ||
length = 0.2 | ||
|
||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ac6sq"] | ||
_data = { | ||
"show_notification": SubResource("Animation_pjprj") | ||
} | ||
|
||
[node name="Main" type="Node"] | ||
script = ExtResource("1_ui10i") | ||
|
||
[node name="UI" parent="." instance=ExtResource("2_06dc6")] | ||
|
||
[node name="ProgressionController" type="Node" parent="."] | ||
|
||
[node name="Utilities" type="Node" parent="."] | ||
|
||
[node name="SaveSystem" type="Node" parent="Utilities" groups=["save_system"]] | ||
script = ExtResource("3_vaodl") | ||
|
||
[node name="NotificationSystem" type="Node" parent="Utilities" groups=["notification_system"]] | ||
script = ExtResource("4_caoxb") | ||
|
||
[node name="NotificationAnimationPlayer" type="AnimationPlayer" parent="Utilities/NotificationSystem"] | ||
unique_name_in_owner = true | ||
libraries = { | ||
"": SubResource("AnimationLibrary_ac6sq") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://fjatxhusdrmj"] | ||
|
||
[ext_resource type="Script" path="res://src/ui/notification/notification_manager.gd" id="1_bopgf"] | ||
|
||
[sub_resource type="Animation" id="Animation_7vkrs"] | ||
resource_name = "show_notification" | ||
length = 1.1 | ||
tracks/0/type = "value" | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/path = NodePath(".:visible") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [true] | ||
} | ||
tracks/1/type = "method" | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/path = NodePath(".") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/keys = { | ||
"times": PackedFloat32Array(0.9, 1.1), | ||
"transitions": PackedFloat32Array(1, 1), | ||
"values": [{ | ||
"args": [], | ||
"method": &"hide_ui" | ||
}, { | ||
"args": [], | ||
"method": &"remove_ui" | ||
}] | ||
} | ||
|
||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0m8h3"] | ||
_data = { | ||
"show_notification": SubResource("Animation_7vkrs") | ||
} | ||
|
||
[node name="Notification" type="CanvasLayer"] | ||
script = ExtResource("1_bopgf") | ||
|
||
[node name="PanelContainer" type="PanelContainer" parent="."] | ||
anchors_preset = -1 | ||
anchor_left = 0.4 | ||
anchor_top = 0.94 | ||
anchor_right = 0.6 | ||
anchor_bottom = 0.975 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] | ||
layout_mode = 2 | ||
theme_override_constants/margin_left = 7 | ||
theme_override_constants/margin_top = 5 | ||
theme_override_constants/margin_right = 7 | ||
theme_override_constants/margin_bottom = 5 | ||
|
||
[node name="NotificationLabel" type="Label" parent="PanelContainer/MarginContainer"] | ||
unique_name_in_owner = true | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 30 | ||
text = "Notification Text..." | ||
horizontal_alignment = 1 | ||
vertical_alignment = 1 | ||
|
||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] | ||
unique_name_in_owner = true | ||
libraries = { | ||
"": SubResource("AnimationLibrary_0m8h3") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## Notification Manager. | ||
## | ||
## Controls the behavior of notification. [br] | ||
## | ||
## [br] | ||
## | ||
## Path: [code]res://src/ui/notification/notification_manager.gd[/code] | ||
|
||
|
||
class_name NotificationManager | ||
extends CanvasLayer | ||
|
||
|
||
## Notification animation player. | ||
@onready var animation_player: AnimationPlayer = %AnimationPlayer | ||
|
||
## Signal for removing notification. | ||
signal notification_removed | ||
|
||
## Extend notificatio duration. | ||
var extend_duration: bool = false | ||
|
||
|
||
## Show notification. | ||
func show_ui() -> void: | ||
# Play notification animation | ||
animation_player.play("show_notification") | ||
|
||
|
||
## Hide notification. | ||
func hide_ui() -> void: | ||
# Change visibility | ||
visible = false | ||
|
||
|
||
## Remove notification. (Removes scene from tree). | ||
func remove_ui() -> void: | ||
# Emit notification removed signal | ||
notification_removed.emit() | ||
# Delete scene from tree | ||
get_parent().remove_child(self) | ||
queue_free() | ||
|
||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
# Hide notification UI as default | ||
hide_ui() | ||
# Check if extend duration is true | ||
if extend_duration == true: | ||
# Extend animation play speed | ||
animation_player.speed_scale = 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.