mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-22 23:17:26 -04:00
onboarding close button
This commit is contained in:
parent
9e46290c36
commit
3131b731e0
7 changed files with 126 additions and 9 deletions
Binary file not shown.
|
@ -36,7 +36,7 @@ grow_vertical = 2
|
|||
pivot_offset = Vector2(300, 350)
|
||||
script = ExtResource("1_dxxs8")
|
||||
focus_button = NodePath("TextureButton")
|
||||
unfocus_color = Color(0.9, 0.9, 0.9, 0.509804)
|
||||
unfocus_color = Color(0.9, 0.9, 0.9, 0.5)
|
||||
unfocus_scale = Vector2(0.8, 0.8)
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
|
@ -49,6 +49,7 @@ grow_vertical = 2
|
|||
theme_override_styles/panel = SubResource("StyleBoxFlat_r2yvw")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://b5tbn17l1pfs1"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://b5tbn17l1pfs1"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/ui/onboarding/onboarding.gd" id="1_2xh2a"]
|
||||
[ext_resource type="Script" path="res://scripts/ui/onboarding/carousel.gd" id="2_uhwdh"]
|
||||
[ext_resource type="Shader" uid="uid://dd1axtdlit6no" path="res://shaders/vignette_blur.tres" id="2_vhqmk"]
|
||||
[ext_resource type="PackedScene" uid="uid://pbsmrx55rb5g" path="res://scenes/components/onboarding/board.tscn" id="3_04ofy"]
|
||||
[ext_resource type="Resource" uid="uid://crjhix0osmtnf" path="res://resources/ui_events.res" id="3_jta5g"]
|
||||
[ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="4_bi8o3"]
|
||||
[ext_resource type="Script" path="res://scripts/ui/onboarding/close_button.gd" id="6_lcfru"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_htqsi"]
|
||||
bg_color = Color(0, 0, 0, 0.258824)
|
||||
|
@ -17,7 +19,20 @@ shader_parameter/VignetteColor = Color(0, 0, 0, 1)
|
|||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b61hg"]
|
||||
|
||||
[node name="Onboarding" type="Control" node_paths=PackedStringArray("root", "skip")]
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vy2ch"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_gh5x7"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p4v5c"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vsedv"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_cgaqc"]
|
||||
font = ExtResource("4_bi8o3")
|
||||
font_size = 26
|
||||
font_color = Color(0.831373, 0.831373, 0.831373, 1)
|
||||
|
||||
[node name="Onboarding" type="Control" node_paths=PackedStringArray("root", "close")]
|
||||
top_level = true
|
||||
z_index = 10
|
||||
layout_mode = 3
|
||||
|
@ -29,7 +44,7 @@ grow_vertical = 2
|
|||
mouse_filter = 2
|
||||
script = ExtResource("1_2xh2a")
|
||||
root = NodePath("Root")
|
||||
skip = NodePath("Root/Carousel/Line/Board/MarginContainer/VBoxContainer/HBoxContainer/Hide")
|
||||
close = NodePath("Root/Carousel/Line/Close")
|
||||
|
||||
[node name="Root" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
|
@ -61,7 +76,7 @@ grow_vertical = 2
|
|||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_b61hg")
|
||||
|
||||
[node name="Carousel" type="Control" parent="Root" node_paths=PackedStringArray("line")]
|
||||
[node name="Carousel" type="Control" parent="Root" node_paths=PackedStringArray("line", "close")]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -71,6 +86,7 @@ grow_vertical = 2
|
|||
script = ExtResource("2_uhwdh")
|
||||
ui_events = ExtResource("3_jta5g")
|
||||
line = NodePath("Line")
|
||||
close = NodePath("Line/Close")
|
||||
tween_duration = 0.3
|
||||
|
||||
[node name="Line" type="Control" parent="Root/Carousel"]
|
||||
|
@ -122,4 +138,58 @@ offset_top = 0.0
|
|||
offset_right = 1900.0
|
||||
offset_bottom = 700.0
|
||||
|
||||
[editable path="Root/Carousel/Line/Board"]
|
||||
[node name="Close" type="Button" parent="Root/Carousel/Line" node_paths=PackedStringArray("content")]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 950.0
|
||||
offset_top = -350.0
|
||||
offset_right = 1550.0
|
||||
offset_bottom = 350.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
scale = Vector2(0.8, 0.8)
|
||||
pivot_offset = Vector2(300, 350)
|
||||
focus_mode = 0
|
||||
mouse_default_cursor_shape = 2
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_vy2ch")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_gh5x7")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_p4v5c")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_vsedv")
|
||||
flat = true
|
||||
script = ExtResource("6_lcfru")
|
||||
content = NodePath("Centered")
|
||||
tween_duration = 0.2
|
||||
base_modulate = Color(1, 1, 1, 0.5)
|
||||
hover_scale = 1.2
|
||||
|
||||
[node name="Centered" type="Control" parent="Root/Carousel/Line/Close"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Root/Carousel/Line/Close/Centered"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -78.0
|
||||
offset_top = -12.5
|
||||
offset_right = 78.0
|
||||
offset_bottom = 12.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Let's try it out →"
|
||||
label_settings = SubResource("LabelSettings_cgaqc")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
|
|
@ -2,6 +2,7 @@ extends Control
|
|||
|
||||
@export var ui_events: UiEvents
|
||||
@export var line: Control
|
||||
@export var close: Button
|
||||
@export var tween_duration: float
|
||||
|
||||
var boards: Array[OnboardingBoard] = []
|
||||
|
@ -19,7 +20,8 @@ func _ready() -> void:
|
|||
|
||||
func setup_boards() -> void:
|
||||
for child in line.get_children():
|
||||
boards.append(child as OnboardingBoard)
|
||||
if child is not OnboardingBoard: continue
|
||||
boards.append(child)
|
||||
|
||||
for i in range(boards.size()):
|
||||
boards[i].request_focus.connect(move_line.bind(i))
|
||||
|
@ -48,3 +50,12 @@ func move_line(board_index: int) -> void:
|
|||
if i == board_index:
|
||||
boards[i].focus(tween_duration)
|
||||
else: boards[i].unfocus(tween_duration)
|
||||
|
||||
await tween.finished
|
||||
refresh_mouse_position()
|
||||
|
||||
|
||||
func refresh_mouse_position() -> void:
|
||||
var event = InputEventMouseMotion.new()
|
||||
event.position = get_viewport().get_mouse_position()
|
||||
Input.parse_input_event(event)
|
||||
|
|
34
app/scripts/ui/onboarding/close_button.gd
Normal file
34
app/scripts/ui/onboarding/close_button.gd
Normal file
|
@ -0,0 +1,34 @@
|
|||
extends Button
|
||||
|
||||
@export var content: Control
|
||||
@export var tween_duration: float
|
||||
@export var base_modulate: Color
|
||||
@export var hover_scale: float
|
||||
|
||||
var tween: Tween
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
mouse_entered.connect(on_mouse_entered)
|
||||
mouse_exited.connect(on_mouse_exited)
|
||||
on_mouse_exited()
|
||||
|
||||
|
||||
func on_mouse_entered() -> void:
|
||||
if is_instance_valid(tween): tween.stop()
|
||||
tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
|
||||
tween.set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
|
||||
tween.tween_property(content, "scale", Vector2.ONE * hover_scale, tween_duration)
|
||||
tween.tween_property(content, "modulate", Color.WHITE, tween_duration)
|
||||
|
||||
|
||||
func on_mouse_exited() -> void:
|
||||
if is_instance_valid(tween): tween.stop()
|
||||
tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
|
||||
tween.set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
|
||||
tween.tween_property(content, "scale", Vector2.ONE, tween_duration)
|
||||
tween.tween_property(content, "modulate", base_modulate, tween_duration)
|
|
@ -5,7 +5,7 @@ const SHOWN = Color(1, 1, 1, 1)
|
|||
const HIDDEN = Color(1, 1, 1, 0)
|
||||
|
||||
@export var root: Control
|
||||
@export var skip: Button
|
||||
@export var close: Button
|
||||
@export var fade_in: float = 0.2
|
||||
@export var fade_out: float = 0.2
|
||||
|
||||
|
@ -13,7 +13,7 @@ var tween: Tween
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
skip.pressed.connect(hide_onboarding)
|
||||
close.pressed.connect(hide_onboarding)
|
||||
|
||||
visible = true
|
||||
root.visible = false
|
||||
|
|
|
@ -143,6 +143,7 @@ void fragment() {
|
|||
|
||||
}
|
||||
"
|
||||
graph_offset = Vector2(-478.86, -398.352)
|
||||
mode = 1
|
||||
modes/blend = 5
|
||||
flags/light_only = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue