mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
Add UI components for Feed and Item displays, including SVG resources
- Introduced FeedCard and FieldShow scenes with corresponding GDScript files for managing feed and item display. - Added SVG resources for banana and baseball items. - Updated ItemStore to include mappings for item types and names in Chinese. - Enhanced FieldShow and ItemShow scripts to dynamically update UI elements based on exported properties. - Implemented a new Feed class for structured feed data handling.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
@tool
|
||||
extends HBoxContainer
|
||||
|
||||
@export var field: FieldStore.Entity = FieldStore.Entity.MAX_HEALTH
|
||||
@export var value: String = ""
|
||||
|
||||
@onready var nameLabel: Label = $"%name"
|
||||
@onready var valueLabel: Label = $"%value"
|
||||
|
||||
func _process(_delta):
|
||||
nameLabel.text = FieldStore.entityMap[field]
|
||||
valueLabel.text = value
|
||||
@@ -0,0 +1,12 @@
|
||||
@tool
|
||||
extends HBoxContainer
|
||||
|
||||
@export var type: ItemStore.ItemType = ItemStore.ItemType.BASEBALL
|
||||
@export var count: int = 0
|
||||
|
||||
@onready var avatarTexture: TextureRect = $"%avatar"
|
||||
@onready var countLabel: Label = $"%count"
|
||||
|
||||
func _process(_delta):
|
||||
avatarTexture.texture = load("res://resources/items/%s.svg" % ItemStore.idMap[type])
|
||||
countLabel.text = str(count)
|
||||
@@ -0,0 +1,3 @@
|
||||
@tool
|
||||
extends PanelContainer
|
||||
class_name Feed
|
||||
@@ -1,3 +1,4 @@
|
||||
@tool
|
||||
class_name FieldStore
|
||||
|
||||
enum Entity {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
@tool
|
||||
class_name ItemStore
|
||||
|
||||
enum ItemType {
|
||||
BASEBALL,
|
||||
BASKETBALL
|
||||
}
|
||||
static var nameMap = {
|
||||
ItemType.BASEBALL: "棒球",
|
||||
ItemType.BASKETBALL: "篮球"
|
||||
}
|
||||
static var idMap = {
|
||||
ItemType.BASEBALL: "baseball",
|
||||
ItemType.BASKETBALL: "basketball"
|
||||
}
|
||||
Reference in New Issue
Block a user