diff --git a/scenes/game.gd b/scenes/game.gd index 5157148..358f0f2 100644 --- a/scenes/game.gd +++ b/scenes/game.gd @@ -49,3 +49,9 @@ func create_file_in_game_env(filename, content): global_shell.cd(tmp_prefix) # Quoted HERE doc doesn't do any substitutions inside. global_shell.run("cat > '%s' <<'HEREHEREHERE'\n%s\nHEREHEREHERE" % [filename, content]) + +func notify(text): + print(text) + var notification = preload("res://scenes/notification.tscn").instance() + notification.text = text + get_tree().root.call_deferred("add_child", notification) diff --git a/scenes/main.gd b/scenes/main.gd index b4f0c2d..566af3e 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -97,6 +97,7 @@ func load_level(level_id): terminal.find_node("TextEditor").close() update_repos() + game.notify("Level loaded!") # Unmute the audio after a while, so that player can hear pop sounds for # nodes they create. diff --git a/scenes/notification.gd b/scenes/notification.gd new file mode 100644 index 0000000..c1d8111 --- /dev/null +++ b/scenes/notification.gd @@ -0,0 +1,14 @@ +extends PopupPanel + +var text setget _set_text + +func _ready(): + popup() + +func _gui_input(event): + if event is InputEventMouseButton: + queue_free() + +func _set_text(new_text): + text = new_text + $Label.text = new_text diff --git a/scenes/notification.tscn b/scenes/notification.tscn new file mode 100644 index 0000000..cccabd9 --- /dev/null +++ b/scenes/notification.tscn @@ -0,0 +1,33 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1] +[ext_resource path="res://styles/theme.tres" type="Theme" id=2] +[ext_resource path="res://scenes/notification.gd" type="Script" id=3] + +[node name="Notification" type="PopupPanel"] +visible = true +margin_left = 16.0 +margin_top = 16.0 +margin_right = 369.0 +margin_bottom = 212.0 +theme = ExtResource( 2 ) +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="."] +anchor_left = 0.045 +anchor_top = 0.082 +anchor_right = 0.955 +anchor_bottom = 0.918 +margin_left = 0.115 +margin_top = -0.0720005 +margin_right = -0.115021 +margin_bottom = 0.071991 +custom_fonts/font = ExtResource( 1 ) +text = "This is a hint! This is a hint! This is a hint! This is a hint! This is a hint! This is a hint! This is a hint! This is a hint! This is a hint!" +autowrap = true +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/styles/theme.tres b/styles/theme.tres index b404e90..35315aa 100644 --- a/styles/theme.tres +++ b/styles/theme.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=24 format=2] +[gd_resource type="Theme" load_steps=25 format=2] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1] [ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=2] @@ -131,6 +131,17 @@ corner_radius_bottom_right = 5 corner_radius_bottom_left = 5 [sub_resource type="StyleBoxFlat" id=18] +content_margin_left = 0.0 +content_margin_right = 0.0 +content_margin_top = 0.0 +content_margin_bottom = 0.0 +bg_color = Color( 0.027451, 0.34902, 0.141176, 0.745098 ) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 + +[sub_resource type="StyleBoxFlat" id=19] content_margin_left = 5.0 content_margin_right = 5.0 content_margin_top = 10.0 @@ -146,7 +157,7 @@ corner_radius_top_right = 10 corner_radius_bottom_right = 10 corner_radius_bottom_left = 10 -[sub_resource type="StyleBoxFlat" id=19] +[sub_resource type="StyleBoxFlat" id=20] content_margin_left = 5.0 content_margin_right = 5.0 content_margin_top = 5.0 @@ -157,7 +168,7 @@ corner_radius_top_right = 10 corner_radius_bottom_right = 10 corner_radius_bottom_left = 10 -[sub_resource type="StyleBoxFlat" id=20] +[sub_resource type="StyleBoxFlat" id=21] content_margin_left = 5.0 content_margin_right = 5.0 content_margin_top = 5.0 @@ -168,7 +179,7 @@ corner_radius_top_right = 5 corner_radius_bottom_right = 5 corner_radius_bottom_left = 5 -[sub_resource type="StyleBoxFlat" id=21] +[sub_resource type="StyleBoxFlat" id=22] bg_color = Color( 0.309804, 0.317647, 0.372549, 1 ) corner_radius_top_left = 5 corner_radius_top_right = 5 @@ -239,6 +250,7 @@ PopupMenu/styles/labeled_separator_right = null PopupMenu/styles/panel = SubResource( 17 ) PopupMenu/styles/panel_disabled = null PopupMenu/styles/separator = null +PopupPanel/styles/panel = SubResource( 18 ) RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 ) RichTextLabel/colors/font_color_selected = Color( 0.49, 0.49, 0.49, 1 ) RichTextLabel/colors/font_color_shadow = Color( 0, 0, 0, 0 ) @@ -292,8 +304,8 @@ TextEdit/icons/folded = null TextEdit/icons/space = null TextEdit/icons/tab = null TextEdit/styles/completion = null -TextEdit/styles/focus = SubResource( 18 ) -TextEdit/styles/normal = SubResource( 19 ) +TextEdit/styles/focus = SubResource( 19 ) +TextEdit/styles/normal = SubResource( 20 ) TextEdit/styles/read_only = null Tree/colors/custom_button_font_highlight = Color( 0.94, 0.94, 0.94, 1 ) Tree/colors/drop_position_color = Color( 1, 0.3, 0.2, 1 ) @@ -318,7 +330,7 @@ Tree/icons/checked = null Tree/icons/select_arrow = null Tree/icons/unchecked = null Tree/icons/updown = null -Tree/styles/bg = SubResource( 20 ) +Tree/styles/bg = SubResource( 21 ) Tree/styles/bg_focus = null Tree/styles/button_pressed = null Tree/styles/cursor = null @@ -326,7 +338,7 @@ Tree/styles/cursor_unfocused = null Tree/styles/custom_button = null Tree/styles/custom_button_hover = null Tree/styles/custom_button_pressed = null -Tree/styles/selected = SubResource( 21 ) +Tree/styles/selected = SubResource( 22 ) Tree/styles/selected_focus = null Tree/styles/title_button_hover = null Tree/styles/title_button_normal = null