1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-02 09:21:54 +08:00

Refactor feed components and UI interactions

- Updated various feed components (Cake, Cupcake, Dango, Donut, FruitPlatter, FruitSalad, Milk, Orange, RedJam, Strawberry, Taco, WaterBottle, Xigua-Full, Xigua-Half, YellowJam) to correct names, textures, and display names.
- Modified MakeFeed scene to improve feed selection and display logic, including the addition of skip functionality.
- Enhanced UIState and EntityBase scripts to manage feed counts and selections more effectively.
- Introduced DirTool for directory operations and improved file loading mechanisms.
- Adjusted TickTool for frame-based operations.
This commit is contained in:
2025-08-27 16:33:21 +08:00
parent a3ae7ae887
commit 9e396eef3d
24 changed files with 164 additions and 162 deletions
+16
View File
@@ -0,0 +1,16 @@
class_name DirTool
static func listdir(path: String) -> Array[String]:
var files: Array[String] = []
var dir = DirAccess.open(path)
if dir:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
if file_name != "." and file_name != "..":
files.append(path + file_name)
file_name = dir.get_next()
dir.list_dir_end()
return files
else:
return []
+12 -3
View File
@@ -21,7 +21,9 @@ enum Entity {
PENARATION_RESISTANCE,
PRICE_REDUCTION,
EXTRA_BULLET_COUNT,
DROP_APPLE_RATE
DROP_APPLE_RATE,
FEED_COUNT_SHOW,
FEED_COUNT_CAN_MADE
}
static var entityMap = {
Entity.MAX_HEALTH: "最大生命值",
@@ -38,7 +40,9 @@ static var entityMap = {
Entity.PENARATION_RESISTANCE: "穿透抗性",
Entity.PRICE_REDUCTION: "饲料降价",
Entity.EXTRA_BULLET_COUNT: "额外子弹",
Entity.DROP_APPLE_RATE: "苹果掉落率"
Entity.DROP_APPLE_RATE: "苹果掉落率",
Entity.FEED_COUNT_SHOW: "可选饲料数量",
Entity.FEED_COUNT_CAN_MADE: "可制作饲料数量"
}
static var entityMapType = {
Entity.MAX_HEALTH: DataType.VALUE,
@@ -55,7 +59,9 @@ static var entityMapType = {
Entity.PENARATION_RESISTANCE: DataType.PERCENT,
Entity.PRICE_REDUCTION: DataType.PERCENT,
Entity.EXTRA_BULLET_COUNT: DataType.VALUE,
Entity.DROP_APPLE_RATE: DataType.PERCENT
Entity.DROP_APPLE_RATE: DataType.PERCENT,
Entity.FEED_COUNT_SHOW: DataType.VALUE,
Entity.FEED_COUNT_CAN_MADE: DataType.VALUE
}
static var entityApplier = {
Entity.MAX_HEALTH: func(entity, value):
@@ -64,6 +70,9 @@ static var entityApplier = {
Entity.EXTRA_APPLE_MAX: func(entity, value):
entity.inventoryMax[ItemStore.ItemType.APPLE] += value
,
Entity.EXTRA_BULLET_COUNT: func(entity, value):
entity.fields[Entity.OFFSET_SHOOT] += value * 5
,
}
enum Bullet {
+4 -1
View File
@@ -1,4 +1,7 @@
class_name TickTool
static func millseconds(ms: int):
return await WorldManager.tree.create_timer(ms / 1000.0).timeout
return await WorldManager.tree.create_timer(ms / 1000.0).timeout
static func frame(count: int = 1):
for i in range(count):
await WorldManager.tree.physics_frame