1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +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
+41 -21
View File
@@ -1,23 +1,13 @@
[gd_scene load_steps=6 format=3 uid="uid://dfwg750a47ggx"]
[gd_scene load_steps=9 format=3 uid="uid://dfwg750a47ggx"]
[ext_resource type="PackedScene" uid="uid://ofpg5s3j7esv" path="res://components/UI/BossBar.tscn" id="1_2pe58"]
[ext_resource type="Script" path="res://scripts/Statemachine/UIState.gd" id="1_f00a6"]
[ext_resource type="StyleBox" uid="uid://dx0udq8nv2ec0" path="res://styleboxes/topPanel.tres" id="3_kep0k"]
[ext_resource type="PackedScene" uid="uid://bbm8l3hr4ihar" path="res://components/UI/ItemShow.tscn" id="3_o2oi4"]
[ext_resource type="PackedScene" uid="uid://1n28ji5sl6bx" path="res://components/Scenes/FullscreenPanels/MakeFeed.tscn" id="4_kkki3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xmgs2"]
content_margin_left = 10.0
content_margin_top = 10.0
content_margin_right = 10.0
content_margin_bottom = 10.0
bg_color = Color(0, 0, 0, 0.5)
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color(0, 0, 0, 0.75)
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="5_widd7"]
[ext_resource type="StyleBox" uid="uid://bsv1daadkv4eq" path="res://styleboxes/topLeftPanel.tres" id="6_8m0pt"]
[ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="7_2om12"]
[node name="UI" type="CanvasLayer"]
process_mode = 3
@@ -34,8 +24,9 @@ grow_vertical = 2
[node name="bossbar" parent="root" instance=ExtResource("1_2pe58")]
unique_name_in_owner = true
layout_mode = 1
metadata/_edit_lock_ = true
[node name="items" type="PanelContainer" parent="root"]
[node name="container" type="PanelContainer" parent="root"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
@@ -45,22 +36,24 @@ offset_top = -3.0
offset_right = 46.0
offset_bottom = 37.0
grow_horizontal = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_xmgs2")
theme_override_styles/panel = ExtResource("3_kep0k")
metadata/_edit_lock_ = true
[node name="container" type="HBoxContainer" parent="root/items"]
[node name="items" type="HBoxContainer" parent="root/container"]
unique_name_in_owner = true
layout_mode = 2
alignment = 1
[node name="baseball" parent="root/items/container" instance=ExtResource("3_o2oi4")]
[node name="baseball" parent="root/container/items" instance=ExtResource("3_o2oi4")]
unique_name_in_owner = true
layout_mode = 2
[node name="basketball" parent="root/items/container" instance=ExtResource("3_o2oi4")]
[node name="basketball" parent="root/container/items" instance=ExtResource("3_o2oi4")]
unique_name_in_owner = true
layout_mode = 2
type = 1
[node name="apple" parent="root/items/container" instance=ExtResource("3_o2oi4")]
[node name="apple" parent="root/container/items" instance=ExtResource("3_o2oi4")]
unique_name_in_owner = true
layout_mode = 2
type = 2
@@ -73,7 +66,34 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_lock_ = true
[node name="MakeFeed" parent="root/panels" instance=ExtResource("4_kkki3")]
visible = false
layout_mode = 1
[node name="energy" type="PanelContainer" parent="root"]
layout_mode = 1
anchors_preset = -1
offset_left = -3.0
offset_top = -3.0
offset_right = 97.0
offset_bottom = 14.0
theme_override_styles/panel = ExtResource("6_8m0pt")
[node name="energy" type="HBoxContainer" parent="root/energy"]
layout_mode = 2
[node name="icon" type="TextureRect" parent="root/energy/energy"]
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("7_2om12")
expand_mode = 1
[node name="energy" type="Label" parent="root/energy/energy"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("5_widd7")
text = "114514.0"
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

+37
View File
@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://k13cte17httt"
path="res://.godot/imported/energy.svg-32660de09c2a807af89f2e5b1c1b0125.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/items/energy.svg"
dest_files=["res://.godot/imported/energy.svg-32660de09c2a807af89f2e5b1c1b0125.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
+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)
+14
View File
@@ -0,0 +1,14 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://bsv1daadkv4eq"]
[resource]
content_margin_left = 10.0
content_margin_top = 10.0
content_margin_right = 15.0
content_margin_bottom = 10.0
bg_color = Color(0, 0, 0, 0.5)
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color(0, 0, 0, 0.75)
corner_radius_bottom_right = 10
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dx0udq8nv2ec0"]
[resource]
content_margin_left = 10.0
content_margin_top = 10.0
content_margin_right = 10.0
content_margin_bottom = 10.0
bg_color = Color(0, 0, 0, 0.5)
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color(0, 0, 0, 0.75)
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10