diff --git a/Cirno.sln.DotSettings.user b/Cirno.sln.DotSettings.user index 2a5250a2..c8698013 100644 --- a/Cirno.sln.DotSettings.user +++ b/Cirno.sln.DotSettings.user @@ -11,7 +11,9 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded diff --git a/Resources/Styles/MainMenuButtons.tres b/Resources/Styles/MainMenuButtons.tres index 057bdb19..9595cb08 100644 --- a/Resources/Styles/MainMenuButtons.tres +++ b/Resources/Styles/MainMenuButtons.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=12 format=3 uid="uid://dnsadvmunm76k"] +[gd_resource type="Theme" load_steps=21 format=3 uid="uid://dnsadvmunm76k"] [ext_resource type="FontFile" uid="uid://coek1e2q257pq" path="res://fonts/at01.ttf" id="1_dp7be"] [ext_resource type="StyleBox" uid="uid://ctw2hju32l3rg" path="res://Resources/Styles/PixelStyleBoxRed.tres" id="2_wf67a"] @@ -6,8 +6,13 @@ [ext_resource type="StyleBox" uid="uid://6ydsirgc5xi5" path="res://Resources/Styles/HealthBarFill.tres" id="4_j5bu4"] [ext_resource type="Texture2D" uid="uid://d2m6srimy07bq" path="res://Sprites/UI/SliderSelector.png" id="4_joeh7"] [ext_resource type="StyleBox" uid="uid://24hh6h4juk3r" path="res://Resources/Styles/PixelStyleBoxRed_SquareBackground.tres" id="4_jpso0"] +[ext_resource type="StyleBox" uid="uid://cpa8himkyhn61" path="res://Resources/Styles/HorizontalGrabberBox.tres" id="4_uwwh5"] +[ext_resource type="Texture2D" uid="uid://d4wo6kxffwo5" path="res://Sprites/UI/ScrollGrabberHorizontal.png" id="5_ercuu"] [ext_resource type="StyleBox" uid="uid://dnb4ogn847dyp" path="res://Resources/Styles/HealthBarBackground.tres" id="5_ogh8g"] [ext_resource type="Texture2D" uid="uid://c4bj6flx8lp68" path="res://Sprites/UI/SliderSelector_Focused.png" id="5_xp2bu"] +[ext_resource type="StyleBox" uid="uid://dj8x7ss2wee7k" path="res://Resources/Styles/VerticalGrabberBox.tres" id="9_0lulh"] +[ext_resource type="Texture2D" uid="uid://d22shrdi1kf7" path="res://Sprites/UI/ScrollGrabber.png" id="10_uwwh5"] +[ext_resource type="StyleBox" uid="uid://5ceac1vp2b47" path="res://Resources/Styles/VerticalScrollStyleBox.tres" id="10_yplb8"] [sub_resource type="AtlasTexture" id="AtlasTexture_jpso0"] atlas = ExtResource("3_xfr2l") @@ -21,6 +26,42 @@ region = Rect2(0, 0, 8, 8) atlas = ExtResource("3_xfr2l") region = Rect2(16, 0, 8, 8) +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_t5cti"] +texture = ExtResource("5_ercuu") +texture_margin_left = 3.0 +texture_margin_top = 3.0 +texture_margin_right = 3.0 +texture_margin_bottom = 3.0 +axis_stretch_horizontal = 2 +modulate_color = Color(0.706778, 0.706778, 0.706778, 1) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_d1bcy"] +texture = ExtResource("5_ercuu") +texture_margin_left = 3.0 +texture_margin_top = 3.0 +texture_margin_right = 3.0 +texture_margin_bottom = 3.0 +axis_stretch_horizontal = 2 +modulate_color = Color(0.603538, 0.603537, 0.603537, 1) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ercuu"] +texture = ExtResource("10_uwwh5") +texture_margin_left = 3.0 +texture_margin_top = 3.0 +texture_margin_right = 3.0 +texture_margin_bottom = 3.0 +axis_stretch_vertical = 2 +modulate_color = Color(0.713915, 0.713915, 0.713915, 1) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_e1y5d"] +texture = ExtResource("10_uwwh5") +texture_margin_left = 3.0 +texture_margin_top = 3.0 +texture_margin_right = 3.0 +texture_margin_bottom = 3.0 +axis_stretch_vertical = 2 +modulate_color = Color(0.692541, 0.692541, 0.692541, 1) + [resource] default_font = ExtResource("1_dp7be") default_font_size = 16 @@ -51,6 +92,17 @@ Button/styles/pressed = ExtResource("2_wf67a") CheckBox/icons/checked = SubResource("AtlasTexture_jpso0") CheckBox/icons/unchecked = SubResource("AtlasTexture_0p6en") CheckBox/icons/unchecked_disabled = SubResource("AtlasTexture_xfr2l") +HScrollBar/icons/decrement = null +HScrollBar/icons/decrement_highlight = null +HScrollBar/icons/decrement_pressed = null +HScrollBar/icons/increment = null +HScrollBar/icons/increment_highlight = null +HScrollBar/icons/increment_pressed = null +HScrollBar/styles/grabber = ExtResource("4_uwwh5") +HScrollBar/styles/grabber_highlight = SubResource("StyleBoxTexture_t5cti") +HScrollBar/styles/grabber_pressed = SubResource("StyleBoxTexture_d1bcy") +HScrollBar/styles/scroll = ExtResource("5_ogh8g") +HScrollBar/styles/scroll_focus = ExtResource("5_ogh8g") HSlider/icons/grabber = ExtResource("4_joeh7") HSlider/icons/grabber_disabled = null HSlider/icons/grabber_highlight = ExtResource("5_xp2bu") @@ -71,6 +123,23 @@ TabContainer/styles/tab_hovered = ExtResource("4_jpso0") TabContainer/styles/tab_selected = ExtResource("4_jpso0") TabContainer/styles/tab_unselected = ExtResource("4_jpso0") TabContainer/styles/tabbar_background = null +VScrollBar/icons/decrement = null +VScrollBar/icons/decrement_highlight = null +VScrollBar/icons/decrement_pressed = null +VScrollBar/icons/increment = null +VScrollBar/icons/increment_highlight = null +VScrollBar/icons/increment_pressed = null +VScrollBar/styles/grabber = ExtResource("9_0lulh") +VScrollBar/styles/grabber_highlight = SubResource("StyleBoxTexture_ercuu") +VScrollBar/styles/grabber_pressed = SubResource("StyleBoxTexture_e1y5d") +VScrollBar/styles/scroll = ExtResource("10_yplb8") +VScrollBar/styles/scroll_focus = ExtResource("10_yplb8") +VSlider/constants/center_grabber = 0 +VSlider/constants/grabber_offset = 0 +VSlider/icons/grabber = null +VSlider/icons/grabber_disabled = null +VSlider/icons/grabber_highlight = null +VSlider/icons/tick = null VSlider/styles/grabber_area = null VSlider/styles/grabber_area_highlight = null VSlider/styles/slider = null diff --git a/Scenes/HUD/OptionsMenu.tscn b/Scenes/HUD/OptionsMenu.tscn index 913fac37..771017dc 100644 --- a/Scenes/HUD/OptionsMenu.tscn +++ b/Scenes/HUD/OptionsMenu.tscn @@ -22,6 +22,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +theme = ExtResource("1_il8fq") script = ExtResource("1_mpohc") ResolutionsList = NodePath("ScrollContainer/VBoxContainer/GeneralSettings/HFlowContainer/Resolution/ResolutionsList") VSyncToggle = NodePath("ScrollContainer/VBoxContainer/GeneralSettings/HFlowContainer/VsyncCheckbox") diff --git a/Scenes/HUD/UiElements/KeyRemappingItem.tscn b/Scenes/HUD/UiElements/KeyRemappingItem.tscn index a0c4c3ee..1f8c0517 100644 --- a/Scenes/HUD/UiElements/KeyRemappingItem.tscn +++ b/Scenes/HUD/UiElements/KeyRemappingItem.tscn @@ -16,12 +16,11 @@ label_settings = ExtResource("2_b0qgl") [node name="Key" type="Label" parent="."] layout_mode = 2 -text = "A" label_settings = ExtResource("2_b0qgl") [node name="Button" type="Button" parent="."] layout_mode = 2 theme = ExtResource("3_b0qgl") -text = "Remap" +text = "Add" [connection signal="pressed" from="Button" to="." method="StartRemap"] diff --git a/Scripts/UI/KeyRemappingItem.cs b/Scripts/UI/KeyRemappingItem.cs index 4d0fc068..c7243251 100644 --- a/Scripts/UI/KeyRemappingItem.cs +++ b/Scripts/UI/KeyRemappingItem.cs @@ -12,18 +12,40 @@ public partial class KeyRemappingItem : HBoxContainer [Export] public Label InputLabel { get; private set; } private bool _active = false; - + public override void _Ready() { NameLabel.Text = KeyName; var actions = InputMap.GetActions(); - + var action = actions.FirstOrDefault(x => x == KeyId); var events = InputMap.ActionGetEvents(action); - - InputLabel.Text = string.Join(",", events.Select(x => x.AsText())); + + foreach (var e in events) + { + var button = new Button(); + + button.Text = e switch + { + InputEventKey key => key.PhysicalKeycode.ToString(), + InputEventJoypadButton jButton => $"Joypad {jButton.ButtonIndex}", + InputEventMouseButton mouseButton => $"Mouse {mouseButton.ButtonIndex}", + _ => e.AsText() + }; + button.Pressed += () => { BeginRemap(button, action, e); }; + this.AddChild(button); + } + + + //InputLabel.Text = string.Join(",", events.Select(x => x.AsText())); } - + + private void BeginRemap(Button button, StringName action, InputEvent e) + { + button.Text = "Remapping..."; + _active = true; + } + public void StartRemap() { _active = true; @@ -32,11 +54,12 @@ public partial class KeyRemappingItem : HBoxContainer public override void _Input(InputEvent e) { if (!_active) return; - + if (e is InputEventKey keyEvent && keyEvent.Pressed) { GD.Print(keyEvent.Keycode); - InputLabel.Text = keyEvent.Keycode.ToString(); + //InputLabel.Text = keyEvent.Keycode.ToString(); + _active = false; } }