hud 玩家状态 功能

master
chendian 2 years ago
parent 469ab760bb
commit 45436078a0

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://comp54dje0355"
path="res://.godot/imported/player_status_background.png-5644ebc433e0259007ab6bf047c17f10.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_background.png"
dest_files=["res://.godot/imported/player_status_background.png-5644ebc433e0259007ab6bf047c17f10.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://0f3lam5c3k0y"
path="res://.godot/imported/player_status_hp.png-02819a40f14f321ad5477a8f7d52edb7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_hp.png"
dest_files=["res://.godot/imported/player_status_hp.png-02819a40f14f321ad5477a8f7d52edb7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bxrpivq41rp23"
path="res://.godot/imported/player_status_hp_empty.png-5383a3aaf00852977e601542ed12dfe7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_hp_empty.png"
dest_files=["res://.godot/imported/player_status_hp_empty.png-5383a3aaf00852977e601542ed12dfe7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c7jpfbmidpu5c"
path="res://.godot/imported/player_status_mp.png-665bd4e1d5d930efc36d4afc9621d448.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_mp.png"
dest_files=["res://.godot/imported/player_status_mp.png-665bd4e1d5d930efc36d4afc9621d448.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://g1fx6txgghiu"
path="res://.godot/imported/player_status_mp_empty.png-b25dc0e66acd0e43b8cf2a91da0717d7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_mp_empty.png"
dest_files=["res://.godot/imported/player_status_mp_empty.png-b25dc0e66acd0e43b8cf2a91da0717d7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bvuv86ujfaqfx"
path="res://.godot/imported/player_status_mp_sub.png-97f6eacd78be615d6f67522b2ef81539.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_mp_sub.png"
dest_files=["res://.godot/imported/player_status_mp_sub.png-97f6eacd78be615d6f67522b2ef81539.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://g4b4cjfdaxsx"
path="res://.godot/imported/player_status_mp_sub_empty.png-d706c11381c262f25fe60ff3258d7221.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resource/ui/hud/player_status_mp_sub_empty.png"
dest_files=["res://.godot/imported/player_status_mp_sub_empty.png-d706c11381c262f25fe60ff3258d7221.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=0
compress/normal_map=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=false
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

@ -1,14 +1,18 @@
[gd_scene load_steps=17 format=3 uid="uid://126wph4owvoy"]
[gd_scene load_steps=21 format=3 uid="uid://126wph4owvoy"]
[ext_resource type="Texture2D" uid="uid://cwhu1ec03t3c8" path="res://resource/ui/hud/headbar_hp_empty.png" id="1_flgf6"]
[ext_resource type="Script" path="res://script/ui/hud/hud_page.gd" id="1_t7dgf"]
[ext_resource type="Texture2D" uid="uid://b4ly1exl0owck" path="res://resource/ui/hud/headbar_hp.png" id="2_sktwb"]
[ext_resource type="Texture2D" uid="uid://c2cwtc10ine84" path="res://resource/ui/design/hud_design.png" id="2_ouq6l"]
[ext_resource type="Script" path="res://script/ui/hud/headbar_page.gd" id="3_6chl0"]
[ext_resource type="Texture2D" uid="uid://comp54dje0355" path="res://resource/ui/hud/player_status_background.png" id="3_nlb4w"]
[ext_resource type="Script" path="res://script/ui/hud/player_status_item.gd" id="3_uokru"]
[ext_resource type="Script" path="res://script/ui/hud/loading_page.gd" id="4_jqajt"]
[ext_resource type="Texture2D" uid="uid://xogtpwyb862f" path="res://resource/ui/hud/_hud_design.png" id="5_qqrb8"]
[ext_resource type="Texture2D" uid="uid://bxrpivq41rp23" path="res://resource/ui/hud/player_status_hp_empty.png" id="4_wyg3a"]
[ext_resource type="Texture2D" uid="uid://0f3lam5c3k0y" path="res://resource/ui/hud/player_status_hp.png" id="5_b0cyb"]
[ext_resource type="Script" path="res://script/ui/hud/lock_item.gd" id="5_usy8x"]
[ext_resource type="Texture2D" uid="uid://g4b4cjfdaxsx" path="res://resource/ui/hud/player_status_mp_sub_empty.png" id="6_fqaaa"]
[ext_resource type="Texture2D" uid="uid://dx2vp753yvh4y" path="res://render/texture/shape/lock.png" id="6_hmslt"]
[ext_resource type="Script" path="res://script/ui/hud/weapon_item.gd" id="7_3g1k3"]
[ext_resource type="Texture2D" uid="uid://bvuv86ujfaqfx" path="res://resource/ui/hud/player_status_mp_sub.png" id="7_wiq06"]
[ext_resource type="Shader" path="res://render/shader/loading.gdshader" id="9_lv4gd"]
[sub_resource type="Animation" id="Animation_ikdwl"]
@ -88,29 +92,58 @@ script = ExtResource("1_t7dgf")
[node name="HudDesign" type="Sprite2D" parent="HudPage"]
position = Vector2(320, 180)
texture = ExtResource("5_qqrb8")
texture = ExtResource("2_ouq6l")
[node name="PlayerStatusItem" type="Control" parent="HudPage"]
anchors_preset = 0
offset_left = 29.0
offset_top = 29.0
offset_right = 29.0
offset_bottom = 29.0
offset_left = 32.0
offset_top = 32.0
offset_right = 32.0
offset_bottom = 32.0
script = ExtResource("3_uokru")
[node name="Background" type="TextureRect" parent="HudPage/PlayerStatusItem"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -16.0
offset_right = 32.0
offset_bottom = 16.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_nlb4w")
stretch_mode = 2
[node name="HpBar" type="TextureProgressBar" parent="HudPage/PlayerStatusItem"]
visible = false
layout_mode = 0
offset_left = -13.0
offset_top = -13.0
offset_right = 51.0
offset_bottom = 3.0
offset_left = 6.0
offset_top = -10.0
offset_right = 102.0
offset_bottom = 6.0
value = 50.0
texture_under = ExtResource("4_wyg3a")
texture_progress = ExtResource("5_b0cyb")
[node name="MpSubBar" type="TextureProgressBar" parent="HudPage/PlayerStatusItem"]
layout_mode = 0
offset_left = 16.0
offset_right = 112.0
offset_bottom = 16.0
value = 50.0
stretch_margin_left = 10
stretch_margin_top = 10
stretch_margin_right = 10
stretch_margin_bottom = 10
texture_under = ExtResource("1_flgf6")
texture_progress = ExtResource("2_sktwb")
texture_under = ExtResource("6_fqaaa")
texture_progress = ExtResource("7_wiq06")
[node name="MpList" type="HBoxContainer" parent="HudPage/PlayerStatusItem"]
layout_mode = 0
offset_left = 8.0
offset_top = 5.0
offset_right = 48.0
offset_bottom = 12.0
theme_override_constants/separation = -5
[node name="LockItem" type="Control" parent="HudPage"]
anchors_preset = 0

@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://darpu7kmey2vs"]
[ext_resource type="Texture2D" uid="uid://c7jpfbmidpu5c" path="res://resource/ui/hud/player_status_mp.png" id="1_6yn2y"]
[ext_resource type="Script" path="res://script/ui/hud/mp_item_sub.gd" id="2_ps8dg"]
[node name="MpItem" type="TextureRect"]
texture = ExtResource("1_6yn2y")
script = ExtResource("2_ps8dg")

@ -201,6 +201,7 @@ func add_mp(value:float):
character.set_status("mp",mp+mp_add)
character.set_status("mp_sub",0)
else:
character.set_status("mp_sub",mp_sub_max)
character.remove_buff("mp_recover_cd")
character.remove_buff("mp_recover")
else:

@ -38,11 +38,9 @@ func create_character(cfg:CharacterCfg,team:Enum.ETeam,pos:Vector3):
character.set_material(ResourceManager.material_character.duplicate())
character.set_pos(pos)
SignalManager.character_create.emit(character_idx,team,character.ui_pos())
if cfg.type == Enum.ECharacterType.Player:player_id = character_idx
character.init_after()
if cfg.type == Enum.ECharacterType.Player:
player_id = character_idx
func destroy_character(id:int):
if not id in character_map:
return

@ -1,6 +1,6 @@
extends Control
@onready var sub_item_list = [$LockItem,$WeaponItem]
@onready var sub_item_list = [$LockItem,$WeaponItem,$PlayerStatusItem]
func _ready():
SignalManager.character_status_changed.connect(on_character_status_changed)

@ -0,0 +1,8 @@
extends TextureRect
class_name MpItemSub
@onready var mp_icon = preload("res://resource/ui/hud/player_status_mp.png") as Texture2D
@onready var mp_icon_empty = preload("res://resource/ui/hud/player_status_mp_empty.png") as Texture2D
func set_active(is_active:bool):
texture = mp_icon if is_active else mp_icon_empty

@ -0,0 +1,31 @@
extends Control
@onready var mp_scene = preload("res://scene/ui/item/mp_item.tscn")
@onready var hp_bar = $HpBar as TextureProgressBar
@onready var mp_sub_bar = $MpSubBar as TextureProgressBar
@onready var mp_list = $MpList as HBoxContainer
func on_hp_max_changed(value:float):
hp_bar.max_value = value
func on_hp_changed(value:float):
hp_bar.value = value
func on_mp_sub_max_changed(value:float):
mp_sub_bar.max_value = value
func on_mp_sub_changed(value:float):
mp_sub_bar.value = value
func on_mp_max_changed(value:int):
for child in mp_list.get_children():
child.queue_free()
for i in range(value):
var mp_item = mp_scene.instantiate() as MpItemSub
mp_list.add_child(mp_item)
func on_mp_changed(value:int):
for i in range(mp_list.get_child_count()):
var mp_item = mp_list.get_child(i) as MpItemSub
mp_item.set_active(i<value)
Loading…
Cancel
Save