1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-06 19:57:12 +08:00

Add new styleboxes and import energy texture

- Created a new SVG import for the energy texture, enabling better resource management and compression.
- Added a StyleBoxFlat resource for the top left panel with specified margins, background color, border width, and corner radius.
- Introduced a StyleBoxFlat resource for the top panel with similar properties, ensuring consistent UI design across panels.
This commit is contained in:
2025-08-27 11:08:11 +08:00
parent 0648ed75d0
commit b3b4fdafc2
10 changed files with 144 additions and 41 deletions
+2 -2
View File
@@ -1,14 +1,14 @@
@tool
extends FullscreenPanelBase
@onready var avaliableFeeds: Node = $"%avaliableFeeds"
@onready var feedCards: HBoxContainer = $"%feedcards"
func hideAll():
func _ready():
for i in avaliableFeeds.get_children():
i.hide()
func beforeOpen():
hideAll()
var feeds = []
for i in avaliableFeeds.get_children():
feeds.append(i)
+15 -10
View File
@@ -37,12 +37,12 @@ func hit(target: Node):
if !indisDamage && !GameRule.allowFriendlyFire:
if entity.isPlayer() == launcher.isPlayer(): return
entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE)))
if !MathTool.rate(fullPenerate()):
if !MathTool.rate(fullPenerate(entity)):
destroy()
func forward(direction: Vector2):
position += direction.normalized() * fields.get(FieldStore.Bullet.SPEED) * GameRule.bulletSpeedMultiplier
func fullPenerate():
return fields.get(FieldStore.Bullet.PENERATE) * (1 + launcher.fields.get(FieldStore.Entity.PENERATE))
func fullPenerate(target: EntityBase):
return fields.get(FieldStore.Bullet.PENERATE) * (1 + launcher.fields.get(FieldStore.Entity.PENERATE)) - target.fields.get(FieldStore.Entity.PENARATION_RESISTANCE)
func ai():
pass
@@ -56,10 +56,15 @@ static func generate(
spawnRotation: float,
addToWorld: bool = true
):
var instance: BulletBase = bullet.instantiate()
instance.launcher = launchBy
instance.position = spawnPosition
instance.rotation = spawnRotation + deg_to_rad(randf_range(-launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT), launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT)))
if addToWorld:
WorldManager.rootNode.add_child(instance)
return instance
var extraCount = launchBy.fields.get(FieldStore.Entity.EXTRA_BULLET_COUNT)
var count = 1 + floor(extraCount) + int(MathTool.rate(extraCount - floor(extraCount)))
var instances = []
for i in range(count):
var instance: BulletBase = bullet.instantiate()
instance.launcher = launchBy
instance.position = spawnPosition
instance.rotation = spawnRotation + deg_to_rad(randf_range(-launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT), launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT)))
if addToWorld:
WorldManager.rootNode.add_child(instance)
instances.append(instance)
return instances
+8 -2
View File
@@ -46,11 +46,12 @@ var inventoryMax = {
@onready var damageAnchor: Node2D = $"%damageAnchor"
var health: float = 0
var energy: float = 0
var sprinting: bool = false
var lastDirection: int = 1
var lastAttack: int = 0
var currentFocusedBoss: EntityBase = null
var sprinting: bool = false
func _ready():
health = fields.get(FieldStore.Entity.MAX_HEALTH)
@@ -95,17 +96,22 @@ func takeDamage(bullet: BulletBase, crit: bool):
var damage = baseDamage + baseDamage * int(crit) * fields.get(FieldStore.Entity.CRIT_DAMAGE)
if sprinting:
playSound("miss")
storeEnergy(damage * 0.5)
damage = 0
else:
playSound("hurt")
bullet.launcher.storeEnergy(damage * 0.25)
health -= damage
DamageLabel.create(damage, crit, damageAnchor.global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset))
if isBoss and bullet.launcher.isPlayer():
bullet.launcher.setBoss(self)
if health <= 0:
if isBoss:
bullet.launcher.storeEnergy(energy)
bullet.launcher.setBoss(null)
tryDie(bullet)
func storeEnergy(value: float):
energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER)
func isCooldowned():
return Time.get_ticks_msec() - lastAttack >= cooldownUnit / fields.get(FieldStore.Entity.ATTACK_SPEED)
func startCooldown():
@@ -137,7 +143,7 @@ func tryHeal(count: float):
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
inventory[ItemStore.ItemType.APPLE] -= 1
playSound("heal")
heal(count)
heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY))
func findWeaponAnchor(weaponName: String):
var anchor = $"%weapons".get_node(weaponName)
if anchor is Node2D:
+6 -3
View File
@@ -4,6 +4,8 @@ class_name UIState
@onready var baseball = $"%baseball"
@onready var basketball = $"%basketball"
@onready var apple = $"%apple"
@onready var items = $"%items"
@onready var energy = $"%energy"
static var player: EntityBase = null
static var bossbar: EntityStateBar
@@ -17,9 +19,10 @@ func _process(_delta):
bossbar.visible = !!bossbar.entity
func _physics_process(_delta):
if is_instance_valid(player):
baseball.count = player.inventory[ItemStore.ItemType.BASEBALL]
basketball.count = player.inventory[ItemStore.ItemType.BASKETBALL]
apple.count = player.inventory[ItemStore.ItemType.APPLE]
energy.text = "%.1f"%player.energy
for i in items.get_children():
var item = i as ItemShow
item.count = player.inventory.get(item.type)
if currentPanel:
WorldManager.rootNode.process_mode = Node.PROCESS_MODE_DISABLED
else:
+5 -3
View File
@@ -45,21 +45,21 @@ func _ready():
var count = costCounts[i]
var costShow: ItemShow = preload("res://components/UI/ItemShow.tscn").instantiate()
costShow.type = cost
costShow.count = count
costShow.count = count * multipiler()
costsBox.add_child(costShow)
func apply(entity: EntityBase):
var allHave = true
for i in range(min(costs.size(), costCounts.size())):
var item = costs[i]
var count = costCounts[i]
var count = costCounts[i] * multipiler()
if entity.inventory[item] < count:
allHave = false
break
if allHave:
for i in range(min(costs.size(), costCounts.size())):
var item = costs[i]
var count = costCounts[i]
var count = costCounts[i] * multipiler()
entity.inventory[item] -= count
for i in range(min(fields.size(), fieldValues.size())):
var field = fields[i]
@@ -68,3 +68,5 @@ func apply(entity: EntityBase):
if !applier or applier.call(entity, value):
entity.fields[field] += value
return allHave
func multipiler():
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)