use only gate icon, fix emty bookmark icon

This commit is contained in:
Nordup 2025-08-10 15:03:11 +07:00
parent 550f89bcf6
commit 97045e25de
9 changed files with 41 additions and 28 deletions

View file

@ -23,7 +23,11 @@ func fill(gate: Gate, special: bool = false) -> void:
url = gate.url
title.text = "Unnamed" if gate.title.is_empty() else gate.title
icon.texture = FileTools.load_external_tex(gate.icon)
var icon_path = gate.icon
if icon_path.is_empty(): icon_path = await FileDownloader.download(gate.icon_url)
icon.texture = FileTools.load_external_tex(icon_path)
func on_pressed() -> void:

View file

@ -15,6 +15,7 @@ func _ready() -> void:
unstar.visible = false
gate_events.open_gate.connect(show_buttons)
gate_events.open_gate.connect(update_gate_order)
gate_events.search.connect(func(_query): hide_buttons())
gate_events.exit_gate.connect(hide_buttons)
gate_events.gate_info_loaded.connect(update_info)
@ -38,10 +39,13 @@ func hide_buttons() -> void:
gate = null
func update_gate_order(_url: String) -> void:
bookmarks.make_first(_url)
func update_info(_gate: Gate) -> void:
gate = _gate
if bookmarks.gates.has(gate.url):
bookmarks.update(gate)
bookmarks.update(gate)
func _on_star_pressed() -> void:

View file

@ -20,7 +20,7 @@ func _ready() -> void:
root.mouse_filter = Control.MOUSE_FILTER_PASS
await get_tree().create_timer(1.0).timeout
show_onboarding()
#show_onboarding()
func show_onboarding() -> void:

View file

@ -22,8 +22,7 @@ func fill(gate: Dictionary) -> void:
title.text = "Unnamed" if gate[KEY_TITLE].is_empty() else gate[KEY_TITLE]
description.text = gate[KEY_DESCRIPTION]
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)
var icon_path = await FileDownloader.download(gate[KEY_ICON])
icon.texture = FileTools.load_external_tex(icon_path)