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 Godot;
using System; using System;
using System.Collections.Generic;
using BITKit; using BITKit;
namespace BITFactory; namespace BITFactory;
@ -13,6 +14,7 @@ public partial class IDIS_RegisterService : Node
[Export] private Control container; [Export] private Control container;
[Export] private Button registerButton; [Export] private Button registerButton;
[Export] private Label hints; [Export] private Label hints;
private readonly Dictionary<int,KeyValuePair<string,string>> _currentValues = new();
public override void _Ready() public override void _Ready()
{ {
templateList.Clear(); templateList.Clear();
@ -45,16 +47,28 @@ public partial class IDIS_RegisterService : Node
container.AddChild(grid); container.AddChild(grid);
_currentValues.Clear();
var _dirIndex = 0;
foreach (var x in template.Formats) foreach (var x in template.Formats)
{ {
var label = new Label(); var label = new Label();
var lineEdit = new LineEdit(); var lineEdit = new LineEdit();
var myIndex = _dirIndex++;
label.Text = x.format; label.Text = x.format;
lineEdit.PlaceholderText = x.hint; lineEdit.PlaceholderText = x.hint;
lineEdit.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill; 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(label);
grid.AddChild(lineEdit); grid.AddChild(lineEdit);
} }
@ -62,6 +76,13 @@ public partial class IDIS_RegisterService : Node
private void Register() 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);
}
} }
} }

View File

@ -29,7 +29,7 @@ layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
theme_type_variation = &"Margin_16px" theme_type_variation = &"Margin_16px"
script = ExtResource("3_sfip0") script = ExtResource("3_sfip0")
tabs = [NodePath("Horizontal Layout/导航栏/Button"), NodePath("Horizontal Layout/导航栏/Button3"), NodePath("Horizontal Layout/导航栏/Button2"), NodePath("Horizontal Layout/导航栏/Button4"), NodePath("Horizontal Layout/导航栏/Button5"), NodePath("Horizontal Layout/导航栏/Button6")] tabs = [NodePath("Horizontal Layout/导航栏/标识模板-button"), NodePath("Horizontal Layout/导航栏/标注注册-button"), NodePath("Horizontal Layout/导航栏/Button2"), NodePath("Horizontal Layout/导航栏/Button4"), NodePath("Horizontal Layout/导航栏/Button5"), NodePath("Horizontal Layout/导航栏/Button6")]
windows = [NodePath("Horizontal Layout/内容/标识模板"), NodePath("Horizontal Layout/内容/标注注册"), NodePath("Horizontal Layout/内容/Container2"), NodePath("Horizontal Layout/内容/Container3"), NodePath("Horizontal Layout/内容/Container4"), NodePath("Horizontal Layout/内容/Container5")] windows = [NodePath("Horizontal Layout/内容/标识模板"), NodePath("Horizontal Layout/内容/标注注册"), NodePath("Horizontal Layout/内容/Container2"), NodePath("Horizontal Layout/内容/Container3"), NodePath("Horizontal Layout/内容/Container4"), NodePath("Horizontal Layout/内容/Container5")]
[node name="Horizontal Layout" type="HBoxContainer" parent="UX Window Service"] [node name="Horizontal Layout" type="HBoxContainer" parent="UX Window Service"]
@ -45,7 +45,7 @@ layout_mode = 2
theme_type_variation = &"HeaderMedium" theme_type_variation = &"HeaderMedium"
text = "管理" text = "管理"
[node name="Button" type="Button" parent="UX Window Service/Horizontal Layout/导航栏"] [node name="标识模板-button" type="Button" parent="UX Window Service/Horizontal Layout/导航栏"]
layout_mode = 2 layout_mode = 2
toggle_mode = true toggle_mode = true
button_group = ExtResource("3_wv1s6") button_group = ExtResource("3_wv1s6")
@ -56,7 +56,7 @@ layout_mode = 2
theme_type_variation = &"HeaderMedium" theme_type_variation = &"HeaderMedium"
text = "准备生产" text = "准备生产"
[node name="Button3" type="Button" parent="UX Window Service/Horizontal Layout/导航栏"] [node name="标注注册-button" type="Button" parent="UX Window Service/Horizontal Layout/导航栏"]
layout_mode = 2 layout_mode = 2
toggle_mode = true toggle_mode = true
button_group = ExtResource("3_wv1s6") button_group = ExtResource("3_wv1s6")