1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-03 09:51:53 +08:00

feat(UI): 添加初始增益选择面板功能

实现初始增益选择面板的创建和显示逻辑,包括:
- 新增SelectInitialFeed面板场景和脚本
- 修改CompilingTip面板结束后跳转到选择面板
- 在ComponentManager中添加面板管理功能
- 优化UIState的面板加载和切换逻辑
This commit is contained in:
2026-01-30 11:44:42 +08:00
parent 2db1f7ac26
commit 0e4d6e6fe3
8 changed files with 56 additions and 42 deletions
@@ -13,12 +13,12 @@ offset_top = 0.0
offset_bottom = 0.0
script = ExtResource("2_3guax")
[node name="PanelContainer" type="PanelContainer" parent="content/wrapper" index="0"]
[node name="container" type="PanelContainer" parent="content/wrapper" index="0"]
layout_mode = 2
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxEmpty_64ee7")
[node name="TextureRect" type="TextureRect" parent="content/wrapper/PanelContainer" index="0"]
[node name="comic" type="TextureRect" parent="content/wrapper/container" index="0"]
layout_mode = 2
size_flags_vertical = 3
texture = ExtResource("2_64ee7")
@@ -0,0 +1,27 @@
[gd_scene load_steps=3 format=3 uid="uid://db6srdvtd8gfx"]
[ext_resource type="PackedScene" uid="uid://d3qojeqa3difn" path="res://components/Abstracts/FullscreenPanelBase.tscn" id="1_xc345"]
[ext_resource type="Script" uid="uid://d02nijqx4oagh" path="res://scripts/Contents/Panels/SelectIntialFeed.gd" id="2_eugsq"]
[node name="SelectInitialFeed" instance=ExtResource("1_xc345")]
offset_top = 0.0
offset_bottom = 0.0
script = ExtResource("2_eugsq")
[node name="wrapper" parent="content" index="1"]
theme_override_constants/separation = 40
[node name="title" type="Label" parent="content/wrapper" index="0"]
layout_mode = 2
size_flags_horizontal = 4
text = "在游戏开始前,你可以选择一项初始增益。"
[node name="container" type="ScrollContainer" parent="content/wrapper" index="1"]
layout_mode = 2
follow_focus = true
vertical_scroll_mode = 0
[node name="initialFeedSelection" type="HBoxContainer" parent="content/wrapper/container" index="0"]
unique_name_in_owner = true
layout_mode = 2
alignment = 1
+1 -39
View File
@@ -1,20 +1,13 @@
[gd_scene load_steps=26 format=3 uid="uid://dfwg750a47ggx"]
[gd_scene load_steps=19 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" uid="uid://bph6blsdbiklk" 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="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://b07gqo6df0r5y" path="res://components/UI/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"]
[ext_resource type="PackedScene" uid="uid://c0r1i5tdbwljj" path="res://components/Scenes/FullscreenPanels/Starter.tscn" id="14_pjwgj"]
[ext_resource type="PackedScene" uid="uid://dxs5j0km0n2n4" path="res://components/Scenes/FullscreenPanels/CompilingTip.tscn" id="15_scul2"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_12otr"]
@@ -302,34 +295,3 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_lock_ = true
[node name="MakeFeed" parent="root/panels" instance=ExtResource("4_kkki3")]
visible = false
layout_mode = 1
offset_top = 0.0
offset_bottom = 0.0
[node name="GameOver" parent="root/panels" instance=ExtResource("6_10ay6")]
visible = false
layout_mode = 1
[node name="Pause" parent="root/panels" instance=ExtResource("12_jkm6o")]
visible = false
layout_mode = 1
[node name="Weapon" parent="root/panels" instance=ExtResource("13_bmc24")]
visible = false
layout_mode = 1
[node name="Thanks" parent="root/panels" instance=ExtResource("14_gp8lx")]
visible = false
layout_mode = 1
[node name="Starter" parent="root/panels" instance=ExtResource("14_pjwgj")]
visible = false
z_index = 2
layout_mode = 1
[node name="CompilingTip" parent="root/panels" instance=ExtResource("15_scul2")]
visible = false
layout_mode = 1
+2 -1
View File
@@ -9,4 +9,5 @@ func afterOpen(_args: Array = []):
(effect.sounds.get_node("spawn") as AudioStreamPlayer2D).volume_db = - INF
effect.shot()
await TickTool.millseconds(3000)
UIState.closeCurrentPanel()
await TickTool.frame()
UIState.setPanel("SelectInitialFeed")
@@ -0,0 +1,11 @@
@tool
extends FullscreenPanelBase
@onready var initialFeedSelection: HBoxContainer = $%initialFeedSelection
func beforeOpen(_args: Array = []):
for feed in initialFeedSelection.get_children():
feed.queue_free()
for feed in ComponentManager.feeds:
var card = feed.instantiate() as Feed
initialFeedSelection.add_child(card)
@@ -0,0 +1 @@
uid://d02nijqx4oagh
+7
View File
@@ -23,6 +23,11 @@ func _ready():
items = $%items
fields = $%fields
fieldsAnimator = $%fieldsAnimator
await get_tree().process_frame
for panel in ComponentManager.panels:
panel = ComponentManager.getPanel(panel).instantiate() as FullscreenPanelBase
panel.hide()
panels.add_child(panel)
setPanel("Starter")
func _process(_delta):
bossbar.visible = !!bossbar.entity
@@ -72,6 +77,8 @@ static func setPanel(targetName: String = "", args: Array = []):
panel.showPanel(args)
else:
panel.hidePanel()
if !currentPanel:
print("没有叫%s的面板" % targetName)
static func closeCurrentPanel():
setPanel()
static func showTip(text: String, messageType: TipBox.MessageType = TipBox.MessageType.INFO):
@@ -9,6 +9,7 @@ static var summons = {}
static var effects = {}
static var feeds = []
static var obstacles = {}
static var panels = {}
static var uiComponents = {}
static var themes = {}
static var fieldTextures = {}
@@ -29,6 +30,8 @@ static func init():
feeds.append(load(i))
for i in DirTool.listdir("res://components/Obstacles"):
obstacles[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Scenes/FullscreenPanels"):
panels[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/UI"):
uiComponents[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://themes"):
@@ -53,6 +56,8 @@ static func getFeed(i: int) -> PackedScene:
return null
static func getObstacle(t: String) -> PackedScene:
return MathTool.priority(obstacles.get(t, false), load("res://components/Obstacles/%s.tscn" % t))
static func getPanel(t: String) -> PackedScene:
return MathTool.priority(panels.get(t, false), load("res://components/Scenes/FullscreenPanels/%s.tscn" % t))
static func getUIComponent(t: String) -> PackedScene:
return MathTool.priority(uiComponents.get(t, false), load("res://components/UI/%s.tscn" % t))
static func getTheme(t: String) -> Theme: