mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +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:
+41
-21
@@ -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="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="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://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"]
|
[ext_resource type="PackedScene" uid="uid://1n28ji5sl6bx" path="res://components/Scenes/FullscreenPanels/MakeFeed.tscn" id="4_kkki3"]
|
||||||
|
[ext_resource type="Theme" uid="uid://b6nox1qqh50ub" path="res://themes/smallText.tres" id="5_widd7"]
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xmgs2"]
|
[ext_resource type="StyleBox" uid="uid://bsv1daadkv4eq" path="res://styleboxes/topLeftPanel.tres" id="6_8m0pt"]
|
||||||
content_margin_left = 10.0
|
[ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="7_2om12"]
|
||||||
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
|
|
||||||
|
|
||||||
[node name="UI" type="CanvasLayer"]
|
[node name="UI" type="CanvasLayer"]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
@@ -34,8 +24,9 @@ grow_vertical = 2
|
|||||||
[node name="bossbar" parent="root" instance=ExtResource("1_2pe58")]
|
[node name="bossbar" parent="root" instance=ExtResource("1_2pe58")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="items" type="PanelContainer" parent="root"]
|
[node name="container" type="PanelContainer" parent="root"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
@@ -45,22 +36,24 @@ offset_top = -3.0
|
|||||||
offset_right = 46.0
|
offset_right = 46.0
|
||||||
offset_bottom = 37.0
|
offset_bottom = 37.0
|
||||||
grow_horizontal = 2
|
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
|
layout_mode = 2
|
||||||
alignment = 1
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
type = 1
|
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
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
type = 2
|
type = 2
|
||||||
@@ -73,7 +66,34 @@ anchor_right = 1.0
|
|||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="MakeFeed" parent="root/panels" instance=ExtResource("4_kkki3")]
|
[node name="MakeFeed" parent="root/panels" instance=ExtResource("4_kkki3")]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 1
|
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 |
@@ -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
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
|
@tool
|
||||||
extends FullscreenPanelBase
|
extends FullscreenPanelBase
|
||||||
|
|
||||||
@onready var avaliableFeeds: Node = $"%avaliableFeeds"
|
@onready var avaliableFeeds: Node = $"%avaliableFeeds"
|
||||||
@onready var feedCards: HBoxContainer = $"%feedcards"
|
@onready var feedCards: HBoxContainer = $"%feedcards"
|
||||||
|
|
||||||
func hideAll():
|
func _ready():
|
||||||
for i in avaliableFeeds.get_children():
|
for i in avaliableFeeds.get_children():
|
||||||
i.hide()
|
i.hide()
|
||||||
|
|
||||||
func beforeOpen():
|
func beforeOpen():
|
||||||
hideAll()
|
|
||||||
var feeds = []
|
var feeds = []
|
||||||
for i in avaliableFeeds.get_children():
|
for i in avaliableFeeds.get_children():
|
||||||
feeds.append(i)
|
feeds.append(i)
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ func hit(target: Node):
|
|||||||
if !indisDamage && !GameRule.allowFriendlyFire:
|
if !indisDamage && !GameRule.allowFriendlyFire:
|
||||||
if entity.isPlayer() == launcher.isPlayer(): return
|
if entity.isPlayer() == launcher.isPlayer(): return
|
||||||
entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE)))
|
entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE)))
|
||||||
if !MathTool.rate(fullPenerate()):
|
if !MathTool.rate(fullPenerate(entity)):
|
||||||
destroy()
|
destroy()
|
||||||
func forward(direction: Vector2):
|
func forward(direction: Vector2):
|
||||||
position += direction.normalized() * fields.get(FieldStore.Bullet.SPEED) * GameRule.bulletSpeedMultiplier
|
position += direction.normalized() * fields.get(FieldStore.Bullet.SPEED) * GameRule.bulletSpeedMultiplier
|
||||||
func fullPenerate():
|
func fullPenerate(target: EntityBase):
|
||||||
return fields.get(FieldStore.Bullet.PENERATE) * (1 + launcher.fields.get(FieldStore.Entity.PENERATE))
|
return fields.get(FieldStore.Bullet.PENERATE) * (1 + launcher.fields.get(FieldStore.Entity.PENERATE)) - target.fields.get(FieldStore.Entity.PENARATION_RESISTANCE)
|
||||||
|
|
||||||
func ai():
|
func ai():
|
||||||
pass
|
pass
|
||||||
@@ -56,10 +56,15 @@ static func generate(
|
|||||||
spawnRotation: float,
|
spawnRotation: float,
|
||||||
addToWorld: bool = true
|
addToWorld: bool = true
|
||||||
):
|
):
|
||||||
var instance: BulletBase = bullet.instantiate()
|
var extraCount = launchBy.fields.get(FieldStore.Entity.EXTRA_BULLET_COUNT)
|
||||||
instance.launcher = launchBy
|
var count = 1 + floor(extraCount) + int(MathTool.rate(extraCount - floor(extraCount)))
|
||||||
instance.position = spawnPosition
|
var instances = []
|
||||||
instance.rotation = spawnRotation + deg_to_rad(randf_range(-launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT), launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT)))
|
for i in range(count):
|
||||||
if addToWorld:
|
var instance: BulletBase = bullet.instantiate()
|
||||||
WorldManager.rootNode.add_child(instance)
|
instance.launcher = launchBy
|
||||||
return instance
|
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
|
||||||
|
|||||||
@@ -46,11 +46,12 @@ var inventoryMax = {
|
|||||||
@onready var damageAnchor: Node2D = $"%damageAnchor"
|
@onready var damageAnchor: Node2D = $"%damageAnchor"
|
||||||
|
|
||||||
var health: float = 0
|
var health: float = 0
|
||||||
|
var energy: float = 0
|
||||||
|
var sprinting: bool = false
|
||||||
|
|
||||||
var lastDirection: int = 1
|
var lastDirection: int = 1
|
||||||
var lastAttack: int = 0
|
var lastAttack: int = 0
|
||||||
var currentFocusedBoss: EntityBase = null
|
var currentFocusedBoss: EntityBase = null
|
||||||
var sprinting: bool = false
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
health = fields.get(FieldStore.Entity.MAX_HEALTH)
|
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)
|
var damage = baseDamage + baseDamage * int(crit) * fields.get(FieldStore.Entity.CRIT_DAMAGE)
|
||||||
if sprinting:
|
if sprinting:
|
||||||
playSound("miss")
|
playSound("miss")
|
||||||
|
storeEnergy(damage * 0.5)
|
||||||
damage = 0
|
damage = 0
|
||||||
else:
|
else:
|
||||||
playSound("hurt")
|
playSound("hurt")
|
||||||
|
bullet.launcher.storeEnergy(damage * 0.25)
|
||||||
health -= damage
|
health -= damage
|
||||||
DamageLabel.create(damage, crit, damageAnchor.global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset))
|
DamageLabel.create(damage, crit, damageAnchor.global_position + MathTool.randv2_range(GameRule.damageLabelSpawnOffset))
|
||||||
if isBoss and bullet.launcher.isPlayer():
|
if isBoss and bullet.launcher.isPlayer():
|
||||||
bullet.launcher.setBoss(self)
|
bullet.launcher.setBoss(self)
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
if isBoss:
|
if isBoss:
|
||||||
|
bullet.launcher.storeEnergy(energy)
|
||||||
bullet.launcher.setBoss(null)
|
bullet.launcher.setBoss(null)
|
||||||
tryDie(bullet)
|
tryDie(bullet)
|
||||||
|
func storeEnergy(value: float):
|
||||||
|
energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER)
|
||||||
func isCooldowned():
|
func isCooldowned():
|
||||||
return Time.get_ticks_msec() - lastAttack >= cooldownUnit / fields.get(FieldStore.Entity.ATTACK_SPEED)
|
return Time.get_ticks_msec() - lastAttack >= cooldownUnit / fields.get(FieldStore.Entity.ATTACK_SPEED)
|
||||||
func startCooldown():
|
func startCooldown():
|
||||||
@@ -137,7 +143,7 @@ func tryHeal(count: float):
|
|||||||
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
if inventory[ItemStore.ItemType.APPLE] > 0 and health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
||||||
inventory[ItemStore.ItemType.APPLE] -= 1
|
inventory[ItemStore.ItemType.APPLE] -= 1
|
||||||
playSound("heal")
|
playSound("heal")
|
||||||
heal(count)
|
heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY))
|
||||||
func findWeaponAnchor(weaponName: String):
|
func findWeaponAnchor(weaponName: String):
|
||||||
var anchor = $"%weapons".get_node(weaponName)
|
var anchor = $"%weapons".get_node(weaponName)
|
||||||
if anchor is Node2D:
|
if anchor is Node2D:
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ class_name UIState
|
|||||||
@onready var baseball = $"%baseball"
|
@onready var baseball = $"%baseball"
|
||||||
@onready var basketball = $"%basketball"
|
@onready var basketball = $"%basketball"
|
||||||
@onready var apple = $"%apple"
|
@onready var apple = $"%apple"
|
||||||
|
@onready var items = $"%items"
|
||||||
|
@onready var energy = $"%energy"
|
||||||
|
|
||||||
static var player: EntityBase = null
|
static var player: EntityBase = null
|
||||||
static var bossbar: EntityStateBar
|
static var bossbar: EntityStateBar
|
||||||
@@ -17,9 +19,10 @@ func _process(_delta):
|
|||||||
bossbar.visible = !!bossbar.entity
|
bossbar.visible = !!bossbar.entity
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if is_instance_valid(player):
|
if is_instance_valid(player):
|
||||||
baseball.count = player.inventory[ItemStore.ItemType.BASEBALL]
|
energy.text = "%.1f"%player.energy
|
||||||
basketball.count = player.inventory[ItemStore.ItemType.BASKETBALL]
|
for i in items.get_children():
|
||||||
apple.count = player.inventory[ItemStore.ItemType.APPLE]
|
var item = i as ItemShow
|
||||||
|
item.count = player.inventory.get(item.type)
|
||||||
if currentPanel:
|
if currentPanel:
|
||||||
WorldManager.rootNode.process_mode = Node.PROCESS_MODE_DISABLED
|
WorldManager.rootNode.process_mode = Node.PROCESS_MODE_DISABLED
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -45,21 +45,21 @@ func _ready():
|
|||||||
var count = costCounts[i]
|
var count = costCounts[i]
|
||||||
var costShow: ItemShow = preload("res://components/UI/ItemShow.tscn").instantiate()
|
var costShow: ItemShow = preload("res://components/UI/ItemShow.tscn").instantiate()
|
||||||
costShow.type = cost
|
costShow.type = cost
|
||||||
costShow.count = count
|
costShow.count = count * multipiler()
|
||||||
costsBox.add_child(costShow)
|
costsBox.add_child(costShow)
|
||||||
|
|
||||||
func apply(entity: EntityBase):
|
func apply(entity: EntityBase):
|
||||||
var allHave = true
|
var allHave = true
|
||||||
for i in range(min(costs.size(), costCounts.size())):
|
for i in range(min(costs.size(), costCounts.size())):
|
||||||
var item = costs[i]
|
var item = costs[i]
|
||||||
var count = costCounts[i]
|
var count = costCounts[i] * multipiler()
|
||||||
if entity.inventory[item] < count:
|
if entity.inventory[item] < count:
|
||||||
allHave = false
|
allHave = false
|
||||||
break
|
break
|
||||||
if allHave:
|
if allHave:
|
||||||
for i in range(min(costs.size(), costCounts.size())):
|
for i in range(min(costs.size(), costCounts.size())):
|
||||||
var item = costs[i]
|
var item = costs[i]
|
||||||
var count = costCounts[i]
|
var count = costCounts[i] * multipiler()
|
||||||
entity.inventory[item] -= count
|
entity.inventory[item] -= count
|
||||||
for i in range(min(fields.size(), fieldValues.size())):
|
for i in range(min(fields.size(), fieldValues.size())):
|
||||||
var field = fields[i]
|
var field = fields[i]
|
||||||
@@ -68,3 +68,5 @@ func apply(entity: EntityBase):
|
|||||||
if !applier or applier.call(entity, value):
|
if !applier or applier.call(entity, value):
|
||||||
entity.fields[field] += value
|
entity.fields[field] += value
|
||||||
return allHave
|
return allHave
|
||||||
|
func multipiler():
|
||||||
|
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user