1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat: 添加局外养成系统和游戏结束面板改进

添加新的物品类型紫水晶和钻石
实现局外属性升级系统
改进游戏结束面板的返回和退出功能
添加新的UI组件用于显示属性和物品
更新游戏规则和存储系统以支持局外养成
This commit is contained in:
2026-05-04 08:52:20 +08:00
parent e53af2a163
commit e1c017bf3a
17 changed files with 434 additions and 101 deletions
+33 -4
View File
@@ -7,6 +7,10 @@ class_name StarterPanel
@onready var gamemodeOption: OptionButton = $%gamemodeOption
@onready var useTutorialBtn: Button = $%useTutorialBtn
@onready var upgradeFieldsBox: Control = $%upgradeFields
@onready var crystalShow: ItemShow = $%crystal
@onready var diamondShow: ItemShow = $%diamond
@onready var startSingleplayerBtn: Button = $%startSingleplayerBtn
@onready var startMultiplayerBtn: Button = $%startMultiplayerBtn
@onready var levelShow: Label = $%levelShow
@@ -81,9 +85,6 @@ func startSingleplayerGame():
func _ready():
historyStack = Composables.useHistoryStack(playerNameInput)
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 "跳过"
@@ -134,7 +135,6 @@ func _ready():
setPlayerName(getLast.call(1), newText)
mutexPlayer.rpc(newText)
)
setState(MultiplayerState.ConnectionState.DISCONNECTED)
func _physics_process(_delta):
levelShow.text = "%d ∈ [%d, %d]" % [diffEdit.value, diffEdit.min_value, diffEdit.max_value]
GameRule.difficulty = diffEdit.value
@@ -158,3 +158,32 @@ func getPlayerNames() -> Array[String]:
for i in playersList.get_children():
result.append(i.text)
return result
func beforeOpen(_args: Array = []):
diffEdit.min_value = GameRule.difficultyRange.x
diffEdit.max_value = GameRule.difficultyRange.y
diffEdit.value = GameRule.difficulty
setState(MultiplayerState.ConnectionState.DISCONNECTED)
crystalShow.count = OutGameStorage.inventory[ItemStore.ItemType.CRYSTAL]
diamondShow.count = OutGameStorage.inventory[ItemStore.ItemType.DIAMOND]
for child in upgradeFieldsBox.get_children():
upgradeFieldsBox.remove_child(child)
for field in OutGameStorage.upgradableFieldsAdvance:
var fieldShow = ComponentManager.getUIComponent("FieldShow").instantiate() as FieldShow
fieldShow.cost(ItemStore.ItemType.CRYSTAL, 50)
fieldShow.cost(ItemStore.ItemType.DIAMOND, 1)
fieldShow.upgradable = true
fieldShow.upgradeValue = OutGameStorage.upgradableFieldsAdvance[field]
fieldShow.field = field
fieldShow.value = OutGameStorage.upgradableFieldsValue[field]
fieldShow.showAdvantage = true
fieldShow.upgrade.connect(
func(newValue: float):
OutGameStorage.upgradableFieldsValue[fieldShow.field] = newValue
for index in len(fieldShow.costCounts):
fieldShow.costCounts[index] *= GameRule.outGameUpgradeMultipiler
)
upgradeFieldsBox.add_child(fieldShow)
startSingleplayerBtn.disabled = false