30 lines
968 B
C#
30 lines
968 B
C#
using Godot;
|
|
|
|
public partial class InfoBlock : PanelContainer {
|
|
private Label _displayLabel;
|
|
|
|
private TextureRect _icon;
|
|
private Label _valueLabel;
|
|
|
|
[Export] public Texture2D IconTexture { get; set; }
|
|
|
|
[Export] public string DisplayName { get; set; } = "资金";
|
|
|
|
[Export] public string Value { get; set; } = "999.9 M";
|
|
|
|
// Called when the node enters the scene tree for the first time.
|
|
public override void _Ready() {
|
|
_icon = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Icon");
|
|
_displayLabel = GetNode<Label>("VBoxContainer/DisplayLabel");
|
|
_valueLabel = GetNode<Label>("VBoxContainer/HBoxContainer/ValueLabel");
|
|
|
|
_icon.Texture = IconTexture;
|
|
_displayLabel.Text = DisplayName;
|
|
_valueLabel.Text = Value;
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta) {
|
|
_valueLabel.Text = Value;
|
|
}
|
|
} |