Added changelog UI!

This commit is contained in:
Noah 2022-11-03 14:53:44 -05:00
parent be6ad82408
commit 65e38eff1b
2 changed files with 103 additions and 9 deletions

View File

@ -2,7 +2,7 @@ extends Control
# Define variables # Define variables
var newest_version # The newest version available online 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 local_version # The version installed on this computer
var os_name # The simplified name of the OS (linux, or windows) var os_name # The simplified name of the OS (linux, or windows)
var suffix # var suffix #
@ -49,6 +49,7 @@ func _versions_request_completed(_result, _response_code, _headers, body):
newest_version = data[0].tag_name newest_version = data[0].tag_name
# Set the newest_version_data to the data received. # Set the newest_version_data to the data received.
newest_version_data = data[0] newest_version_data = data[0]
update_changelog(newest_version_data)
print("Got versions!") print("Got versions!")
@ -78,7 +79,11 @@ func _download_request_completed(_result, _response_code, _headers, body):
$Panel/ProgressBar.hide() $Panel/ProgressBar.hide()
$Panel/ProgressBar.value = 0 $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 # Every _process tick
@ -204,3 +209,10 @@ func _on_Change_timer_timeout():
# When the refresh button is pressed, # When the refresh button is pressed,
func _on_Refresh_button_pressed(): func _on_Refresh_button_pressed():
check_for_update() check_for_update()
func _on_Changelog_button_pressed():
if $Changelog_panel.visible == false:
$Changelog_panel.show()
else:
$Changelog_panel.hide()

View File

@ -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://textures/backgrounds/background1.png" type="Texture" id=1]
[ext_resource path="res://fonts/SPACEBAR.ttf" type="DynamicFontData" id=2] [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://fonts/SPACE.tres" type="DynamicFont" id=6]
[ext_resource path="res://ProgressBar.gd" type="Script" id=7] [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://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] [sub_resource type="Theme" id=1]
default_font = ExtResource( 4 ) default_font = ExtResource( 4 )
@ -50,9 +53,32 @@ corner_radius_top_right = 4
corner_radius_bottom_right = 4 corner_radius_bottom_right = 4
corner_radius_bottom_left = 4 corner_radius_bottom_left = 4
[sub_resource type="StreamTexture" id=8] [sub_resource type="DynamicFont" id=9]
flags = 4 size = 24
load_path = "res://.import/return.png-37ee6a37bc4abf83a64fce1b810ae01f.stex" 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"] [node name="Main_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -145,14 +171,70 @@ margin_top = 8.0
margin_right = 332.0 margin_right = 332.0
margin_bottom = 108.0 margin_bottom = 108.0
rect_scale = Vector2( 0.3, 0.3 ) rect_scale = Vector2( 0.3, 0.3 )
texture_normal = SubResource( 8 ) texture_normal = ExtResource( 9 )
texture_pressed = ExtResource( 9 ) texture_pressed = ExtResource( 11 )
[node name="Notices" type="VBoxContainer" parent="."] [node name="Notices" type="VBoxContainer" parent="."]
margin_top = 80.0 margin_top = 80.0
margin_right = 192.0 margin_right = 192.0
margin_bottom = 272.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="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/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="Panel/Panel/Refresh_button" to="." method="_on_Refresh_button_pressed"]
[connection signal="pressed" from="Changelog_button" to="." method="_on_Changelog_button_pressed"]