From 44f5bbeeb8004aa3e0fdbef847c635b07717a0d2 Mon Sep 17 00:00:00 2001 From: Nordup Date: Wed, 27 Nov 2024 04:19:22 +0400 Subject: [PATCH] fix bookmark image, loading msg --- .../{bookmark.stylebox => panel.stylebox} | Bin ...rk_hover.stylebox => panel_hover.stylebox} | Bin app/scenes/components/bookmark.tscn | 42 +++++++++++-- app/scenes/components/not_responding.tscn | 2 +- app/scenes/components/result.tscn | 4 +- app/scenes/components/round_button.tscn | 2 +- app/scenes/menu_body/world.tscn | 55 +++++++++++++++++- app/scripts/resources/bookmarks.gd | 4 +- app/scripts/ui/menu/bookmark_ui.gd | 7 ++- app/scripts/ui/menu/round_button.gd | 6 -- app/scripts/ui/world/blackout.gd | 7 +++ app/scripts/ui/world/rotate.gd | 6 ++ 12 files changed, 116 insertions(+), 19 deletions(-) rename app/assets/styles/{bookmark.stylebox => panel.stylebox} (100%) rename app/assets/styles/{bookmark_hover.stylebox => panel_hover.stylebox} (100%) create mode 100644 app/scripts/ui/world/blackout.gd create mode 100644 app/scripts/ui/world/rotate.gd diff --git a/app/assets/styles/bookmark.stylebox b/app/assets/styles/panel.stylebox similarity index 100% rename from app/assets/styles/bookmark.stylebox rename to app/assets/styles/panel.stylebox diff --git a/app/assets/styles/bookmark_hover.stylebox b/app/assets/styles/panel_hover.stylebox similarity index 100% rename from app/assets/styles/bookmark_hover.stylebox rename to app/assets/styles/panel_hover.stylebox diff --git a/app/scenes/components/bookmark.tscn b/app/scenes/components/bookmark.tscn index 5263aab..5873bd1 100644 --- a/app/scenes/components/bookmark.tscn +++ b/app/scenes/components/bookmark.tscn @@ -1,19 +1,37 @@ -[gd_scene load_steps=8 format=3 uid="uid://82ca8so31njy"] +[gd_scene load_steps=10 format=3 uid="uid://82ca8so31njy"] [ext_resource type="Script" path="res://scripts/ui/menu/bookmark_ui.gd" id="1_bpkqj"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_7i5yr"] -[ext_resource type="StyleBox" uid="uid://bllkg32sc4iam" path="res://assets/styles/bookmark.stylebox" id="3_tb1mf"] -[ext_resource type="StyleBox" uid="uid://bmxiecm3vkddl" path="res://assets/styles/bookmark_hover.stylebox" id="4_figib"] +[ext_resource type="StyleBox" uid="uid://bllkg32sc4iam" path="res://assets/styles/panel.stylebox" id="3_tb1mf"] +[ext_resource type="StyleBox" uid="uid://bmxiecm3vkddl" path="res://assets/styles/panel_hover.stylebox" id="4_figib"] [ext_resource type="LabelSettings" uid="uid://85ms8ndcmbn0" path="res://assets/styles/text_small.tres" id="4_xqjm8"] [ext_resource type="Texture2D" uid="uid://6k1ia4pidwrq" path="res://assets/textures/empty_icon.svg" id="5_vwpfy"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1vnuq"] +bg_color = Color(0.423529, 0.235294, 0.933333, 1) +corner_radius_top_left = 25 +corner_radius_top_right = 25 +corner_radius_bottom_right = 25 +corner_radius_bottom_left = 25 +shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314) +shadow_size = 4 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bktbh"] +bg_color = Color(0.32549, 0.14902, 0.8, 1) +corner_radius_top_left = 25 +corner_radius_top_right = 25 +corner_radius_bottom_right = 25 +corner_radius_bottom_left = 25 +shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314) +shadow_size = 4 + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_od0ga"] corner_radius_top_left = 20 corner_radius_top_right = 20 corner_radius_bottom_right = 20 corner_radius_bottom_left = 20 -[node name="Bookmark" type="Control" node_paths=PackedStringArray("image", "title", "button")] +[node name="Bookmark" type="Control" node_paths=PackedStringArray("image", "title", "button", "button_special")] clip_children = 1 custom_minimum_size = Vector2(180, 100) layout_mode = 3 @@ -25,6 +43,7 @@ gate_events = ExtResource("2_7i5yr") image = NodePath("Mask/Image") title = NodePath("Title") button = NodePath("Button") +button_special = NodePath("ButtonSpecial") [node name="Button" type="Button" parent="."] layout_mode = 1 @@ -35,11 +54,24 @@ grow_horizontal = 2 grow_vertical = 2 focus_mode = 0 mouse_default_cursor_shape = 2 -theme_override_styles/focus = ExtResource("3_tb1mf") theme_override_styles/hover = ExtResource("4_figib") theme_override_styles/pressed = ExtResource("4_figib") theme_override_styles/normal = ExtResource("3_tb1mf") +[node name="ButtonSpecial" type="Button" parent="."] +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/hover = SubResource("StyleBoxFlat_1vnuq") +theme_override_styles/pressed = SubResource("StyleBoxFlat_1vnuq") +theme_override_styles/normal = SubResource("StyleBoxFlat_bktbh") + [node name="Mask" type="Panel" parent="."] clip_children = 1 layout_mode = 1 diff --git a/app/scenes/components/not_responding.tscn b/app/scenes/components/not_responding.tscn index bae2f33..9e81ec8 100644 --- a/app/scenes/components/not_responding.tscn +++ b/app/scenes/components/not_responding.tscn @@ -4,7 +4,7 @@ [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_8u6e2"] [ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="2_ugt55"] [ext_resource type="Resource" uid="uid://bqgikyax6jfqa" path="res://resources/history.tres" id="3_ge6h5"] -[ext_resource type="StyleBox" uid="uid://bllkg32sc4iam" path="res://assets/styles/bookmark.stylebox" id="4_2kla0"] +[ext_resource type="StyleBox" uid="uid://bllkg32sc4iam" path="res://assets/styles/panel.stylebox" id="4_2kla0"] [ext_resource type="LabelSettings" uid="uid://crt4elt055uhg" path="res://assets/styles/text_big.tres" id="5_ruiif"] [ext_resource type="PackedScene" uid="uid://xagbhqfidf2" path="res://scenes/components/round_button.tscn" id="7_mxyw0"] diff --git a/app/scenes/components/result.tscn b/app/scenes/components/result.tscn index a664dfb..ce0ac7f 100644 --- a/app/scenes/components/result.tscn +++ b/app/scenes/components/result.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=15 format=3 uid="uid://i3lgu2dyypcq"] [ext_resource type="Script" path="res://scripts/ui/search/result.gd" id="1_b6nfm"] -[ext_resource type="StyleBox" uid="uid://bmxiecm3vkddl" path="res://assets/styles/bookmark_hover.stylebox" id="1_bqxb5"] -[ext_resource type="StyleBox" uid="uid://bllkg32sc4iam" path="res://assets/styles/bookmark.stylebox" id="2_agglm"] +[ext_resource type="StyleBox" uid="uid://bmxiecm3vkddl" path="res://assets/styles/panel_hover.stylebox" id="1_bqxb5"] +[ext_resource type="StyleBox" uid="uid://bllkg32sc4iam" path="res://assets/styles/panel.stylebox" id="2_agglm"] [ext_resource type="Script" path="res://scripts/ui/search/one_line_text.gd" id="2_nxics"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_wgd6i"] [ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="4_tevcf"] diff --git a/app/scenes/components/round_button.tscn b/app/scenes/components/round_button.tscn index 4520f5d..27e8493 100644 --- a/app/scenes/components/round_button.tscn +++ b/app/scenes/components/round_button.tscn @@ -9,9 +9,9 @@ texture_filter = 4 custom_minimum_size = Vector2(26, 26) size_flags_vertical = 4 +focus_mode = 0 theme_override_colors/icon_normal_color = Color(0.831373, 0.831373, 0.831373, 1) theme_override_colors/icon_disabled_color = Color(0.431373, 0.435294, 0.494118, 1) -theme_override_styles/focus = ExtResource("1_6dhuv") theme_override_styles/disabled = ExtResource("1_6dhuv") theme_override_styles/hover = ExtResource("2_3cilb") theme_override_styles/pressed = ExtResource("1_6dhuv") diff --git a/app/scenes/menu_body/world.tscn b/app/scenes/menu_body/world.tscn index c550d5c..afd9808 100644 --- a/app/scenes/menu_body/world.tscn +++ b/app/scenes/menu_body/world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=3 uid="uid://kywrsqro3d5i"] +[gd_scene load_steps=30 format=3 uid="uid://kywrsqro3d5i"] [ext_resource type="Script" path="res://scripts/loading/gate_loader.gd" id="1_uxhy6"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_q7cvi"] @@ -18,7 +18,11 @@ [ext_resource type="Script" path="res://scripts/ui/world/world_ui.gd" id="12_jdwjt"] [ext_resource type="Script" path="res://scripts/ui/world/splash_screen.gd" id="13_3b6nd"] [ext_resource type="PackedScene" uid="uid://c7571vjq7l0jp" path="res://scenes/components/not_responding.tscn" id="17_kwbm3"] +[ext_resource type="Script" path="res://scripts/ui/world/blackout.gd" id="18_776rt"] [ext_resource type="Script" path="res://scripts/ui/fullscreen_animation.gd" id="18_sx3kr"] +[ext_resource type="Texture2D" uid="uid://dapysvexbecnd" path="res://assets/textures/reload.svg" id="19_itbnl"] +[ext_resource type="Script" path="res://scripts/ui/world/rotate.gd" id="20_dsgqt"] +[ext_resource type="LabelSettings" uid="uid://crt4elt055uhg" path="res://assets/styles/text_big.tres" id="20_v1648"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_be6ex"] resource_local_to_scene = true @@ -171,6 +175,52 @@ gate_events = ExtResource("2_q7cvi") command_events = ExtResource("6_18mgg") snbx_logger = NodePath("../SandboxLogger") +[node name="Loading" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="Loading"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -40.0 +offset_top = -20.0 +offset_right = 40.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 12 + +[node name="Control" type="Control" parent="Loading/HBoxContainer"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="Loading/HBoxContainer/Control"] +self_modulate = Color(0.831373, 0.831373, 0.831373, 1) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +pivot_offset = Vector2(12, 20) +texture = ExtResource("19_itbnl") +expand_mode = 1 +stretch_mode = 5 +script = ExtResource("20_dsgqt") + +[node name="Label" type="Label" parent="Loading/HBoxContainer"] +layout_mode = 2 +text = "Loading..." +label_settings = ExtResource("20_v1648") + [node name="WorldCanvas" type="Control" parent="."] custom_minimum_size = Vector2(1300, 0) layout_mode = 1 @@ -225,6 +275,7 @@ grow_vertical = 2 focus_mode = 0 [node name="Blackout" type="Panel" parent="WorldCanvas"] +visible = false layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -233,6 +284,8 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_ybg1t") +script = ExtResource("18_776rt") +gate_events = ExtResource("2_q7cvi") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { diff --git a/app/scripts/resources/bookmarks.gd b/app/scripts/resources/bookmarks.gd index 8a5cc5f..6dd091e 100644 --- a/app/scripts/resources/bookmarks.gd +++ b/app/scripts/resources/bookmarks.gd @@ -34,8 +34,8 @@ func update(gate: Gate) -> void: starred_gates.erase(replace) starred_gates.append(gate) - on_update.emit(gate) save_image.emit(gate) + on_update.emit(gate) func star(gate: Gate, featured: bool = false) -> void: @@ -44,8 +44,8 @@ func star(gate: Gate, featured: bool = false) -> void: gates[gate.url] = gate starred_gates.append(gate) - on_star.emit(gate, featured) save_image.emit(gate) + on_star.emit(gate, featured) func unstar(gate: Gate) -> void: diff --git a/app/scripts/ui/menu/bookmark_ui.gd b/app/scripts/ui/menu/bookmark_ui.gd index 91d89ed..a231146 100644 --- a/app/scripts/ui/menu/bookmark_ui.gd +++ b/app/scripts/ui/menu/bookmark_ui.gd @@ -5,17 +5,22 @@ class_name BookmarkUI @export var image: TextureRect @export var title: Label @export var button: Button +@export var button_special: Button var url: String func _ready() -> void: button.pressed.connect(on_pressed) + button_special.pressed.connect(on_pressed) -func fill(gate: Gate) -> void: +func fill(gate: Gate, special: bool = false) -> void: if gate == null: return + button.visible = not special + button_special.visible = special + url = gate.url title.text = "Unnamed" if gate.title.is_empty() else gate.title image.texture = FileTools.load_external_tex(gate.image) diff --git a/app/scripts/ui/menu/round_button.gd b/app/scripts/ui/menu/round_button.gd index 3b12412..19cc9d6 100644 --- a/app/scripts/ui/menu/round_button.gd +++ b/app/scripts/ui/menu/round_button.gd @@ -5,12 +5,6 @@ class_name RoundButton func _ready() -> void: if disabled: disable() else: enable() - - button_up.connect(on_button_up) - - -func on_button_up() -> void: - release_focus() func disable() -> void: diff --git a/app/scripts/ui/world/blackout.gd b/app/scripts/ui/world/blackout.gd new file mode 100644 index 0000000..74633b5 --- /dev/null +++ b/app/scripts/ui/world/blackout.gd @@ -0,0 +1,7 @@ +extends Panel + +@export var gate_events: GateEvents + + +func _ready() -> void: + gate_events.first_frame.connect(func(): visible = true) diff --git a/app/scripts/ui/world/rotate.gd b/app/scripts/ui/world/rotate.gd new file mode 100644 index 0000000..0aaf117 --- /dev/null +++ b/app/scripts/ui/world/rotate.gd @@ -0,0 +1,6 @@ +extends TextureRect + + +func _ready() -> void: + var tween = create_tween().set_loops() + tween.tween_property(self, "rotation", 360, 50).from(0)