mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-26 17:13:16 +03:00
Handle files without a position in them. Streamline cards a bit.
This commit is contained in:
parent
ca09ad0245
commit
12e9aff7ff
13
levels/2d/sandbox
Normal file
13
levels/2d/sandbox
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
title = Sandbox
|
||||||
|
cards = checkout add reset commit merge rebase-interactive file-new file-delete
|
||||||
|
|
||||||
|
[setup]
|
||||||
|
|
||||||
|
echo "x = 200
|
||||||
|
y = 100" > apple
|
||||||
|
|
||||||
|
echo "x = 400
|
||||||
|
y = 100" > pen
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "The beginning"
|
1
levels/2d/sequence
Normal file
1
levels/2d/sequence
Normal file
@ -0,0 +1 @@
|
|||||||
|
sandbox
|
@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "checkout",
|
"id": "checkout",
|
||||||
"command": "git checkout [commit, ref]",
|
"command": "git checkout [commit, ref, file]",
|
||||||
"description": "Drag this card to a commit or to a branch to travel to it!"
|
"description": "Drag this card to a commit or to a branch to travel to it!"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "reset",
|
"id": "reset",
|
||||||
"command": "git reset [commit]",
|
"command": "git reset [commit, file]",
|
||||||
"description": "Jump to the commit, and update the index. Keep the current environment."
|
"description": "Jump to the commit, and update the index. Keep the current environment."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "commit",
|
"id": "commit",
|
||||||
"command": "git commit",
|
"command": "git commit -m $RANDOM",
|
||||||
"description": "Make a commit from the plan."
|
"description": "Make a commit from the plan."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -79,6 +79,7 @@ func update():
|
|||||||
# Populate HEAD versions.
|
# Populate HEAD versions.
|
||||||
|
|
||||||
if shell.run("test -d .git && echo yes || echo no") == "yes\n":
|
if shell.run("test -d .git && echo yes || echo no") == "yes\n":
|
||||||
|
if shell.run("git rev-parse HEAD &> /dev/null && echo yes || echo no") == "yes\n":
|
||||||
var files = Array(shell.run("git ls-tree --name-only -r %s" % "HEAD").split("\n"))
|
var files = Array(shell.run("git ls-tree --name-only -r %s" % "HEAD").split("\n"))
|
||||||
# The last entry is an empty string, remove it.
|
# The last entry is an empty string, remove it.
|
||||||
files.pop_back()
|
files.pop_back()
|
||||||
@ -116,12 +117,12 @@ func update():
|
|||||||
wd_files.pop_back()
|
wd_files.pop_back()
|
||||||
wd_files = helpers.map(wd_files, self, "substr2")
|
wd_files = helpers.map(wd_files, self, "substr2")
|
||||||
|
|
||||||
var deleted_files = []
|
# var deleted_files = []
|
||||||
if shell.run("test -d .git && echo yes || echo no") == "yes\n":
|
# if shell.run("test -d .git && echo yes || echo no") == "yes\n":
|
||||||
deleted_files = Array(shell.run("git status -s | grep '^.D' | sed 's/^...//'").split("\n"))
|
# deleted_files = Array(shell.run("git status -s | grep '^.D' | sed 's/^...//'").split("\n"))
|
||||||
deleted_files.pop_back()
|
# deleted_files.pop_back()
|
||||||
|
|
||||||
var files = wd_files + deleted_files
|
var files = wd_files# + deleted_files
|
||||||
|
|
||||||
player = null
|
player = null
|
||||||
files.sort_custom(self, "very_best_sort")
|
files.sort_custom(self, "very_best_sort")
|
||||||
|
@ -34,20 +34,27 @@ func read_from_file():
|
|||||||
"index":
|
"index":
|
||||||
content = file_browser.shell.run("git show :'%s'" % label)
|
content = file_browser.shell.run("git show :'%s'" % label)
|
||||||
modulate = Color(0, 0, 1.0)
|
modulate = Color(0, 0, 1.0)
|
||||||
$Sprite.scale = Vector2(0.75, 0.75)
|
$Sprite.scale *= 1.2
|
||||||
"head":
|
"head":
|
||||||
var commit = "HEAD"
|
var commit = "HEAD"
|
||||||
if file_browser.commit:
|
if file_browser.commit:
|
||||||
commit = file_browser.commit.id
|
commit = file_browser.commit.id
|
||||||
else:
|
else:
|
||||||
modulate = Color(0, 0, 0, 0.2)
|
modulate = Color(0, 0, 0, 0.2)
|
||||||
$Sprite.scale = Vector2(0.8, 0.8)
|
$Sprite.scale *= 1.4
|
||||||
content = file_browser.shell.run("git show %s:'%s'" % [commit, label])
|
content = file_browser.shell.run("git show %s:'%s'" % [commit, label])
|
||||||
|
|
||||||
|
|
||||||
attributes = helpers.parse(content)
|
attributes = helpers.parse(content)
|
||||||
position.x = int(attributes["x"])
|
if attributes.has("x"):
|
||||||
position.y = int(attributes["y"])
|
position.x = float(attributes["x"])
|
||||||
|
else:
|
||||||
|
position.x = rand_range(100, 400)
|
||||||
|
if attributes.has("y"):
|
||||||
|
position.y = float(attributes["y"])
|
||||||
|
else:
|
||||||
|
position.y = rand_range(100, 300)
|
||||||
|
write_to_file()
|
||||||
|
|
||||||
func write_to_file():
|
func write_to_file():
|
||||||
attributes["x"] = str(position.x)
|
attributes["x"] = str(position.x)
|
||||||
@ -63,6 +70,12 @@ func _set_label(new_label):
|
|||||||
if label_node:
|
if label_node:
|
||||||
label_node.text = helpers.abbreviate(new_label, 30)
|
label_node.text = helpers.abbreviate(new_label, 30)
|
||||||
|
|
||||||
|
if new_label == "you":
|
||||||
|
$Sprite.texture = preload("res://nodes/head.svg")
|
||||||
|
else:
|
||||||
|
$Sprite.texture = preload("res://nodes/document.svg")
|
||||||
|
$Sprite.scale *= 0.85
|
||||||
|
|
||||||
#func _gui_input(event):
|
#func _gui_input(event):
|
||||||
# if event is InputEventMouseButton and event.is_pressed() and event.button_index == BUTTON_LEFT:
|
# if event is InputEventMouseButton and event.is_pressed() and event.button_index == BUTTON_LEFT:
|
||||||
# emit_signal("clicked", self)
|
# emit_signal("clicked", self)
|
||||||
|
Loading…
Reference in New Issue
Block a user