Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
errors support + multiple game issues (#9)
Browse files Browse the repository at this point in the history
* fix: some multiple game issues, still a bit iffy

* change intro animation + add setup screen

* fix button weirdness, add oops + panic + error handling system
  • Loading branch information
int-72h authored Jun 14, 2024
1 parent 6167fc7 commit af85674
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 24 deletions.
Binary file added assets/adastral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/adastral.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dylpmivsu37k8"
path="res://.godot/imported/adastral.png-7554715c26cf7308a7759caa370ebfd8.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/adastral.png"
dest_files=["res://.godot/imported/adastral.png-7554715c26cf7308a7759caa370ebfd8.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
1 change: 1 addition & 0 deletions boot.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ offset_left = 232.0
offset_top = 143.0
offset_right = 594.0
offset_bottom = 196.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("4_6hwq1")
theme_override_font_sizes/font_size = 40
text = "Adastral Initialising..."
Expand Down
37 changes: 37 additions & 0 deletions icon.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://c5kdgsphlw0bn"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
13 changes: 9 additions & 4 deletions init.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Control
#var oops = preload("res://oops.tscn")
var oops = preload("res://oops.tscn")

var spin_tween: Tween
var s: binding
Expand All @@ -20,7 +20,8 @@ func do_stuff():
move_child($Control,0)
$Control/Main.s = s
$Control/Main.ready_after_sutton()
$Control.position = Vector2(0,349)
#$Control.position = Vector2(0,349)
$Control.modulate = Color.TRANSPARENT
do_the_shiny_thing()


Expand Down Expand Up @@ -49,15 +50,19 @@ func do_the_shiny_thing():
tween.tween_property(x,"pivot_offset",Vector2(100,100),t).set_trans(trans).set_ease(ease)
spin_tween.tween_property(x,"rotation_degrees",360.0+180,t).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
tween.tween_property(x,"modulate",Color.WHITE,t).set_trans(trans).set_ease(Tween.EASE_IN)
await get_tree().create_timer(t+0.2).timeout
await get_tree().create_timer(t-0.5).timeout
tween = create_tween().set_parallel()
tween.tween_property($Control,"modulate",Color.WHITE,0.5).set_trans(Tween.TRANS_LINEAR)
await get_tree().create_timer(0.5).timeout
$TextureRect2.hide()
$TextureRect3.hide()
$TextureRect4.hide()
$TextureRect5.hide()
$TextureRect6.hide()
$Label3.reparent($Control/Main)
tween = create_tween().set_parallel()
tween.tween_property($Control,"position",Vector2(0,0),0.5).set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT)
#tween.tween_property($Control,"position",Vector2(0,0),0.5).set_trans(Tween.TRANS_ELASTIC).set_ease(Tween.EASE_OUT)

await get_tree().create_timer(0.5).timeout
$TextureRect.reparent($Control/Main,false)

Expand Down
69 changes: 55 additions & 14 deletions main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,41 @@ extends Control
var pallete
var theme_json = {"adastral":
{"id":"adastral","dark":"#00000000","light": "#f8f3ee",
"main": "#005c9d",
"main": "#0064ad",
"accent": "#b76300",
"lightfg": "#8d847b",
"click":"#ffdd63",
"click_t":"#000000",
"bg": "res://assets/bg.png",
"star": "res://assets/adastral.svg"}}
"star": "res://assets/adastral.png"}}
var games: Dictionary
var s : binding
var current_screen : String # use an enum damnit!!!!
var current_game = ""
signal change_to(game)
signal update_game(game)
signal verify_game(game)
var oops_s = preload("res://oops.tscn")
var panic_s = preload("res://panic.tscn")

func panic(err_string):
var z = panic_s.instantiate()
z.find_child("Label2").set("text",err_string)
get_tree().get_root().add_child(z)
await get_tree().create_timer(1).timeout
get_tree().paused = true

func oops(err_string):
var z = oops_s.instantiate()
z.find_child("Label2").set("text",err_string)
get_tree().get_root().add_child(z)
await get_tree().create_timer(1).timeout
get_tree().paused = true

func load_image(path):
if path == "":
panic("no image path specified?")
return
if "res://" in path:
return load(path)
else:
Expand All @@ -37,13 +56,17 @@ func _on_HomeButton_pressed():
apply_theme("adastral")

func _on_game_verified(status,game):
print("[Belmont/GameVerified] %s verified" % [game])
call_deferred("t_game_verified",game)

func _on_game_updated(status,game):
call_deferred("t_game_updated",game)


