mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +01:00
Only drag one file with drag and drop, pretty ordering when taking/dropping
This commit is contained in:
parent
f27faabcba
commit
1289ce19a3
5 changed files with 17 additions and 18 deletions
|
@ -37,14 +37,17 @@ func _input(event):
|
||||||
get_parent_with_type().dropped_on(area.get_parent_with_type())
|
get_parent_with_type().dropped_on(area.get_parent_with_type())
|
||||||
_turn_off_highlights()
|
_turn_off_highlights()
|
||||||
dragged = false
|
dragged = false
|
||||||
if game.dragged_object:
|
game.dragged_object = null
|
||||||
|
elif game.dragged_object and game.dragged_object.has_method("try_play"):
|
||||||
if hovered and highlighted:
|
if hovered and highlighted:
|
||||||
game.dragged_object.dropped_on(get_parent_with_type())
|
game.dragged_object.dropped_on(get_parent_with_type())
|
||||||
|
|
||||||
if event.button_index == BUTTON_LEFT and event.pressed and hovered:
|
if event.button_index == BUTTON_LEFT and event.pressed and hovered:
|
||||||
if get_parent().type == "file" and get_parent().item_type == "wd":
|
if not game.dragged_object:
|
||||||
dragged = true
|
if get_parent().type == "file" and get_parent().item_type == "wd":
|
||||||
_turn_on_highlights()
|
dragged = true
|
||||||
|
game.dragged_object = self
|
||||||
|
_turn_on_highlights()
|
||||||
|
|
||||||
func _set_highlighted(new_highlighted):
|
func _set_highlighted(new_highlighted):
|
||||||
highlighted = new_highlighted
|
highlighted = new_highlighted
|
||||||
|
|
|
@ -127,6 +127,6 @@ margin_right = 20.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
|
|
||||||
[node name="DropArea" parent="." instance=ExtResource( 4 )]
|
[node name="DropArea" parent="." instance=ExtResource( 4 )]
|
||||||
position = Vector2( 121.101, 116.61 )
|
position = Vector2( 79.9581, 82.3243 )
|
||||||
[connection signal="pressed" from="Panel/TextEdit/SaveButton" to="." method="save"]
|
[connection signal="pressed" from="Panel/TextEdit/SaveButton" to="." method="save"]
|
||||||
[connection signal="pressed" from="Panel/TextEdit/CloseButton" to="." method="close"]
|
[connection signal="pressed" from="Panel/TextEdit/CloseButton" to="." method="close"]
|
||||||
|
|
|
@ -118,6 +118,6 @@ func dropped_on(other):
|
||||||
if other.type == "inventory":
|
if other.type == "inventory":
|
||||||
file_browser.shell.run("take '%s'" % label)
|
file_browser.shell.run("take '%s'" % label)
|
||||||
else:
|
else:
|
||||||
other.shell.run("drop '%s'" % label)
|
other.shell.run("drop '%s' %d %d" % [label, rand_range(50, 400), rand_range(50, 200)])
|
||||||
file_browser.update()
|
file_browser.update()
|
||||||
other.update()
|
other.update()
|
||||||
|
|
|
@ -45,20 +45,10 @@ func _ready():
|
||||||
|
|
||||||
# Load first chapter.
|
# Load first chapter.
|
||||||
load_chapter(current_chapter)
|
load_chapter(current_chapter)
|
||||||
file_browser.grab_focus()
|
|
||||||
|
|
||||||
inventory.shell = Shell.new()
|
inventory.shell = Shell.new()
|
||||||
inventory.shell.cd(game.tmp_prefix + "inventory")
|
inventory.shell.cd(game.tmp_prefix + "inventory")
|
||||||
|
|
||||||
|
|
||||||
func _input(event):
|
|
||||||
if event.is_action_pressed("tab"):
|
|
||||||
print("ha")
|
|
||||||
if file_browser.has_focus():
|
|
||||||
terminal.grab_focus()
|
|
||||||
else:
|
|
||||||
file_browser.grab_focus()
|
|
||||||
|
|
||||||
func load_chapter(id):
|
func load_chapter(id):
|
||||||
current_chapter = id
|
current_chapter = id
|
||||||
repopulate_levels()
|
repopulate_levels()
|
||||||
|
@ -156,8 +146,7 @@ func update_repos():
|
||||||
var repo = repositories[r]
|
var repo = repositories[r]
|
||||||
repo.update_everything()
|
repo.update_everything()
|
||||||
file_browser.update()
|
file_browser.update()
|
||||||
#index.update()
|
inventory.update()
|
||||||
file_browser.grab_focus()
|
|
||||||
|
|
||||||
if levels.chapters[current_chapter].levels[current_level].check_win():
|
if levels.chapters[current_chapter].levels[current_level].check_win():
|
||||||
show_win_status()
|
show_win_status()
|
||||||
|
|
|
@ -3,3 +3,10 @@
|
||||||
echo "Taking $1!"
|
echo "Taking $1!"
|
||||||
mkdir -p ~/inventory
|
mkdir -p ~/inventory
|
||||||
mv "$1" ~/inventory
|
mv "$1" ~/inventory
|
||||||
|
|
||||||
|
X=50
|
||||||
|
for file in ~/inventory/*; do
|
||||||
|
echo "x = $X" > $file
|
||||||
|
echo "y = 50" >> $file
|
||||||
|
X=$(expr $X + 100)
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in a new issue