breakpoint

This commit is contained in:
CortexCore
2023-07-08 13:54:17 +08:00
parent a2da9039f8
commit 506d2b2c72
2 changed files with 25 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
using Godot;
using System;
using System.Collections.Generic;
using BITKit;
namespace BITFactory;
@@ -13,6 +14,7 @@ public partial class IDIS_RegisterService : Node
[Export] private Control container;
[Export] private Button registerButton;
[Export] private Label hints;
private readonly Dictionary<int,KeyValuePair<string,string>> _currentValues = new();
public override void _Ready()
{
templateList.Clear();
@@ -45,16 +47,28 @@ public partial class IDIS_RegisterService : Node
container.AddChild(grid);
_currentValues.Clear();
var _dirIndex = 0;
foreach (var x in template.Formats)
{
var label = new Label();
var lineEdit = new LineEdit();
var myIndex = _dirIndex++;
label.Text = x.format;
lineEdit.PlaceholderText = x.hint;
lineEdit.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
_currentValues.Add(myIndex,new KeyValuePair<string, string>(x.format,x.hint));
lineEdit.TextChanged += (s) =>
{
_currentValues[myIndex] = new KeyValuePair<string, string>(x.format, s);
};
grid.AddChild(label);
grid.AddChild(lineEdit);
}
@@ -62,6 +76,13 @@ public partial class IDIS_RegisterService : Node
private void Register()
{
var handle = handleEdit.Text;
var json = JsonHelper.Get(_currentValues);
BIT4Log.Log<IDIS_RegisterService>($"注册标识:{handle}");
BIT4Log.Log<IDIS_RegisterService>($"\n{json}");
foreach (var x in _currentValues)
{
service.Register(handle, x.Value.Key, x.Value.Value);
}
}
}