Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added shuffle stack shortcut #132

Merged
merged 7 commits into from
Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
84 changes: 51 additions & 33 deletions game/Scenes/OptionsMenu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ section_name = "key_bindings"
text = "Key Bindings"

[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings"]
margin_right = 976.0
margin_bottom = 536.0
margin_right = 964.0
margin_bottom = 566.0
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
Expand Down Expand Up @@ -761,142 +761,160 @@ size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_reset_piece"

[node name="LockPiece" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
[node name="Shuffle" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 303.0
margin_right = 480.0
margin_bottom = 323.0
size_flags_horizontal = 3
text = "Lock/Unlock Piece"
text = "Shuffle"
align = 2

[node name="LockPieceButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
[node name="ShuffleButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 300.0
margin_right = 964.0
margin_bottom = 326.0
hint_tooltip = "Shuffle stack"
RomanNovo marked this conversation as resolved.
Show resolved Hide resolved
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_shuffle_stack"

[node name="LockPiece" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 333.0
margin_right = 480.0
margin_bottom = 353.0
size_flags_horizontal = 3
text = "Lock/Unlock Piece"
align = 2

[node name="LockPieceButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 330.0
margin_right = 964.0
margin_bottom = 356.0
hint_tooltip = "Toggles the lock on the selected piece, fixing its position and rotation."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_lock_piece"

[node name="DeletePiece" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 333.0
margin_top = 363.0
margin_right = 480.0
margin_bottom = 353.0
margin_bottom = 383.0
size_flags_horizontal = 3
text = "Delete Piece"
align = 2

[node name="DeletePieceButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 330.0
margin_top = 360.0
margin_right = 964.0
margin_bottom = 356.0
margin_bottom = 386.0
hint_tooltip = "Deletes the currently selected piece."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_delete_piece"

[node name="ToggleDebugInfo" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 363.0
margin_top = 393.0
margin_right = 480.0
margin_bottom = 383.0
margin_bottom = 413.0
size_flags_horizontal = 3
text = "Toggle Debug Info"
align = 2

[node name="ToggleDebugInfoButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 360.0
margin_top = 390.0
margin_right = 964.0
margin_bottom = 386.0
margin_bottom = 416.0
hint_tooltip = "Toggles whether debug information is displayed."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_toggle_debug_info"

[node name="Quicksave" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 393.0
margin_top = 423.0
margin_right = 480.0
margin_bottom = 413.0
margin_bottom = 443.0
size_flags_horizontal = 3
text = "Quicksave"
align = 2

[node name="QuicksaveButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 390.0
margin_top = 420.0
margin_right = 964.0
margin_bottom = 416.0
margin_bottom = 446.0
hint_tooltip = "Creates a quicksave file."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_quicksave"

[node name="Quickload" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 423.0
margin_top = 453.0
margin_right = 480.0
margin_bottom = 443.0
margin_bottom = 473.0
size_flags_horizontal = 3
text = "Quickload"
align = 2

[node name="QuickloadButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 420.0
margin_top = 450.0
margin_right = 964.0
margin_bottom = 446.0
margin_bottom = 476.0
hint_tooltip = "Loads the latest quicksave file."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_quickload"

[node name="ToggleUI" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 453.0
margin_top = 483.0
margin_right = 480.0
margin_bottom = 473.0
margin_bottom = 503.0
size_flags_horizontal = 3
text = "Toggle UI"
align = 2

[node name="ToggleUIButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 450.0
margin_top = 480.0
margin_right = 964.0
margin_bottom = 476.0
margin_bottom = 506.0
hint_tooltip = "Toggles whether the entire UI is displayed."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_toggle_ui"

[node name="TakeScreenshot" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 483.0
margin_top = 513.0
margin_right = 480.0
margin_bottom = 503.0
margin_bottom = 533.0
size_flags_horizontal = 3
text = "Take Screenshot"
align = 2

[node name="TakeScreenshotButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 480.0
margin_top = 510.0
margin_right = 964.0
margin_bottom = 506.0
margin_bottom = 536.0
hint_tooltip = "Takes a screenshot of the game in its current state."
size_flags_horizontal = 3
script = ExtResource( 2 )
action = "game_take_screenshot"

[node name="ResetBindingsSpace" type="Control" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_top = 510.0
margin_top = 540.0
margin_right = 480.0
margin_bottom = 536.0
margin_bottom = 566.0

[node name="ResetBindingsButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Key Bindings/GridContainer"]
margin_left = 484.0
margin_top = 510.0
margin_top = 540.0
margin_right = 964.0
margin_bottom = 536.0
margin_bottom = 566.0
hint_tooltip = "Used to reset the key bindings to their default values."
text = "Reset Bindings"

Expand Down
19 changes: 19 additions & 0 deletions game/Scripts/Game/CameraController.gd
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,15 @@ func _unhandled_input(event):
for piece in _selected_pieces:
if piece is Piece:
piece.rpc_id(1, "request_reset_orientation")
elif event.is_action_pressed("game_shuffle_stack", true):
RomanNovo marked this conversation as resolved.
Show resolved Hide resolved
if _selected_pieces.empty():
drwhut marked this conversation as resolved.
Show resolved Hide resolved
if _piece_mouse_is_over != null and _piece_mouse_is_over is Stack:
_piece_mouse_is_over.rpc_id(1, "request_shuffle")
else:
for piece in _selected_pieces:
if piece is Stack:
piece.rpc_id(1, "request_shuffle")

elif event.is_action_pressed("game_toggle_debug_info"):
_debug_info_label.visible = not _debug_info_label.visible
elif event.is_action_pressed("game_toggle_ui"):
Expand All @@ -792,6 +801,7 @@ func _unhandled_input(event):

_on_scroll(delta, ctrl, alt)


if event is InputEventKey:
var ctrl = event.command if OS.get_name() == "OSX" else event.control
if event.pressed and ctrl:
Expand Down Expand Up @@ -1438,6 +1448,10 @@ func _set_control_hint_label() -> void:
text += _set_control_hint_label_row_actions(tr("Reset orientation"),
["game_reset_piece"])

text += _set_control_hint_label_row_actions(tr("Shuffle"),
["game_shuffle_stack"])


var ctrl_mod = cmd if OS.get_name() == "OSX" else ctrl
var alt_mod = ctrl if OS.get_name() == "OSX" else alt

Expand All @@ -1457,6 +1471,7 @@ func _set_control_hint_label() -> void:

text += _set_control_hint_label_row_actions(tr("Delete selected"),
["game_delete_piece"])


elif _piece_mouse_is_over != null and _piece_mouse_is_over is Card:
if _piece_mouse_is_over.over_hands == [ get_tree().get_network_unique_id() ]:
Expand All @@ -1466,6 +1481,10 @@ func _set_control_hint_label() -> void:
text += _set_control_hint_label_row_actions(tr("Face card up"),
["game_reset_piece"])

if _piece_mouse_is_over != null and _piece_mouse_is_over is Stack:
text += _set_control_hint_label_row_actions(tr("Shuffle"),
["game_shuffle_stack"])

text += _set_control_hint_label_row_actions(tr("Reset camera"), ["game_reset_camera"])

text += "[/table][/right]"
Expand Down
5 changes: 5 additions & 0 deletions game/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ game_zoom_out={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":46,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
game_shuffle_stack={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}

[locale]

Expand Down