diff --git a/Classes/Events/Assets/Event1.png b/Classes/Events/Assets/Event1.png new file mode 100644 index 00000000..302a4298 Binary files /dev/null and b/Classes/Events/Assets/Event1.png differ diff --git a/Classes/Events/Assets/Event1.png.import b/Classes/Events/Assets/Event1.png.import new file mode 100644 index 00000000..2a9b08e8 --- /dev/null +++ b/Classes/Events/Assets/Event1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://76wufdnhkrvk" +path="res://.godot/imported/Event1.png-2f5f476395c8adde38110b361ff5d5f3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Classes/Events/Assets/Event1.png" +dest_files=["res://.godot/imported/Event1.png-2f5f476395c8adde38110b361ff5d5f3.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Classes/Events/Assets/Event2.png b/Classes/Events/Assets/Event2.png new file mode 100644 index 00000000..9d3bc2e9 Binary files /dev/null and b/Classes/Events/Assets/Event2.png differ diff --git a/Classes/Events/Assets/Event2.png.import b/Classes/Events/Assets/Event2.png.import new file mode 100644 index 00000000..ddda9671 --- /dev/null +++ b/Classes/Events/Assets/Event2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cex5vg2ycajdi" +path="res://.godot/imported/Event2.png-a647bc6675ac54fecafbb5f9d56de04d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Classes/Events/Assets/Event2.png" +dest_files=["res://.godot/imported/Event2.png-a647bc6675ac54fecafbb5f9d56de04d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Classes/Events/Assets/Event3.png b/Classes/Events/Assets/Event3.png new file mode 100644 index 00000000..302a4298 Binary files /dev/null and b/Classes/Events/Assets/Event3.png differ diff --git a/Classes/Events/Assets/Event3.png.import b/Classes/Events/Assets/Event3.png.import new file mode 100644 index 00000000..e2a824b9 --- /dev/null +++ b/Classes/Events/Assets/Event3.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c0d0dwwnotlfq" +path="res://.godot/imported/Event3.png-445c0675f61362532d1032be33503df0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Classes/Events/Assets/Event3.png" +dest_files=["res://.godot/imported/Event3.png-445c0675f61362532d1032be33503df0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Classes/Events/EventDatabase.cs b/Classes/Events/EventDatabase.cs new file mode 100644 index 00000000..d6d7cb1d --- /dev/null +++ b/Classes/Events/EventDatabase.cs @@ -0,0 +1,153 @@ +using System; +using Godot; + +/// +/// Holds all game events and their associated logic. +/// +public class EventDatabase +{ + public static readonly EventTemplate[] EventDictionary = new[] + { + new EventTemplate( + 1, + "EVENT_EVENT1_DESC", + ["EVENT_EVENT1_OPTION1", "EVENT_EVENT1_OPTION2", "EVENT_EVENT1_OPTION3"], + ["EVENT_EVENT1_OUTCOME1", "EVENT_EVENT1_OUTCOME2", "EVENT_EVENT1_OUTCOME3"], + [ + (self, node) => + { + int randIndex = StageProducer.GlobalRng.RandiRange( + 0, + StageProducer.PlayerStats.CurNotes.Length - 1 + ); + StageProducer.PlayerStats.RemoveNote(randIndex); + }, + (self, node) => + { + int randIndex = StageProducer.GlobalRng.RandiRange( + 0, + StageProducer.PlayerStats.CurRelics.Length - 1 + ); + StageProducer.PlayerStats.RemoveRelic(randIndex); + }, + (self, node) => + { + StageProducer.PlayerStats.Money /= 2; + }, + ], + GD.Load("res://Classes/Events/Assets/Event1.png"), + [ + () => StageProducer.PlayerStats.CurNotes.Length > 0, + () => StageProducer.PlayerStats.CurRelics.Length > 0, + () => StageProducer.PlayerStats.Money > 0, + ] + ), + new EventTemplate( + 1, + "EVENT_EVENT2_DESC", + ["EVENT_EVENT2_OPTION1", "EVENT_EVENT2_OPTION2"], + ["", "EVENT_EVENT2_OUTCOME1"], + [ + (self, node) => + { + var spinner = node.EventSprite; + int spinOutcome = StageProducer.GlobalRng.RandiRange(0, 5); + + int outcomeCount = 6; + float sectorAngle = 360f / outcomeCount; + float targetAngle = spinOutcome * sectorAngle; + float fullSpins = 6 * 360f; + float finalRotation = spinner.RotationDegrees % 360f + fullSpins + targetAngle; + + var tween = node.CreateTween(); + tween + .TweenProperty(spinner, "rotation_degrees", finalRotation, 2.5f) + .SetTrans(Tween.TransitionType.Cubic) + .SetEase(Tween.EaseType.Out); + + // Defer execution of the outcome until the tween finishes + tween.TweenCallback( + Callable.From(() => + { + switch (spinOutcome) + { + case 0: + StageProducer.PlayerStats.Money /= 2; + self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME2"; + break; + case 1: + self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME3"; + StageProducer.PlayerStats.CurrentHealth = Math.Max( + 1, + StageProducer.PlayerStats.CurrentHealth - 10 + ); + break; + case 2: + self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME4"; + StageProducer.PlayerStats.Money += 50; + break; + case 3: + self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME5"; + StageProducer.PlayerStats.AddNote( + Scribe.GetRandomRewardNotes(1, StageProducer.CurRoom + 10)[ + 0 + ] + ); + break; + case 4: + self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME6"; + StageProducer.PlayerStats.AddRelic( + Scribe.GetRandomRelics( + 1, + StageProducer.CurRoom + 10, + StageProducer.PlayerStats.RarityOdds + )[0] + ); + break; + case 5: + self.OutcomeDescriptions[0] = "EVENT_EVENT2_OUTCOME7"; + StageProducer.PlayerStats.CurrentHealth = Math.Min( + StageProducer.PlayerStats.CurrentHealth + 20, + StageProducer.PlayerStats.MaxHealth + ); + break; + } + node.AnyButtonPressed(0); + self.OutcomeDescriptions[0] = ""; //Will need to fix later, currently changes the primary reference + }) + ); + }, + null, + ], + GD.Load("res://Classes/Events/Assets/Event2.png"), + [null, null] + ), + new EventTemplate( + 2, + "EVENT_EVENT3_DESC", + ["EVENT_EVENT3_OPTION1", "EVENT_EVENT3_OPTION2", "EVENT_EVENT3_OPTION3"], + ["EVENT_EVENT3_OUTCOME1", "EVENT_EVENT3_OUTCOME2", "EVENT_EVENT3_OUTCOME3"], + [ + (self, node) => + { + StageProducer.PlayerStats.CurrentHealth = Math.Min( + StageProducer.PlayerStats.CurrentHealth + 10, + StageProducer.PlayerStats.MaxHealth + ); + }, + (self, node) => + { + StageProducer.PlayerStats.MaxComboBar -= 5; + }, + (self, node) => + { + StageProducer.PlayerStats.Money -= 30; + StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]); + StageProducer.PlayerStats.AddNote(Scribe.NoteDictionary[3]); + }, + ], + GD.Load("res://Classes/Events/Assets/Event3.png"), + [null, null, () => StageProducer.PlayerStats.Money >= 30] + ), + }; +} diff --git a/Classes/Events/EventDatabase.cs.uid b/Classes/Events/EventDatabase.cs.uid new file mode 100644 index 00000000..df77bf1c --- /dev/null +++ b/Classes/Events/EventDatabase.cs.uid @@ -0,0 +1 @@ +uid://c7pukvtaeda8h diff --git a/Classes/Events/EventTemplate.cs b/Classes/Events/EventTemplate.cs new file mode 100644 index 00000000..104afb86 --- /dev/null +++ b/Classes/Events/EventTemplate.cs @@ -0,0 +1,39 @@ +using System; +using Godot; + +public delegate void EventAction(EventTemplate self, EventScene contextNode); +public delegate bool EventCondition(); + +//TODO: Consider making event option struct for better parallelizing of option parameters + +public class EventTemplate +{ + public int Id; + public string EventDescription; + public string[] ButtonDescriptions; + public string[] OutcomeDescriptions; + public Texture2D Texture; + public EventAction[] OptionActions; + public EventCondition[] OptionEnabledConditions; + + public EventTemplate() { } + + public EventTemplate( + int id, + string eventDescription, + string[] buttonDescriptions, + string[] outcomeDescriptions, + EventAction[] optionActions, + Texture2D texture, + EventCondition[] optionEnabledConditions = null + ) + { + Id = id; + EventDescription = eventDescription; + ButtonDescriptions = buttonDescriptions; + OutcomeDescriptions = outcomeDescriptions; + OptionActions = optionActions; + Texture = texture; + OptionEnabledConditions = optionEnabledConditions; + } +} diff --git a/Classes/Events/EventTemplate.cs.uid b/Classes/Events/EventTemplate.cs.uid new file mode 100644 index 00000000..197ac53a --- /dev/null +++ b/Classes/Events/EventTemplate.cs.uid @@ -0,0 +1 @@ +uid://4ro8fwi5f8uk diff --git a/Globals/SaveSystem.cs b/Globals/SaveSystem.cs index 7eb6b5b1..57da2020 100644 --- a/Globals/SaveSystem.cs +++ b/Globals/SaveSystem.cs @@ -386,6 +386,7 @@ public class SaveFile public int[] RelicIds { get; init; } public int PlayerHealth { get; init; } public int Shortcuts { get; init; } + public int PlayerMaxCombo { get; init; } public SaveFile( ulong rngSeed, @@ -396,7 +397,8 @@ public SaveFile( int playerHealth, int area, int money, - int shortcuts + int shortcuts, + int playerMaxCombo ) { RngSeed = rngSeed; @@ -408,6 +410,7 @@ int shortcuts Area = area; Money = money; Shortcuts = shortcuts; + PlayerMaxCombo = playerMaxCombo; } } @@ -424,7 +427,8 @@ public static void SaveGame() StageProducer.PlayerStats.CurrentHealth, StageProducer.CurLevel.Id, StageProducer.PlayerStats.Money, - StageProducer.PlayerStats.Shortcuts + StageProducer.PlayerStats.Shortcuts, + StageProducer.PlayerStats.MaxComboBar ); string json = JsonSerializer.Serialize(sv); diff --git a/Globals/StageProducer.cs b/Globals/StageProducer.cs index da88c937..535dbce5 100644 --- a/Globals/StageProducer.cs +++ b/Globals/StageProducer.cs @@ -103,6 +103,7 @@ private bool LoadGame() PlayerStats.CurrentHealth = sv.PlayerHealth; PlayerStats.Money = sv.Money; PlayerStats.Shortcuts = sv.Shortcuts; + PlayerStats.MaxComboBar = sv.PlayerMaxCombo; IsInitialized = true; return true; } @@ -140,13 +141,18 @@ public void PreloadScene(int nextRoomIdx) .Instantiate(); }); break; + case Stages.Event: + _loadTask = Task.Run(() => + { + _preloadStage = GD.Load(EventScene.LoadPath).Instantiate(); + }); + break; case Stages.Shop: _loadTask = Task.Run(() => { _preloadStage = GD.Load(ShopScene.LoadPath).Instantiate(); }); break; - case Stages.Event: case Stages.Chest: _loadTask = Task.Run(() => { diff --git a/Globals/Translations/Translations.csv b/Globals/Translations/Translations.csv index 70febe64..c19f2296 100644 --- a/Globals/Translations/Translations.csv +++ b/Globals/Translations/Translations.csv @@ -130,4 +130,29 @@ TUTORIAL_PLACE_6,"Now go ahead, place a note in the bottom lane!",(TODO) TUTORIAL_FINAL_1,"Good job, you placed a note! You either healed yourself, or dealt damage. I can't tell I'm just a Strawman.",(TODO) TUTORIAL_FINAL_2,"As a refresher: Hit notes to build a combo and fill the bar. When the bar is full, press one of your buttons for a lane that doesn't have a note at the current beat. Notes in the chart will loop around. Keep it up to win.",(TODO) TUTORIAL_FINAL_3,"Good luck! I believe in you.",(TODO) -TUTORIAL_BOSS,"This may take some getting used to, but death is ok in the grand scheme of things. Just have some patience with yourself, you'll learn in the end.",(TODO) \ No newline at end of file +TUTORIAL_BOSS,"This may take some getting used to, but death is ok in the grand scheme of things. Just have some patience with yourself, you'll learn in the end.",(TODO) +EVENT_CONTINUE_BUTTON,"Continue",(TODO) +EVENT_EVENT1_DESC,"A bandit approaches you.",(TODO) +EVENT_EVENT1_OPTION1,"Give them a random note",(TODO) +EVENT_EVENT1_OPTION2,"Give them a random relic",(TODO) +EVENT_EVENT1_OPTION3,"Give them half your gold",(TODO) +EVENT_EVENT1_OUTCOME1,"You got robbed of a random note.",(TODO) +EVENT_EVENT1_OUTCOME2,"You got robbed of a random relic.",(TODO) +EVENT_EVENT1_OUTCOME3,"You got robbed of half your gold.",(TODO) +EVENT_EVENT2_DESC,"There is a wheel with different outcomes.",(TODO) +EVENT_EVENT2_OPTION1,"Spin the wheel",(TODO) +EVENT_EVENT2_OPTION2,"Ignore the cool wheel",(TODO) +EVENT_EVENT2_OUTCOME1,"You decided not to spin the wheel.",(TODO) +EVENT_EVENT2_OUTCOME2,"You lost half your money.",(TODO) +EVENT_EVENT2_OUTCOME3,"You took some damage.",(TODO) +EVENT_EVENT2_OUTCOME4,"You won a lot of money!",(TODO) +EVENT_EVENT2_OUTCOME5,"You gained a random note!",(TODO) +EVENT_EVENT2_OUTCOME6,"You gained a random relic!",(TODO) +EVENT_EVENT2_OUTCOME7,"You gained some health!",(TODO) +EVENT_EVENT3_DESC,"There is a field medic on the side of the road.",(TODO) +EVENT_EVENT3_OPTION1,"Receive a bit of healing",(TODO) +EVENT_EVENT3_OPTION2,"Decrease max energy",(TODO) +EVENT_EVENT3_OPTION3,"Purchase 2 heal notes (30g)",(TODO) +EVENT_EVENT3_OUTCOME1,"The medic patched you up.\nYou restored 10 Health.",(TODO) +EVENT_EVENT3_OUTCOME2,"The medic gave you a shot of adrenaline.\nMax Energy reduced by 5.",(TODO) +EVENT_EVENT3_OUTCOME3,"The medic sold you some healing supplies.\nAdded 2 heal notes to your inventory.",(TODO) \ No newline at end of file diff --git a/Scenes/AreaBasedBackground.cs b/Scenes/AreaBasedBackground.cs index 3ae8150a..5dc2a560 100644 --- a/Scenes/AreaBasedBackground.cs +++ b/Scenes/AreaBasedBackground.cs @@ -6,6 +6,9 @@ public partial class AreaBasedBackground : TextureRect { public override void _Ready() { - Texture = GD.Load(StageProducer.CurLevel.BackgroundPath); + if (StageProducer.CurLevel == null) + Texture = GD.Load("res://SharedAssets/BackGround_Full.png"); + else + Texture = GD.Load(StageProducer.CurLevel.BackgroundPath); } } diff --git a/Scenes/EventScene/EventScene.cs b/Scenes/EventScene/EventScene.cs new file mode 100644 index 00000000..eb236c62 --- /dev/null +++ b/Scenes/EventScene/EventScene.cs @@ -0,0 +1,121 @@ +using System; +using FunkEngine; +using Godot; + +public partial class EventScene : Node +{ + public static readonly string LoadPath = "res://Scenes/EventScene/EventScene.tscn"; + private PlayerPuppet _player; + + [Export] + public Marker2D PlayerMarker; + + [Export] + public Sprite2D EventSprite; + + [Export] + private Label _eventDescription; + + [Export] + private VBoxContainer _buttonContainer; + + [Export] + private Button _continueButton; + + [Export] + private MarginContainer _continueContainer; + + private static readonly Theme ButtonTheme = GD.Load( + "res://Scenes/UI/Assets/GeneralTheme.tres" + ); // Store the theme + + private EventTemplate _eventReference; + private int _updateOutputIndex; + + public override void _Ready() + { + GD.Print("loaded event"); + _player = GD.Load(PlayerPuppet.LoadPath).Instantiate(); + PlayerMarker.AddChild(_player); + + int eventIndex = StageProducer.GlobalRng.RandiRange( + 0, + EventDatabase.EventDictionary.Length - 1 + ); + _eventReference = EventDatabase.EventDictionary[eventIndex]; + DisplayEvent(); + } + + public override void _Process(double delta) + { + if (GetViewport().GuiGetFocusOwner() == null) + { + if (_continueContainer.Visible) + _continueButton.GrabFocus(); + else + _buttonContainer.GetChild(0).GrabFocus(); + } + } + + /// + /// Displays the set event. + /// + public void DisplayEvent() + { + _eventDescription.Text = _eventReference.EventDescription; + EventSprite.Texture = _eventReference.Texture; + + for (int i = 0; i < _eventReference.ButtonDescriptions.Length; i++) + { + var button = new Button + { + Text = _eventReference.ButtonDescriptions[i], + Theme = ButtonTheme, + SizeFlagsVertical = Control.SizeFlags.Expand | Control.SizeFlags.Fill, + }; + + bool isEnabled; + if ( + _eventReference.OptionEnabledConditions == null + || _eventReference.OptionEnabledConditions.Length <= i + ) + { + GD.PushWarning("Event Conditions are invalid for event: " + _eventReference.Id); + isEnabled = true; + } + else + { // Check if the button should be enabled + isEnabled = + _eventReference.OptionEnabledConditions[i] == null + || _eventReference.OptionEnabledConditions[i].Invoke(); + } + + button.Disabled = !isEnabled; + + int capturedIndex = i; + button.Pressed += () => + { + GD.Print($"Selected option: {_eventReference.ButtonDescriptions[capturedIndex]}"); + _eventReference.OptionActions[capturedIndex]?.Invoke(_eventReference, this); + AnyButtonPressed(capturedIndex); + }; + + // Automatically focus the first *enabled* button + if (capturedIndex == 0 && isEnabled) + { + button.CallDeferred("grab_focus"); + } + + _buttonContainer.AddChild(button); + } + } + + public void AnyButtonPressed(int capturedIndex) + { + _updateOutputIndex = capturedIndex; + _buttonContainer.GetParent().Visible = false; + _continueContainer.Visible = _eventReference.OutcomeDescriptions[capturedIndex] != ""; + _eventDescription.Text = _eventReference.OutcomeDescriptions[capturedIndex]; + _continueButton.GrabFocus(); + } +} diff --git a/Scenes/EventScene/EventScene.cs.uid b/Scenes/EventScene/EventScene.cs.uid new file mode 100644 index 00000000..cb060cd4 --- /dev/null +++ b/Scenes/EventScene/EventScene.cs.uid @@ -0,0 +1 @@ +uid://md1vhln8ji5h diff --git a/Scenes/EventScene/EventScene.tscn b/Scenes/EventScene/EventScene.tscn new file mode 100644 index 00000000..92dbbd0d --- /dev/null +++ b/Scenes/EventScene/EventScene.tscn @@ -0,0 +1,147 @@ +[gd_scene load_steps=10 format=3 uid="uid://u7oppwtmvmci"] + +[ext_resource type="Script" uid="uid://md1vhln8ji5h" path="res://Scenes/EventScene/EventScene.cs" id="1_x82kl"] +[ext_resource type="AudioStream" uid="uid://be5ial13ynf3o" path="res://Audio/Song1.ogg" id="2_vywvm"] +[ext_resource type="Script" uid="uid://pl57giqyhckb" path="res://Scenes/UI/Scripts/MenuModule.cs" id="2_x82kl"] +[ext_resource type="Texture2D" uid="uid://qhwve7fik4do" path="res://SharedAssets/BackGround_Full.png" id="4_l56en"] +[ext_resource type="Texture2D" uid="uid://8u3xvcma81d" path="res://Scenes/UI/Assets/UI_CrystalFrame.png" id="5_erk58"] +[ext_resource type="Script" uid="uid://cp6t6haqyef7o" path="res://Scenes/AreaBasedBackground.cs" id="5_v3lan"] +[ext_resource type="Texture2D" uid="uid://burj10os057fx" path="res://Scenes/UI/Assets/UI_CrystalFrameInset.png" id="6_4prsq"] +[ext_resource type="Theme" uid="uid://d37e3tpsbxwak" path="res://Scenes/UI/Assets/GeneralTheme.tres" id="8_4prsq"] +[ext_resource type="Script" uid="uid://cahjluc6v7ked" path="res://Scenes/UI/TitleScreen/Scripts/SceneChange.cs" id="9_lw2xf"] + +[node name="EventScene" type="Node2D" node_paths=PackedStringArray("PlayerMarker", "EventSprite", "_eventDescription", "_buttonContainer", "_continueButton", "_continueContainer")] +process_mode = 1 +script = ExtResource("1_x82kl") +PlayerMarker = NodePath("PlayerMarker") +EventSprite = NodePath("EventSprite") +_eventDescription = NodePath("Control/MarginContainer/PanelContainer/HBoxContainer/DescBox/DescMargin/Description") +_buttonContainer = NodePath("Control/MarginContainer/PanelContainer/HBoxContainer/ButtonContainer/VBoxContainer") +_continueButton = NodePath("Control/MarginContainer/PanelContainer/HBoxContainer/ContinueContainer/ContinueButton") +_continueContainer = NodePath("Control/MarginContainer/PanelContainer/HBoxContainer/ContinueContainer") + +[node name="UILayer" type="CanvasLayer" parent="." node_paths=PackedStringArray("CurSceneNode")] +script = ExtResource("2_x82kl") +CurSceneNode = NodePath("..") + +[node name="Audio" type="AudioStreamPlayer" parent="."] +unique_name_in_owner = true +stream = ExtResource("2_vywvm") +autoplay = true + +[node name="PlayerMarker" type="Marker2D" parent="."] +position = Vector2(158, 125) + +[node name="EventSprite" type="Sprite2D" parent="."] +position = Vector2(385, 125) + +[node name="BackGround" type="TextureRect" parent="."] +z_index = -1 +offset_right = 640.0 +offset_bottom = 178.0 +texture = ExtResource("4_l56en") +script = ExtResource("5_v3lan") + +[node name="Control" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = 640.0 +offset_bottom = 360.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="MarginContainer" type="MarginContainer" parent="Control"] +custom_minimum_size = Vector2(0, 180) +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -105.0 +grow_horizontal = 2 +grow_vertical = 0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="PanelContainer" type="PanelContainer" parent="Control/MarginContainer"] +layout_mode = 2 + +[node name="SelectionBG" type="NinePatchRect" parent="Control/MarginContainer/PanelContainer"] +self_modulate = Color(1, 1, 1, 0.75) +custom_minimum_size = Vector2(540, 105) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +texture = ExtResource("5_erk58") +patch_margin_left = 30 +patch_margin_top = 10 +patch_margin_right = 20 +patch_margin_bottom = 27 + +[node name="HBoxContainer" type="HBoxContainer" parent="Control/MarginContainer/PanelContainer"] +layout_mode = 2 + +[node name="DescBox" type="MarginContainer" parent="Control/MarginContainer/PanelContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/margin_left = 5 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 5 + +[node name="DescBackground" type="NinePatchRect" parent="Control/MarginContainer/PanelContainer/HBoxContainer/DescBox"] +layout_mode = 2 +texture = ExtResource("6_4prsq") +patch_margin_left = 7 +patch_margin_top = 7 +patch_margin_right = 7 +patch_margin_bottom = 7 + +[node name="DescMargin" type="MarginContainer" parent="Control/MarginContainer/PanelContainer/HBoxContainer/DescBox"] +layout_mode = 2 +size_flags_stretch_ratio = 0.0 +theme_override_constants/margin_left = 0 +theme_override_constants/margin_top = 0 +theme_override_constants/margin_right = 0 +theme_override_constants/margin_bottom = 0 + +[node name="Description" type="Label" parent="Control/MarginContainer/PanelContainer/HBoxContainer/DescBox/DescMargin"] +layout_mode = 2 +size_flags_vertical = 1 +text = ":HeathCliff:" +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 2 +clip_text = true +text_overrun_behavior = 1 + +[node name="ButtonContainer" type="MarginContainer" parent="Control/MarginContainer/PanelContainer/HBoxContainer"] +layout_mode = 2 +theme_override_constants/margin_left = -5 +theme_override_constants/margin_top = 7 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 7 + +[node name="VBoxContainer" type="VBoxContainer" parent="Control/MarginContainer/PanelContainer/HBoxContainer/ButtonContainer"] +layout_mode = 2 + +[node name="ContinueContainer" type="MarginContainer" parent="Control/MarginContainer/PanelContainer/HBoxContainer"] +visible = false +layout_mode = 2 +theme_override_constants/margin_left = -5 +theme_override_constants/margin_top = 7 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 7 + +[node name="ContinueButton" type="Button" parent="Control/MarginContainer/PanelContainer/HBoxContainer/ContinueContainer"] +layout_mode = 2 +size_flags_vertical = 8 +theme = ExtResource("8_4prsq") +text = "EVENT_CONTINUE_BUTTON" +script = ExtResource("9_lw2xf") +ScenePath = 7 diff --git a/Scenes/Puppets/Scripts/PlayerStats.cs b/Scenes/Puppets/Scripts/PlayerStats.cs index 602cb0ac..9b0d70e5 100644 --- a/Scenes/Puppets/Scripts/PlayerStats.cs +++ b/Scenes/Puppets/Scripts/PlayerStats.cs @@ -42,6 +42,17 @@ public void AddRelic(RelicTemplate relic) Scribe.RemoveRelicFromPool(relic); } + public void RemoveRelic(int index) + { + if (index < 0 || index >= CurRelics.Length) + { + GD.Print("index out of range"); + return; + } + + CurRelics = CurRelics.Where((_, i) => i != index).ToArray(); + } + public void AddNote(Note nSelection) { //If the note is vampire, check to see if we already have 2 of them @@ -56,6 +67,16 @@ public void AddNote(Note nSelection) CurNotes = CurNotes.Append(nSelection).ToArray(); } + public void RemoveNote(int index) + { + if (index < 0 || index >= CurNotes.Length) + { + GD.Print("index out of range"); + return; + } + + CurNotes = CurNotes.Where((_, i) => i != index).ToArray(); + } public void RemoveNote(Note nSelection) { CurNotes = CurNotes.Where(n => n != nSelection).ToArray();