func _on_error(error_detail):
print(error_detail)

func _on_install_pressed():
games[current_game]["status"] = "installing"
s.update_game(current_game)
$Install.disabled = true
$Install.text = "Installing..."
Expand All @@ -53,6 +76,8 @@ func _on_install_pressed():
tween.tween_property($ProgressBar,"modulate",Color.WHITE,0.2)

func _on_verify_pressed():
games[current_game]["status"] = "verifying"
print("[Belmont/VerifyPressed] Verifying %s" % [current_game])
s.verify_game(current_game)
$Install.disabled = true
$Verify.text = "Verifying..."
Expand Down Expand Up @@ -86,6 +111,7 @@ func ready_after_sutton():
s.connect("game_verified",_on_game_verified)
s.connect("game_updated",_on_game_updated)
s.connect("progress_update",_on_progress_update)
s.connect("error",_on_error)
var z = s.get_server_games()
for x in z:
theme_json[x] = s.get_game_assets(x)
Expand All @@ -107,7 +133,7 @@ func add_side_icons():
new.ignore_texture_size = true
new.stretch_mode = TextureButton.STRETCH_SCALE
new.custom_minimum_size= Vector2(42,42)
new.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
new.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
new.size_flags_vertical = Control.SIZE_SHRINK_CENTER
new.texture_normal = load_image(x["icon"])
$HBoxContainer.add_child(new)
Expand All @@ -120,21 +146,23 @@ func t_progress_update(game,progress):
games[game]["progress"] = progress*100

func t_game_verified(game):
set_buttons(game)
var tween = get_tree().create_tween()
tween.tween_property($ProgressBar,"modulate",Color.TRANSPARENT,0.2)
change_game(game)
games[game]["progress"] = 0
await get_tree().create_timer(0.2).timeout
$ProgressBar.hide()
if current_game == game:
var tween = get_tree().create_tween()
tween.tween_property($ProgressBar,"modulate",Color.TRANSPARENT,0.2)
await get_tree().create_timer(0.2).timeout
$ProgressBar.hide()

func t_game_updated(game):
set_buttons(game)
change_game(game)
$InstalledVersion.text = "[left]Installed Version: [b]%s[/b]" % s.get_installed_version(game)
var tween = get_tree().create_tween()
tween.tween_property($ProgressBar,"modulate",Color.TRANSPARENT,0.2)
games[game]["progress"] = 0
await get_tree().create_timer(0.2).timeout
$ProgressBar.hide()
if current_game == game:
var tween = get_tree().create_tween()
tween.tween_property($ProgressBar,"modulate",Color.TRANSPARENT,0.2)
await get_tree().create_timer(0.2).timeout
$ProgressBar.hide()



Expand All @@ -150,9 +178,16 @@ func set_stylebox_colour(stylebox,colour):

func set_buttons(game_name):
if s.get_installed_version(game_name) == "":
if game_name in games.keys():
if "status" in games[game_name].keys():
if games[game_name]["status"] == "installing":
$Install.text = "Installing.."
else:
$Install.text = "Install"
$InstalledVersion.text = "[left]Not Installed!"
$Verify.disabled = true
$Install.disabled = false

else:
$InstalledVersion.text = "[left]Installed Version: [b]%s[/b]" % s.get_installed_version(game_name)
if s.get_installed_version(game_name) == s.get_latest_version(game_name):
Expand All @@ -165,6 +200,12 @@ func set_buttons(game_name):
$Install.disabled = false
$Verify.disabled = false
$Install.text = "Update"
if game_name in games.keys(): # this is insanely cooked
if "status" in games[game_name].keys():
if games[game_name]["status"] == "installing":
$Install.text = "Installing.."
else:
$Install.text = "Install"



Expand Down
8 changes: 4 additions & 4 deletions main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ext_resource type="FontVariation" uid="uid://th0tjv2xcuen" path="res://fonts/main_font.tres" id="3_qwbhy"]
[ext_resource type="Shader" path="res://tween.gdshader" id="4_5diq2"]
[ext_resource type="Texture2D" uid="uid://diee7uq3voana" path="res://assets/adastral-256.svg" id="4_5x6qi"]
[ext_resource type="Texture2D" uid="uid://ccbrk3xcvf5gv" path="res://icon.svg" id="4_epacs"]
[ext_resource type="Texture2D" uid="uid://c5kdgsphlw0bn" path="res://icon.svg" id="4_epacs"]
[ext_resource type="Script" path="res://main.gd" id="6"]
[ext_resource type="Shader" path="res://rounded.gdshader" id="9_ife38"]
[ext_resource type="Texture2D" uid="uid://b21fcl1p2qpc8" path="res://assets/settings.png" id="10"]
Expand All @@ -23,7 +23,7 @@ shader_parameter/weight = null
shader_parameter/alpha = 1.0

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fdqvn"]
bg_color = Color(0, 0.360784, 0.615686, 1)
bg_color = Color(0, 0.392157, 0.678431, 1)
corner_radius_top_left = 16
corner_radius_top_right = 16
corner_radius_bottom_right = 16
Expand Down Expand Up @@ -179,7 +179,8 @@ theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = SubResource("FontVariation_sxnxf")
theme_override_font_sizes/font_size = 100
text = "Adastral"
visible_ratio = -0.125
visible_characters = 0
visible_ratio = 0.0

[node name="Label" type="Label" parent="Main/AboutInfo"]
layout_mode = 0
Expand Down Expand Up @@ -341,7 +342,6 @@ offset_bottom = 350.0
texture = ExtResource("20_17qi8")
expand_mode = 1

[connection signal="change_to" from="Main" to="Main/HBoxContainer" method="_on_Main_change_to"]
[connection signal="pressed" from="Main/TopPanel/HomeButton" to="Main" method="_on_HomeButton_pressed"]
[connection signal="pressed" from="Main/TopPanel/AdvancedButton" to="Main" method="_on_Button4_pressed"]
[connection signal="pressed" from="Main/Install" to="Main" method="_on_install_pressed"]
Expand Down
4 changes: 3 additions & 1 deletion oops.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://da7m6swunt04t"]
[gd_scene load_steps=6 format=3 uid="uid://da7m6swunt04t"]

[ext_resource type="Texture2D" uid="uid://diee7uq3voana" path="res://assets/adastral-256.svg" id="1_878ms"]
[ext_resource type="Script" path="res://error.gd" id="1_fvxd1"]
[ext_resource type="FontFile" uid="uid://pskwpwxk0pd4" path="res://fonts/HankenGrotesk-SemiBold.ttf" id="2_cx3cw"]

[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2ld2c"]
Expand All @@ -15,6 +16,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_fvxd1")

[node name="Panel" type="ColorRect" parent="."]
material = SubResource("CanvasItemMaterial_2ld2c")
Expand Down
2 changes: 1 addition & 1 deletion panic.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ theme_override_fonts/normal_font = ExtResource("1_rwsp8")
theme_override_font_sizes/normal_font_size = 20
bbcode_enabled = true
text = "[center]Adastral stopped itself to avoid further issues.
For support, please go to adastral.net and look for the support category.
This is to be expected. This is an alpha build.
To continue, you should restart Adastral.
"
scroll_active = false
Expand Down
57 changes: 57 additions & 0 deletions setup.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[gd_scene load_steps=3 format=3 uid="uid://dsp33e8s172n5"]

[ext_resource type="FontFile" uid="uid://culcak1g0byvy" path="res://fonts/HankenGrotesk-Medium.ttf" id="1_e5qvj"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_37v2i"]
bg_color = Color(0, 0.392157, 0.678431, 1)

[node name="Setup" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="Panel" type="Panel" parent="."]
layout_mode = 0
offset_right = 770.0
offset_bottom = 350.0
theme_override_styles/panel = SubResource("StyleBoxFlat_37v2i")

[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_left = 7.0
offset_top = 7.0
offset_right = 172.0
offset_bottom = 56.0
theme_override_fonts/font = ExtResource("1_e5qvj")
text = "Welcome to Adastral.
let's get you set up!"

[node name="Label2" type="Label" parent="."]
layout_mode = 0
offset_left = 6.0
offset_top = 65.0
offset_right = 301.0
offset_bottom = 88.0
theme_override_fonts/font = ExtResource("1_e5qvj")
text = "Sourcemod path:"

[node name="Label3" type="Label" parent="."]
layout_mode = 0
offset_left = 7.0
offset_top = 91.0
offset_right = 302.0
offset_bottom = 114.0
theme_override_fonts/font = ExtResource("1_e5qvj")
text = "TF2:"

[node name="Label4" type="Label" parent="."]
layout_mode = 0
offset_left = 6.0
offset_top = 116.0
offset_right = 301.0
offset_bottom = 139.0
theme_override_fonts/font = ExtResource("1_e5qvj")
text = "SDK 2013 Multiplayer:"

0 comments on commit af85674

Please sign in to comment.