From 5a5d6f90e601ad496a68ae68f7f2c65e03582e55 Mon Sep 17 00:00:00 2001 From: notdraimdev Date: Mon, 25 Nov 2024 20:56:28 +0100 Subject: [PATCH] actually added "important" updates --- Main.tscn | 15 +++++++++------ update_checker.gd | 11 +++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Main.tscn b/Main.tscn index 4bcc58c..6e9bbed 100644 --- a/Main.tscn +++ b/Main.tscn @@ -910,7 +910,7 @@ offset_left = -64.0 offset_top = -23.0 grow_horizontal = 0 grow_vertical = 0 -text = "v1.5.3" +text = "v1.5.4" horizontal_alignment = 2 [node name="SettingsButton" type="Button" parent="."] @@ -1001,6 +1001,8 @@ grow_horizontal = 0 grow_vertical = 0 script = ExtResource("30_byc5i") errorColor = Color(0.981984, 0, 0.065929, 1) +IMPUpdateLinkColor = Color(0.51, 0.31008, 0.2652, 1) +IMPUpdatePatchNotesColor = Color(0.35, 0.27125, 0.2555, 1) [node name="HTTPRequest" type="HTTPRequest" parent="UpdateChecker"] timeout = 5.0 @@ -1020,8 +1022,8 @@ layout_mode = 1 anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 -offset_left = -68.0 -offset_right = 68.0 +offset_left = -136.0 +offset_right = 113.0 offset_bottom = 23.0 grow_horizontal = 2 text = "Update Available!" @@ -1037,11 +1039,12 @@ anchor_right = 1.0 anchor_bottom = 0.820755 grow_horizontal = 2 grow_vertical = 2 -text = "PatchNotes" +text = "PatchNotes +(!IT) for importaint updates" context_menu_enabled = true metadata/_edit_use_anchors_ = true -[node name="ColorRect" type="ColorRect" parent="UpdateChecker/ColorRect/Patchnotes"] +[node name="PatchnotesBG" type="ColorRect" parent="UpdateChecker/ColorRect/Patchnotes"] z_index = -1 layout_mode = 1 anchors_preset = 15 @@ -1064,7 +1067,7 @@ grow_vertical = 0 text = "Update" flat = true -[node name="ColorRect" type="ColorRect" parent="UpdateChecker/ColorRect/LinkButton"] +[node name="LinkBTTNBG" type="ColorRect" parent="UpdateChecker/ColorRect/LinkButton"] z_index = -1 layout_mode = 1 anchors_preset = 15 diff --git a/update_checker.gd b/update_checker.gd index 3655a27..9008639 100644 --- a/update_checker.gd +++ b/update_checker.gd @@ -11,8 +11,12 @@ extends Control @onready var updating_bg: ColorRect = $"../UpdatingBG" @onready var paused_indicator: TextureRect = $"../PausedIndicator" @onready var patchnotes: RichTextLabel = $ColorRect/Patchnotes +@onready var link_bttnbg: ColorRect = $ColorRect/LinkButton/LinkBTTNBG +@onready var patchnotes_bg: ColorRect = $ColorRect/Patchnotes/PatchnotesBG @export var errorColor:Color +@export var IMPUpdateLinkColor:Color +@export var IMPUpdatePatchNotesColor:Color var CheckForUpdates:bool = true @@ -54,6 +58,13 @@ func _on_http_request_completed(result: int, _response_code: int, _headers: Pack updateLink = result2["html_url"] if result2.has("body"): patchnotes.text = str(result2["body"]) + if patchnotes.text.contains("(!IT)"): + patchnotes.text = patchnotes.text.erase(patchnotes.text.find("(!IT)"),7) + print("importaint update detected") + update_available_text.text = "(Important) " + result2["tag_name"] + " Is Out!" + patchnotes_bg.color = IMPUpdatePatchNotesColor + link_bttnbg.color = IMPUpdateLinkColor + link_bttnbg.StandardColor = IMPUpdateLinkColor func _on_close_buen_pressed() -> void: hide()