Prettier goal boxes, remote tip button for now

This commit is contained in:
blinry 2021-01-08 13:54:37 +01:00
parent 023a98cfae
commit 4910e4d566
4 changed files with 41 additions and 6 deletions

View file

@ -6,6 +6,8 @@ enum FileBrowserMode {
INDEX INDEX
} }
signal saved
export(String) var title setget _set_title export(String) var title setget _set_title
export(FileBrowserMode) var mode = FileBrowserMode.WORKING_DIRECTORY setget _set_mode export(FileBrowserMode) var mode = FileBrowserMode.WORKING_DIRECTORY setget _set_mode
@ -184,6 +186,7 @@ func save():
helpers.write_file(fixme_path+open_file, text_edit.text) helpers.write_file(fixme_path+open_file, text_edit.text)
update() update()
emit_signal("saved")
close() close()
func _set_commit(new_commit): func _set_commit(new_commit):

View file

@ -67,7 +67,7 @@ func load(path):
var desc = "Goal" var desc = "Goal"
for line in Array(config[k].split("\n")): for line in Array(config[k].split("\n")):
if line.length() > 0 and line[0] == "#": if line.length() > 0 and line[0] == "#":
desc = line.substr(1) desc = line.substr(1).strip_edges(true, true)
else: else:
if not repos[repo].win_conditions.has(desc): if not repos[repo].win_conditions.has(desc):
repos[repo].win_conditions[desc] = "" repos[repo].win_conditions[desc] = ""

View file

@ -15,6 +15,7 @@ onready var level_description = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Tex
onready var level_congrats = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Text/LevelCongrats onready var level_congrats = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Text/LevelCongrats
onready var cards = $Rows/Controls/Cards onready var cards = $Rows/Controls/Cards
onready var file_browser = $Rows/Columns/RightSide/FileBrowser onready var file_browser = $Rows/Columns/RightSide/FileBrowser
onready var goals = $Rows/Columns/RightSide/LevelInfo/LevelPanel/Goals
var _hint_server var _hint_server
var _hint_client_connection var _hint_client_connection
@ -129,8 +130,31 @@ func load_next_level():
func show_win_status(win_states): func show_win_status(win_states):
var all_won = true var all_won = true
var win_text = "\n\n" var win_text = "\n\n"
for child in goals.get_children():
child.queue_free()
for state in win_states: for state in win_states:
win_text += "%s: %s\n" % [state, win_states[state]] var b = Label.new()
b.text = state
b.align = HALIGN_LEFT
var bg = StyleBoxFlat.new()
if win_states[state]:
bg.bg_color = Color(0.1, 0.5, 0.1)
else:
bg.bg_color = Color(0.5, 0.1, 0.1)
bg.corner_radius_bottom_left = 8
bg.corner_radius_bottom_right = 8
bg.corner_radius_top_left = 8
bg.corner_radius_top_right = 8
bg.content_margin_bottom = 8
bg.content_margin_top = 8
bg.content_margin_left = 8
bg.content_margin_right = 8
b.set("custom_styles/normal", bg)
#b.connect("pressed", self, "load", [chapter_id, level_id])
#var slug = chapter.slug + "/" + level.slug
goals.add_child(b)
b.autowrap = true
if not win_states[state]: if not win_states[state]:
all_won = false all_won = false
var level = levels.chapters[game.current_chapter].levels[game.current_level] var level = levels.chapters[game.current_chapter].levels[game.current_level]

View file

@ -145,6 +145,7 @@ __meta__ = {
} }
[node name="Tip!" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] [node name="Tip!" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
visible = false
margin_left = 169.0 margin_left = 169.0
margin_right = 225.0 margin_right = 225.0
margin_bottom = 39.0 margin_bottom = 39.0
@ -156,8 +157,8 @@ __meta__ = {
} }
[node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] [node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
margin_left = 233.0 margin_left = 169.0
margin_right = 350.0 margin_right = 286.0
margin_bottom = 39.0 margin_bottom = 39.0
focus_mode = 0 focus_mode = 0
custom_styles/hover = SubResource( 1 ) custom_styles/hover = SubResource( 1 )
@ -187,7 +188,7 @@ __meta__ = {
[node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] [node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
margin_top = 65.0 margin_top = 65.0
margin_right = 633.0 margin_right = 633.0
margin_bottom = 469.0 margin_bottom = 264.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"] [node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"]
@ -213,6 +214,12 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Goals" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
margin_top = 269.0
margin_right = 633.0
margin_bottom = 469.0
size_flags_vertical = 3
[node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )] [node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
@ -270,4 +277,5 @@ shape = SubResource( 2 )
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/CardsButton" to="." method="toggle_cards"] [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/Tip!" to="." method="new_tip"]
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/NextLevelButton" to="." method="load_next_level"] [connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/NextLevelButton" to="." method="load_next_level"]
[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="command_done" from="Rows/Controls/Terminal" to="." method="update_repos"]