mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
refactor(资源加载): 将preload替换为load以优化内存使用
统一使用load方法动态加载资源,减少启动时的内存占用 移动Manager类到Tools/Managers目录下 修复DirTool处理remap文件的问题
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
[gd_scene load_steps=10 format=3 uid="uid://dmxi1ikn6avig"]
|
[gd_scene load_steps=10 format=3 uid="uid://dmxi1ikn6avig"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/Tools/WorldManager.gd" id="1_lxsxj"]
|
[ext_resource type="Script" path="res://scripts/Tools/Managers/WorldManager.gd" id="1_lxsxj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dfwg750a47ggx" path="res://components/Scenes/UI.tscn" id="2_04cdd"]
|
[ext_resource type="PackedScene" uid="uid://dfwg750a47ggx" path="res://components/Scenes/UI.tscn" id="2_04cdd"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bm7ymrri6pykb" path="res://components/Characters/Rooster.tscn" id="3_5ui6q"]
|
[ext_resource type="PackedScene" uid="uid://bm7ymrri6pykb" path="res://components/Characters/Rooster.tscn" id="3_5ui6q"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c33c8mtm4x3e3" path="res://resources/maps/Galaxy.png" id="4_oy4jj"]
|
[ext_resource type="Texture2D" uid="uid://c33c8mtm4x3e3" path="res://resources/maps/Galaxy.png" id="4_oy4jj"]
|
||||||
[ext_resource type="Script" path="res://scripts/Tools/CameraManager.gd" id="5_mk7bv"]
|
[ext_resource type="Script" path="res://scripts/Tools/Managers/CameraManager.gd" id="5_mk7bv"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_ykpvi"]
|
[sub_resource type="Animation" id="Animation_ykpvi"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ func ai():
|
|||||||
PresetBulletAI.trace(self, tracer.getTrackingAnchor(), clamp(speed / 50 * tracePower, 0, 1))
|
PresetBulletAI.trace(self, tracer.getTrackingAnchor(), clamp(speed / 50 * tracePower, 0, 1))
|
||||||
PresetBulletAI.forward(self, rotation)
|
PresetBulletAI.forward(self, rotation)
|
||||||
func destroy(_b):
|
func destroy(_b):
|
||||||
EffectController.create(preload("res://components/Effects/LGBTBoom.tscn"), position).shot()
|
EffectController.create(load("res://components/Effects/LGBTBoom.tscn"), position).shot()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func ai():
|
|||||||
warn.size = Vector2.ONE * 2 * radius * (timeLived() / countdown)
|
warn.size = Vector2.ONE * 2 * radius * (timeLived() / countdown)
|
||||||
label.text = "NUCLEAR WARNING %.1f" % ((countdown - timeLived()) / 1000)
|
label.text = "NUCLEAR WARNING %.1f" % ((countdown - timeLived()) / 1000)
|
||||||
func destroy(_b):
|
func destroy(_b):
|
||||||
EffectController.create(preload("res://components/Effects/NuclearExplosion.tscn"), global_position).shot()
|
EffectController.create(load("res://components/Effects/NuclearExplosion.tscn"), global_position).shot()
|
||||||
hitbox.disabled = false
|
hitbox.disabled = false
|
||||||
CameraManager.shake(5000, 500, func(_c, t, r): return t * r) # 震屏强度随进度递减
|
CameraManager.shake(5000, 500, func(_c, t, r): return t * r) # 震屏强度随进度递减
|
||||||
await TickTool.frame(5)
|
await TickTool.frame(5)
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ extends BulletBase
|
|||||||
func ai():
|
func ai():
|
||||||
PresetBulletAI.forward(self, rotation)
|
PresetBulletAI.forward(self, rotation)
|
||||||
func destroy(_beacuseMap: bool):
|
func destroy(_beacuseMap: bool):
|
||||||
var eff = EffectController.create(preload("res://components/Effects/PurpleCrystalExplosion.tscn"), global_position)
|
var eff = EffectController.create(load("res://components/Effects/PurpleCrystalExplosion.tscn"), global_position)
|
||||||
eff.rotation = rotation
|
eff.rotation = rotation
|
||||||
eff.shot()
|
eff.shot()
|
||||||
func split(index, total, _last):
|
func split(index, total, _last):
|
||||||
BulletBase.generate(
|
BulletBase.generate(
|
||||||
preload("res://components/Bullets/PurpleCrystal.tscn"),
|
load("res://components/Bullets/PurpleCrystal.tscn"),
|
||||||
launcher,
|
launcher,
|
||||||
position,
|
position,
|
||||||
rotation + deg_to_rad(360 / total * index),
|
rotation + deg_to_rad(360 / total * index),
|
||||||
@@ -17,7 +17,7 @@ func split(index, total, _last):
|
|||||||
)
|
)
|
||||||
func refract(entity, _index, _total, _last):
|
func refract(entity, _index, _total, _last):
|
||||||
BulletBase.generate(
|
BulletBase.generate(
|
||||||
preload("res://components/Bullets/PurpleCrystal.tscn"),
|
load("res://components/Bullets/PurpleCrystal.tscn"),
|
||||||
launcher,
|
launcher,
|
||||||
position,
|
position,
|
||||||
position.angle_to_point(entity.position) if is_instance_valid(entity) else randf_range(0, deg_to_rad(360)),
|
position.angle_to_point(entity.position) if is_instance_valid(entity) else randf_range(0, deg_to_rad(360)),
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func attack(type):
|
|||||||
playSound("attack0")
|
playSound("attack0")
|
||||||
for i in randi_range(20, 30):
|
for i in randi_range(20, 30):
|
||||||
if !is_instance_valid(currentFocusedBoss): return false
|
if !is_instance_valid(currentFocusedBoss): return false
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
|
||||||
bullet.tracer = currentFocusedBoss
|
bullet.tracer = currentFocusedBoss
|
||||||
bullet.position += MathTool.randv2_range(50)
|
bullet.position += MathTool.randv2_range(50)
|
||||||
await TickTool.millseconds(50)
|
await TickTool.millseconds(50)
|
||||||
@@ -48,10 +48,10 @@ func attack(type):
|
|||||||
await sprintTo(currentFocusedBoss.position - Vector2(MathTool.randc_from([-300, 300]), 300), 0.25)
|
await sprintTo(currentFocusedBoss.position - Vector2(MathTool.randc_from([-300, 300]), 300), 0.25)
|
||||||
var count = randi_range(6, 8)
|
var count = randi_range(6, 8)
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/SunDance.tscn"), self, weaponPos, deg_to_rad(360.0 / count * i))
|
BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/SunDance.tscn"), self, weaponPos, deg_to_rad(360.0 / count * i))
|
||||||
elif type == 2:
|
elif type == 2:
|
||||||
for i in range(13):
|
for i in range(13):
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ForeverRainbow.tscn"), self, weaponPos, 0):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/ForeverRainbow.tscn"), self, weaponPos, 0):
|
||||||
bullet.rotation = 360 / 13.0 * i
|
bullet.rotation = 360 / 13.0 * i
|
||||||
elif type == 3:
|
elif type == 3:
|
||||||
if !is_instance_valid(currentFocusedBoss): return false
|
if !is_instance_valid(currentFocusedBoss): return false
|
||||||
@@ -61,7 +61,7 @@ func attack(type):
|
|||||||
currentInvinsible = true
|
currentInvinsible = true
|
||||||
playSound("attack3")
|
playSound("attack3")
|
||||||
await TickTool.millseconds(500)
|
await TickTool.millseconds(500)
|
||||||
BulletBase.generate(preload("res://components/Bullets/BearSprint.tscn"), self, weaponPos, 0)
|
BulletBase.generate(load("res://components/Bullets/BearSprint.tscn"), self, weaponPos, 0)
|
||||||
await trySprint()
|
await trySprint()
|
||||||
sprintParticle.emitting = false
|
sprintParticle.emitting = false
|
||||||
canRunAi = true
|
canRunAi = true
|
||||||
@@ -73,7 +73,7 @@ func attack(type):
|
|||||||
var count = randi_range(8, 12)
|
var count = randi_range(8, 12)
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
if !is_instance_valid(currentFocusedBoss): return false
|
if !is_instance_valid(currentFocusedBoss): return false
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(360.0 / count * i)):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/ArrowSeven.tscn"), self, findWeaponAnchor("normal"), deg_to_rad(360.0 / count * i)):
|
||||||
bullet.tracer = currentFocusedBoss
|
bullet.tracer = currentFocusedBoss
|
||||||
await TickTool.millseconds(830.0 / count)
|
await TickTool.millseconds(830.0 / count)
|
||||||
return false
|
return false
|
||||||
@@ -82,7 +82,7 @@ func attack(type):
|
|||||||
var count = randi_range(20, 30)
|
var count = randi_range(20, 30)
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
if !is_instance_valid(currentFocusedBoss): return false
|
if !is_instance_valid(currentFocusedBoss): return false
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
||||||
bullet.rotation = deg_to_rad(360.0 / count * i)
|
bullet.rotation = deg_to_rad(360.0 / count * i)
|
||||||
await TickTool.millseconds(1670.0 / count)
|
await TickTool.millseconds(1670.0 / count)
|
||||||
return false
|
return false
|
||||||
@@ -90,7 +90,7 @@ func attack(type):
|
|||||||
playSound("attack6")
|
playSound("attack6")
|
||||||
for i in 16:
|
for i in 16:
|
||||||
if !is_instance_valid(currentFocusedBoss): return false
|
if !is_instance_valid(currentFocusedBoss): return false
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
||||||
bullet.position += MathTool.randv2_range(600)
|
bullet.position += MathTool.randv2_range(600)
|
||||||
bullet.look_at(currentFocusedBoss.position + MathTool.randv2_range(50))
|
bullet.look_at(currentFocusedBoss.position + MathTool.randv2_range(50))
|
||||||
await TickTool.millseconds(100)
|
await TickTool.millseconds(100)
|
||||||
@@ -102,7 +102,7 @@ func attack(type):
|
|||||||
if !is_instance_valid(currentFocusedBoss): return false
|
if !is_instance_valid(currentFocusedBoss): return false
|
||||||
playSound("attack7")
|
playSound("attack7")
|
||||||
for i in 16:
|
for i in 16:
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
||||||
bullet.rotation_degrees += initAngle
|
bullet.rotation_degrees += initAngle
|
||||||
bullet.rotation -= angle / 2
|
bullet.rotation -= angle / 2
|
||||||
bullet.rotation += angle / 16 * i
|
bullet.rotation += angle / 16 * i
|
||||||
|
|||||||
@@ -26,19 +26,19 @@ func attack(type):
|
|||||||
if type == 0:
|
if type == 0:
|
||||||
var weaponPos = findWeaponAnchor("normal")
|
var weaponPos = findWeaponAnchor("normal")
|
||||||
for i in randi_range(10, 20):
|
for i in randi_range(10, 20):
|
||||||
BulletBase.generate(preload("res://components/Bullets/Diamond.tscn"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90)))
|
BulletBase.generate(load("res://components/Bullets/Diamond.tscn"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90)))
|
||||||
elif type == 1:
|
elif type == 1:
|
||||||
var laserCount = randi_range(2, 4)
|
var laserCount = randi_range(2, 4)
|
||||||
for i in laserCount:
|
for i in laserCount:
|
||||||
BulletBase.generate(preload("res://components/Bullets/ChickLaser.tscn"), self, texture.global_position, deg_to_rad(360.0 / laserCount * i))
|
BulletBase.generate(load("res://components/Bullets/ChickLaser.tscn"), self, texture.global_position, deg_to_rad(360.0 / laserCount * i))
|
||||||
elif type == 2:
|
elif type == 2:
|
||||||
var weaponPos = findWeaponAnchor("normal")
|
var weaponPos = findWeaponAnchor("normal")
|
||||||
var target = weaponPos.angle_to_point(currentFocusedBoss.position)
|
var target = weaponPos.angle_to_point(currentFocusedBoss.position)
|
||||||
firepot.global_rotation = target
|
firepot.global_rotation = target
|
||||||
firepot.shot()
|
firepot.shot()
|
||||||
BulletBase.generate(preload("res://components/Bullets/FireScan.tscn"), self, weaponPos, target)
|
BulletBase.generate(load("res://components/Bullets/FireScan.tscn"), self, weaponPos, target)
|
||||||
elif type == 3:
|
elif type == 3:
|
||||||
BulletBase.generate(preload("res://components/Bullets/ChickSprint.tscn"), self, position, 0)
|
BulletBase.generate(load("res://components/Bullets/ChickSprint.tscn"), self, position, 0)
|
||||||
trySprint()
|
trySprint()
|
||||||
return true
|
return true
|
||||||
func sprint():
|
func sprint():
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ func attack(type):
|
|||||||
if type == 0:
|
if type == 0:
|
||||||
var weaponPos = findWeaponAnchor("normal")
|
var weaponPos = findWeaponAnchor("normal")
|
||||||
for i in randi_range(1, 4):
|
for i in randi_range(1, 4):
|
||||||
BulletBase.generate(preload("res://components/Bullets/Star.tscn"), self, weaponPos, (currentFocusedBoss.position - position).angle())
|
BulletBase.generate(load("res://components/Bullets/Star.tscn"), self, weaponPos, (currentFocusedBoss.position - position).angle())
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ func ai():
|
|||||||
tryKill()
|
tryKill()
|
||||||
func attack(type):
|
func attack(type):
|
||||||
if type == 0:
|
if type == 0:
|
||||||
BulletBase.generate(preload("res://components/Bullets/PurpleCrystalSmall.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))
|
BulletBase.generate(load("res://components/Bullets/PurpleCrystalSmall.tscn"), self, findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))
|
||||||
await TickTool.millseconds(randi_range(5, 25))
|
await TickTool.millseconds(randi_range(5, 25))
|
||||||
elif type == 1:
|
elif type == 1:
|
||||||
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))
|
||||||
func kill():
|
func kill():
|
||||||
masterMine.tryHeal(100)
|
masterMine.tryHeal(100)
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ func attack(type):
|
|||||||
if type == 0:
|
if type == 0:
|
||||||
for i in randi_range(8, 16):
|
for i in randi_range(8, 16):
|
||||||
fields[FieldStore.Entity.OFFSET_SHOOT] = 25
|
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))
|
await TickTool.millseconds(randi_range(10, 50))
|
||||||
elif type == 1 and health < fields[FieldStore.Entity.MAX_HEALTH] * 0.5 and canSummon:
|
elif type == 1 and health < fields[FieldStore.Entity.MAX_HEALTH] * 0.5 and canSummon:
|
||||||
for i in randi_range(1, 2):
|
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.currentFocusedBoss = currentFocusedBoss
|
||||||
child.masterMine = self
|
child.masterMine = self
|
||||||
elif type == 2:
|
elif type == 2:
|
||||||
@@ -47,7 +47,7 @@ func attack(type):
|
|||||||
for bulletIndex in countOfBullet:
|
for bulletIndex in countOfBullet:
|
||||||
for branchIndex in countOfBranch:
|
for branchIndex in countOfBranch:
|
||||||
fields[FieldStore.Entity.OFFSET_SHOOT] = 0
|
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)
|
await TickTool.millseconds(100)
|
||||||
elif type == 3:
|
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))
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ func _ready():
|
|||||||
refreshNeedBaseballCount *= 1 + randf_range(GameRule.refreshCountIncreasePercent.x, GameRule.refreshCountIncreasePercent.y)
|
refreshNeedBaseballCount *= 1 + randf_range(GameRule.refreshCountIncreasePercent.x, GameRule.refreshCountIncreasePercent.y)
|
||||||
regenerateCards()
|
regenerateCards()
|
||||||
)
|
)
|
||||||
for feedScene in DirTool.listdir("res://components/Feeds/"):
|
for feedScene in DirTool.listdir("res://components/Feeds"):
|
||||||
if feedScene.get_extension() == "remap":
|
|
||||||
feedScene = feedScene.substr(0, len(feedScene) - 6)
|
|
||||||
print("正在从 %s 加载饲料卡" % feedScene)
|
print("正在从 %s 加载饲料卡" % feedScene)
|
||||||
var feed = load(feedScene).instantiate() as Feed
|
var feed = load(feedScene).instantiate() as Feed
|
||||||
feed.selected.connect(
|
feed.selected.connect(
|
||||||
|
|||||||
+10
-10
@@ -10,26 +10,26 @@ var per: int = 0
|
|||||||
|
|
||||||
static var current: int = 0
|
static var current: int = 0
|
||||||
static var WAVE_NORMAL = [
|
static var WAVE_NORMAL = [
|
||||||
Wave.create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
|
Wave.create(load("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
|
||||||
Wave.create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 9, INF, 15),
|
Wave.create(load("res://components/Characters/Chick.tscn"), 0, 0, true, 9, INF, 15),
|
||||||
Wave.create(preload("res://components/Characters/Bear.tscn"), 0, 0, true, 19, INF, 10),
|
Wave.create(load("res://components/Characters/Bear.tscn"), 0, 0, true, 19, INF, 10),
|
||||||
Wave.create(preload("res://components/Characters/KukeMC.tscn"), 0, 0, true, 14, INF, 20),
|
Wave.create(load("res://components/Characters/KukeMC.tscn"), 0, 0, true, 14, INF, 20),
|
||||||
]
|
]
|
||||||
static var WAVE_TESTBOSS_ALL = [
|
static var WAVE_TESTBOSS_ALL = [
|
||||||
Wave.create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 0, INF, 10),
|
Wave.create(load("res://components/Characters/Chick.tscn"), 0, 0, true, 0, INF, 10),
|
||||||
Wave.create(preload("res://components/Characters/KukeMC.tscn"), 0, 0, true, 1, INF, 10),
|
Wave.create(load("res://components/Characters/KukeMC.tscn"), 0, 0, true, 1, INF, 10),
|
||||||
Wave.create(preload("res://components/Characters/Bear.tscn"), 0, 0, true, 2, INF, 10),
|
Wave.create(load("res://components/Characters/Bear.tscn"), 0, 0, true, 2, INF, 10),
|
||||||
]
|
]
|
||||||
static var WAVE_TESTBOSS_KUKE = [
|
static var WAVE_TESTBOSS_KUKE = [
|
||||||
Wave.create(preload("res://components/Characters/KukeMC.tscn"), 0, 0, true, 0, INF, 10),
|
Wave.create(load("res://components/Characters/KukeMC.tscn"), 0, 0, true, 0, INF, 10),
|
||||||
]
|
]
|
||||||
static var WAVE_EMPTY = []
|
static var WAVE_EMPTY = []
|
||||||
static var data = WAVE_NORMAL
|
static var data = WAVE_NORMAL
|
||||||
|
|
||||||
static func customStart():
|
static func customStart():
|
||||||
if false:
|
if false:
|
||||||
var furryr = EntityBase.generate(preload("res://components/Characters/Bear.tscn"), MathTool.randv2_range(500), true, false)
|
var furryr = EntityBase.generate(load("res://components/Characters/Bear.tscn"), MathTool.randv2_range(500), true, false)
|
||||||
var kukemc = EntityBase.generate(preload("res://components/Characters/KukeMC.tscn"), MathTool.randv2_range(500), true, false)
|
var kukemc = EntityBase.generate(load("res://components/Characters/KukeMC.tscn"), MathTool.randv2_range(500), true, false)
|
||||||
furryr.currentFocusedBoss = kukemc
|
furryr.currentFocusedBoss = kukemc
|
||||||
kukemc.currentFocusedBoss = furryr
|
kukemc.currentFocusedBoss = furryr
|
||||||
static func create(
|
static func create(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BigLaser.tscn"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()):
|
for bullet in BulletBase.generate(load("res://components/Bullets/BigLaser.tscn"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()):
|
||||||
var bigLaser: BigLaser = bullet
|
var bigLaser: BigLaser = bullet
|
||||||
bigLaser.dotTime = readStore("time") * 1000
|
bigLaser.dotTime = readStore("time") * 1000
|
||||||
bigLaser.damage = readStore("atk")
|
bigLaser.damage = readStore("atk")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func attack(entity: EntityBase):
|
|||||||
var facingAngle = (get_global_mouse_position() - weaponPos).angle()
|
var facingAngle = (get_global_mouse_position() - weaponPos).angle()
|
||||||
var startAngle = facingAngle - deg_to_rad(readStore("angle") * (readStore("count") / 2))
|
var startAngle = facingAngle - deg_to_rad(readStore("angle") * (readStore("count") / 2))
|
||||||
for i in range(int(readStore("count"))):
|
for i in range(int(readStore("count"))):
|
||||||
for j in BulletBase.generate(preload("res://components/Bullets/LGBTBullet.tscn"), entity, weaponPos, startAngle + deg_to_rad(readStore("angle") * i)):
|
for j in BulletBase.generate(load("res://components/Bullets/LGBTBullet.tscn"), entity, weaponPos, startAngle + deg_to_rad(readStore("angle") * i)):
|
||||||
var bullet: LGBTBullet = j
|
var bullet: LGBTBullet = j
|
||||||
bullet.damage = readStore("atk")
|
bullet.damage = readStore("atk")
|
||||||
bullet.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
bullet.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ func update(to, origin, _entity):
|
|||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for i in BulletBase.generate(preload("res://components/Bullets/Meowmere.tscn"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
for i in BulletBase.generate(load("res://components/Bullets/Meowmere.tscn"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
||||||
i.damage = readStore("atk")
|
i.damage = readStore("atk")
|
||||||
for i in readStore("count"):
|
for i in readStore("count"):
|
||||||
BulletBase.generate(preload("res://components/Bullets/RainbowCat.tscn"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position()))
|
BulletBase.generate(load("res://components/Bullets/RainbowCat.tscn"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position()))
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for j in BulletBase.generate(preload("res://components/Bullets/MushroomPickaxe.tscn"), entity, entity.texture.global_position, weaponPos.angle_to_point(get_global_mouse_position())):
|
for j in BulletBase.generate(load("res://components/Bullets/MushroomPickaxe.tscn"), entity, entity.texture.global_position, weaponPos.angle_to_point(get_global_mouse_position())):
|
||||||
var bullet: MushroomPickaxe = j
|
var bullet: MushroomPickaxe = j
|
||||||
bullet.damage = readStore("atk")
|
bullet.damage = readStore("atk")
|
||||||
bullet.rate = readStore("rate")
|
bullet.rate = readStore("rate")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for j in BulletBase.generate(preload("res://components/Bullets/NuclearBomb.tscn"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
for j in BulletBase.generate(load("res://components/Bullets/NuclearBomb.tscn"), entity, weaponPos, weaponPos.angle_to_point(get_global_mouse_position())):
|
||||||
var bullet: NuclearBomb = j
|
var bullet: NuclearBomb = j
|
||||||
bullet.damage = readStore("atk")
|
bullet.damage = readStore("atk")
|
||||||
bullet.radius = readStore("radius")
|
bullet.radius = readStore("radius")
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for bullet in BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()):
|
for bullet in BulletBase.generate(load("res://components/Bullets/PurpleCrystal.tscn"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle()):
|
||||||
bullet.damage = readStore("atk")
|
bullet.damage = readStore("atk")
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for i in range(int(randi_range(readStore("mincount"), readStore("maxcount")))):
|
for i in range(int(randi_range(readStore("mincount"), readStore("maxcount")))):
|
||||||
for j in BulletBase.generate(preload("res://components/Bullets/VectorStar.tscn"), entity, weaponPos, deg_to_rad(randf_range(0, 360))):
|
for j in BulletBase.generate(load("res://components/Bullets/VectorStar.tscn"), entity, weaponPos, deg_to_rad(randf_range(0, 360))):
|
||||||
var bullet: VectorStar = j
|
var bullet: VectorStar = j
|
||||||
bullet.damage = readStore("atk")
|
bullet.damage = readStore("atk")
|
||||||
bullet.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
bullet.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func _ready():
|
|||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
static func create(spawnDamage: float, spawnCrit: bool, spawnPosition: Vector2, addToWorld: bool = true) -> DamageLabel:
|
static func create(spawnDamage: float, spawnCrit: bool, spawnPosition: Vector2, addToWorld: bool = true) -> DamageLabel:
|
||||||
var instance = preload("res://components/UI/DamageLabel.tscn").instantiate()
|
var instance = load("res://components/UI/DamageLabel.tscn").instantiate()
|
||||||
instance.damage = spawnDamage
|
instance.damage = spawnDamage
|
||||||
instance.crit = spawnCrit
|
instance.crit = spawnCrit
|
||||||
instance.position = spawnPosition
|
instance.position = spawnPosition
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ func _ready():
|
|||||||
UIState.energyPercent.setCurrent(newEnergy)
|
UIState.energyPercent.setCurrent(newEnergy)
|
||||||
)
|
)
|
||||||
for i in weapons:
|
for i in weapons:
|
||||||
var icon: SkillIcon = preload("res://components/Abstracts/SkillIconBase.tscn").instantiate()
|
var icon: SkillIcon = load("res://components/Abstracts/SkillIconBase.tscn").instantiate()
|
||||||
icon.weapon = i
|
icon.weapon = i
|
||||||
UIState.skillIconContainer.add_child(icon)
|
UIState.skillIconContainer.add_child(icon)
|
||||||
else:
|
else:
|
||||||
@@ -266,7 +266,7 @@ func tryAttack(type: int, needChargeUp: bool = false):
|
|||||||
if state:
|
if state:
|
||||||
if needChargeUp:
|
if needChargeUp:
|
||||||
charginup = true
|
charginup = true
|
||||||
await EffectController.create(preload("res://components/Effects/AttackStar.tscn"), damageAnchor.global_position).shot()
|
await EffectController.create(load("res://components/Effects/AttackStar.tscn"), damageAnchor.global_position).shot()
|
||||||
charginup = false
|
charginup = false
|
||||||
if isPlayer():
|
if isPlayer():
|
||||||
if await weapon.tryAttack(self):
|
if await weapon.tryAttack(self):
|
||||||
@@ -317,7 +317,7 @@ func tryDie(by: BulletBase = null):
|
|||||||
if isPlayer():
|
if isPlayer():
|
||||||
if UIState.player == self:
|
if UIState.player == self:
|
||||||
UIState.setPanel("GameOver", [displayName, by.launcher.displayName, by.displayName])
|
UIState.setPanel("GameOver", [displayName, by.launcher.displayName, by.displayName])
|
||||||
EffectController.create(preload("res://components/Effects/DeadBlood.tscn"), texture.global_position).shot()
|
EffectController.create(load("res://components/Effects/DeadBlood.tscn"), texture.global_position).shot()
|
||||||
await die()
|
await die()
|
||||||
died.emit()
|
died.emit()
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func _ready():
|
|||||||
valueLabel.label_settings.font_color = Color(1, 1, 1)
|
valueLabel.label_settings.font_color = Color(1, 1, 1)
|
||||||
|
|
||||||
static func create(newField: FieldStore.Entity, newValue: float, newShowSign: bool, newEntity: EntityBase, newUseViewCast: bool) -> FieldShow:
|
static func create(newField: FieldStore.Entity, newValue: float, newShowSign: bool, newEntity: EntityBase, newUseViewCast: bool) -> FieldShow:
|
||||||
var fieldShow = preload("res://components/UI/FieldShow.tscn").instantiate()
|
var fieldShow = load("res://components/UI/FieldShow.tscn").instantiate()
|
||||||
fieldShow.field = newField
|
fieldShow.field = newField
|
||||||
fieldShow.value = newValue
|
fieldShow.value = newValue
|
||||||
fieldShow.showSign = newShowSign
|
fieldShow.showSign = newShowSign
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ static func generate(
|
|||||||
spawnPosition: Vector2,
|
spawnPosition: Vector2,
|
||||||
addToWorld: bool = true
|
addToWorld: bool = true
|
||||||
):
|
):
|
||||||
var instance: ItemDropped = preload("res://components/UI/ItemDropped.tscn").instantiate()
|
var instance: ItemDropped = load("res://components/UI/ItemDropped.tscn").instantiate()
|
||||||
instance.item = itemType
|
instance.item = itemType
|
||||||
instance.stackCount = count
|
instance.stackCount = count
|
||||||
instance.position = spawnPosition
|
instance.position = spawnPosition
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func _physics_process(_delta):
|
|||||||
countLabel.text = str(count)
|
countLabel.text = str(count)
|
||||||
|
|
||||||
static func generate(itemType: ItemStore.ItemType, itemCount: int = 1, isAutoFree: bool = false):
|
static func generate(itemType: ItemStore.ItemType, itemCount: int = 1, isAutoFree: bool = false):
|
||||||
var item = preload("res://components/UI/ItemShow.tscn").instantiate()
|
var item = load("res://components/UI/ItemShow.tscn").instantiate()
|
||||||
item.type = itemType
|
item.type = itemType
|
||||||
item.count = itemCount
|
item.count = itemCount
|
||||||
item.autoFree = isAutoFree
|
item.autoFree = isAutoFree
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class_name Feed
|
|||||||
|
|
||||||
signal selected(applied: bool)
|
signal selected(applied: bool)
|
||||||
|
|
||||||
@export var avatarTexture: Texture2D = preload("res://icon.svg")
|
@export var avatarTexture: Texture2D = load("res://icon.svg")
|
||||||
@export var displayName: String = "未命名饲料"
|
@export var displayName: String = "未命名饲料"
|
||||||
@export var quality: FeedName.Quality = FeedName.Quality.COMMON
|
@export var quality: FeedName.Quality = FeedName.Quality.COMMON
|
||||||
@export var topic: FeedName.Topic = FeedName.Topic.SURVIVAL
|
@export var topic: FeedName.Topic = FeedName.Topic.SURVIVAL
|
||||||
@@ -69,7 +69,7 @@ func rebuildInfo():
|
|||||||
noField = false
|
noField = false
|
||||||
var field = fields[i]
|
var field = fields[i]
|
||||||
var value = fieldValues[i]
|
var value = fieldValues[i]
|
||||||
var fieldShow: FieldShow = preload("res://components/UI/FieldShow.tscn").instantiate()
|
var fieldShow: FieldShow = load("res://components/UI/FieldShow.tscn").instantiate()
|
||||||
fieldShow.field = field
|
fieldShow.field = field
|
||||||
fieldShow.value = value
|
fieldShow.value = value
|
||||||
if is_instance_valid(UIState.player):
|
if is_instance_valid(UIState.player):
|
||||||
@@ -82,7 +82,7 @@ func rebuildInfo():
|
|||||||
for i in range(min(costs.size(), costCounts.size())):
|
for i in range(min(costs.size(), costCounts.size())):
|
||||||
var cost = costs[i]
|
var cost = costs[i]
|
||||||
var count = costCounts[i]
|
var count = costCounts[i]
|
||||||
var costShow: ItemShow = preload("res://components/UI/ItemShow.tscn").instantiate()
|
var costShow: ItemShow = load("res://components/UI/ItemShow.tscn").instantiate()
|
||||||
costShow.type = cost
|
costShow.type = cost
|
||||||
costShow.count = int(count * multipiler())
|
costShow.count = int(count * multipiler())
|
||||||
costsBox.add_child(costShow)
|
costsBox.add_child(costShow)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
extends PanelContainer
|
extends PanelContainer
|
||||||
class_name Weapon
|
class_name Weapon
|
||||||
|
|
||||||
@export var avatarTexture: Texture2D = preload("res://icon.svg")
|
@export var avatarTexture: Texture2D = load("res://icon.svg")
|
||||||
@export var displayName: String = "未命名饲料"
|
@export var displayName: String = "未命名饲料"
|
||||||
@export var quality: WeaponName.Quality = WeaponName.Quality.COMMON
|
@export var quality: WeaponName.Quality = WeaponName.Quality.COMMON
|
||||||
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
|
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
|
||||||
|
|||||||
@@ -3,15 +3,18 @@ class_name DirTool
|
|||||||
static func listdir(path: String) -> Array[String]:
|
static func listdir(path: String) -> Array[String]:
|
||||||
var files: Array[String] = []
|
var files: Array[String] = []
|
||||||
var dir = DirAccess.open(path)
|
var dir = DirAccess.open(path)
|
||||||
|
if !path.ends_with("/"):
|
||||||
|
path += "/"
|
||||||
if dir:
|
if dir:
|
||||||
dir.list_dir_begin()
|
dir.list_dir_begin()
|
||||||
var file_name = dir.get_next()
|
var file_name = dir.get_next()
|
||||||
while file_name != "":
|
while file_name != "":
|
||||||
if file_name != "." and file_name != "..":
|
if file_name != "." and file_name != "..":
|
||||||
|
if file_name.get_extension() == "remap":
|
||||||
|
file_name = file_name.substr(0, len(file_name) - 6)
|
||||||
files.append(path + file_name)
|
files.append(path + file_name)
|
||||||
file_name = dir.get_next()
|
file_name = dir.get_next()
|
||||||
dir.list_dir_end()
|
dir.list_dir_end()
|
||||||
return files
|
return files
|
||||||
else:
|
else:
|
||||||
print("无法打开目录: ", path)
|
|
||||||
return []
|
return []
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
class_name ComponentManager
|
||||||
|
|
||||||
|
var store = {}
|
||||||
@@ -3,7 +3,7 @@ class_name QuickUI
|
|||||||
static func smallText(text: String, center: bool = true):
|
static func smallText(text: String, center: bool = true):
|
||||||
var label = Label.new()
|
var label = Label.new()
|
||||||
label.text = text
|
label.text = text
|
||||||
label.theme = preload("res://themes/smallText.tres")
|
label.theme = load("res://themes/smallText.tres")
|
||||||
if center:
|
if center:
|
||||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
return label
|
return label
|
||||||
|
|||||||
Reference in New Issue
Block a user