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