Skip to content

Commit

Permalink
player profile: minor redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Oct 11, 2024
1 parent 2acf5cd commit 8cf0784
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 81 deletions.
10 changes: 10 additions & 0 deletions game/src/tests/tests.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ static func create_mock_team() -> Team:
team.lineup_player_ids.append(player.id)

return team


static func create_mock_player() -> Player:
var player: Player = Player.new()

player.name = "Mock"
player.surname = "Player"
player.nr = 1

return player
33 changes: 17 additions & 16 deletions game/src/ui_components/player_profile/player_profile.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ const ColorLabelScene: PackedScene = preload("res://src/ui_components/color_labe

var player: Player

@onready var info: Control = $Info
@onready var attributes: Control = $Attributes

@onready var player_name: Label = $Info/Name
@onready var pos: Label = $Info/Position
@onready var alt_pos: Label = $Info/AltPosition
@onready var age: Label = $Info/Age
@onready var foot: Label = $Info/Foot
@onready var nationality: Label = $Info/Nationality
@onready var team: Label = $Info/Team
@onready var nr: Label = $Info/Nr
@onready var attributes_average: Label = $Info/AttributesAverage
@onready var prestige: Label = $Info/Prestige
@onready var price: Label = $Info/Price
@onready var goals: Label = $History/Goals
@onready var info: Control = $Main/Info
@onready var attributes: Control = $Main/Attributes

@onready var player_name: Label = $Main/Info/Name
@onready var pos: Label = $Main/Info/Position
@onready var alt_pos: Label = $Main/Info/AltPosition
@onready var age: Label = $Main/Info/Age
@onready var foot: Label = $Main/Info/Foot
@onready var nationality: Label = $Main/Info/Nationality
@onready var team: Label = $Main/Info/Team
@onready var nr: Label = $Main/Info/Nr
@onready var attributes_average: Label = $Main/Info/AttributesAverage
@onready var prestige: Label = $Main/Info/Prestige
@onready var price: Label = $Main/Info/Price
@onready var goals: Label = $Main/History/Goals


func _ready() -> void:
# setup automatically, if run in editor and is run by 'Run current scene'
if OS.has_feature("editor") and get_parent() == get_tree().root:
set_player(Global.team.players[0])
set_player(Tests.create_mock_player())


func set_player(_player: Player) -> void:
Expand Down
141 changes: 76 additions & 65 deletions game/src/ui_components/player_profile/player_profile.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -9,148 +9,159 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("1")
script = ExtResource("2")
metadata/_edit_use_anchors_ = true

[node name="Attributes" type="HBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 10
alignment = 1

[node name="Goalkeeper" type="GridContainer" parent="Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Physical" type="GridContainer" parent="Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Mental" type="GridContainer" parent="Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Technical" type="GridContainer" parent="Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="History" type="GridContainer" parent="."]
layout_mode = 2
columns = 2

[node name="GoalsLabel" type="Label" parent="History"]
[node name="Main" type="HBoxContainer" parent="."]
layout_mode = 2
text = "GOALS"

[node name="Goals" type="Label" parent="History"]
layout_mode = 2
text = "Viustel Hans"
size_flags_vertical = 3
theme_override_constants/separation = 20

[node name="Contract" type="Control" parent="."]
layout_mode = 2

[node name="Info" type="GridContainer" parent="."]
[node name="Info" type="GridContainer" parent="Main"]
layout_mode = 2
columns = 2

[node name="NameLabel" type="Label" parent="Info"]
[node name="NameLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "NAME"

[node name="Name" type="Label" parent="Info"]
[node name="Name" type="Label" parent="Main/Info"]
layout_mode = 2
text = "Viustel Hans"

[node name="PositionLabel" type="Label" parent="Info"]
[node name="PositionLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "POSITION"

[node name="Position" type="Label" parent="Info"]
[node name="Position" type="Label" parent="Main/Info"]
layout_mode = 2
text = "PIVOT"

[node name="AltPositionLabel" type="Label" parent="Info"]
[node name="AltPositionLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "ALT_POSITION"

[node name="AltPosition" type="Label" parent="Info"]
[node name="AltPosition" type="Label" parent="Main/Info"]
layout_mode = 2
text = "PIVOT"

[node name="AgeLabel" type="Label" parent="Info"]
[node name="AgeLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "AGE"

[node name="Age" type="Label" parent="Info"]
[node name="Age" type="Label" parent="Main/Info"]
layout_mode = 2
text = "32"

[node name="FootLabel" type="Label" parent="Info"]
[node name="FootLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "FOOT"

[node name="Foot" type="Label" parent="Info"]
[node name="Foot" type="Label" parent="Main/Info"]
layout_mode = 2
text = "32"

[node name="NationalityLabel" type="Label" parent="Info"]
[node name="NationalityLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "NATIONALITY"

[node name="Nationality" type="Label" parent="Info"]
[node name="Nationality" type="Label" parent="Main/Info"]
layout_mode = 2
text = "Italiana"

[node name="TeamLabel" type="Label" parent="Info"]
[node name="TeamLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "TEAM"

[node name="Team" type="Label" parent="Info"]
[node name="Team" type="Label" parent="Main/Info"]
layout_mode = 2

[node name="NrLabel" type="Label" parent="Info"]
[node name="NrLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "NR"

[node name="Nr" type="Label" parent="Info"]
[node name="Nr" type="Label" parent="Main/Info"]
layout_mode = 2
text = "Bronzolo"

[node name="AttributesAverageLabel" type="Label" parent="Info"]
[node name="AttributesAverageLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "ATTRIBUTES_AVERGE"

[node name="AttributesAverage" type="Label" parent="Info"]
[node name="AttributesAverage" type="Label" parent="Main/Info"]
layout_mode = 2
text = "Bronzolo"

[node name="PrestigeLabel" type="Label" parent="Info"]
[node name="PrestigeLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "PRESTIGE"

[node name="Prestige" type="Label" parent="Info"]
[node name="Prestige" type="Label" parent="Main/Info"]
layout_mode = 2
text = "Bronzolo"

[node name="PriceLabel" type="Label" parent="Info"]
[node name="PriceLabel" type="Label" parent="Main/Info"]
layout_mode = 2
text = "PRICE"

[node name="Price" type="Label" parent="Info"]
[node name="Price" type="Label" parent="Main/Info"]
layout_mode = 2
text = "1234 $"

[node name="VSeparator2" type="VSeparator" parent="Main"]
layout_mode = 2

[node name="History" type="GridContainer" parent="Main"]
layout_mode = 2
columns = 2

[node name="GoalsLabel" type="Label" parent="Main/History"]
layout_mode = 2
text = "GOALS"

[node name="Goals" type="Label" parent="Main/History"]
layout_mode = 2
text = "Viustel Hans"

[node name="VSeparator" type="VSeparator" parent="Main"]
layout_mode = 2

[node name="Attributes" type="HBoxContainer" parent="Main"]
layout_mode = 2
theme_override_constants/separation = 10
alignment = 1

[node name="Goalkeeper" type="GridContainer" parent="Main/Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Physical" type="GridContainer" parent="Main/Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Mental" type="GridContainer" parent="Main/Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Technical" type="GridContainer" parent="Main/Attributes"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
columns = 2

[node name="Buttons" type="HBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 40
alignment = 2
metadata/_edit_use_anchors_ = true

[node name="Close" type="Button" parent="Buttons"]
Expand Down

0 comments on commit 8cf0784

Please sign in to comment.