Made it so it says version outdated if the version is outdated
Right now its literally impossible to get the popup but at some point it will be possible.
This commit is contained in:
1 parent
3a4b905869
commit
62de4bd400
3 files changed
+162
No files matched your search
@@ -0,0 +1,145 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dggreseg0i3de"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dq7nkk7n7wrq4" path="res://Fonts/Lexend.ttf" id="1_4oqe8"]
|
||||
[ext_resource type="Script" uid="uid://bc4miccifwrk0" path="res://Scripts/SceneSwitcher.cs" id="2_1ejpl"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fy1fk"]
|
||||
bg_color = Color(0.95158, 0.95158, 0.95158, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hsdot"]
|
||||
bg_color = Color(0.830335, 0.830335, 0.830335, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0d7pb"]
|
||||
bg_color = Color(1, 1, 1, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[node name="OutdatedVersion" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Header" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -324.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = -284.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="OutdatedVersion" type="Label" parent="Header"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -960.0
|
||||
offset_top = -107.0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 107.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_fonts/font = ExtResource("1_4oqe8")
|
||||
theme_override_font_sizes/font_size = 171
|
||||
text = "Outdated Version!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="SecondaryText" type="Label" parent="Header"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -960.0
|
||||
offset_top = 85.0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 193.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_fonts/font = ExtResource("1_4oqe8")
|
||||
theme_override_font_sizes/font_size = 86
|
||||
text = "Please update your client!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Buttons" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="UpdateButton" type="Button" parent="Buttons"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -250.0
|
||||
offset_top = -75.0
|
||||
offset_right = 250.0
|
||||
offset_bottom = 75.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_focus_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
|
||||
theme_override_fonts/font = ExtResource("1_4oqe8")
|
||||
theme_override_font_sizes/font_size = 56
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_fy1fk")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_hsdot")
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_0d7pb")
|
||||
text = "Update"
|
||||
|
||||
[node name="ContinueButton" type="Button" parent="Buttons"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -250.0
|
||||
offset_top = 105.0
|
||||
offset_right = 250.0
|
||||
offset_bottom = 255.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_hover_pressed_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_hover_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_focus_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_pressed_color = Color(0, 0, 0, 1)
|
||||
theme_override_fonts/font = ExtResource("1_4oqe8")
|
||||
theme_override_font_sizes/font_size = 56
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_fy1fk")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_hsdot")
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_0d7pb")
|
||||
text = "Continue"
|
||||
script = ExtResource("2_1ejpl")
|
||||
ScenePath = "res://Scenes/MainMenu.tscn"
|
||||
@@ -4,4 +4,5 @@ using System;
|
||||
public partial class Globals : Node {
|
||||
public static string LatestVersion = "";
|
||||
public static string AccessLevel = "";
|
||||
public static bool VersionChecked = false;
|
||||
}
|
||||
@@ -10,6 +10,11 @@ public partial class VersionChecker : Control {
|
||||
|
||||
VersionLabel.Text = "Version: " + GameVersion;
|
||||
|
||||
if (Globals.VersionChecked) {
|
||||
Label LatestVersionLabel = GetNode<Label>("LatestVersion");
|
||||
|
||||
LatestVersionLabel.Text = "Latest Version: " + Globals.LatestVersion;
|
||||
} else {
|
||||
HttpRequest GetLatestVersionNode = GetNode<HttpRequest>("LatestVersion/HTTPRequest");
|
||||
|
||||
GetLatestVersionNode.RequestCompleted += OnRequestCompleted;
|
||||
@@ -18,6 +23,7 @@ public partial class VersionChecker : Control {
|
||||
|
||||
GetLatestVersionNode.Request(url);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body) {
|
||||
string ResponseBody = Encoding.UTF8.GetString(body);
|
||||
@@ -31,5 +37,15 @@ public partial class VersionChecker : Control {
|
||||
Label LatestVersionLabel = GetNode<Label>("LatestVersion");
|
||||
|
||||
LatestVersionLabel.Text = "Latest Version: " + Globals.LatestVersion;
|
||||
|
||||
Globals.VersionChecked = true;
|
||||
|
||||
if (Globals.AccessLevel != "all") {
|
||||
var error = GetTree().ChangeSceneToFile("res://Scenes/OutdatedVersion.tscn");
|
||||
|
||||
if (error != Error.Ok) {
|
||||
GD.PrintErr("Failed to change scene: " + error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user