Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dev_adri
Browse files Browse the repository at this point in the history
  • Loading branch information
SeindElBardo committed Oct 7, 2021
2 parents 9b50313 + bf218d5 commit f966f39
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 151 deletions.
Binary file added assets/prototipos/elementos/items/helmet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 22 additions & 62 deletions real_deal/scenes/menu/Inventory.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=3 format=2]

[ext_resource path="res://assets/sprites/cards_ilustrations/ilustration_placeholder.png" type="Texture" id=1]
[ext_resource path="res://assets/prototipos/personaje/Prototipo Final/lateral_izq.png" type="Texture" id=2]
[ext_resource path="res://real_deal/scripts/menu/Inventory.gd" type="Script" id=3]

Expand Down Expand Up @@ -48,6 +47,7 @@ margin_right = 188.0
margin_bottom = 400.0

[node name="Background" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo"]
show_behind_parent = true
margin_top = 94.0
margin_right = 188.0
margin_bottom = 305.0
Expand All @@ -58,64 +58,27 @@ size_flags_stretch_ratio = 0.0
texture = ExtResource( 2 )
stretch_mode = 4

[node name="ItemsIzq" type="HBoxContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo"]
margin_top = 115.0
[node name="MarginContainer" type="MarginContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo"]
margin_right = 188.0
margin_bottom = 285.0
size_flags_vertical = 4
margin_bottom = 400.0

[node name="Items" type="GridContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsIzq"]
margin_right = 60.0
margin_bottom = 170.0
custom_constants/vseparation = 10

[node name="TextureRect2" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsIzq/Items"]
margin_right = 60.0
margin_bottom = 50.0
texture = ExtResource( 1 )

[node name="TextureRect4" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsIzq/Items"]
margin_top = 60.0
margin_right = 60.0
margin_bottom = 110.0
texture = ExtResource( 1 )

[node name="TextureRect3" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsIzq/Items"]
margin_top = 120.0
margin_right = 60.0
margin_bottom = 170.0
texture = ExtResource( 1 )

[node name="ItemsDrch" type="HBoxContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo"]
margin_top = 115.0
[node name="ItemsContainer" type="HBoxContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo/MarginContainer"]
margin_top = 200.0
margin_right = 188.0
margin_bottom = 285.0
size_flags_vertical = 4
size_flags_stretch_ratio = 0.0
alignment = 2
margin_bottom = 200.0
size_flags_horizontal = 3
size_flags_vertical = 6
alignment = 1

[node name="Items" type="GridContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsDrch"]
margin_left = 128.0
margin_right = 188.0
margin_bottom = 170.0
custom_constants/vseparation = 10

[node name="TextureRect" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsDrch/Items"]
margin_right = 60.0
margin_bottom = 50.0
texture = ExtResource( 1 )

[node name="TextureRect2" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsDrch/Items"]
margin_top = 60.0
margin_right = 60.0
margin_bottom = 110.0
texture = ExtResource( 1 )

[node name="TextureRect3" type="TextureRect" parent="Container/TabContainer/PanelPJ/HBox/Equipo/ItemsDrch/Items"]
margin_top = 120.0
margin_right = 60.0
margin_bottom = 170.0
texture = ExtResource( 1 )
[node name="Items" type="GridContainer" parent="Container/TabContainer/PanelPJ/HBox/Equipo/MarginContainer/ItemsContainer"]
margin_left = 94.0
margin_right = 94.0
custom_constants/vseparation = 150
custom_constants/hseparation = 90
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}

[node name="VSeparator" type="VSeparator" parent="Container/TabContainer/PanelPJ/HBox"]
margin_left = 203.0
Expand All @@ -136,16 +99,13 @@ size_flags_horizontal = 5
size_flags_vertical = 5
alignment = 1

[node name="Items" type="CenterContainer" parent="Container/TabContainer/PanelPJ/HBox/Stats/VBox"]
[node name="ItemsCenter" type="MarginContainer" parent="Container/TabContainer/PanelPJ/HBox/Stats/VBox"]
margin_top = 191.0
margin_right = 94.0
margin_bottom = 191.0
size_flags_horizontal = 5
size_flags_vertical = 5

[node name="Grid" type="GridContainer" parent="Container/TabContainer/PanelPJ/HBox/Stats/VBox/Items"]
margin_left = 47.0
margin_right = 47.0
[node name="Grid" type="GridContainer" parent="Container/TabContainer/PanelPJ/HBox/Stats/VBox/ItemsCenter"]
margin_right = 94.0
custom_constants/vseparation = 0
custom_constants/hseparation = 20
columns = 6
Expand Down
17 changes: 10 additions & 7 deletions real_deal/scenes/utils/Item.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,24 @@ __meta__ = {
}

[node name="Menu" type="NinePatchRect" parent="."]
visible = false
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ItemList" type="ItemList" parent="Menu"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 100.0
margin_bottom = 9.0
[node name="CanvasLayer" type="CanvasLayer" parent="Menu"]
layer = 2

[node name="ItemList" type="ItemList" parent="Menu/CanvasLayer"]
visible = false
margin_left = 512.0
margin_top = 300.0
margin_right = 619.0
margin_bottom = 309.0
rect_clip_content = false
size_flags_horizontal = 2
custom_constants/vseparation = 5
auto_height = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="item_activated" from="Menu/ItemList" to="." method="_on_ItemList_item_activated"]
[connection signal="item_activated" from="Menu/CanvasLayer/ItemList" to="." method="_on_ItemList_item_activated"]
2 changes: 1 addition & 1 deletion real_deal/scripts/menu/CartaMazo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends Control

var card_database = load("res://real_deal/scripts/utils/CardsDatabase.gd").DATA

signal a_coleccion;
# signal a_coleccion;
var card_name;


Expand Down
147 changes: 101 additions & 46 deletions real_deal/scripts/menu/Inventory.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,153 @@ extends CanvasLayer

onready var Item = preload("res://real_deal/scenes/utils/Item.tscn")

var player_equipped = PlayerManager.equipped_items

# Called when the node enters the scene tree for the first time.
func _ready():
#### TAB PERSONALIZACIÓN ####
self.init_tab_personalizacion();
self.init_tab_personalizacion()
#### TAB MAZO ####
self.init_tab_mazo();
self.init_tab_mazo()


func draw_equipped_items():
""" Dibuja los objetos equipados
"""
print("draw-equipped")
var equipo_node = $Container/TabContainer/PanelPJ/HBox/Equipo
self.player_equipped = PlayerManager.equipped_items
for n in equipo_node.get_node("MarginContainer/ItemsContainer/Items").get_children():
equipo_node.get_node("MarginContainer/ItemsContainer/Items").remove_child(n)
n.queue_free()

for item in self.player_equipped:
# Rellenamos con los items del jugador
var itemNode = Item.instance()
itemNode.init_item(item)
itemNode.connect("is_used", self, "redraw_inventory")
itemNode.connect("is_equipment", self, "draw_equipped_items")
equipo_node.get_node("MarginContainer/ItemsContainer/Items").add_child(itemNode)

var item_count = equipo_node.get_node("MarginContainer/ItemsContainer/Items").get_child_count()
while item_count == 0 or item_count < 4:
# Rellenamos con casillas vacías
var itemNode = Item.instance()
itemNode.connect("is_used", self, "redraw_inventory")
itemNode.connect("is_equipment", self, "draw_equipped_items")
equipo_node.get_node("MarginContainer/ItemsContainer/Items").add_child(itemNode)
item_count += 1


func redraw_inventory():
""" Redibuja los objetos del inventario
"""
print("draw-inventory")
var stats_node = $Container/TabContainer/PanelPJ/HBox/Stats
for node in stats_node.get_node("VBox/ItemsCenter/Grid").get_children():
stats_node.get_node("VBox/ItemsCenter/Grid").remove_child(node)
node.queue_free()

for item in PlayerManager.inventory.get_items():
# Rellenamos con los items del jugador
var itemNode = Item.instance()
itemNode.init_item(item)
itemNode.connect("is_used", self, "redraw_inventory")
itemNode.connect("is_equipment", self, "draw_equipped_items")
stats_node.get_node("VBox/ItemsCenter/Grid").add_child(itemNode)

var item_count = stats_node.get_node("VBox/ItemsCenter/Grid").get_child_count()
while item_count == 0 or item_count % 12 != 0:
# Rellenamos con casillas vacías
var itemNode = Item.instance()
itemNode.connect("is_used", self, "redraw_inventory")
itemNode.connect("is_equipment", self, "draw_equipped_items")
stats_node.get_node("VBox/ItemsCenter/Grid").add_child(itemNode);
item_count += 1


func init_tab_personalizacion(items=[]):
""" Inicializa las dimensiones y cosas correspondientes al tab
de personalización.
"""
# Establece tamaños, ya que dependen de los padres.
var panel_node = $Container/TabContainer/PanelPJ;
var equipo_node = $Container/TabContainer/PanelPJ/HBox/Equipo;
var stats_node = $Container/TabContainer/PanelPJ/HBox/Stats;
var panel_node = $Container/TabContainer/PanelPJ
var equipo_node = $Container/TabContainer/PanelPJ/HBox/Equipo
var stats_node = $Container/TabContainer/PanelPJ/HBox/Stats

# Contenedores principales
equipo_node.rect_min_size = Vector2(panel_node.get_size().x*0.3, equipo_node.get_size().y);
stats_node.rect_min_size = Vector2(panel_node.get_size().x*0.65, stats_node.get_size().y);
equipo_node.rect_min_size = Vector2(panel_node.get_size().x*0.3, equipo_node.get_size().y)
stats_node.rect_min_size = Vector2(panel_node.get_size().x*0.65, stats_node.get_size().y)

# Contenedor equipo
# Contenedor objetos equipados
self.draw_equipped_items()

equipo_node.get_node("MarginContainer").add_constant_override("margin_left", 50)
equipo_node.get_node("MarginContainer").add_constant_override("margin_top", 50)
equipo_node.get_node("MarginContainer").add_constant_override("margin_right", 0)
########################

# Contenedor items
# Iteramos por los objetos del jugador
var player_items = PlayerManager.inventory.get_items()
for item in player_items:
# Rellenamos con los items del jugador
var itemNode = Item.instance()
itemNode.init_item(item)
stats_node.get_node("VBox/Items/Grid").add_child(itemNode);
self.redraw_inventory()

var item_count = stats_node.get_node("VBox/Items/Grid").get_child_count()
while item_count == 0 or item_count % 12 != 0:
# Rellenamos con casillas vacías
var itemNode = Item.instance()
stats_node.get_node("VBox/Items/Grid").add_child(itemNode);
item_count += 1
stats_node.get_node("VBox/ItemsCenter/Grid").add_constant_override("hseparation", 20)
stats_node.get_node("VBox/ItemsCenter/Grid").add_constant_override("vseparation", 20)

stats_node.get_node("VBox/Items/Grid").add_constant_override("hseparation", 90)
stats_node.get_node("VBox/Items/Grid").add_constant_override("vseparation", 90)
stats_node.get_node("VBox/ItemsCenter").rect_min_size.y = stats_node.rect_min_size.y/2
stats_node.get_node("VBox/ItemsCenter").rect_min_size.x = stats_node.rect_min_size.x
stats_node.get_node("VBox/ItemsCenter").add_constant_override("margin_left", 50)
stats_node.get_node("VBox/ItemsCenter").add_constant_override("margin_top", 50)
########################

# Contenedor estadísticas
stats_node.get_node("VBox/Stats/Text").text = "AAAA CHUGUENÑAAAA CHIBABA ULIASNDJADjaiDISAD";

stats_node.get_node("VBox/Items").rect_min_size.y = stats_node.rect_min_size.y/2;
stats_node.get_node("VBox/Stats").rect_min_size.y = stats_node.rect_min_size.y/2;
stats_node.get_node("VBox/Stats/Text").text = "AAAA CHUGUENÑAAAA CHIBABA ULIASNDJADjaiDISAD"
stats_node.get_node("VBox/Stats").rect_min_size.y = stats_node.rect_min_size.y/2
#########################


func create_node_collection(card_name: String):
var inst = load("res://real_deal/scenes/menu/CartaColeccion.tscn").instance();
inst.init_image(card_name);
inst.connect("a_mazo", self, "_on_from_collection_to_deck");
return inst;
var inst = load("res://real_deal/scenes/menu/CartaColeccion.tscn").instance()
inst.init_image(card_name)
inst.connect("a_mazo", self, "_on_from_collection_to_deck")
return inst


func create_node_deck(card_name: String):
var inst = load("res://real_deal/scenes/menu/CartaMazo.tscn").instance();
inst.init_image(card_name);
return inst;
var inst = load("res://real_deal/scenes/menu/CartaMazo.tscn").instance()
inst.init_image(card_name)
return inst


func init_tab_mazo(coleccion=[], cartas=[]):
""" Inicializa las dimensiones y cosas correspondientes al tab
de edición de mazo.
"""
# Establece tamaños, ya que dependen de los padres.
var mazo_node = $Container/TabContainer/Mazo;
var coleccion_node = $Container/TabContainer/Mazo/VBox/HBoxCartas/Coleccion;
var cartas_node = $Container/TabContainer/Mazo/VBox/HBoxCartas/Cartas;
var mazo_node = $Container/TabContainer/Mazo
var coleccion_node = $Container/TabContainer/Mazo/VBox/HBoxCartas/Coleccion
var cartas_node = $Container/TabContainer/Mazo/VBox/HBoxCartas/Cartas
# Contenedores principales
$Container/TabContainer/Mazo/VBox/HBoxCartas.rect_min_size.y = mazo_node.get_size().y*0.9;
$Container/TabContainer/Mazo/VBox/HBoxCartas.rect_min_size.y = mazo_node.get_size().y*0.9
# Contenedor coleción cartas
coleccion_node.rect_min_size = Vector2(mazo_node.get_size().x*0.6, coleccion_node.get_size().y);
coleccion_node.get_node("ScrollContainer").rect_min_size.x = coleccion_node.get_size().x;
coleccion_node.rect_min_size = Vector2(mazo_node.get_size().x*0.6, coleccion_node.get_size().y)
coleccion_node.get_node("ScrollContainer").rect_min_size.x = coleccion_node.get_size().x

# Contenedor cartas equipadas
cartas_node.rect_min_size = Vector2(mazo_node.get_size().x*0.3, cartas_node.get_size().y);
cartas_node.rect_min_size = Vector2(mazo_node.get_size().x*0.3, cartas_node.get_size().y)
for k in PlayerManager.deck:
PlayerManager.card_collection[k] -= 1; # Se reduce el nº de cartas disponibles
PlayerManager.card_collection[k] -= 1 # Se reduce el nº de cartas disponibles
cartas_node.get_node(
"ScrollContainer/Grid"
).add_child(create_node_deck(k));
).add_child(create_node_deck(k))

# Cartas de la colleccion
for k in PlayerManager.card_collection.keys():
coleccion_node.get_node(
"ScrollContainer/CenterGrid/Grid"
).add_child(create_node_collection(k));
).add_child(create_node_collection(k))

cartas_node.get_node("ScrollContainer/Grid").rect_min_size.x = cartas_node.get_size().x;
cartas_node.get_node("ScrollContainer/Grid").rect_min_size.x = cartas_node.get_size().x


func _on_from_collection_to_deck(card_name):
Expand All @@ -118,10 +173,10 @@ func _on_Aceptar_pressed():
# y nos quedamos con sus nombres/identificadores.

# Y cerramos el menú
queue_free();
queue_free()


func _on_Cerrar_pressed():
""" Cerrar el desplegable sin guardar ningún cambio en el mazo
"""
queue_free();
queue_free()
Loading

0 comments on commit f966f39

Please sign in to comment.