mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(UI): 重构能量条为垂直样式并调整UI布局
refactor: 修改能量恢复随机范围从0.01-0.15调整为0.01-0.1 style: 更新着色器进度范围提示从0.0-2.0改为-0.0-2.0 feat: 新增垂直颜色条组件和样式资源 chore: 恢复测试波次为普通模式
This commit is contained in:
+36
-31
@@ -1,20 +1,31 @@
|
||||
[gd_scene load_steps=21 format=3 uid="uid://dfwg750a47ggx"]
|
||||
[gd_scene load_steps=24 format=3 uid="uid://dfwg750a47ggx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ofpg5s3j7esv" path="res://components/UI/BossBar.tscn" id="1_2pe58"]
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/UIState.gd" id="1_f00a6"]
|
||||
[ext_resource type="StyleBox" uid="uid://dx0udq8nv2ec0" path="res://styleboxes/topPanel.tres" id="3_kep0k"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbm8l3hr4ihar" path="res://components/UI/ItemShow.tscn" id="3_o2oi4"]
|
||||
[ext_resource type="PackedScene" uid="uid://1n28ji5sl6bx" path="res://components/Scenes/FullscreenPanels/MakeFeed.tscn" id="4_kkki3"]
|
||||
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="5_widd7"]
|
||||
[ext_resource type="StyleBox" uid="uid://bsv1daadkv4eq" path="res://styleboxes/topLeftPanel.tres" id="6_8m0pt"]
|
||||
[ext_resource type="StyleBox" uid="uid://8pg3ry3y5wjv" path="res://styleboxes/centerRight.tres" id="5_3hym1"]
|
||||
[ext_resource type="PackedScene" uid="uid://beo6s1kudbbve" path="res://components/Scenes/FullscreenPanels/GameOver.tscn" id="6_10ay6"]
|
||||
[ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="7_2om12"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1ulrvupa76ap" path="res://components/UI/ColorBar.tscn" id="9_44nw8"]
|
||||
[ext_resource type="PackedScene" uid="uid://b07gqo6df0r5y" path="res://components/UI/Variants/VerticalColorBar.tscn" id="8_f4j2b"]
|
||||
[ext_resource type="StyleBox" uid="uid://ddnjus87wwlm8" path="res://styleboxes/leftPanel.tres" id="11_67ghp"]
|
||||
[ext_resource type="PackedScene" uid="uid://cksonrrx38k36" path="res://components/Scenes/FullscreenPanels/Pause.tscn" id="12_jkm6o"]
|
||||
[ext_resource type="PackedScene" uid="uid://dekcqdhrjs07u" path="res://components/Scenes/FullscreenPanels/Weapon.tscn" id="13_bmc24"]
|
||||
[ext_resource type="PackedScene" uid="uid://w2o3klbsssq3" path="res://components/Scenes/FullscreenPanels/Thanks.tscn" id="14_gp8lx"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kp2r0"]
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kgnwf"]
|
||||
bg_color = Color(1, 0, 0, 0.5)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_egr4c"]
|
||||
bg_color = Color(0, 1, 0, 0.5)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1xshu"]
|
||||
bg_color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ri8gw"]
|
||||
content_margin_left = 20.0
|
||||
content_margin_top = 20.0
|
||||
@@ -169,20 +180,28 @@ type = 3
|
||||
[node name="energy" type="PanelContainer" parent="root"]
|
||||
z_index = 1
|
||||
z_as_relative = false
|
||||
custom_minimum_size = Vector2(300, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
offset_left = -3.0
|
||||
offset_top = -3.0
|
||||
offset_right = 97.0
|
||||
offset_bottom = 14.0
|
||||
theme_override_styles/panel = ExtResource("6_8m0pt")
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.4
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.6
|
||||
offset_left = -33.0
|
||||
offset_top = -70.0
|
||||
offset_right = 3.0
|
||||
offset_bottom = 70.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = ExtResource("5_3hym1")
|
||||
|
||||
[node name="container" type="VBoxContainer" parent="root/energy"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
alignment = 1
|
||||
|
||||
[node name="energy" type="HBoxContainer" parent="root/energy/container"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="icon" type="TextureRect" parent="root/energy/container/energy"]
|
||||
custom_minimum_size = Vector2(16, 16)
|
||||
@@ -192,27 +211,14 @@ size_flags_vertical = 4
|
||||
texture = ExtResource("7_2om12")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="energy" type="Label" parent="root/energy/container/energy"]
|
||||
[node name="percent" parent="root/energy/container" instance=ExtResource("8_f4j2b")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("5_widd7")
|
||||
text = "%current%"
|
||||
|
||||
[node name="sep" type="Label" parent="root/energy/container/energy"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("5_widd7")
|
||||
text = "/"
|
||||
|
||||
[node name="energyMax" type="Label" parent="root/energy/container/energy"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("5_widd7")
|
||||
text = "%max%"
|
||||
|
||||
[node name="percent" parent="root/energy/container" instance=ExtResource("9_44nw8")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 5)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
backBox = SubResource("StyleBoxFlat_kp2r0")
|
||||
middleBox1 = SubResource("StyleBoxFlat_kgnwf")
|
||||
middleBox2 = SubResource("StyleBoxFlat_egr4c")
|
||||
frontBox = SubResource("StyleBoxFlat_1xshu")
|
||||
|
||||
[node name="fields" type="PanelContainer" parent="root"]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
@@ -292,9 +298,8 @@ offset_top = 0.0
|
||||
offset_bottom = 0.0
|
||||
|
||||
[node name="GameOver" parent="root/panels" instance=ExtResource("6_10ay6")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_top = 0.0
|
||||
offset_bottom = 0.0
|
||||
|
||||
[node name="Pause" parent="root/panels" instance=ExtResource("12_jkm6o")]
|
||||
visible = false
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://b07gqo6df0r5y"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d1ulrvupa76ap" path="res://components/UI/ColorBar.tscn" id="1_345g7"]
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/Variants/VerticalColorBar.gd" id="2_25su1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b46aq"]
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jm5oe"]
|
||||
bg_color = Color(1, 0, 0, 0.5)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_w7upt"]
|
||||
bg_color = Color(0, 1, 0, 0.5)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_l12vy"]
|
||||
bg_color = Color(1, 1, 1, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[node name="VerticalColorBar" instance=ExtResource("1_345g7")]
|
||||
offset_right = 10.0
|
||||
offset_bottom = 100.0
|
||||
script = ExtResource("2_25su1")
|
||||
backBox = SubResource("StyleBoxFlat_b46aq")
|
||||
middleBox1 = SubResource("StyleBoxFlat_jm5oe")
|
||||
middleBox2 = SubResource("StyleBoxFlat_w7upt")
|
||||
frontBox = SubResource("StyleBoxFlat_l12vy")
|
||||
@@ -17,12 +17,12 @@ static var presetWaves = {
|
||||
create(preload("res://components/Characters/Bear.tscn"), 0, 0, true, 19, INF, 10),
|
||||
],
|
||||
"testBoss": [
|
||||
# create(preload("res://components/Characters/Chick.tscn"), 1, 1, true, 0, INF, 1),
|
||||
# create(preload("res://components/Characters/Bear.tscn"), 1, 1, true, 0, INF, 1),
|
||||
create(preload("res://components/Characters/Chick.tscn"), 1, 1, true, 0, INF, 1),
|
||||
create(preload("res://components/Characters/Bear.tscn"), 1, 1, true, 0, INF, 1),
|
||||
create(preload("res://components/Characters/KukeMC.tscn"), 1, 1, true, 0, INF, 1),
|
||||
]
|
||||
}
|
||||
static var data = presetWaves["testBoss"]
|
||||
static var data = presetWaves["normal"]
|
||||
|
||||
static func create(
|
||||
entity_: PackedScene,
|
||||
|
||||
@@ -156,7 +156,7 @@ func _physics_process(_delta: float) -> void:
|
||||
if (isPlayer() or is_instance_valid(currentFocusedBoss)) and not charginup:
|
||||
ai()
|
||||
move_and_slide()
|
||||
storeEnergy(randf_range(0.01, 0.15) * fields.get(FieldStore.Entity.ENERGY_REGENERATION), true)
|
||||
storeEnergy(randf_range(0.01, 0.1) * fields.get(FieldStore.Entity.ENERGY_REGENERATION), true)
|
||||
trailParticle.emitting = trailing
|
||||
|
||||
# 通用方法
|
||||
|
||||
@@ -2,8 +2,6 @@ extends CanvasLayer
|
||||
class_name UIState
|
||||
|
||||
@onready var items = $"%items"
|
||||
@onready var energyLabel: Label = $"%energy"
|
||||
@onready var energyMaxLabel: Label = $"%energyMax"
|
||||
@onready var fields: VBoxContainer = $"%fields"
|
||||
@onready var fieldsAnimator: AnimationPlayer = $"%fieldsAnimator"
|
||||
|
||||
@@ -21,14 +19,10 @@ func _ready():
|
||||
energyPercent = $"%percent"
|
||||
itemCollect = $"%itemCollect"
|
||||
skillIconContainer = $"%skillContainer"
|
||||
# for i in FieldStore.entityMap:
|
||||
# print(FieldStore.entityMap[i])
|
||||
func _process(_delta):
|
||||
bossbar.visible = !!bossbar.entity
|
||||
func _physics_process(_delta):
|
||||
if is_instance_valid(player):
|
||||
energyLabel.text = "%.2f" % clamp(player.energy, 0, player.fields.get(FieldStore.Entity.MAX_ENERGY))
|
||||
energyMaxLabel.text = "%.1f" % player.fields.get(FieldStore.Entity.MAX_ENERGY)
|
||||
for i in items.get_children():
|
||||
var item = i as ItemShow
|
||||
item.count = player.inventory.get(item.type)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
@tool
|
||||
extends ColorBar
|
||||
class_name VerticalColorBar
|
||||
|
||||
func _draw():
|
||||
draw_style_box(backBox, Rect2(0, 0, size.x, size.y))
|
||||
draw_style_box(middleBox2 if forwardDirection > 0 else middleBox1, Rect2(0, size.y * (1 - getPercent(middleValue)), size.x, size.y * getPercent(middleValue)))
|
||||
draw_style_box(frontBox, Rect2(0, size.y * (1 - getPercent(frontValue)), size.x, size.y * getPercent(frontValue)))
|
||||
@@ -1,5 +1,5 @@
|
||||
shader_type canvas_item;
|
||||
uniform float progress:hint_range(0.0, 2.0, 0.01)=0.5;
|
||||
uniform float progress:hint_range(-0.0, 2.0, 0.01)=0.5;
|
||||
uniform float backAlpha:hint_range(0.0, 1.0, 0.01)=0.25;
|
||||
uniform float edgeHeight:hint_range(0.0, 1.0, 0.01)=0.05;
|
||||
uniform float trailHeight:hint_range(0.0, 1.0, 0.01)=0.3;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
shader_type canvas_item;
|
||||
uniform float progress:hint_range(-0.0, 2.0, 0.01)=0.5;
|
||||
uniform float backAlpha:hint_range(0.0, 1.0, 0.01)=0.25;
|
||||
uniform float edgeHeight:hint_range(0.0, 1.0, 0.01)=0.05;
|
||||
uniform float trailHeight:hint_range(0.0, 1.0, 0.01)=0.3;
|
||||
uniform float trailAlpha:hint_range(0.0, 1.0, 0.01)=0.5;
|
||||
void fragment() {
|
||||
if(UV.y>=progress){
|
||||
COLOR.a*=backAlpha;
|
||||
}else if(distance(UV.y,progress)<edgeHeight){
|
||||
COLOR.rgb*=255.0;
|
||||
}else if(progress-UV.y<=trailHeight){
|
||||
COLOR.rgb*=1.0+(trailHeight/(progress-UV.y)-1.0)*trailAlpha;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[gd_resource type="StyleBoxFlat" format=3 uid="uid://8pg3ry3y5wjv"]
|
||||
|
||||
[resource]
|
||||
content_margin_left = 10.0
|
||||
content_margin_top = 10.0
|
||||
content_margin_right = 10.0
|
||||
content_margin_bottom = 10.0
|
||||
bg_color = Color(0, 0, 0, 0.5)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(0, 0, 0, 0.75)
|
||||
corner_radius_top_left = 10
|
||||
corner_radius_bottom_left = 10
|
||||
Reference in New Issue
Block a user