diff --git a/main.gd b/main.gd index b69685f..d4e2563 100644 --- a/main.gd +++ b/main.gd @@ -44,6 +44,7 @@ func list_levels(): return levels func load_level(id): + $NextLevelButton.hide() current_level = id var levels = list_levels() @@ -123,3 +124,7 @@ func save_commit_message(): $CommitMessage.text = "" $CommitMessage.hide() input.grab_focus() + +func show_win_status(): + $NextLevelButton.show() + $LevelDescription.text = "Yay, you solved the puzzle! Enjoy the view or continue to the next level!" diff --git a/main.tscn b/main.tscn index 2ca3837..2ccc6f8 100644 --- a/main.tscn +++ b/main.tscn @@ -1,10 +1,18 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://terminal.tscn" type="PackedScene" id=1] [ext_resource path="res://main.gd" type="Script" id=2] [ext_resource path="res://repository.tscn" type="PackedScene" id=3] +[ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=5] +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0.847059, 0.0666667, 0.0666667, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + [node name="Main" type="Node2D"] script = ExtResource( 2 ) @@ -106,4 +114,19 @@ text = "Level description here!" __meta__ = { "_edit_use_anchors_": false } + +[node name="NextLevelButton" type="Button" parent="."] +visible = false +margin_left = 1403.0 +margin_top = 16.0 +margin_right = 1621.0 +margin_bottom = 47.0 +custom_styles/hover = SubResource( 1 ) +custom_styles/normal = ExtResource( 4 ) +custom_fonts/font = ExtResource( 5 ) +text = "Next Level" +__meta__ = { +"_edit_use_anchors_": false +} [connection signal="pressed" from="CommitMessage/SaveButton" to="." method="save_commit_message"] +[connection signal="pressed" from="NextLevelButton" to="." method="load_next_level"] diff --git a/shell.gd b/shell.gd index cb636d2..3a96b22 100644 --- a/shell.gd +++ b/shell.gd @@ -59,9 +59,9 @@ func _shell_binary(): var os = OS.get_name() if os == "X11": - return "sh" + return "bash" elif os == "Windows": - return "dependencies\\windows\\git\\bin\\sh.exe" + return "dependencies\\windows\\git\\bin\\bash.exe" else: push_error("Unsupported OS") get_tree().quit() diff --git a/styles/alert_button.tres b/styles/alert_button.tres new file mode 100644 index 0000000..3c9819d --- /dev/null +++ b/styles/alert_button.tres @@ -0,0 +1,8 @@ +[gd_resource type="StyleBoxFlat" format=2] + +[resource] +bg_color = Color( 0.717647, 0.160784, 0.160784, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 diff --git a/terminal.gd b/terminal.gd index 6229f47..41df938 100644 --- a/terminal.gd +++ b/terminal.gd @@ -57,5 +57,5 @@ func receive_output(text): output.text += text func check_win_condition(): - if repo.shell.run("bash /tmp/win &>/dev/null && echo yes || echo no") == "yes\n": - main.load_next_level() + if repo.shell.run("bash /tmp/win 2>&1 >/dev/null && echo yes || echo no") == "yes\n": + main.show_win_status()