mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:05:34 +00:00
Debug menu items spawn buttons
This commit is contained in:
parent
6bf12a021f
commit
4c58436a74
9 changed files with 216 additions and 33 deletions
|
|
@ -103,7 +103,7 @@ _gameOverPanel = NodePath("GameOver")
|
|||
_fairyTerminatedPanel = NodePath("FairyTerminated")
|
||||
_hudInfoPanel = NodePath("HudInfo")
|
||||
NotificationsContainer = NodePath("NotificationsContainer")
|
||||
WeaponContainer = NodePath("VBoxContainer/WeaponContainer")
|
||||
WeaponContainer = NodePath("WeaponContainer/WeaponContainer")
|
||||
PauseMenuContainer = NodePath("PauseMenuContainer")
|
||||
PauseMenuScene = ExtResource("3_hxmxt")
|
||||
DebugMenuTemplate = ExtResource("4_gd1k6")
|
||||
|
|
@ -255,28 +255,37 @@ size_flags_vertical = 3
|
|||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="NotificationsContainer" type="VBoxContainer" parent="."]
|
||||
offset_left = 161.0
|
||||
offset_top = 123.0
|
||||
offset_right = 317.0
|
||||
offset_bottom = 157.0
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -156.0
|
||||
offset_top = -34.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
alignment = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
offset_left = 4.0
|
||||
offset_top = 118.0
|
||||
offset_right = 38.0
|
||||
offset_bottom = 155.0
|
||||
[node name="WeaponContainer" type="VBoxContainer" parent="."]
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 5.0
|
||||
offset_top = -42.0
|
||||
offset_right = 39.0
|
||||
offset_bottom = -5.0
|
||||
grow_vertical = 0
|
||||
theme_override_constants/separation = 0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
[node name="Label" type="Label" parent="WeaponContainer"]
|
||||
layout_mode = 2
|
||||
text = "Weapon"
|
||||
label_settings = ExtResource("2_x7kl7")
|
||||
|
||||
[node name="WeaponContainer" type="PanelContainer" parent="VBoxContainer"]
|
||||
[node name="WeaponContainer" type="PanelContainer" parent="WeaponContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("9_sx5r0")
|
||||
|
|
@ -444,15 +453,12 @@ stretch_mode = 3
|
|||
[node name="FPS" type="Label" parent="."]
|
||||
z_index = 20
|
||||
z_as_relative = false
|
||||
anchors_preset = 3
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -40.0
|
||||
offset_top = -23.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
text = "1234"
|
||||
label_settings = ExtResource("2_x7kl7")
|
||||
script = ExtResource("15_x61tu")
|
||||
|
|
|
|||
|
|
@ -1,10 +1,53 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bemu3l6b1e84y"]
|
||||
[gd_scene load_steps=35 format=3 uid="uid://bemu3l6b1e84y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://sqhb36u3acw7" path="res://Scripts/UI/DebugMenu.cs" id="1_5vtnj"]
|
||||
[ext_resource type="Theme" uid="uid://dkom8gcup42kd" path="res://Resources/Styles/DebugMenuButtons.tres" id="2_6il8q"]
|
||||
[ext_resource type="Theme" uid="uid://dnsadvmunm76k" path="res://Resources/Styles/MainMenuButtons.tres" id="2_wqb8e"]
|
||||
[ext_resource type="Resource" uid="uid://d1lc8lhq1b05p" path="res://Resources/Debug/DebugLevels.tres" id="3_cvgqx"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1a0nwd4wdph7" path="res://Sprites/UI/Back_Small.png" id="5_1xl3a"]
|
||||
[ext_resource type="Texture2D" uid="uid://bao53hesxreoh" path="res://Resources/Sprites/Red_Keycard_Inventory_Texture.tres" id="5_2s8o7"]
|
||||
[ext_resource type="Script" uid="uid://v6tkgo5mwi1w" path="res://Scripts/UI/DebugItemButton.cs" id="6_1omws"]
|
||||
[ext_resource type="Resource" uid="uid://dibquna7fww7t" path="res://Resources/Items/Red_Keycard.tres" id="7_tpuu5"]
|
||||
[ext_resource type="Resource" uid="uid://cj5aa7btaw6q0" path="res://Resources/Items/Blue_Keycard.tres" id="8_6t1ll"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvybqletsvqgk" path="res://Sprites/Items/BlueKeycard_Small.png" id="8_xqq1n"]
|
||||
[ext_resource type="Resource" uid="uid://cspcgkr0tane2" path="res://Resources/Items/Green_Keycard.tres" id="9_jf7mu"]
|
||||
[ext_resource type="Resource" uid="uid://b2vyr1tcm4rc1" path="res://Resources/Items/Yellow_Keycard.tres" id="10_p65nv"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvkjnc3ggp7ba" path="res://Sprites/Items/GreenKeycard_Small.png" id="10_yq36q"]
|
||||
[ext_resource type="Resource" uid="uid://oa8s6xydriib" path="res://Resources/Items/Generic_Keycard.tres" id="11_c30ky"]
|
||||
[ext_resource type="Texture2D" uid="uid://ckpehix3prcx5" path="res://Sprites/Items/YellowKeycard_Small.png" id="12_025fa"]
|
||||
[ext_resource type="Texture2D" uid="uid://liwkh6rv1m41" path="res://Sprites/Items/GrayKeycard_Small.png" id="14_qenyx"]
|
||||
[ext_resource type="Resource" uid="uid://cfq121rs3bsu8" path="res://Resources/Items/Cheat_Gun_Item.tres" id="16_mps4w"]
|
||||
[ext_resource type="Texture2D" uid="uid://cwy7g861vnbj1" path="res://Sprites/Items/Cheat_Gun.png" id="17_ubovs"]
|
||||
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="18_4ya5e"]
|
||||
[ext_resource type="Texture2D" uid="uid://c5g0qg6u2gm6f" path="res://Sprites/Items/Ammo1.png" id="19_last5"]
|
||||
[ext_resource type="Resource" uid="uid://diqm2ju0xakkt" path="res://Resources/Items/Yin_Yang_Ammo.tres" id="20_a32ms"]
|
||||
[ext_resource type="Texture2D" uid="uid://b61po207ggn63" path="res://Sprites/Items/Yin_Ammo.png" id="21_g6p7f"]
|
||||
[ext_resource type="Resource" uid="uid://cfod8kephnio6" path="res://Resources/Items/Nuclear_Ammo_Pickup.tres" id="22_wtyjh"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxwcjp25xba1j" path="res://Sprites/Items/Nuclear_Ammo.png" id="23_afddb"]
|
||||
[ext_resource type="Resource" uid="uid://clr1gln7nxa1o" path="res://Resources/Items/Power_Pickup.tres" id="24_bg771"]
|
||||
[ext_resource type="Texture2D" uid="uid://bjdsi4x8m42ky" path="res://Sprites/Items/Power_Pickup.png" id="25_mps4w"]
|
||||
[ext_resource type="Resource" uid="uid://dy53gia1tmkah" path="res://Resources/Items/Points_Pickup.tres" id="26_ubovs"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2vmocquikjia" path="res://Sprites/Items/Point_Pickup.png" id="27_4ya5e"]
|
||||
[ext_resource type="Resource" uid="uid://cltxhkrqp055v" path="res://Resources/Items/Money_Pickup.tres" id="28_last5"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ebbst"]
|
||||
atlas = ExtResource("8_xqq1n")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iasoh"]
|
||||
atlas = ExtResource("10_yq36q")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ew85h"]
|
||||
atlas = ExtResource("12_025fa")
|
||||
region = Rect2(0, 0, 16.0056, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_munhl"]
|
||||
atlas = ExtResource("14_qenyx")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3y0hf"]
|
||||
atlas = ExtResource("19_last5")
|
||||
|
||||
[node name="DebugMenu" type="VBoxContainer" node_paths=PackedStringArray("ButtonsContainer", "CheatsContainer", "DefaultSelectedButton")]
|
||||
process_mode = 3
|
||||
|
|
@ -37,11 +80,98 @@ text = "God Mode
|
|||
[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("2_wqb8e")
|
||||
|
||||
[node name="CheatsContainer" type="HBoxContainer" parent="HBoxContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("2_wqb8e")
|
||||
theme_override_constants/separation = -2
|
||||
|
||||
[node name="RedKeycard" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = ExtResource("5_2s8o7")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("7_tpuu5")
|
||||
|
||||
[node name="BlueKeycard" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = SubResource("AtlasTexture_ebbst")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("8_6t1ll")
|
||||
|
||||
[node name="GreenKeycard" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = SubResource("AtlasTexture_iasoh")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("9_jf7mu")
|
||||
|
||||
[node name="YellowKeycard" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = SubResource("AtlasTexture_ew85h")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("10_p65nv")
|
||||
|
||||
[node name="GenericKeycard" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = SubResource("AtlasTexture_munhl")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("11_c30ky")
|
||||
|
||||
[node name="CheatGun" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = SubResource("AtlasTexture_munhl")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("16_mps4w")
|
||||
|
||||
[node name="Ammo" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = ExtResource("17_ubovs")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("18_4ya5e")
|
||||
|
||||
[node name="Ammo2" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = SubResource("AtlasTexture_3y0hf")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("20_a32ms")
|
||||
|
||||
[node name="Ammo3" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = ExtResource("21_g6p7f")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("22_wtyjh")
|
||||
|
||||
[node name="Power" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = ExtResource("23_afddb")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("24_bg771")
|
||||
|
||||
[node name="Points" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = ExtResource("25_mps4w")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("26_ubovs")
|
||||
|
||||
[node name="Credits" type="Button" parent="HBoxContainer/ScrollContainer/CheatsContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_wqb8e")
|
||||
icon = ExtResource("27_4ya5e")
|
||||
script = ExtResource("6_1omws")
|
||||
Item = ExtResource("28_last5")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_f8f0c"]
|
||||
font = ExtResource("2_kog7o")
|
||||
outline_size = 4
|
||||
outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="PauseMenu" type="VBoxContainer" node_paths=PackedStringArray("ResumeButton", "QuitButton", "OptionsButton", "DebugButton")]
|
||||
process_mode = 3
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -358,7 +358,10 @@ public partial class Hud : CanvasLayer
|
|||
menu.MenuClosed += () =>
|
||||
{
|
||||
DebugMenuHolder.Visible = false;
|
||||
SpawnPauseMenu();
|
||||
if (GameManager.Instance.GameState is GameState.Paused)
|
||||
{
|
||||
SpawnPauseMenu();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
25
Scripts/UI/DebugItemButton.cs
Normal file
25
Scripts/UI/DebugItemButton.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.UI;
|
||||
|
||||
[Tool]
|
||||
public partial class DebugItemButton : Button
|
||||
{
|
||||
[Export] public LootItem Item { get; set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Item is null) return;
|
||||
this.Icon = Item.InventorySprite;
|
||||
|
||||
if (Engine.IsEditorHint()) return;
|
||||
this.Pressed += OnPressed;
|
||||
}
|
||||
|
||||
private void OnPressed()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
InventoryManager.Instance.AddItem(Item);
|
||||
}
|
||||
}
|
||||
1
Scripts/UI/DebugItemButton.cs.uid
Normal file
1
Scripts/UI/DebugItemButton.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://v6tkgo5mwi1w
|
||||
|
|
@ -25,6 +25,8 @@ public partial class DebugMenu : MenuBase
|
|||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
GameManager.Instance.GameStateChange += OnGameStateChange;
|
||||
|
||||
DefaultSelectedButton.GrabFocus();
|
||||
|
||||
foreach (var level in Levels.Maps)
|
||||
|
|
@ -53,6 +55,16 @@ public partial class DebugMenu : MenuBase
|
|||
|
||||
}
|
||||
|
||||
private void OnGameStateChange(GameState state)
|
||||
{
|
||||
if (state is not GameState.Paused)
|
||||
{
|
||||
GameManager.Instance.GameStateChange -= OnGameStateChange;
|
||||
CloseMenu();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RefillHealthButtonOnPressed()
|
||||
{
|
||||
GameManager.Instance?.Player?.RefillHealth();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ public partial class MenuBase : Control
|
|||
public delegate void MenuClosedEventHandler();
|
||||
|
||||
protected virtual void _on_back_button_pressed()
|
||||
{
|
||||
CloseMenu();
|
||||
}
|
||||
|
||||
protected void CloseMenu()
|
||||
{
|
||||
this.QueueFree();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue