完成输入框

This commit is contained in:
xsl
2025-11-17 21:17:24 +08:00
parent a316ba9781
commit 22beada5e9
2 changed files with 30 additions and 6 deletions
+13 -1
View File
@@ -5,7 +5,10 @@ public partial class add1 : Label3D
{
private int _counter = 0;
private double _timer = 0.0;
[Export]
public LineEdit _soldier_number_input;
// 每秒增加的数值,可以在编辑器中调整
[Export]
public int IncrementPerSecond = 1;
@@ -14,6 +17,15 @@ public partial class add1 : Label3D
{
// 初始化显示
UpdateDisplay();
_soldier_number_input.TextSubmitted += OnSoldierNumberInput_TextSubmitted;
}
void OnSoldierNumberInput_TextSubmitted(string value)
{
GD.Print(value);
int sub_number = value.ToInt();
_counter -= sub_number;
UpdateDisplay();
}
public override void _Process(double delta)