Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Globals/Translations/Translations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ CONTROLS_ARROW_BUTTON,Arrow Keys,箭头键
CONTROLS_RETURN_BUTTON,Return,返回
CONTROLS_CHOOSE_SCHEME,Choose Control Scheme,选择控制方式
CONTROLS_CHOOSE_BUTTON,Choose new button,选择输入按钮
CONTROLS_CHOOSE_TEXT_KEYBOARD,"Press Escape to close","按下 Escape 键关闭"
CONTROLS_CHOOSE_TEXT_CONTROLLER,"Press Start to close","按下 Start 键关闭"
CONTROLS_CHOOSE_INVALID,"System input, can't be used!",预留输入,无法重定向!
CONTROLS_CHOOSE_DUPLICATE,"Input already set, can't be used again!",输入冲突,无法继续!
ESCAPE_MENU_RESUME,Resume,继续
ESCAPE_MENU_QUIT,Quit,退出
ESCAPE_MENU_TITLE,Quit to Title,返回标题
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ We now have a Steam page!
The repository license **does not** apply to any music or image files in this repository, including but not limited to `.wav`, `.mp3`, `.ogg`, `.png`, `.jpg`, and other media formats. These assets are **not licensed** for use, private or public, without prior written consent from the team.

All source code and documentation files are licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**.

23 changes: 21 additions & 2 deletions Scenes/UI/Remapping/ControlSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ public partial class ControlSettings : Node2D, IFocusableMenu

[Export]
private Label _remapLabel;
private string _keyboardRemap = "CONTROLS_CHOOSE_TEXT_KEYBOARD";
private string _controllerRemap = "CONTROLS_CHOOSE_TEXT_CONTROLLER";
private string _invalidMessage = "CONTROLS_CHOOSE_INVALID";
private string _duplicateInput = "CONTROLS_CHOOSE_DUPLICATE";

[Export]
private Label _remapDescription;

[Export]
private Timer _remapTimer;
Expand Down Expand Up @@ -122,6 +129,8 @@ public override void _Ready()
? 0
: 1;

_remapDescription.Text = Tr(_remapTabs.CurrentTab == 0 ? _keyboardRemap : _controllerRemap);

_remapTimer.Timeout += OnTimerEnd;
_remapTabs.TabChanged += (_) => ChangeInputType();
_closeButton.Pressed += ReturnToPrev;
Expand Down Expand Up @@ -197,6 +206,7 @@ private void ChangeInputType()
SaveSystem.ConfigSettings.InputType,
_remapTabs.CurrentTab == 0 ? KeyboardPrefix : JoyPrefix
);
_remapDescription.Text = Tr(_remapTabs.CurrentTab == 0 ? _keyboardRemap : _controllerRemap);
}

/// <summary>
Expand Down Expand Up @@ -255,7 +265,7 @@ public override void _Input(InputEvent @event)
{
if (_remapPopup.Visible)
{
if (@event.IsActionPressed("ui_cancel"))
if (@event.IsActionPressed("Pause"))
{
_remapTimer.Stop();
OnTimerEnd();
Expand Down Expand Up @@ -295,8 +305,14 @@ private void HandleRemapInput(InputEvent @event)
{
case true when @event is InputEventKey keyEvent:
{
if (_invalidKeys.Contains(keyEvent.Keycode))
if (
_invalidKeys.Contains(keyEvent.Keycode)
|| !FileAccess.FileExists($"{IconPath}{CleanKeyboardText(@event.AsText())}.png")
)
{
_remapDescription.Text = Tr(_invalidMessage);
return;
}

string action = KeyboardPrefix + _chosenKey;
InputMap.ActionEraseEvents(action);
Expand Down Expand Up @@ -425,7 +441,10 @@ evt is InputEventKey keyEvent
&& CleanKeyboardText(keyEvent.AsText()) == keyText
) || (evt is InputEventJoypadButton padEvent && padEvent.AsText() == keyText)
)
{
_remapDescription.Text = Tr(_duplicateInput);
return false;
}
}
}
return true;
Expand Down
11 changes: 10 additions & 1 deletion Scenes/UI/Remapping/Remap.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
[ext_resource type="Texture2D" uid="uid://cpxcg12lovxu5" path="res://Scenes/UI/Remapping/Assets/Joypad Button 4 (Back, Sony Select, Xbox Back, Nintendo -).png" id="16_s0mtp"]
[ext_resource type="Texture2D" uid="uid://djd6iw2g84bba" path="res://Scenes/UI/Assets/UI_CenterFrame.png" id="18_8iace"]

[node name="Remap" type="Node2D" node_paths=PackedStringArray("_closeButton", "_remapPopup", "_remapLabel", "_remapTimer", "_remapTabs")]
[node name="Remap" type="Node2D" node_paths=PackedStringArray("_closeButton", "_remapPopup", "_remapLabel", "_remapDescription", "_remapTimer", "_remapTabs")]
process_mode = 3
script = ExtResource("1_ir12b")
_closeButton = NodePath("Panel/TitleButton")
_remapPopup = NodePath("RemapPopup")
_remapLabel = NodePath("RemapPopup/Label2")
_remapDescription = NodePath("RemapPopup/Label3")
_remapTimer = NodePath("RemapPopup/Timer")
_remapTabs = NodePath("Panel/TabContainer")

Expand Down Expand Up @@ -580,6 +581,14 @@ offset_bottom = 59.0
text = "CONTROLS_CHOOSE_BUTTON"
horizontal_alignment = 1

[node name="Label3" type="Label" parent="RemapPopup"]
layout_mode = 0
offset_top = 75.0
offset_right = 372.0
offset_bottom = 98.0
text = "CONTROLS_CHOOSE_TEXT_KEYBOARD"
horizontal_alignment = 1

[node name="Label2" type="Label" parent="RemapPopup"]
layout_mode = 0
offset_top = 111.0
Expand Down