Add NotificationManager and NotificationLabel for age advancement notifications; refactor scripts into Components directory
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="AddResourceEffect" load_steps=2 format=3 uid="uid://bs5iwc5lsdu0r"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://flyhl4i86han" path="res://Scripts/Core/Effects/AddResourceEffect.cs" id="1_2o4it"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_2o4it")
|
|
||||||
TargetResource = 1
|
|
||||||
Value = 10000.0
|
|
||||||
metadata/_custom_type_script = "uid://flyhl4i86han"
|
|
@@ -1,9 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="AddResourceEffect" load_steps=2 format=3 uid="uid://dxiaxhggfqcyb"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://flyhl4i86han" path="res://Scripts/Core/Effects/AddResourceEffect.cs" id="1_2xs1x"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_2xs1x")
|
|
||||||
TargetResource = 1
|
|
||||||
Value = 100.0
|
|
||||||
metadata/_custom_type_script = "uid://flyhl4i86han"
|
|
@@ -1,9 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="AddResourceEffect" load_steps=2 format=3 uid="uid://dd17hc8jju5ek"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://flyhl4i86han" path="res://Scripts/Core/Effects/AddResourceEffect.cs" id="1_pce0a"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_pce0a")
|
|
||||||
TargetResource = 2
|
|
||||||
Value = 5.0
|
|
||||||
metadata/_custom_type_script = "uid://flyhl4i86han"
|
|
@@ -1,13 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="MiracleDefinition" load_steps=4 format=3 uid="uid://df3cq0eb82x0i"]
|
|
||||||
|
|
||||||
[ext_resource type="Resource" uid="uid://dd17hc8jju5ek" path="res://Resources/Effects/Add_5_Corruption.tres" id="1_jmmaa"]
|
|
||||||
[ext_resource type="Script" uid="uid://cfn3mx12xism5" path="res://Scripts/Core/MiracleDefinition.cs" id="1_oh2pa"]
|
|
||||||
[ext_resource type="Resource" uid="uid://dxiaxhggfqcyb" path="res://Resources/Effects/Add_10_Followers.tres" id="2_lg4lk"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_oh2pa")
|
|
||||||
Name = "Fertility Blessing"
|
|
||||||
FaithCost = 100.0
|
|
||||||
FollowersRequired = 0
|
|
||||||
Effects = Array[Resource]([ExtResource("2_lg4lk"), ExtResource("1_jmmaa")])
|
|
||||||
metadata/_custom_type_script = "uid://cfn3mx12xism5"
|
|
@@ -1,12 +0,0 @@
|
|||||||
[gd_resource type="Resource" script_class="MiracleDefinition" load_steps=3 format=3 uid="uid://ckdc32ptfjhx6"]
|
|
||||||
|
|
||||||
[ext_resource type="Resource" uid="uid://bs5iwc5lsdu0r" path="res://Resources/Effects/Add_1000_Followers.tres" id="1_bkpio"]
|
|
||||||
[ext_resource type="Script" uid="uid://cfn3mx12xism5" path="res://Scripts/Core/MiracleDefinition.cs" id="3_oqu5j"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("3_oqu5j")
|
|
||||||
Name = "GOD POWER"
|
|
||||||
FaithCost = 1.0
|
|
||||||
FollowersRequired = 0
|
|
||||||
Effects = Array[Resource]([ExtResource("1_bkpio")])
|
|
||||||
metadata/_custom_type_script = "uid://cfn3mx12xism5"
|
|
@@ -1,13 +1,15 @@
|
|||||||
[gd_scene load_steps=23 format=3 uid="uid://bfil8sd154327"]
|
[gd_scene load_steps=25 format=3 uid="uid://bfil8sd154327"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://t71ewkpa5uqs" path="res://Scenes/Main/Main.cs" id="1_p8rbg"]
|
[ext_resource type="Script" uid="uid://t71ewkpa5uqs" path="res://Scenes/Main/Main.cs" id="1_p8rbg"]
|
||||||
[ext_resource type="Script" uid="uid://b77vh831r1e3c" path="res://Scenes/Main/MiraclePanel.cs" id="2_hcu3t"]
|
[ext_resource type="Script" uid="uid://b77vh831r1e3c" path="res://Scenes/Main/MiraclePanel.cs" id="2_hcu3t"]
|
||||||
[ext_resource type="PackedScene" uid="uid://rj1fsdlhju5y" path="res://Scenes/Main/miracle_button.tscn" id="3_qdkat"]
|
[ext_resource type="PackedScene" uid="uid://rj1fsdlhju5y" path="res://Scenes/UI/miracle_button.tscn" id="3_qdkat"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dg6ac3jb1366r" path="res://Sprites/globe.svg" id="4_i3fi7"]
|
[ext_resource type="Texture2D" uid="uid://dg6ac3jb1366r" path="res://Sprites/globe.svg" id="4_i3fi7"]
|
||||||
[ext_resource type="Script" uid="uid://ddshg236tlltt" path="res://Scripts/ActiveBuffsManager.cs" id="4_xggvw"]
|
[ext_resource type="Script" uid="uid://ddshg236tlltt" path="res://Scripts/Components/ActiveBuffsManager.cs" id="4_xggvw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b417dl07c13uc" path="res://Scenes/Main/buff_button.tscn" id="5_xd21n"]
|
[ext_resource type="PackedScene" uid="uid://b417dl07c13uc" path="res://Scenes/UI/buff_button.tscn" id="5_xd21n"]
|
||||||
[ext_resource type="PackedScene" uid="uid://be5d0d3aweg0l" path="res://Scenes/Huts/HutMarker.tscn" id="6_cv8e0"]
|
[ext_resource type="PackedScene" uid="uid://be5d0d3aweg0l" path="res://Scenes/Huts/HutMarker.tscn" id="6_cv8e0"]
|
||||||
[ext_resource type="Script" uid="uid://dj2wyrq07gfp2" path="res://Scripts/PopulationVisualizer.cs" id="8_cv8e0"]
|
[ext_resource type="Script" uid="uid://c6uh5h3sdlg7n" path="res://Scripts/Components/NotificationManager.cs" id="6_iwp64"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://crpf0llofg0sc" path="res://Scenes/UI/notification_label.tscn" id="7_4etfk"]
|
||||||
|
[ext_resource type="Script" uid="uid://dj2wyrq07gfp2" path="res://Scripts/Components/PopulationVisualizer.cs" id="8_cv8e0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://8w7tvsgkev1y" path="res://Scenes/tree.tscn" id="8_hcu3t"]
|
[ext_resource type="PackedScene" uid="uid://8w7tvsgkev1y" path="res://Scenes/tree.tscn" id="8_hcu3t"]
|
||||||
[ext_resource type="Resource" uid="uid://8ooxfo2wdbhu" path="res://Resources/Tiers/Followers/follower_tier_1.tres" id="9_hkvnm"]
|
[ext_resource type="Resource" uid="uid://8ooxfo2wdbhu" path="res://Resources/Tiers/Followers/follower_tier_1.tres" id="9_hkvnm"]
|
||||||
[ext_resource type="Shader" uid="uid://bf8nk145fjkgh" path="res://Shaders/corruption_shader.gdshader" id="9_wgovn"]
|
[ext_resource type="Shader" uid="uid://bf8nk145fjkgh" path="res://Shaders/corruption_shader.gdshader" id="9_wgovn"]
|
||||||
@@ -19,8 +21,8 @@
|
|||||||
[ext_resource type="Resource" uid="uid://bbkbssvptkyvh" path="res://Resources/Tiers/Huts/hut_tier_1.tres" id="14_18xdc"]
|
[ext_resource type="Resource" uid="uid://bbkbssvptkyvh" path="res://Resources/Tiers/Huts/hut_tier_1.tres" id="14_18xdc"]
|
||||||
[ext_resource type="Resource" uid="uid://co2sdpwpajjqi" path="res://Resources/Tiers/Huts/hut_tier_2.tres" id="15_epx8f"]
|
[ext_resource type="Resource" uid="uid://co2sdpwpajjqi" path="res://Resources/Tiers/Huts/hut_tier_2.tres" id="15_epx8f"]
|
||||||
[ext_resource type="Resource" uid="uid://b8k30qsd434dp" path="res://Resources/Tiers/Huts/hut_tier_3.tres" id="16_hcu3t"]
|
[ext_resource type="Resource" uid="uid://b8k30qsd434dp" path="res://Resources/Tiers/Huts/hut_tier_3.tres" id="16_hcu3t"]
|
||||||
[ext_resource type="Script" uid="uid://furbvcmw31bx" path="res://Scripts/ForestVisualizer.cs" id="18_qdkat"]
|
[ext_resource type="Script" uid="uid://furbvcmw31bx" path="res://Scripts/Components/ForestVisualizer.cs" id="18_qdkat"]
|
||||||
[ext_resource type="Script" uid="uid://cw8gpeaq3yfjn" path="res://Scripts/RoadManager.cs" id="19_qdkat"]
|
[ext_resource type="Script" uid="uid://cw8gpeaq3yfjn" path="res://Scripts/Components/RoadManager.cs" id="19_qdkat"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_cv8e0"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_cv8e0"]
|
||||||
shader = ExtResource("9_wgovn")
|
shader = ExtResource("9_wgovn")
|
||||||
@@ -117,6 +119,11 @@ size_flags_vertical = 3
|
|||||||
script = ExtResource("4_xggvw")
|
script = ExtResource("4_xggvw")
|
||||||
_activeBuffScene = ExtResource("5_xd21n")
|
_activeBuffScene = ExtResource("5_xd21n")
|
||||||
|
|
||||||
|
[node name="Notification Layer" type="CanvasLayer" parent="."]
|
||||||
|
layer = 3
|
||||||
|
script = ExtResource("6_iwp64")
|
||||||
|
_notificationLabelScene = ExtResource("7_4etfk")
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
|
||||||
[node name="World Sprite" type="Sprite2D" parent="."]
|
[node name="World Sprite" type="Sprite2D" parent="."]
|
||||||
@@ -5534,6 +5541,7 @@ position = Vector2(243.12, -124.88)
|
|||||||
[node name="FollowerPopulationVisualizer" type="Node" parent="." node_paths=PackedStringArray("_markersContainer")]
|
[node name="FollowerPopulationVisualizer" type="Node" parent="." node_paths=PackedStringArray("_markersContainer")]
|
||||||
script = ExtResource("8_cv8e0")
|
script = ExtResource("8_cv8e0")
|
||||||
_markersContainer = NodePath("../Followers Markers")
|
_markersContainer = NodePath("../Followers Markers")
|
||||||
|
_unitsPerMarker = 1
|
||||||
_tiers = Array[Object]([ExtResource("9_hkvnm"), ExtResource("10_5ci8a"), ExtResource("11_18xdc"), ExtResource("12_epx8f"), ExtResource("13_hcu3t")])
|
_tiers = Array[Object]([ExtResource("9_hkvnm"), ExtResource("10_5ci8a"), ExtResource("11_18xdc"), ExtResource("12_epx8f"), ExtResource("13_hcu3t")])
|
||||||
metadata/_custom_type_script = "uid://dj2wyrq07gfp2"
|
metadata/_custom_type_script = "uid://dj2wyrq07gfp2"
|
||||||
|
|
||||||
|
10
Scenes/UI/notification_label.tscn
Normal file
10
Scenes/UI/notification_label.tscn
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://crpf0llofg0sc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://drx8lqcjq5khj" path="res://Scripts/NotificationLabel.cs" id="1_x4sn4"]
|
||||||
|
|
||||||
|
[node name="NotificationLabel" type="Label"]
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 23.0
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
script = ExtResource("1_x4sn4")
|
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Godot;
|
using Godot;
|
||||||
using ParasiticGod.Scripts.Core;
|
using ParasiticGod.Scripts;
|
||||||
using ParasiticGod.Scripts.Core.Effects;
|
using ParasiticGod.Scripts.Core.Effects;
|
||||||
using ParasiticGod.Scripts.Singletons;
|
using ParasiticGod.Scripts.Singletons;
|
||||||
|
|
||||||
namespace ParasiticGod.Scripts;
|
namespace ParasiticGod.Scripts.Components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class ActiveBuffsManager : Node
|
public partial class ActiveBuffsManager : Node
|
@@ -5,7 +5,7 @@ using Godot;
|
|||||||
using ParasiticGod.Scripts.Core;
|
using ParasiticGod.Scripts.Core;
|
||||||
using ParasiticGod.Scripts.Singletons;
|
using ParasiticGod.Scripts.Singletons;
|
||||||
|
|
||||||
namespace ParasiticGod.Scripts;
|
namespace ParasiticGod.Scripts.Components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class ForestVisualizer : Node
|
public partial class ForestVisualizer : Node
|
31
Scripts/Components/NotificationManager.cs
Normal file
31
Scripts/Components/NotificationManager.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Godot;
|
||||||
|
using ParasiticGod.Scripts;
|
||||||
|
using ParasiticGod.Scripts.Singletons;
|
||||||
|
|
||||||
|
namespace ParasiticGod.Scripts.Components;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class NotificationManager : CanvasLayer
|
||||||
|
{
|
||||||
|
[Export] private PackedScene _notificationLabelScene;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
GameBus.Instance.AgeAdvanced += OnAgeAdvanced;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
if (GameBus.Instance != null)
|
||||||
|
{
|
||||||
|
GameBus.Instance.AgeAdvanced -= OnAgeAdvanced;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAgeAdvanced(string ageName)
|
||||||
|
{
|
||||||
|
var notification = _notificationLabelScene.Instantiate<NotificationLabel>();
|
||||||
|
AddChild(notification);
|
||||||
|
notification.ShowNotification($"You have entered\n{ageName}!");
|
||||||
|
}
|
||||||
|
}
|
1
Scripts/Components/NotificationManager.cs.uid
Normal file
1
Scripts/Components/NotificationManager.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://c6uh5h3sdlg7n
|
@@ -4,7 +4,7 @@ using Godot.Collections;
|
|||||||
using ParasiticGod.Scripts.Core;
|
using ParasiticGod.Scripts.Core;
|
||||||
using ParasiticGod.Scripts.Singletons;
|
using ParasiticGod.Scripts.Singletons;
|
||||||
|
|
||||||
namespace ParasiticGod.Scripts;
|
namespace ParasiticGod.Scripts.Components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class PopulationVisualizer : Node
|
public partial class PopulationVisualizer : Node
|
1
Scripts/Components/ProgressiveVisualizer.cs.uid
Normal file
1
Scripts/Components/ProgressiveVisualizer.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://m3qqshwpk16h
|
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
using ParasiticGod.Scripts.Core;
|
|
||||||
using ParasiticGod.Scripts.Singletons;
|
using ParasiticGod.Scripts.Singletons;
|
||||||
|
|
||||||
namespace ParasiticGod.Scripts;
|
namespace ParasiticGod.Scripts.Components;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class RoadManager : Node2D
|
public partial class RoadManager : Node2D
|
@@ -14,6 +14,7 @@ public partial class MiracleDefinition : Resource
|
|||||||
[Export] public double FaithCost { get; set; }
|
[Export] public double FaithCost { get; set; }
|
||||||
[Export] public long FollowersRequired { get; set; }
|
[Export] public long FollowersRequired { get; set; }
|
||||||
[Export] public double ProductionRequired { get; set; }
|
[Export] public double ProductionRequired { get; set; }
|
||||||
|
public string AdvancesToAge { get; set; }
|
||||||
|
|
||||||
[Export] public Array<Effect> Effects { get; set; }
|
[Export] public Array<Effect> Effects { get; set; }
|
||||||
}
|
}
|
@@ -6,6 +6,7 @@ namespace ParasiticGod.Scripts.Core;
|
|||||||
public class EffectDto
|
public class EffectDto
|
||||||
{
|
{
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
// --- For "AddResource" Effect ---
|
// --- For "AddResource" Effect ---
|
||||||
public Stat TargetResource { get; set; }
|
public Stat TargetResource { get; set; }
|
||||||
public double Value { get; set; }
|
public double Value { get; set; }
|
||||||
@@ -19,11 +20,11 @@ public class EffectDto
|
|||||||
public double FromAmount { get; set; }
|
public double FromAmount { get; set; }
|
||||||
public Stat ToResource { get; set; }
|
public Stat ToResource { get; set; }
|
||||||
public double ToAmount { get; set; }
|
public double ToAmount { get; set; }
|
||||||
|
|
||||||
// --- For "ModifyStat" Effect ---
|
// --- For "ModifyStat" Effect ---
|
||||||
public Stat TargetStat { get; set; }
|
public Stat TargetStat { get; set; }
|
||||||
public ModifyStatEffect.Operation Op { get; set; }
|
public ModifyStatEffect.Operation Op { get; set; }
|
||||||
|
|
||||||
public List<string> MiraclesToUnlock { get; set; }
|
public List<string> MiraclesToUnlock { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,5 +35,6 @@ public class MiracleDto
|
|||||||
public long FollowersRequired { get; set; }
|
public long FollowersRequired { get; set; }
|
||||||
public double ProductionRequired { get; set; }
|
public double ProductionRequired { get; set; }
|
||||||
public bool UnlockedByDefault { get; set; }
|
public bool UnlockedByDefault { get; set; }
|
||||||
|
public string AdvancesToAge { get; set; }
|
||||||
public List<EffectDto> Effects { get; set; }
|
public List<EffectDto> Effects { get; set; }
|
||||||
}
|
}
|
@@ -70,6 +70,7 @@ public static class MiracleLoader
|
|||||||
FaithCost = miracleDto.FaithCost,
|
FaithCost = miracleDto.FaithCost,
|
||||||
FollowersRequired = miracleDto.FollowersRequired,
|
FollowersRequired = miracleDto.FollowersRequired,
|
||||||
ProductionRequired = miracleDto.ProductionRequired,
|
ProductionRequired = miracleDto.ProductionRequired,
|
||||||
|
AdvancesToAge = miracleDto.AdvancesToAge,
|
||||||
Effects = []
|
Effects = []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
20
Scripts/NotificationLabel.cs
Normal file
20
Scripts/NotificationLabel.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace ParasiticGod.Scripts;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class NotificationLabel : Label
|
||||||
|
{
|
||||||
|
public void ShowNotification(string text)
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
PivotOffset = Size / 2;
|
||||||
|
GlobalPosition = GetViewportRect().Size / 2;
|
||||||
|
|
||||||
|
var tween = CreateTween();
|
||||||
|
tween.TweenProperty(this, "modulate:a", 1.0f, 0.5f).From(0.0f);
|
||||||
|
tween.TweenInterval(2.5f);
|
||||||
|
tween.TweenProperty(this, "modulate:a", 0.0f, 1.0f);
|
||||||
|
tween.Finished += QueueFree;
|
||||||
|
}
|
||||||
|
}
|
1
Scripts/NotificationLabel.cs.uid
Normal file
1
Scripts/NotificationLabel.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://drx8lqcjq5khj
|
@@ -21,6 +21,7 @@ public partial class GameBus : Node
|
|||||||
public event Action<Buff> BuffAdded;
|
public event Action<Buff> BuffAdded;
|
||||||
public event Action<Buff> BuffRemoved;
|
public event Action<Buff> BuffRemoved;
|
||||||
public event Action PopulationVisualsUpdated;
|
public event Action PopulationVisualsUpdated;
|
||||||
|
public event Action<string> AgeAdvanced;
|
||||||
|
|
||||||
public override void _EnterTree()
|
public override void _EnterTree()
|
||||||
{
|
{
|
||||||
@@ -74,6 +75,11 @@ public partial class GameBus : Node
|
|||||||
{
|
{
|
||||||
MiraclesUnlocked?.Invoke(miraclesToUnlock);
|
MiraclesUnlocked?.Invoke(miraclesToUnlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(miracle.AdvancesToAge))
|
||||||
|
{
|
||||||
|
AgeAdvanced?.Invoke(miracle.AdvancesToAge);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user