Testing chip bar
This commit is contained in:
@@ -303,7 +303,7 @@ offset_bottom = 26.0
|
|||||||
size_flags_horizontal = 8
|
size_flags_horizontal = 8
|
||||||
texture = SubResource("AtlasTexture_3wejr")
|
texture = SubResource("AtlasTexture_3wejr")
|
||||||
|
|
||||||
[node name="Items" type="HBoxContainer" parent="UIBase/UnitPanel/TextureRect" unique_id=828992814]
|
[node name="UnitLevel" type="HBoxContainer" parent="UIBase/UnitPanel/TextureRect" unique_id=828992814]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
@@ -315,16 +315,17 @@ offset_top = -20.0
|
|||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="Spacer" type="Control" parent="UIBase/UnitPanel/TextureRect/Items" unique_id=1068603879]
|
[node name="Spacer" type="Control" parent="UIBase/UnitPanel/TextureRect/UnitLevel" unique_id=1068603879]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="Label" type="TextureRect" parent="UIBase/UnitPanel/TextureRect/Items" unique_id=1299333906]
|
[node name="Label" type="TextureRect" parent="UIBase/UnitPanel/TextureRect/UnitLevel" unique_id=1299333906]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 8
|
size_flags_vertical = 8
|
||||||
texture = SubResource("AtlasTexture_uh1k2")
|
texture = SubResource("AtlasTexture_uh1k2")
|
||||||
|
|
||||||
[node name="StylizedNumberDisplay" parent="UIBase/UnitPanel/TextureRect/Items" unique_id=702997768 instance=ExtResource("5_55shj")]
|
[node name="LevelNumber" parent="UIBase/UnitPanel/TextureRect/UnitLevel" unique_id=702997768 instance=ExtResource("5_55shj")]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
sprite_sheet = SubResource("AtlasTexture_yayqj")
|
sprite_sheet = SubResource("AtlasTexture_yayqj")
|
||||||
number_sprite_width = 27
|
number_sprite_width = 27
|
||||||
@@ -333,7 +334,7 @@ value = 12
|
|||||||
|
|
||||||
[node name="UnitHealth" type="HBoxContainer" parent="UIBase/UnitPanel" unique_id=53239936]
|
[node name="UnitHealth" type="HBoxContainer" parent="UIBase/UnitPanel" unique_id=53239936]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 1.0
|
offset_left = -102.0
|
||||||
offset_top = 103.0
|
offset_top = 103.0
|
||||||
offset_right = 225.0
|
offset_right = 225.0
|
||||||
offset_bottom = 131.0
|
offset_bottom = 131.0
|
||||||
@@ -415,3 +416,17 @@ size_flags_vertical = 0
|
|||||||
sprite_sheet = SubResource("AtlasTexture_ox7qj")
|
sprite_sheet = SubResource("AtlasTexture_ox7qj")
|
||||||
number_sprite_width = 13
|
number_sprite_width = 13
|
||||||
number_sprite_height = 15
|
number_sprite_height = 15
|
||||||
|
|
||||||
|
[node name="UnitName" type="RichTextLabel" parent="UIBase/UnitPanel" unique_id=1945794101]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 69.0
|
||||||
|
offset_top = 51.0
|
||||||
|
offset_right = 258.0
|
||||||
|
offset_bottom = 66.0
|
||||||
|
theme = ExtResource("1_2ro41")
|
||||||
|
theme_override_font_sizes/normal_font_size = 16
|
||||||
|
theme_override_font_sizes/bold_font_size = 16
|
||||||
|
bbcode_enabled = true
|
||||||
|
scroll_active = false
|
||||||
|
text_direction = 2
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://cmh4lphvboggy" path="res://scripts/battle/deployed_units/deployed_unit.gd" id="1_cq4v0"]
|
[ext_resource type="Script" uid="uid://cmh4lphvboggy" path="res://scripts/battle/deployed_units/deployed_unit.gd" id="1_cq4v0"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cw5su6lignryo" path="res://assets/sprites/flag.png" id="2_fhs1y"]
|
[ext_resource type="Texture2D" uid="uid://cw5su6lignryo" path="res://assets/sprites/flag.png" id="2_fhs1y"]
|
||||||
[ext_resource type="Shader" uid="uid://bd8ki8xwym5nc" path="res://shaders/chroma_key.gdshader" id="3_fhs1y"]
|
[ext_resource type="Shader" uid="uid://bd8ki8xwym5nc" path="res://shaders/chroma_key.gdshader" id="3_fhs1y"]
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_on614"]
|
[sub_resource type="GDScript" id="GDScript_on614"]
|
||||||
resource_name = "UnitSelectorHandler"
|
resource_name = "UnitSelectorHandler"
|
||||||
script/source = "extends ColorRect
|
script/source = "extends ColorRect
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"down",
|
"name": &"down",
|
||||||
"speed": 8.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@@ -118,7 +118,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"idle",
|
"name": &"idle",
|
||||||
"speed": 8.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@@ -135,7 +135,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"left",
|
"name": &"left",
|
||||||
"speed": 8.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@@ -152,7 +152,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"right",
|
"name": &"right",
|
||||||
"speed": 8.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [{
|
"frames": [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
@@ -169,7 +169,7 @@ animations = [{
|
|||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": &"up",
|
"name": &"up",
|
||||||
"speed": 8.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ metadata/_custom_type_script = "uid://d37ulss2k0bq5"
|
|||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_nc6h6"]
|
[sub_resource type="Resource" id="Resource_nc6h6"]
|
||||||
script = ExtResource("5_rqhbp")
|
script = ExtResource("5_rqhbp")
|
||||||
max_hp = 20
|
max_hp = 156
|
||||||
metadata/_custom_type_script = "uid://cydoey8a8nmb8"
|
metadata/_custom_type_script = "uid://cydoey8a8nmb8"
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ func _pressed() -> void:
|
|||||||
|
|
||||||
var player_unit: Unit = LILY_CHILD.duplicate(true)
|
var player_unit: Unit = LILY_CHILD.duplicate(true)
|
||||||
player_unit.allegiance = PLAYER_ALLEGIANCE
|
player_unit.allegiance = PLAYER_ALLEGIANCE
|
||||||
|
player_unit.stats.level = 68
|
||||||
combat_map.deploy_unit(player_unit, Vector2i(3, 3))
|
combat_map.deploy_unit(player_unit, Vector2i(3, 3))
|
||||||
|
|
||||||
var enemy_unit: Unit = LILY_CHILD.duplicate(true)
|
var enemy_unit: Unit = LILY_CHILD.duplicate(true)
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ signal fight_confirmed(proposal: CombatProposal)
|
|||||||
signal fight_cancelled
|
signal fight_cancelled
|
||||||
|
|
||||||
@onready var unit_panel: Control = %UnitPanel
|
@onready var unit_panel: Control = %UnitPanel
|
||||||
|
@onready var unit_name_label: RichTextLabel = %UnitName
|
||||||
|
@onready var level_number: StylizedNumberDisplay = %LevelNumber
|
||||||
@onready var health_chip_bar: ChipBar = %HealthChipBar
|
@onready var health_chip_bar: ChipBar = %HealthChipBar
|
||||||
@onready var health_number: StylizedNumberDisplay = %HealthNumber
|
@onready var health_number: StylizedNumberDisplay = %HealthNumber
|
||||||
@onready var sp_chip_bar: ChipBar = %SPChipBar
|
@onready var sp_chip_bar: ChipBar = %SPChipBar
|
||||||
@@ -82,6 +84,8 @@ func _on_unit_selected_changed(deployed: DeployedUnit, selected: bool) -> void:
|
|||||||
|
|
||||||
func _refresh_unit_panel() -> void:
|
func _refresh_unit_panel() -> void:
|
||||||
var stats := _selected_unit.current_stats
|
var stats := _selected_unit.current_stats
|
||||||
|
unit_name_label.text = "[b]%s[/b]" % _selected_unit.unit.info.name
|
||||||
|
level_number.value = stats.level
|
||||||
health_chip_bar.max_value = stats.max_hp
|
health_chip_bar.max_value = stats.max_hp
|
||||||
health_chip_bar.value = stats.current_hp
|
health_chip_bar.value = stats.current_hp
|
||||||
health_number.value = stats.current_hp
|
health_number.value = stats.current_hp
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ var lck: int:
|
|||||||
get: return unit_stats.lck
|
get: return unit_stats.lck
|
||||||
var mov: int:
|
var mov: int:
|
||||||
get: return unit_stats.mov
|
get: return unit_stats.mov
|
||||||
|
var level: int:
|
||||||
|
get: return unit_stats.level
|
||||||
|
|
||||||
static func from_unit_stats(source: UnitStats) -> DeployedUnitStats:
|
static func from_unit_stats(source: UnitStats) -> DeployedUnitStats:
|
||||||
var stats := DeployedUnitStats.new()
|
var stats := DeployedUnitStats.new()
|
||||||
|
|||||||
@@ -38,10 +38,11 @@ func _refresh() -> void:
|
|||||||
var chip_width := filled_chip_texture.get_width()
|
var chip_width := filled_chip_texture.get_width()
|
||||||
_container.custom_minimum_size.x = chip_width * max_chips_per_row
|
_container.custom_minimum_size.x = chip_width * max_chips_per_row
|
||||||
|
|
||||||
|
var empty_count := max_value - value
|
||||||
for i in max_value:
|
for i in max_value:
|
||||||
var tex_rect := TextureRect.new()
|
var tex_rect := TextureRect.new()
|
||||||
if i < value:
|
if i < empty_count:
|
||||||
tex_rect.texture = filled_chip_texture
|
|
||||||
else:
|
|
||||||
tex_rect.texture = empty_chip_texture
|
tex_rect.texture = empty_chip_texture
|
||||||
|
else:
|
||||||
|
tex_rect.texture = filled_chip_texture
|
||||||
_container.add_child(tex_rect)
|
_container.add_child(tex_rect)
|
||||||
|
|||||||
@@ -13,3 +13,6 @@ class_name UnitStats extends Resource
|
|||||||
@export var eva: int = 1
|
@export var eva: int = 1
|
||||||
@export var lck: int = 1
|
@export var lck: int = 1
|
||||||
@export var mov: int = 3
|
@export var mov: int = 3
|
||||||
|
|
||||||
|
@export var level: int = 1
|
||||||
|
@export var experience: int = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user