1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

feat(UI): 添加波次开始提示并优化提示框功能

- 在Wave.gd中添加波次开始时的UI提示
- 调整UI.tscn中提示框的布局和位置
- 修复TipBox.gd中实例化组件的错误
- 修改UIState.gd中提示框的显示逻辑,支持自动销毁
This commit is contained in:
2026-01-24 15:54:42 +08:00
parent 6be95a5658
commit a6ece59c71
4 changed files with 19 additions and 14 deletions
+2 -1
View File
@@ -286,9 +286,10 @@ theme_override_constants/separation = 10
[node name="tips" type="VBoxContainer" parent="root"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 2
anchors_preset = -1
anchor_top = 1.0
anchor_bottom = 1.0
offset_bottom = -100.0
grow_vertical = 0
[node name="panels" type="Control" parent="root"]
+1
View File
@@ -97,5 +97,6 @@ static func next(waves: Array):
wave = instance_from_id(wave.get_instance_id())
EntityBase.generate(ComponentManager.getCharacter(wave.entity), wave.entityPosition, true, wave.isBoss)
current += 1
UIState.showTip("%d波开始!" % current, true)
static func startWith(wave: int):
return wave - 1
+9 -9
View File
@@ -8,17 +8,17 @@ class_name TipBox
@onready var animator: AnimationPlayer = $%animator
func _ready():
label.text = text
animator.play("show")
label.text = text
animator.play("show")
func _process(_delta):
label.text = text
label.text = text
func destroy():
animator.play("hide")
await animator.animation_finished
queue_free()
animator.play("hide")
await animator.animation_finished
queue_free()
static func create(applyText: String) -> TipBox:
var box = ComponentManager.getUIComponent("TipBox")
box.text = applyText
return box
var box = ComponentManager.getUIComponent("TipBox").instantiate()
box.text = applyText
return box
+7 -4
View File
@@ -1,7 +1,7 @@
extends CanvasLayer
class_name UIState
static var items: PanelContainer
static var items: HBoxContainer
static var fields: VBoxContainer
static var fieldsAnimator: AnimationPlayer
static var player: EntityBase
@@ -20,6 +20,9 @@ func _ready():
itemCollect = $%itemCollect
skillIconContainer = $%skillContainer
tips = $%tips
items = $%items
fields = $%fields
fieldsAnimator = $%fieldsAnimator
setPanel("Starter")
func _process(_delta):
bossbar.visible = !!bossbar.entity
@@ -71,11 +74,11 @@ static func setPanel(targetName: String = "", args: Array = []):
panel.hidePanel()
static func closeCurrentPanel():
setPanel()
static func showTip(text: String, destroyAfter: float = -1):
static func showTip(text: String, destroyAfter: bool = false):
var box = TipBox.create(text)
tips.add_child(box)
if destroyAfter > 0:
await TickTool.millseconds(destroyAfter * 1000)
if destroyAfter:
await TickTool.millseconds(len(text) * 500)
box.destroy()
else:
return box