mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
refactor(UI): 调整技能图标布局并优化冷却效果
修改技能图标面板的锚点设置以改善布局 将冷却进度着色器逻辑反转并优化视觉效果 统一材质管理方式,移除重复的材质复制
This commit is contained in:
@@ -4,6 +4,14 @@
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/SkillIcon.gd" id="1_l7say"]
|
||||
[ext_resource type="Texture2D" uid="uid://cp4ypuarjoshp" path="res://resources/skillIcons/purple-crystal.png" id="2_hh1bl"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3fyf3"]
|
||||
shader = ExtResource("1_jaivk")
|
||||
shader_parameter/progress = 0.55
|
||||
shader_parameter/backAlpha = 0.25
|
||||
shader_parameter/edgeHeight = 0.05
|
||||
shader_parameter/trailHeight = 0.3
|
||||
shader_parameter/trailAlpha = 0.5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a60wd"]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
@@ -15,14 +23,8 @@ corner_radius_top_right = 20
|
||||
corner_radius_bottom_right = 20
|
||||
corner_radius_bottom_left = 20
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ew32n"]
|
||||
shader = ExtResource("1_jaivk")
|
||||
shader_parameter/progress = 0.5
|
||||
shader_parameter/backAlpha = 0.25
|
||||
shader_parameter/edgeHeight = 0.05
|
||||
shader_parameter/trailHeight = 0.3
|
||||
|
||||
[node name="SkillIconBase" type="PanelContainer"]
|
||||
material = SubResource("ShaderMaterial_3fyf3")
|
||||
custom_minimum_size = Vector2(40, 40)
|
||||
offset_right = 30.0
|
||||
offset_bottom = 30.0
|
||||
@@ -31,7 +33,7 @@ script = ExtResource("1_l7say")
|
||||
|
||||
[node name="texture" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
material = SubResource("ShaderMaterial_ew32n")
|
||||
z_index = -1
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_hh1bl")
|
||||
expand_mode = 1
|
||||
|
||||
@@ -119,7 +119,6 @@ _data = {
|
||||
}
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_12otr"]
|
||||
content_margin_right = 10.0
|
||||
|
||||
[node name="UI" type="CanvasLayer"]
|
||||
process_mode = 3
|
||||
@@ -252,12 +251,13 @@ libraries = {
|
||||
|
||||
[node name="skills" type="PanelContainer" parent="root"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.97
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_right = 0.97
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -10.0
|
||||
offset_left = 0.399902
|
||||
offset_right = 0.399902
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_12otr")
|
||||
|
||||
@@ -4,11 +4,10 @@ class_name SkillIcon
|
||||
@export var weapon: Weapon = null;
|
||||
|
||||
@onready var textureRect: TextureRect = $"%texture"
|
||||
|
||||
func _ready():
|
||||
textureRect.material = textureRect.material.duplicate()
|
||||
material = material.duplicate()
|
||||
func _physics_process(_delta):
|
||||
if is_instance_valid(weapon):
|
||||
textureRect.texture = weapon.avatarTexture
|
||||
var progress = min(weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown, UIState.player.energy / weapon.needEnergy)
|
||||
textureRect.material.set_shader_parameter("progress", progress)
|
||||
material.set_shader_parameter("progress", progress)
|
||||
|
||||
@@ -5,11 +5,15 @@ 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){
|
||||
if(UV.y>=1.0-progress){
|
||||
if(1.0-progress+trailHeight-UV.y>0.0){
|
||||
float dist=distance(UV.y,1.0-progress);
|
||||
COLOR=vec4(1);
|
||||
COLOR.a=(trailHeight-dist)/trailHeight*trailAlpha;
|
||||
}else{
|
||||
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;
|
||||
}
|
||||
}else if(distance(UV.y,1.0-progress)<edgeHeight){
|
||||
COLOR=vec4(1.0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user