mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(UI): 添加教程开关按钮并优化面板控制逻辑
- 在Starter面板中添加新手教程开关按钮 - 为MakeFeed和SelectInitialFeed面板添加class_name - 重构UIState中的输入处理逻辑,修复面板切换问题
This commit is contained in:
@@ -262,6 +262,20 @@ expand_to_text_length = true
|
||||
select_all_on_focus = true
|
||||
virtual_keyboard_type = 7
|
||||
|
||||
[node name="useTutorial" type="HBoxContainer" parent="content/wrapper/wrapper/start/starter/singleplayer/playConfig" index="3" unique_id=2079979053]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="tip" type="Label" parent="content/wrapper/wrapper/start/starter/singleplayer/playConfig/useTutorial" index="0" unique_id=20976924]
|
||||
layout_mode = 2
|
||||
text = "新手教程?"
|
||||
|
||||
[node name="useTutorialBtn" type="Button" parent="content/wrapper/wrapper/start/starter/singleplayer/playConfig/useTutorial" index="1" unique_id=689654160]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "观看"
|
||||
|
||||
[node name="start" type="VBoxContainer" parent="content/wrapper/wrapper/start/starter/singleplayer" index="1" unique_id=1119283819]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@tool
|
||||
extends FullscreenPanelBase
|
||||
class_name MakeFeedPanel
|
||||
|
||||
var selectedCount: int = 0
|
||||
var refreshNeedBaseballCount = 10
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@tool
|
||||
extends FullscreenPanelBase
|
||||
class_name SelectInitialFeedPanel
|
||||
|
||||
@onready var initialFeedSelection: HBoxContainer = $%initialFeedSelection
|
||||
@onready var initialWeaponSelection: HBoxContainer = $%initialWeaponSelection
|
||||
|
||||
@@ -5,6 +5,7 @@ class_name StarterPanel
|
||||
@onready var diffEdit: HSlider = $%diffEdit
|
||||
@onready var playerNameInput: LineEdit = $%playerNameInput
|
||||
@onready var gamemodeOption: OptionButton = $%gamemodeOption
|
||||
@onready var useTutorialBtn: Button = $%useTutorialBtn
|
||||
|
||||
@onready var startSingleplayerBtn: Button = $%startSingleplayerBtn
|
||||
@onready var startMultiplayerBtn: Button = $%startMultiplayerBtn
|
||||
@@ -59,6 +60,7 @@ func rebuildAllPlayers(playerNames: Array[String]):
|
||||
i.queue_free()
|
||||
for i in playerNames:
|
||||
addPlayerName(i)
|
||||
|
||||
@rpc("any_peer")
|
||||
func startMultiplayerGame():
|
||||
MultiplayerState.isMultiplayer = true
|
||||
@@ -81,6 +83,10 @@ func _ready():
|
||||
diffEdit.min_value = GameRule.difficultyRange.x
|
||||
diffEdit.max_value = GameRule.difficultyRange.y
|
||||
diffEdit.value = GameRule.difficulty
|
||||
useTutorialBtn.toggled.connect(
|
||||
func(on: bool):
|
||||
useTutorialBtn.text = "观看" if on else "跳过"
|
||||
)
|
||||
multiplayer.connection_failed.connect(
|
||||
func():
|
||||
setState(MultiplayerState.ConnectionState.DISCONNECTED)
|
||||
|
||||
@@ -43,6 +43,35 @@ func _physics_process(_delta):
|
||||
bossbar.visible = true
|
||||
itemsContainer.visible = true
|
||||
energyContainer.visible = true
|
||||
if Input.is_action_just_pressed("showFields"):
|
||||
for i in fields.get_children():
|
||||
fields.remove_child(i)
|
||||
for i in player.fields:
|
||||
if player.fields[i] == EntityBase.TITLE_FLAG:
|
||||
fields.add_child(QuickUI.graySmallText(i))
|
||||
else:
|
||||
fields.add_child(FieldShow.create(i, player.fields[i], false, player, true))
|
||||
fieldsAnimator.play("show")
|
||||
if Input.is_action_just_released("showFields"):
|
||||
fieldsAnimator.play("hide")
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
if currentPanel:
|
||||
if currentPanel is MakeFeedPanel:
|
||||
currentPanel.skipBtn.pressed.emit()
|
||||
else:
|
||||
closeCurrentPanel()
|
||||
else:
|
||||
setPanel("Pause")
|
||||
if Input.is_action_just_pressed("openWeapon"):
|
||||
var canOpen = true
|
||||
if currentPanel:
|
||||
if currentPanel.name == "Weapon":
|
||||
closeCurrentPanel()
|
||||
canOpen = false
|
||||
elif ["MakeFeed", "GameOver"].has(currentPanel.name):
|
||||
canOpen = false
|
||||
if canOpen:
|
||||
setPanel("Weapon")
|
||||
else:
|
||||
bossbar.visible = false
|
||||
itemsContainer.visible = false
|
||||
@@ -51,33 +80,6 @@ func _physics_process(_delta):
|
||||
WorldManager.rootNode.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
else:
|
||||
WorldManager.rootNode.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
if Input.is_action_just_pressed("showFields"):
|
||||
for i in fields.get_children():
|
||||
fields.remove_child(i)
|
||||
for i in player.fields:
|
||||
if player.fields[i] == EntityBase.TITLE_FLAG:
|
||||
fields.add_child(QuickUI.graySmallText(i))
|
||||
else:
|
||||
fields.add_child(FieldShow.create(i, player.fields[i], false, player, true))
|
||||
fieldsAnimator.play("show")
|
||||
if Input.is_action_just_released("showFields"):
|
||||
fieldsAnimator.play("hide")
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
if currentPanel:
|
||||
if currentPanel.name != "MakeFeed":
|
||||
closeCurrentPanel()
|
||||
else:
|
||||
setPanel("Pause")
|
||||
if Input.is_action_just_pressed("openWeapon"):
|
||||
var canOpen = true
|
||||
if currentPanel:
|
||||
if currentPanel.name == "Weapon":
|
||||
closeCurrentPanel()
|
||||
canOpen = false
|
||||
elif ["MakeFeed", "GameOver"].has(currentPanel.name):
|
||||
canOpen = false
|
||||
if canOpen:
|
||||
setPanel("Weapon")
|
||||
|
||||
static func setPanel(targetName: String = "", args: Array = []):
|
||||
currentPanel = null
|
||||
|
||||
Reference in New Issue
Block a user