Skip to content

Commit

Permalink
fix: make sure course thumbnails are clickable on end screens, simpli…
Browse files Browse the repository at this point in the history
…fy ui core
  • Loading branch information
NathanLovato committed Dec 10, 2023
1 parent 2fc11f7 commit c81e9de
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
6 changes: 2 additions & 4 deletions ui/UICore.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ var _course_navigator: UINavigator
onready var _pages := $Pages as Control
onready var _loading_screen := $Pages/LoadingScreen as LoadingScreen
onready var _welcome_screen := $Pages/WelcomeScreen as WelcomeScreen
onready var _end_screen := $Pages/EndScreen as Control
onready var _sponsorless_end_screen := $Pages/SponsorlessEndScreen as Control
onready var _settings_screen := $Pages/SettingsScreen as Control
onready var _course_screen := $Pages/CourseScreen as Control

Expand Down Expand Up @@ -138,9 +136,9 @@ func _show_end_screen(_course: Course) -> void:
page.hide()

if show_sponsored_screen:
_end_screen.show()
get_tree().change_scene("res://ui/screens/end_screen/EndScreen.tscn")
else:
_sponsorless_end_screen.show()
get_tree().change_scene("res://ui/screens/end_screen/SponsorlessEndScreen.tscn")


func _go_to_welcome_screen() -> void:
Expand Down
14 changes: 4 additions & 10 deletions ui/UICore.tscn
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://ui/screens/welcome_screen/WelcomeScreen.tscn" type="PackedScene" id=1]
[ext_resource path="res://ui/theme/gdscript_app_theme.tres" type="Theme" id=2]
[ext_resource path="res://ui/LoadingScreen.tscn" type="PackedScene" id=3]
[ext_resource path="res://ui/UICore.gd" type="Script" id=4]
[ext_resource path="res://ui/components/popups/ReportFormPopup.tscn" type="PackedScene" id=5]
[ext_resource path="res://ui/components/popups/SettingsPopup.tscn" type="PackedScene" id=6]
[ext_resource path="res://ui/screens/end_screen/EndScreen.tscn" type="PackedScene" id=7]
[ext_resource path="res://ui/UIVersion.gd" type="Script" id=8]
[ext_resource path="res://ui/theme/fonts/font_version.tres" type="DynamicFont" id=9]
[ext_resource path="res://ui/screens/end_screen/SponsorlessEndScreen.tscn" type="PackedScene" id=10]

[node name="UICore" type="Control"]
pause_mode = 2
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 2.0
margin_right = 2.0
mouse_filter = 2
theme = ExtResource( 2 )
script = ExtResource( 4 )
Expand All @@ -39,13 +39,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2

[node name="EndScreen" parent="Pages" instance=ExtResource( 7 )]
visible = false
mouse_filter = 2

[node name="SponsorlessEndScreen" parent="Pages" instance=ExtResource( 10 )]
visible = false

[node name="LoadingScreen" parent="Pages" instance=ExtResource( 3 )]
mouse_filter = 2

Expand All @@ -72,6 +65,7 @@ margin_right = -2.0
grow_vertical = 0
rect_min_size = Vector2( 1918, 20 )
focus_mode = 2
mouse_filter = 2
custom_colors/default_color = Color( 0.572549, 0.560784, 0.721569, 1 )
custom_fonts/normal_font = ExtResource( 9 )
bbcode_enabled = true
Expand Down
10 changes: 9 additions & 1 deletion ui/screens/end_screen/EndScreen.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=49 format=2]
[gd_scene load_steps=50 format=2]

[ext_resource path="res://ui/theme/fonts/Inter-Medium.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://ui/theme/gdscript_app_theme.tres" type="Theme" id=2]
Expand All @@ -23,6 +23,13 @@
[ext_resource path="res://ui/screens/end_screen/third-person-platformer-panoramic.jpg" type="Texture" id=21]
[ext_resource path="res://ui/screens/end_screen/arrow_black.svg" type="Texture" id=22]

[sub_resource type="GDScript" id=37]
script/source = "extends Button

func _ready() -> void:
connect(\"pressed\", get_tree(), \"change_scene\", [\"res://ui/UICore.tscn\"])
"
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.251478, 0.2021, 0.43, 0.894118 )
shadow_offset = Vector2( 0, 4 )
Expand Down Expand Up @@ -241,6 +248,7 @@ hint_tooltip = "Open the course index"
mouse_default_cursor_shape = 2
icon = ExtResource( 11 )
flat = true
script = SubResource( 37 )
[node name="Control" type="Control" parent="Layout/TopBar/MarginContainer/ToolBarLayout"]
margin_left = 48.0
Expand Down
12 changes: 10 additions & 2 deletions ui/screens/end_screen/SponsorlessEndScreen.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=2]
[gd_scene load_steps=21 format=2]

[ext_resource path="res://ui/theme/fonts/font_title.tres" type="DynamicFont" id=1]
[ext_resource path="res://ui/theme/gdscript_app_theme.tres" type="Theme" id=2]
Expand All @@ -13,6 +13,13 @@
[ext_resource path="res://ui/screens/end_screen/main_menu/sky_dark.png" type="Texture" id=12]
[ext_resource path="res://ui/screens/end_screen/main_menu/sky_day_blurred.png" type="Texture" id=13]

[sub_resource type="GDScript" id=10]
script/source = "extends Button

func _ready() -> void:
connect(\"pressed\", get_tree(), \"change_scene\", [\"res://ui/UICore.tscn\"])
"
[sub_resource type="GDScript" id=2]
script/source = "tool
extends HBoxContainer
Expand Down Expand Up @@ -117,6 +124,7 @@ hint_tooltip = "Open the course index"
mouse_default_cursor_shape = 2
icon = ExtResource( 11 )
flat = true
script = SubResource( 10 )
[node name="Control" type="Control" parent="Layout/TopBar/MarginContainer/ToolBarLayout"]
margin_left = 48.0
Expand Down Expand Up @@ -223,7 +231,7 @@ bbcode_enabled = true
bbcode_text = "Like Godot, this app and course is free and open-source.

You can find the app's source code and contribute translations here: [url=\"https://github.com/GDQuest/learn-gdscript\"]Learn GDScript From Zero (Github repository)[/url]."
text = "Like Godot, this app and course are free and open-source.
text = "Like Godot, this app and course is free and open-source.
You can find the app's source code and contribute translations here: Learn GDScript From Zero (Github repository)."
fit_content_height = true
Expand Down

0 comments on commit c81e9de

Please sign in to comment.