1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-29 23:41:54 +08:00

refactor(资源加载): 将preload替换为load以优化内存使用

统一使用load方法动态加载资源,减少启动时的内存占用
移动Manager类到Tools/Managers目录下
修复DirTool处理remap文件的问题
This commit is contained in:
2025-09-21 12:53:15 +08:00
parent 9f82b7f9fa
commit 4c5842fb9e
30 changed files with 64 additions and 60 deletions
+4 -4
View File
@@ -34,11 +34,11 @@ func attack(type):
if type == 0:
for i in randi_range(8, 16):
fields[FieldStore.Entity.OFFSET_SHOOT] = 25
BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))
BulletBase.generate(load("res://components/Bullets/PurpleCrystal.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))
await TickTool.millseconds(randi_range(10, 50))
elif type == 1 and health < fields[FieldStore.Entity.MAX_HEALTH] * 0.5 and canSummon:
for i in randi_range(1, 2):
var child = EntityBase.generate(preload("res://components/Characters/KukeChild.tscn"), position + MathTool.randv2_range(500))
var child = EntityBase.generate(load("res://components/Characters/KukeChild.tscn"), position + MathTool.randv2_range(500))
child.currentFocusedBoss = currentFocusedBoss
child.masterMine = self
elif type == 2:
@@ -47,7 +47,7 @@ func attack(type):
for bulletIndex in countOfBullet:
for branchIndex in countOfBranch:
fields[FieldStore.Entity.OFFSET_SHOOT] = 0
BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(360.0 / countOfBullet * bulletIndex + 360.0 / countOfBranch * branchIndex))
BulletBase.generate(load("res://components/Bullets/PurpleCrystal.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(360.0 / countOfBullet * bulletIndex + 360.0 / countOfBranch * branchIndex))
await TickTool.millseconds(100)
elif type == 3:
BulletBase.generate(preload("res://components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))
BulletBase.generate(load("res://components/Bullets/BossAttack/KukeMC/HeavyCrystal.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))