diff --git a/components/Scenes/FullscreenPanels/CompilingTip.tscn b/components/Scenes/FullscreenPanels/CompilingTip.tscn index 6deaa82..5268b25 100644 --- a/components/Scenes/FullscreenPanels/CompilingTip.tscn +++ b/components/Scenes/FullscreenPanels/CompilingTip.tscn @@ -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") diff --git a/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn b/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn new file mode 100644 index 0000000..1f5b1d6 --- /dev/null +++ b/components/Scenes/FullscreenPanels/SelectInitialFeed.tscn @@ -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 diff --git a/components/Scenes/UI.tscn b/components/Scenes/UI.tscn index e1aaceb..19dec82 100644 --- a/components/Scenes/UI.tscn +++ b/components/Scenes/UI.tscn @@ -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 diff --git a/scripts/Contents/Panels/CompilingTip.gd b/scripts/Contents/Panels/CompilingTip.gd index df6fb32..91f82ba 100644 --- a/scripts/Contents/Panels/CompilingTip.gd +++ b/scripts/Contents/Panels/CompilingTip.gd @@ -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") diff --git a/scripts/Contents/Panels/SelectIntialFeed.gd b/scripts/Contents/Panels/SelectIntialFeed.gd new file mode 100644 index 0000000..4bd7fa9 --- /dev/null +++ b/scripts/Contents/Panels/SelectIntialFeed.gd @@ -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) diff --git a/scripts/Contents/Panels/SelectIntialFeed.gd.uid b/scripts/Contents/Panels/SelectIntialFeed.gd.uid new file mode 100644 index 0000000..b1db71d --- /dev/null +++ b/scripts/Contents/Panels/SelectIntialFeed.gd.uid @@ -0,0 +1 @@ +uid://d02nijqx4oagh diff --git a/scripts/Statemachine/UIState.gd b/scripts/Statemachine/UIState.gd index b721b87..4e57884 100644 --- a/scripts/Statemachine/UIState.gd +++ b/scripts/Statemachine/UIState.gd @@ -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): diff --git a/scripts/Tools/Managers/ComponentManager.gd b/scripts/Tools/Managers/ComponentManager.gd index befb310..ac842b3 100644 --- a/scripts/Tools/Managers/ComponentManager.gd +++ b/scripts/Tools/Managers/ComponentManager.gd @@ -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: