mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Enable actual command execution again, when playing cards
This commit is contained in:
parent
977a085940
commit
751434c4d8
4 changed files with 19 additions and 32 deletions
|
@ -53,14 +53,10 @@ func _unhandled_input(event):
|
||||||
_turn_off_highlights()
|
_turn_off_highlights()
|
||||||
modulate.a = 1
|
modulate.a = 1
|
||||||
|
|
||||||
if get_viewport().get_mouse_position().y < get_viewport().size.y/3*2:
|
if "[" in command:
|
||||||
# if arg_number == 0 :
|
|
||||||
# try_play($Label.text)
|
|
||||||
# else:
|
|
||||||
# move_back()
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
move_back()
|
move_back()
|
||||||
|
else:
|
||||||
|
try_play(command)
|
||||||
|
|
||||||
func _turn_on_highlights():
|
func _turn_on_highlights():
|
||||||
var arg_regex = RegEx.new()
|
var arg_regex = RegEx.new()
|
||||||
|
@ -109,21 +105,15 @@ func move_back():
|
||||||
$ReturnSound.play()
|
$ReturnSound.play()
|
||||||
|
|
||||||
func dropped_on(other):
|
func dropped_on(other):
|
||||||
var full_command = ""
|
if "[" in command:
|
||||||
# match arg_number:
|
var argument = other.id
|
||||||
# 1:
|
if (command.begins_with("git checkout") or command.begins_with("git rebase")) and other.id.begins_with("refs/heads"):
|
||||||
# var argument = other.id
|
argument = Array(other.id.split("/")).pop_back()
|
||||||
# if ($Label.text.begins_with("git checkout") or $Label.text.begins_with("git rebase")) and other.id.begins_with("refs/heads"):
|
|
||||||
# argument = Array(other.id.split("/")).pop_back()
|
var arg_regex = RegEx.new()
|
||||||
# full_command = $Label.text + " " + argument
|
arg_regex.compile("\\[(.*)\\]")
|
||||||
# try_play(full_command)
|
var full_command = arg_regex.sub(command, argument)
|
||||||
# 2:
|
try_play(full_command)
|
||||||
# if _first_argument:
|
|
||||||
# full_command = $Label.text + " " + _first_argument + " " + other.id
|
|
||||||
# $"../Terminal".send_command(full_command)
|
|
||||||
# move_back()
|
|
||||||
# else:
|
|
||||||
# _first_argument = other.id
|
|
||||||
|
|
||||||
func try_play(full_command):
|
func try_play(full_command):
|
||||||
if game.energy >= energy:
|
if game.energy >= energy:
|
||||||
|
|
|
@ -15,7 +15,7 @@ func _mouse_exited():
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == BUTTON_LEFT and !event.pressed and hovered:
|
if event.button_index == BUTTON_LEFT and !event.pressed and hovered:
|
||||||
if game.dragged_object:
|
if highlighted and game.dragged_object:
|
||||||
game.dragged_object.dropped_on($"..")
|
game.dragged_object.dropped_on($"..")
|
||||||
|
|
||||||
func _set_highlighted(new_highlighted):
|
func _set_highlighted(new_highlighted):
|
||||||
|
@ -23,8 +23,5 @@ func _set_highlighted(new_highlighted):
|
||||||
$Highlight.visible = highlighted
|
$Highlight.visible = highlighted
|
||||||
|
|
||||||
func highlight(type):
|
func highlight(type):
|
||||||
print("highlight:")
|
|
||||||
print(type)
|
|
||||||
print(get_parent().type)
|
|
||||||
if get_parent().type == type:
|
if get_parent().type == type:
|
||||||
_set_highlighted(true)
|
_set_highlighted(true)
|
||||||
|
|
|
@ -10,6 +10,7 @@ radius = 23.5871
|
||||||
"drop_areas",
|
"drop_areas",
|
||||||
]]
|
]]
|
||||||
position = Vector2( -0.197731, 0.0673599 )
|
position = Vector2( -0.197731, 0.0673599 )
|
||||||
|
z_index = -2
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
@ -18,12 +19,11 @@ script = ExtResource( 1 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Highlight" type="Node2D" parent="."]
|
[node name="Highlight" type="Node2D" parent="."]
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="Highlight"]
|
[node name="Sprite" type="Sprite" parent="Highlight"]
|
||||||
modulate = Color( 0.65098, 0.560784, 0.890196, 0.533333 )
|
modulate = Color( 0.65098, 0.560784, 0.890196, 0.533333 )
|
||||||
position = Vector2( -0.302719, 0.302704 )
|
position = Vector2( -0.302734, -1.13884 )
|
||||||
scale = Vector2( 1.64865, 1.64865 )
|
scale = Vector2( 0.921018, 0.921018 )
|
||||||
texture = ExtResource( 2 )
|
texture = ExtResource( 2 )
|
||||||
[connection signal="mouse_entered" from="Area2D" to="." method="_mouse_entered"]
|
[connection signal="mouse_entered" from="Area2D" to="." method="_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"]
|
[connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"]
|
||||||
|
|
|
@ -23,6 +23,8 @@ corner_radius_bottom_left = 5
|
||||||
[node name="Node" type="Node2D"]
|
[node name="Node" type="Node2D"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="DropArea" parent="." instance=ExtResource( 6 )]
|
||||||
|
|
||||||
[node name="Arrows" type="Node2D" parent="."]
|
[node name="Arrows" type="Node2D" parent="."]
|
||||||
z_index = -1
|
z_index = -1
|
||||||
|
|
||||||
|
@ -58,8 +60,6 @@ __meta__ = {
|
||||||
[node name="Pop" type="AudioStreamPlayer2D" parent="."]
|
[node name="Pop" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource( 5 )
|
stream = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="DropArea" parent="." instance=ExtResource( 6 )]
|
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
|
Loading…
Reference in a new issue