From 65e38eff1b2e30285241296b97463f4bc9402aba Mon Sep 17 00:00:00 2001 From: Noah Date: Thu, 3 Nov 2022 14:53:44 -0500 Subject: [PATCH] Added changelog UI! --- Main_menu.gd | 16 +++++++-- Main_menu.tscn | 96 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/Main_menu.gd b/Main_menu.gd index 7778d36..15ba659 100644 --- a/Main_menu.gd +++ b/Main_menu.gd @@ -2,7 +2,7 @@ extends Control # Define variables var newest_version # The newest version available online -var newest_version_data # The data about the newest version online +var newest_version_data # The data about the newest version online var local_version # The version installed on this computer var os_name # The simplified name of the OS (linux, or windows) var suffix # @@ -49,6 +49,7 @@ func _versions_request_completed(_result, _response_code, _headers, body): newest_version = data[0].tag_name # Set the newest_version_data to the data received. newest_version_data = data[0] + update_changelog(newest_version_data) print("Got versions!") @@ -78,7 +79,11 @@ func _download_request_completed(_result, _response_code, _headers, body): $Panel/ProgressBar.hide() $Panel/ProgressBar.value = 0 - +# SETGETS +func update_changelog(new_value): + + print("Set to "+new_value.body) + $Changelog_panel/ScrollContainer/RichTextLabel.text = new_value.body # Every _process tick @@ -204,3 +209,10 @@ func _on_Change_timer_timeout(): # When the refresh button is pressed, func _on_Refresh_button_pressed(): check_for_update() + + +func _on_Changelog_button_pressed(): + if $Changelog_panel.visible == false: + $Changelog_panel.show() + else: + $Changelog_panel.hide() diff --git a/Main_menu.tscn b/Main_menu.tscn index a7920ff..ca39bee 100644 --- a/Main_menu.tscn +++ b/Main_menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=2] +[gd_scene load_steps=24 format=2] [ext_resource path="res://textures/backgrounds/background1.png" type="Texture" id=1] [ext_resource path="res://fonts/SPACEBAR.ttf" type="DynamicFontData" id=2] @@ -8,7 +8,10 @@ [ext_resource path="res://fonts/SPACE.tres" type="DynamicFont" id=6] [ext_resource path="res://ProgressBar.gd" type="Script" id=7] [ext_resource path="res://fonts/retro_gaming.tres" type="DynamicFont" id=8] -[ext_resource path="res://textures/kenny-game-icons/PNG/Black/2x/return.png" type="Texture" id=9] +[ext_resource path="res://textures/kenney-game-icons/PNG/White/2x/return.png" type="Texture" id=9] +[ext_resource path="res://themes/Base_panel.tres" type="StyleBox" id=10] +[ext_resource path="res://textures/kenney-game-icons/PNG/Black/2x/return.png" type="Texture" id=11] +[ext_resource path="res://fonts/Retro Gaming.ttf" type="DynamicFontData" id=12] [sub_resource type="Theme" id=1] default_font = ExtResource( 4 ) @@ -50,9 +53,32 @@ corner_radius_top_right = 4 corner_radius_bottom_right = 4 corner_radius_bottom_left = 4 -[sub_resource type="StreamTexture" id=8] -flags = 4 -load_path = "res://.import/return.png-37ee6a37bc4abf83a64fce1b810ae01f.stex" +[sub_resource type="DynamicFont" id=9] +size = 24 +font_data = ExtResource( 2 ) + +[sub_resource type="StyleBoxFlat" id=12] +bg_color = Color( 0.0823529, 0.0745098, 0.117647, 1 ) +border_width_left = 10 +border_width_right = 5 +border_color = Color( 0.0823529, 0.0745098, 0.117647, 1 ) +corner_radius_top_left = 16 +corner_radius_top_right = 16 +corner_radius_bottom_right = 16 +corner_radius_bottom_left = 16 +corner_detail = 20 + +[sub_resource type="DynamicFont" id=10] +size = 32 +font_data = ExtResource( 2 ) + +[sub_resource type="DynamicFont" id=13] +size = 10 +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 12 ) + +[sub_resource type="GDScript" id=11] [node name="Main_menu" type="Control"] anchor_right = 1.0 @@ -145,14 +171,70 @@ margin_top = 8.0 margin_right = 332.0 margin_bottom = 108.0 rect_scale = Vector2( 0.3, 0.3 ) -texture_normal = SubResource( 8 ) -texture_pressed = ExtResource( 9 ) +texture_normal = ExtResource( 9 ) +texture_pressed = ExtResource( 11 ) [node name="Notices" type="VBoxContainer" parent="."] margin_top = 80.0 margin_right = 192.0 margin_bottom = 272.0 +[node name="Changelog_button" type="Button" parent="."] +margin_left = 976.0 +margin_top = 328.0 +margin_right = 1192.0 +margin_bottom = 377.0 +rect_rotation = -89.9999 +custom_fonts/font = SubResource( 9 ) +custom_styles/normal = ExtResource( 10 ) +text = "changelog" + +[node name="Changelog_panel" type="Panel" parent="."] +visible = false +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -40.0 +margin_top = -212.0 +margin_right = 468.0 +margin_bottom = 52.0 +custom_styles/panel = SubResource( 12 ) +__meta__ = { +"_edit_group_": true +} + +[node name="Label" type="Label" parent="Changelog_panel"] +margin_right = 510.0 +margin_bottom = 66.0 +custom_fonts/font = SubResource( 10 ) +text = "Changelog" +align = 1 +valign = 1 + +[node name="ScrollContainer" type="ScrollContainer" parent="Changelog_panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 24.0 +margin_top = 64.0 +margin_right = -20.0 +margin_bottom = -12.0 + +[node name="RichTextLabel" type="RichTextLabel" parent="Changelog_panel/ScrollContainer"] +margin_right = 384.0 +margin_bottom = 180.0 +rect_min_size = Vector2( 384, 180 ) +focus_mode = 2 +custom_fonts/mono_font = ExtResource( 8 ) +custom_fonts/bold_italics_font = ExtResource( 8 ) +custom_fonts/italics_font = ExtResource( 8 ) +custom_fonts/bold_font = ExtResource( 8 ) +custom_fonts/normal_font = SubResource( 13 ) +fit_content_height = true +selection_enabled = true +script = SubResource( 11 ) + [connection signal="timeout" from="Background/Change_timer" to="." method="_on_Change_timer_timeout"] [connection signal="pressed" from="Panel/Play_button" to="." method="_on_Play_button_pressed"] [connection signal="pressed" from="Panel/Panel/Refresh_button" to="." method="_on_Refresh_button_pressed"] +[connection signal="pressed" from="Changelog_button" to="." method="_on_Changelog_button_pressed"]