完成输入框
This commit is contained in:
+13
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user