mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-25 14:17:29 -04:00
gate info
This commit is contained in:
parent
71b8d06c69
commit
a425178538
10 changed files with 177 additions and 72 deletions
|
@ -5,9 +5,9 @@ extends AnimationPlayer
|
|||
|
||||
const RESET := "RESET"
|
||||
const INITIAL := "initial"
|
||||
const FULLSCREEN := "fullscreen"
|
||||
const FOCUSED := "focused"
|
||||
|
||||
var fullscreen := false
|
||||
var focused := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -16,10 +16,10 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func on_ui_mode_changed(mode: UiEvents.UiMode) -> void:
|
||||
if mode == UiEvents.UiMode.INITIAL and fullscreen:
|
||||
fullscreen = false
|
||||
if mode == UiEvents.UiMode.INITIAL and focused:
|
||||
focused = false
|
||||
play(INITIAL)
|
||||
|
||||
if mode == UiEvents.UiMode.FULL_SCREEN and not fullscreen:
|
||||
fullscreen = true
|
||||
play(FULLSCREEN)
|
||||
if mode == UiEvents.UiMode.FOCUSED and not focused:
|
||||
focused = true
|
||||
play(FOCUSED)
|
35
app/scripts/ui/world/foreground.gd
Normal file
35
app/scripts/ui/world/foreground.gd
Normal file
|
@ -0,0 +1,35 @@
|
|||
extends Control
|
||||
|
||||
@export var gate_events: GateEvents
|
||||
@export var ui_events: UiEvents
|
||||
@export var splash_screen: TextureRect
|
||||
@export var vignette_blur: VignetteBlur
|
||||
@export var click_anywhere: Control
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
gate_events.gate_info_loaded.connect(show_thumbnail)
|
||||
gate_events.first_frame.connect(on_first_frame)
|
||||
ui_events.ui_mode_changed.connect(on_ui_mode_changed)
|
||||
vignette_blur.hide()
|
||||
click_anywhere.hide()
|
||||
|
||||
|
||||
func show_thumbnail(gate: Gate, _is_cached: bool) -> void:
|
||||
splash_screen.texture = FileTools.load_external_tex(gate.image)
|
||||
vignette_blur.show()
|
||||
|
||||
|
||||
func on_first_frame() -> void:
|
||||
splash_screen.hide()
|
||||
click_anywhere.show()
|
||||
vignette_blur.gate_started_params()
|
||||
|
||||
|
||||
func on_ui_mode_changed(mode: UiEvents.UiMode) -> void:
|
||||
if mode == UiEvents.UiMode.INITIAL:
|
||||
show()
|
||||
|
||||
if mode == UiEvents.UiMode.FOCUSED:
|
||||
click_anywhere.hide()
|
||||
hide()
|
|
@ -3,15 +3,19 @@ extends Control
|
|||
@export var gate_events: GateEvents
|
||||
|
||||
@export var image: TextureRect
|
||||
@export var title: Label
|
||||
@export var image_darken: Control
|
||||
@export var title: RichTextLabel
|
||||
@export var description: RichTextLabel
|
||||
@export var gate_status: Array[Control]
|
||||
|
||||
var gate: Gate
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
gate_events.gate_info_loaded.connect(display_info)
|
||||
gate_events.first_frame.connect(on_first_frame)
|
||||
gate_events.gate_error.connect(on_gate_error)
|
||||
clear_info()
|
||||
|
||||
|
||||
func display_info(_gate: Gate, _is_cached: bool) -> void:
|
||||
|
@ -19,6 +23,20 @@ func display_info(_gate: Gate, _is_cached: bool) -> void:
|
|||
title.text = "Unnamed" if gate.title.is_empty() else gate.title
|
||||
description.text = "No description" if gate.description.is_empty() else gate.description
|
||||
image.texture = FileTools.load_external_tex(gate.image)
|
||||
if is_instance_valid(image.texture): image_darken.show()
|
||||
|
||||
|
||||
func clear_info() -> void:
|
||||
gate = null
|
||||
title.text = ""
|
||||
description.text = ""
|
||||
image.texture = null
|
||||
image_darken.hide()
|
||||
|
||||
|
||||
func on_first_frame() -> void:
|
||||
for node in gate_status:
|
||||
node.hide()
|
||||
|
||||
|
||||
func on_gate_error(_code: GateEvents.GateError) -> void:
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
extends TextureRect
|
||||
class_name SplashScreen
|
||||
|
||||
@export var gate_events: GateEvents
|
||||
@export var command_events: CommandEvents
|
||||
@export var ui_events: UiEvents
|
||||
@export var render_result: RenderResult
|
||||
|
||||
|
||||
func _ready():
|
||||
gate_events.gate_info_loaded.connect(show_thumbnail)
|
||||
#gate_events.first_frame.connect(func(): hide())
|
||||
|
||||
|
||||
func show_thumbnail(gate: Gate, _is_cached: bool) -> void:
|
||||
#if is_cached: return # Resource pack is already downloaded
|
||||
texture = FileTools.load_external_tex(gate.image)
|
17
app/scripts/ui/world/vignette_blur.gd
Normal file
17
app/scripts/ui/world/vignette_blur.gd
Normal file
|
@ -0,0 +1,17 @@
|
|||
extends Control
|
||||
class_name VignetteBlur
|
||||
|
||||
const BLUR_AMOUNT = "BlurAmount"
|
||||
const UV_SCALE = "UVScale"
|
||||
|
||||
@export var blur_amount_game: float
|
||||
@export var uv_scale: Vector2
|
||||
|
||||
|
||||
func gate_started_params() -> void:
|
||||
set_param(BLUR_AMOUNT, blur_amount_game)
|
||||
set_param(UV_SCALE, uv_scale)
|
||||
|
||||
|
||||
func set_param(param: StringName, value: Variant) -> void:
|
||||
(material as ShaderMaterial).set_shader_parameter(param, value)
|
|
@ -5,12 +5,14 @@ extends Control
|
|||
@export var command_events: CommandEvents
|
||||
@export var render_result: RenderResult
|
||||
|
||||
var gate_started: bool
|
||||
var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
|
||||
var _visible: bool = true
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
command_events.set_mouse_mode.connect(set_mouse_mode)
|
||||
gate_events.first_frame.connect(func(): gate_started = true)
|
||||
gate_events.not_responding.connect(func(): set_mouse_mode(Input.MOUSE_MODE_VISIBLE))
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
|
@ -38,9 +40,9 @@ func show_ui() -> void:
|
|||
|
||||
|
||||
func hide_ui() -> void:
|
||||
if not _visible: return
|
||||
if not _visible or not gate_started: return
|
||||
_visible = false
|
||||
|
||||
Input.set_mouse_mode(mouse_mode)
|
||||
ui_events.ui_mode_changed_emit(UiEvents.UiMode.FULL_SCREEN)
|
||||
ui_events.ui_mode_changed_emit(UiEvents.UiMode.FOCUSED)
|
||||
render_result.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue