mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Allow multiple level sets, pull out default order into "sequence" file
This commit is contained in:
parent
a9f096636a
commit
5031009dd5
96 changed files with 37 additions and 29 deletions
18
levels/bottom-up/sequence
Normal file
18
levels/bottom-up/sequence
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
welcome
|
||||||
|
basics
|
||||||
|
blob-create
|
||||||
|
blob-remove
|
||||||
|
index-add
|
||||||
|
index-remove
|
||||||
|
index-update
|
||||||
|
tree-create
|
||||||
|
tree-read
|
||||||
|
tree-nested
|
||||||
|
commit-create
|
||||||
|
commit-parents
|
||||||
|
commit-rhombus
|
||||||
|
ref-create
|
||||||
|
ref-move
|
||||||
|
ref-remove
|
||||||
|
symref-create
|
||||||
|
symref-no-deref
|
1
levels/top-down/sequence
Normal file
1
levels/top-down/sequence
Normal file
|
@ -0,0 +1 @@
|
||||||
|
welcome
|
1
levels/top-down/welcome/description
Normal file
1
levels/top-down/welcome/description
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Hiiii!
|
38
main.gd
38
main.gd
|
@ -2,6 +2,8 @@ extends Control
|
||||||
|
|
||||||
var dragged = null
|
var dragged = null
|
||||||
|
|
||||||
|
var level_set = "top-down"
|
||||||
|
#var level_set = "bottom-up"
|
||||||
var current_level = 0
|
var current_level = 0
|
||||||
|
|
||||||
export(NodePath) var terminal_path
|
export(NodePath) var terminal_path
|
||||||
|
@ -42,48 +44,34 @@ func _ready():
|
||||||
func list_levels():
|
func list_levels():
|
||||||
var levels = []
|
var levels = []
|
||||||
var dir = Directory.new()
|
var dir = Directory.new()
|
||||||
dir.open("res://levels")
|
dir.open("res://levels/%s" % level_set)
|
||||||
dir.list_dir_begin()
|
dir.list_dir_begin()
|
||||||
|
|
||||||
while true:
|
while true:
|
||||||
var file = dir.get_next()
|
var file = dir.get_next()
|
||||||
if file == "":
|
if file == "":
|
||||||
break
|
break
|
||||||
elif not file.begins_with("."):
|
elif not file.begins_with(".") and file != "sequence":
|
||||||
levels.append(file)
|
levels.append(file)
|
||||||
|
|
||||||
dir.list_dir_end()
|
dir.list_dir_end()
|
||||||
levels.sort()
|
levels.sort()
|
||||||
|
|
||||||
var level_sequence = [
|
var final_level_sequence = []
|
||||||
"welcome",
|
|
||||||
"basics",
|
var level_sequence = Array(game.read_file("res://levels/%s/sequence" % level_set, "").split("\n"))
|
||||||
"blob-create",
|
|
||||||
"blob-remove",
|
|
||||||
"index-add",
|
|
||||||
"index-remove",
|
|
||||||
"index-update",
|
|
||||||
"tree-create",
|
|
||||||
"tree-read",
|
|
||||||
"tree-nested",
|
|
||||||
"commit-create",
|
|
||||||
"commit-parents",
|
|
||||||
"commit-rhombus",
|
|
||||||
"ref-create",
|
|
||||||
"ref-move",
|
|
||||||
"ref-remove",
|
|
||||||
"symref-create",
|
|
||||||
"symref-no-deref",
|
|
||||||
]
|
|
||||||
|
|
||||||
for level in level_sequence:
|
for level in level_sequence:
|
||||||
|
if level == "":
|
||||||
|
continue
|
||||||
if not levels.has(level):
|
if not levels.has(level):
|
||||||
push_error("Level '%s' is specified in the sequence, but could not be found" % level)
|
push_error("Level '%s' is specified in the sequence, but could not be found" % level)
|
||||||
levels.erase(level)
|
levels.erase(level)
|
||||||
|
final_level_sequence.push_back(level)
|
||||||
|
|
||||||
level_sequence += levels
|
final_level_sequence += levels
|
||||||
|
|
||||||
return level_sequence
|
return final_level_sequence
|
||||||
|
|
||||||
func load_level(id):
|
func load_level(id):
|
||||||
next_level_button.hide()
|
next_level_button.hide()
|
||||||
|
@ -94,7 +82,7 @@ func load_level(id):
|
||||||
var levels = list_levels()
|
var levels = list_levels()
|
||||||
|
|
||||||
var level = levels[id]
|
var level = levels[id]
|
||||||
var level_prefix = "res://levels/"
|
var level_prefix = "res://levels/%s/" % level_set
|
||||||
|
|
||||||
var goal_repository_path = "/tmp/goal/"
|
var goal_repository_path = "/tmp/goal/"
|
||||||
var active_repository_path = "/tmp/active/"
|
var active_repository_path = "/tmp/active/"
|
||||||
|
|
|
@ -19,9 +19,9 @@ anchor_left = 1.0
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_left = -117.279
|
margin_left = -114.396
|
||||||
margin_top = -59.399
|
margin_top = -59.399
|
||||||
margin_right = -17.2788
|
margin_right = -14.3955
|
||||||
margin_bottom = -14.399
|
margin_bottom = -14.399
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
custom_fonts/font = ExtResource( 1 )
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
@ -34,9 +34,9 @@ __meta__ = {
|
||||||
[node name="CloseButton" type="Button" parent="."]
|
[node name="CloseButton" type="Button" parent="."]
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
margin_left = -50.0
|
margin_left = -54.3247
|
||||||
margin_top = 12.0
|
margin_top = 12.0
|
||||||
margin_right = -10.0
|
margin_right = -14.3247
|
||||||
margin_bottom = 52.0
|
margin_bottom = 52.0
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
custom_fonts/font = ExtResource( 1 )
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
|
Loading…
Reference in a new issue