mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat: 添加暂停面板类名并优化字段显示逻辑
修复TipBox销毁时的动画冲突问题 重构游戏重启逻辑以包含库存保存 移除GameOver面板中的重复库存保存代码 优化UIState中的字段显示控制和提示清除功能
This commit is contained in:
@@ -9,7 +9,5 @@ func beforeOpen(args: Array = []):
|
||||
audio.play()
|
||||
var reasonTemplate = MathTool.randomChoiceFrom(GameRule.deadReasons)
|
||||
deadreason.text = ("[color=gray]" + reasonTemplate + "凶手是[b]%s[/b]的[b]%s[/b]。[/color]") % args
|
||||
for item in OutGameStorage.inventory:
|
||||
OutGameStorage.inventory[item] += UIState.player.inventory[item]
|
||||
func afterOpen(_args: Array = []):
|
||||
gameControl.enable()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@tool
|
||||
extends FullscreenPanelBase
|
||||
class_name PausePanel
|
||||
|
||||
@onready var gameControl: GameControl = $%gameControl
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ func _process(_delta):
|
||||
label.text = text
|
||||
|
||||
func destroy():
|
||||
if animator.is_playing(): return
|
||||
animator.play("hide")
|
||||
await animator.animation_finished
|
||||
queue_free()
|
||||
|
||||
@@ -15,6 +15,8 @@ static var tips: VBoxContainer
|
||||
static var itemsContainer: Control
|
||||
static var energyContainer: Control
|
||||
|
||||
static var showingFields: bool = false
|
||||
|
||||
func _ready():
|
||||
bossbar = $%bossbar
|
||||
panels = $%panels
|
||||
@@ -44,17 +46,22 @@ func _physics_process(_delta):
|
||||
itemsContainer.visible = true
|
||||
energyContainer.visible = true
|
||||
if !fieldsAnimator.is_playing():
|
||||
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 showingFields:
|
||||
if Input.is_action_just_released("showFields") || !(currentPanel is PausePanel):
|
||||
showingFields = false
|
||||
fieldsAnimator.play("hide")
|
||||
else:
|
||||
if Input.is_action_just_pressed("showFields") || currentPanel is PausePanel:
|
||||
showingFields = true
|
||||
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_pressed("pause"):
|
||||
if currentPanel:
|
||||
if currentPanel is MakeFeedPanel:
|
||||
@@ -96,5 +103,10 @@ static func closeCurrentPanel():
|
||||
static func showTip(text: String, messageType: TipBox.MessageType = TipBox.MessageType.INFO):
|
||||
var box = TipBox.create(text, messageType)
|
||||
tips.add_child(box)
|
||||
await box.animator.animation_finished
|
||||
await TickTool.millseconds(500 * len(text))
|
||||
box.destroy()
|
||||
static func clearTips():
|
||||
for child in tips.get_children():
|
||||
if child is TipBox:
|
||||
child.destroy()
|
||||
|
||||
@@ -9,6 +9,9 @@ static func restart(tree: SceneTree):
|
||||
effect.queue_free()
|
||||
for item in tree.get_nodes_in_group("items"):
|
||||
item.queue_free()
|
||||
|
||||
OutGameStorage.saveInventory()
|
||||
CameraManager.shakeStop()
|
||||
WorldManager.timeRestart()
|
||||
|
||||
UIState.setPanel("Starter")
|
||||
|
||||
@@ -19,3 +19,7 @@ static var upgradableFieldsLevel = ArrayTool.fill(upgradableFieldsAdvance, func(
|
||||
static var maxInitialFeedCount: int = 3
|
||||
static var maxInitialWeaponCount: int = 3
|
||||
static var inventory = ArrayTool.fill(upgradableFieldsCost, func(_k): return 0)
|
||||
|
||||
static func saveInventory():
|
||||
for item in OutGameStorage.inventory:
|
||||
OutGameStorage.inventory[item] += UIState.player.inventory[item]
|
||||
|
||||
Reference in New Issue
Block a user