gate icon and undiscoverable mode

This commit is contained in:
Nordup 2025-06-29 01:26:39 +07:00
parent fb6cf98f2b
commit 414ad4eeda
18 changed files with 108 additions and 52 deletions

View file

@ -8,8 +8,8 @@ extends Control
func _ready() -> void:
visible = false
if key.is_empty() or button == null: Debug.logerr("hint has empty vars")
var first = DataSaver.get_value(section, key)
if first == null or not first: show_hint()
var is_shown = DataSaver.get_value(section, key, false)
if not is_shown: show_hint()
func _notification(what: int) -> void:

View file

@ -2,7 +2,7 @@ extends Control
class_name BookmarkUI
@export var gate_events: GateEvents
@export var image: TextureRect
@export var icon: TextureRect
@export var title: Label
@export var button: Button
@export var button_special: Button
@ -23,7 +23,7 @@ func fill(gate: Gate, special: bool = false) -> void:
url = gate.url
title.text = "Unnamed" if gate.title.is_empty() else gate.title
image.texture = FileTools.load_external_tex(gate.image)
icon.texture = FileTools.load_external_tex(gate.icon)
func on_pressed() -> void:

View file

@ -29,8 +29,7 @@ func scale_content() -> void:
func set_initial_screen() -> void:
var last_screen = DataSaver.get_value("settings", "last_screen")
if last_screen == null: last_screen = 0
var last_screen = DataSaver.get_value("settings", "last_screen", 0)
DisplayServer.window_set_current_screen(last_screen)
Debug.logclr("Initial screen: %d" % [last_screen], Debug.SILENT_CLR)

View file

@ -18,6 +18,7 @@ func _ready() -> void:
gate_events.search.connect(func(_query): hide_buttons())
gate_events.exit_gate.connect(hide_buttons)
gate_events.gate_info_loaded.connect(update_info)
gate_events.gate_icon_loaded.connect(update_info)
gate_events.gate_image_loaded.connect(update_info)

View file

@ -1,23 +1,30 @@
extends Control
class_name SearchResult
const KEY_URL = "url"
const KEY_TITLE = "title"
const KEY_DESCRIPTION = "description"
const KEY_ICON = "icon"
const KEY_IMAGE = "image"
@export var gate_events: GateEvents
@export var url: Label
@export var title: Label
@export var description: RichTextLabel
@export var image: TextureRect
@export var icon: TextureRect
func fill(gate: Dictionary) -> void:
if gate == null: return
url.text = gate["url"]
title.text = "Unnamed" if gate["title"].is_empty() else gate["title"]
description.text = gate["description"]
url.text = gate[KEY_URL]
title.text = "Unnamed" if gate[KEY_TITLE].is_empty() else gate[KEY_TITLE]
description.text = gate[KEY_DESCRIPTION]
var image_path = await FileDownloader.download(gate["image"])
image.texture = FileTools.load_external_tex(image_path)
var icon_url = gate[KEY_ICON] if not gate[KEY_ICON].is_empty() else gate[KEY_IMAGE]
var icon_path = await FileDownloader.download(icon_url)
icon.texture = FileTools.load_external_tex(icon_path)
func _on_button_pressed() -> void:

View file

@ -115,6 +115,7 @@ func on_gate_entered() -> void:
func on_gate_error(code: GateEvents.GateError) -> void:
gate_events.download_progress.disconnect(show_progress)
match code:
GateEvents.GateError.NOT_FOUND:
set_progress("Gate not found", ProgressStatus.ERROR)