mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-20 20:33:11 +01:00
Optimize screen layout a bit
This commit is contained in:
parent
285a89efef
commit
d258f812ce
4 changed files with 114 additions and 130 deletions
|
@ -45,6 +45,7 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Title" type="Label" parent="Panel/Margin/Rows"]
|
||||
visible = false
|
||||
margin_right = 1904.0
|
||||
margin_bottom = 29.0
|
||||
text = "title"
|
||||
|
@ -69,7 +70,6 @@ margin_bottom = 50.0
|
|||
text = "dir"
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="Panel/Margin/Rows"]
|
||||
margin_top = 29.0
|
||||
margin_right = 1904.0
|
||||
margin_bottom = 1064.0
|
||||
size_flags_horizontal = 3
|
||||
|
@ -77,7 +77,7 @@ size_flags_vertical = 3
|
|||
|
||||
[node name="Grid" type="GridContainer" parent="Panel/Margin/Rows/Scroll"]
|
||||
margin_right = 1904.0
|
||||
margin_bottom = 1035.0
|
||||
margin_bottom = 1064.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/vseparation = 16
|
||||
|
|
|
@ -39,14 +39,15 @@ __meta__ = {
|
|||
|
||||
[node name="Control2" type="Control" parent="VBoxContainer"]
|
||||
margin_right = 200.0
|
||||
margin_bottom = 11.0
|
||||
margin_bottom = 2.0
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.13
|
||||
|
||||
[node name="Control" type="Control" parent="VBoxContainer"]
|
||||
margin_top = 15.0
|
||||
margin_top = 6.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 106.0
|
||||
margin_bottom = 96.0
|
||||
rect_min_size = Vector2( 0, 90 )
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
|
@ -107,9 +108,10 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
margin_top = 110.0
|
||||
margin_top = 100.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 139.0
|
||||
margin_bottom = 140.0
|
||||
rect_min_size = Vector2( 0, 40 )
|
||||
size_flags_vertical = 7
|
||||
size_flags_stretch_ratio = 0.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
|
|
|
@ -7,9 +7,7 @@ onready var input = terminal.input
|
|||
onready var output = terminal.output
|
||||
onready var repositories_node = $Rows/Columns/Repositories
|
||||
var repositories = {}
|
||||
onready var level_select = $Rows/Columns/RightSide/LevelInfo/Menu/LevelSelect
|
||||
onready var chapter_select = $Rows/Columns/RightSide/LevelInfo/Menu/ChapterSelect
|
||||
onready var next_level_button = $Rows/Columns/RightSide/LevelInfo/Menu/NextLevelButton
|
||||
onready var next_level_button = $Menu/NextLevelButton
|
||||
onready var level_name = $Rows/Columns/RightSide/LevelInfo/LevelPanel/LevelName
|
||||
onready var level_description = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Text/LevelDescription
|
||||
onready var level_congrats = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Text/LevelCongrats
|
||||
|
@ -33,14 +31,14 @@ func _ready():
|
|||
return
|
||||
|
||||
# Initialize level select.
|
||||
level_select.connect("item_selected", self, "load_level")
|
||||
repopulate_levels()
|
||||
level_select.select(game.current_level)
|
||||
# level_select.connect("item_selected", self, "load_level")
|
||||
# repopulate_levels()
|
||||
# level_select.select(game.current_level)
|
||||
|
||||
# Initialize chapter select.
|
||||
chapter_select.connect("item_selected", self, "load_chapter")
|
||||
repopulate_chapters()
|
||||
chapter_select.select(game.current_chapter)
|
||||
# # Initialize chapter select.
|
||||
# chapter_select.connect("item_selected", self, "load_chapter")
|
||||
# repopulate_chapters()
|
||||
# chapter_select.select(game.current_chapter)
|
||||
|
||||
# Load current level.
|
||||
load_level(game.current_level)
|
||||
|
@ -56,7 +54,6 @@ func _process(delta):
|
|||
|
||||
func load_chapter(id):
|
||||
game.current_chapter = id
|
||||
repopulate_levels()
|
||||
load_level(0)
|
||||
|
||||
func load_level(level_id):
|
||||
|
@ -114,8 +111,8 @@ func load_level(level_id):
|
|||
AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), false)
|
||||
# FIXME: Need to clean these up when switching levels somehow.
|
||||
|
||||
chapter_select.select(game.current_chapter)
|
||||
level_select.select(game.current_level)
|
||||
# chapter_select.select(game.current_chapter)
|
||||
# level_select.select(game.current_level)
|
||||
|
||||
|
||||
func reload_level():
|
||||
|
@ -179,19 +176,19 @@ func show_win_status(win_states):
|
|||
game.state["solved_levels"].push_back(slug)
|
||||
game.save_state()
|
||||
|
||||
func repopulate_levels():
|
||||
levels.reload()
|
||||
level_select.clear()
|
||||
for level in levels.chapters[game.current_chapter].levels:
|
||||
level_select.add_item(level.title)
|
||||
level_select.select(game.current_level)
|
||||
#func repopulate_levels():
|
||||
# levels.reload()
|
||||
# level_select.clear()
|
||||
# for level in levels.chapters[game.current_chapter].levels:
|
||||
# level_select.add_item(level.title)
|
||||
# level_select.select(game.current_level)
|
||||
|
||||
func repopulate_chapters():
|
||||
levels.reload()
|
||||
chapter_select.clear()
|
||||
for c in levels.chapters:
|
||||
chapter_select.add_item(c.slug)
|
||||
chapter_select.select(game.current_chapter)
|
||||
#func repopulate_chapters():
|
||||
# levels.reload()
|
||||
# chapter_select.clear()
|
||||
# for c in levels.chapters:
|
||||
# chapter_select.add_item(c.slug)
|
||||
# chapter_select.select(game.current_chapter)
|
||||
|
||||
func update_repos():
|
||||
var win_states = levels.chapters[game.current_chapter].levels[game.current_level].check_win()
|
||||
|
|
181
scenes/main.tscn
181
scenes/main.tscn
|
@ -10,6 +10,9 @@
|
|||
[ext_resource path="res://sounds/success.wav" type="AudioStream" id=8]
|
||||
[ext_resource path="res://scenes/cursor.gd" type="Script" id=9]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 1.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
content_margin_left = 10.0
|
||||
content_margin_right = 10.0
|
||||
|
@ -21,9 +24,6 @@ corner_radius_top_right = 3
|
|||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 1.0
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -84,95 +84,14 @@ custom_constants/separation = 8
|
|||
|
||||
[node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns/RightSide"]
|
||||
margin_right = 633.0
|
||||
margin_bottom = 516.0
|
||||
margin_bottom = 595.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/separation = 8
|
||||
|
||||
[node name="Menu" type="HBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"]
|
||||
margin_right = 633.0
|
||||
margin_bottom = 39.0
|
||||
custom_constants/separation = 8
|
||||
|
||||
[node name="ChapterSelect" type="OptionButton" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
visible = false
|
||||
margin_right = 187.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Select chapter..."
|
||||
|
||||
[node name="LevelSelect" type="OptionButton" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
visible = false
|
||||
margin_right = 159.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Select level..."
|
||||
expand_icon = true
|
||||
|
||||
[node name="BackButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
margin_right = 65.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Back"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ReloadButton2" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
margin_left = 73.0
|
||||
margin_right = 161.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Reload"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CardsButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
visible = false
|
||||
margin_left = 458.0
|
||||
margin_right = 539.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Cards!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Tip!" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
visible = false
|
||||
margin_left = 169.0
|
||||
margin_right = 225.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Tip!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
|
||||
margin_left = 169.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
custom_styles/hover = SubResource( 1 )
|
||||
custom_styles/normal = ExtResource( 4 )
|
||||
enabled_focus_mode = 0
|
||||
text = "Next level"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"]
|
||||
margin_top = 47.0
|
||||
margin_right = 633.0
|
||||
margin_bottom = 516.0
|
||||
margin_bottom = 595.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
||||
|
@ -188,7 +107,7 @@ __meta__ = {
|
|||
[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
||||
margin_top = 65.0
|
||||
margin_right = 633.0
|
||||
margin_bottom = 464.0
|
||||
margin_bottom = 590.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"]
|
||||
|
@ -215,20 +134,20 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="Goals" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
|
||||
margin_top = 469.0
|
||||
margin_top = 595.0
|
||||
margin_right = 633.0
|
||||
margin_bottom = 469.0
|
||||
margin_bottom = 595.0
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.0
|
||||
|
||||
[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_top = 524.0
|
||||
margin_top = 603.0
|
||||
margin_right = 633.0
|
||||
margin_bottom = 782.0
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.5
|
||||
size_flags_stretch_ratio = 0.3
|
||||
|
||||
[node name="Controls" type="HBoxContainer" parent="Rows"]
|
||||
margin_top = 790.0
|
||||
|
@ -271,12 +190,78 @@ collision_mask = 0
|
|||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Cursor/Area2D"]
|
||||
shape = SubResource( 2 )
|
||||
[connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/ChapterSelect" to="." method="repopulate_chapters"]
|
||||
[connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/LevelSelect" to="." method="repopulate_levels"]
|
||||
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/BackButton" to="." method="back"]
|
||||
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/ReloadButton2" to="." method="reload_level"]
|
||||
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/CardsButton" to="." method="toggle_cards"]
|
||||
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/Tip!" to="." method="new_tip"]
|
||||
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/NextLevelButton" to="." method="load_next_level"]
|
||||
|
||||
[node name="Menu" type="HBoxContainer" parent="."]
|
||||
margin_left = 3.86392
|
||||
margin_top = 5.13129
|
||||
margin_right = 636.864
|
||||
margin_bottom = 44.1313
|
||||
custom_constants/separation = 8
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="BackButton" type="Button" parent="Menu"]
|
||||
margin_right = 65.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Back"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ReloadButton2" type="Button" parent="Menu"]
|
||||
margin_left = 73.0
|
||||
margin_right = 161.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Reload"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CardsButton" type="Button" parent="Menu"]
|
||||
visible = false
|
||||
margin_left = 458.0
|
||||
margin_right = 539.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Cards!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Tip!" type="Button" parent="Menu"]
|
||||
visible = false
|
||||
margin_left = 169.0
|
||||
margin_right = 225.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
text = "Tip!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="NextLevelButton" type="Button" parent="Menu"]
|
||||
margin_left = 169.0
|
||||
margin_right = 286.0
|
||||
margin_bottom = 39.0
|
||||
focus_mode = 0
|
||||
custom_styles/hover = SubResource( 1 )
|
||||
custom_styles/normal = ExtResource( 4 )
|
||||
enabled_focus_mode = 0
|
||||
text = "Next level"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[connection signal="saved" from="Rows/Columns/RightSide/FileBrowser" to="." method="update_repos"]
|
||||
[connection signal="command_done" from="Rows/Controls/Terminal" to="." method="update_repos"]
|
||||
[connection signal="pressed" from="Menu/BackButton" to="." method="back"]
|
||||
[connection signal="pressed" from="Menu/ReloadButton2" to="." method="reload_level"]
|
||||
[connection signal="pressed" from="Menu/CardsButton" to="." method="toggle_cards"]
|
||||
[connection signal="pressed" from="Menu/Tip!" to="." method="new_tip"]
|
||||
[connection signal="pressed" from="Menu/NextLevelButton" to="." method="load_next_level"]
|
||||
|
|
Loading…
Reference in a new issue