objetos raros, objetos decorativos rompibles
This commit is contained in:
1 parent
827e16cf50
commit
66f4d8b33b
55 files changed
+4793
-163
No files matched your search
@@ -32,7 +32,7 @@ func _ready() -> void:
|
||||
if player_ref.is_node_ready():
|
||||
var data: Resource = player_ref.get("character_data") as Resource
|
||||
if data != null:
|
||||
_on_health_changed(int(player_ref.get("current_health")), int(data.get("max_health")))
|
||||
_on_health_changed(int(player_ref.get("current_health")), int(player_ref.call("get_max_health")))
|
||||
|
||||
|
||||
## Muestra segundos solo para efectos temporales; dano indica hasta recibir un golpe.
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
extends CanvasLayer
|
||||
|
||||
## Salida minima de los escenarios de prueba. No es un menu de pausa ni guardado.
|
||||
## Salida minima de los escenarios de prueba. Abandonar no confirma los raros encontrados.
|
||||
## Se usa una escena compartida para que el boton se pueda editar visualmente.
|
||||
const MENU_PATH: String = "res://ui/menu/main_menu.tscn"
|
||||
var _leaving: bool = false
|
||||
var _notice_seconds: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$Overlay/Menu.pressed.connect(return_to_menu)
|
||||
# No referencia LevelRoot por tipo: esta escena se precarga desde esa clase.
|
||||
var level: Node = get_parent()
|
||||
if level.has_signal("progress_notice"):
|
||||
level.connect("progress_notice", _show_notice)
|
||||
if level.has_signal("rare_items_changed"):
|
||||
level.connect("rare_items_changed", _refresh_pending)
|
||||
_refresh_pending()
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
@@ -34,3 +42,23 @@ func _change_scene() -> void:
|
||||
if error != OK:
|
||||
_leaving = false
|
||||
push_error("No se pudo volver al menu: " + error_string(error))
|
||||
|
||||
|
||||
func _refresh_pending() -> void:
|
||||
var level: Node = get_parent()
|
||||
var count: int = int(level.call("get_pending_rare_count")) if level.has_method("get_pending_rare_count") else 0
|
||||
$Overlay/Pending.text = "RAROS PENDIENTES: %d\nCompleta el nivel para guardarlos" % count
|
||||
$Overlay/Pending.visible = count > 0
|
||||
|
||||
|
||||
func _show_notice(message: String) -> void:
|
||||
$Overlay/Notice.text = message
|
||||
$Overlay/Notice.show()
|
||||
_notice_seconds = 8.0
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if _notice_seconds > 0.0:
|
||||
_notice_seconds -= delta
|
||||
if _notice_seconds <= 0.0:
|
||||
$Overlay/Notice.hide()
|
||||
@@ -30,3 +30,41 @@ offset_bottom = 76.0
|
||||
grow_horizontal = 0
|
||||
focus_mode = 0
|
||||
text = "MENU"
|
||||
|
||||
|
||||
[node name="Pending" type="Label" parent="Overlay"]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -330.0
|
||||
offset_top = 88.0
|
||||
offset_right = -16.0
|
||||
offset_bottom = 150.0
|
||||
grow_horizontal = 0
|
||||
mouse_filter = 2
|
||||
theme_override_colors/font_color = Color(1, 0.8, 0.35, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/shadow_offset_x = 2
|
||||
theme_override_constants/shadow_offset_y = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
horizontal_alignment = 2
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Notice" type="Label" parent="Overlay"]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchor_left = 0.2
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.8
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -32.0
|
||||
offset_bottom = 48.0
|
||||
mouse_filter = 2
|
||||
theme_override_colors/font_color = Color(1, 0.9, 0.55, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/shadow_offset_x = 2
|
||||
theme_override_constants/shadow_offset_y = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 3
|
||||
+19
-3
@@ -1,6 +1,6 @@
|
||||
extends Control
|
||||
|
||||
## Menu provisional sin seleccion de personaje, progreso ni lista manual de niveles.
|
||||
## Menu provisional, coleccion persistente y selector de niveles sin lista manual.
|
||||
## Solo descubre escenas directamente dentro de levels, nunca sus subcarpetas.
|
||||
const LEVEL_DIRECTORY: String = "res://levels"
|
||||
|
||||
@@ -10,6 +10,8 @@ const LEVEL_DIRECTORY: String = "res://levels"
|
||||
@onready var level_list: VBoxContainer = $Margin/Layout/Levels/Scroll/LevelList
|
||||
@onready var empty_label: Label = $Margin/Layout/Levels/Empty
|
||||
@onready var play_button: Button = $Margin/Layout/Home/Play
|
||||
@onready var inventory_panel: VBoxContainer = $Margin/Layout/RareInventory
|
||||
@onready var inventory_button: Button = $Margin/Layout/Home/RareItems
|
||||
@onready var quit_button: Button = $Margin/Layout/Home/Quit
|
||||
@onready var back_button: Button = $Margin/Layout/Levels/Back
|
||||
@onready var error_label: Label = $Margin/Layout/Error
|
||||
@@ -24,6 +26,8 @@ func _ready() -> void:
|
||||
set_process(false)
|
||||
play_button.pressed.connect(_show_levels)
|
||||
back_button.pressed.connect(_show_home)
|
||||
inventory_button.pressed.connect(_show_inventory)
|
||||
inventory_panel.connect("back_requested", _show_home)
|
||||
quit_button.pressed.connect(_quit_game)
|
||||
# En web no se puede cerrar la pestana desde el juego.
|
||||
quit_button.visible = not OS.has_feature("web")
|
||||
@@ -54,6 +58,7 @@ static func level_label(path: String) -> String:
|
||||
func _show_home() -> void:
|
||||
if not _loading_path.is_empty():
|
||||
return
|
||||
inventory_panel.hide()
|
||||
home_panel.show()
|
||||
levels_panel.hide()
|
||||
loading_panel.hide()
|
||||
@@ -81,6 +86,7 @@ func _show_levels() -> void:
|
||||
button.pressed.connect(_load_level.bind(path))
|
||||
level_list.add_child(button)
|
||||
empty_label.visible = paths.is_empty()
|
||||
inventory_panel.hide()
|
||||
home_panel.hide()
|
||||
levels_panel.show()
|
||||
error_label.hide()
|
||||
@@ -91,6 +97,16 @@ func _show_levels() -> void:
|
||||
back_button.grab_focus()
|
||||
|
||||
|
||||
func _show_inventory() -> void:
|
||||
if not _loading_path.is_empty():
|
||||
return
|
||||
home_panel.hide()
|
||||
levels_panel.hide()
|
||||
error_label.hide()
|
||||
title_label.text = "OBJETOS RAROS"
|
||||
inventory_panel.call("show_collection")
|
||||
|
||||
|
||||
## La pantalla de carga real no introduce otros diez segundos artificiales.
|
||||
func _load_level(path: String) -> void:
|
||||
if not _loading_path.is_empty():
|
||||
@@ -142,14 +158,14 @@ func _show_load_error(message: String) -> void:
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and _loading_path.is_empty() and levels_panel.visible:
|
||||
if event.is_action_pressed("ui_cancel") and _loading_path.is_empty() and (levels_panel.visible or inventory_panel.visible):
|
||||
_show_home()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
if what == NOTIFICATION_WM_GO_BACK_REQUEST and is_node_ready() and _loading_path.is_empty():
|
||||
if levels_panel.visible:
|
||||
if levels_panel.visible or inventory_panel.visible:
|
||||
_show_home()
|
||||
else:
|
||||
_quit_game()
|
||||
|
||||
+12
-1
@@ -1,8 +1,10 @@
|
||||
[gd_scene load_steps=3 format=3]
|
||||
[gd_scene load_steps=4 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/menu/main_menu.gd" id="script"]
|
||||
[ext_resource type="Theme" path="res://ui/menu/menu_theme.tres" id="theme"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://ui/menu/rare_inventory.tscn" id="inventory"]
|
||||
|
||||
[node name="MainMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
@@ -58,6 +60,11 @@ custom_minimum_size = Vector2(0, 64)
|
||||
layout_mode = 2
|
||||
text = "JUGAR"
|
||||
|
||||
[node name="RareItems" type="Button" parent="Margin/Layout/Home"]
|
||||
custom_minimum_size = Vector2(0, 64)
|
||||
layout_mode = 2
|
||||
text = "OBJETOS RAROS"
|
||||
|
||||
[node name="Quit" type="Button" parent="Margin/Layout/Home"]
|
||||
custom_minimum_size = Vector2(0, 64)
|
||||
layout_mode = 2
|
||||
@@ -92,6 +99,10 @@ custom_minimum_size = Vector2(0, 64)
|
||||
layout_mode = 2
|
||||
text = "VOLVER"
|
||||
|
||||
[node name="RareInventory" parent="Margin/Layout" instance=ExtResource("inventory")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Error" type="Label" parent="Margin/Layout"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
extends VBoxContainer
|
||||
|
||||
## Vista de la coleccion permanente. No equipa, consume ni modifica los objetos.
|
||||
## Las tarjetas se crean desde el catalogo del perfil, no desde una segunda lista.
|
||||
signal back_requested
|
||||
const ITEM_CARD: PackedScene = preload("res://ui/menu/rare_item_card.tscn")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$Back.pressed.connect(func() -> void: back_requested.emit())
|
||||
|
||||
|
||||
func show_collection() -> void:
|
||||
for child: Node in $Scroll/Items.get_children():
|
||||
$Scroll/Items.remove_child(child)
|
||||
child.queue_free()
|
||||
var progress: PlayerProgressStore = get_node_or_null("/root/PlayerProgress") as PlayerProgressStore
|
||||
if progress == null:
|
||||
$Status.text = "No se encontro el perfil de objetos raros."
|
||||
$Status.show()
|
||||
show()
|
||||
return
|
||||
var owned_count: int = 0
|
||||
var items: Array[RareItemData] = progress.get_items()
|
||||
for item: RareItemData in items:
|
||||
var owned: bool = progress.has_item(item.id)
|
||||
if owned:
|
||||
owned_count += 1
|
||||
var card: PanelContainer = ITEM_CARD.instantiate() as PanelContainer
|
||||
$Scroll/Items.add_child(card)
|
||||
var icon: TextureRect = card.get_node("Margin/Row/Icon") as TextureRect
|
||||
icon.texture = item.icon
|
||||
icon.modulate = Color.WHITE if owned else Color(0.45, 0.45, 0.45)
|
||||
(card.get_node("Margin/Row/Text/Name") as Label).text = item.display_name
|
||||
(card.get_node("Margin/Row/Text/State") as Label).text = "CONSEGUIDO - SIEMPRE ACTIVO" if owned else "SIN CONSEGUIR"
|
||||
(card.get_node("Margin/Row/Text/Bonus") as Label).text = item.get_bonus_text()
|
||||
(card.get_node("Margin/Row/Text/Description") as Label).text = item.description
|
||||
$Count.text = "%d / %d objetos conseguidos" % [owned_count, items.size()]
|
||||
$Status.text = progress.last_error
|
||||
$Status.visible = not progress.last_error.is_empty()
|
||||
show()
|
||||
$Back.grab_focus()
|
||||
@@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/menu/rare_inventory.gd" id="script"]
|
||||
|
||||
[node name="RareInventory" type="VBoxContainer"]
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
script = ExtResource("script")
|
||||
|
||||
[node name="Count" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "0 / 1 objetos conseguidos"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Hint" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "Encuentra el objeto y completa el nivel para conservarlo.\nSus mejoras son permanentes, automaticas y compartidas por todos los personajes."
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
follow_focus = true
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="Items" type="VBoxContainer" parent="Scroll"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 16
|
||||
|
||||
[node name="Status" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(1, 0.7, 0.4, 1)
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Back" type="Button" parent="."]
|
||||
custom_minimum_size = Vector2(0, 64)
|
||||
layout_mode = 2
|
||||
text = "VOLVER"
|
||||
@@ -0,0 +1,57 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="panel"]
|
||||
bg_color = Color(0.085, 0.095, 0.12, 1)
|
||||
border_width_left = 3
|
||||
border_width_top = 1
|
||||
border_width_right = 1
|
||||
border_width_bottom = 1
|
||||
border_color = Color(0.65, 0.48, 0.18, 1)
|
||||
|
||||
[node name="RareItemCard" type="PanelContainer"]
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/panel = SubResource("panel")
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="Row" type="HBoxContainer" parent="Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 16
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="Margin/Row"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture_filter = 1
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Text" type="VBoxContainer" parent="Margin/Row"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="Name" type="Label" parent="Margin/Row/Text"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 24
|
||||
autowrap_mode = 3
|
||||
text = "Objeto raro"
|
||||
|
||||
[node name="State" type="Label" parent="Margin/Row/Text"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(1, 0.77, 0.26, 1)
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Bonus" type="Label" parent="Margin/Row/Text"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.7, 1, 0.55, 1)
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="Description" type="Label" parent="Margin/Row/Text"]
|
||||
layout_mode = 2
|
||||
autowrap_mode = 3
|
||||
Reference in new issue
Block a user