iFactory.Godot/Mods/工业数据采集与分析应用分享/Scripts/IDIS_UpdateService.cs

49 lines
1.1 KiB
C#
Raw Normal View History

using Godot;
using System;
using BITKit;
namespace BITFactory;
public partial class IDIS_UpdateService : Node
{
[ExportCategory("Service")]
[Export] private IDIS_Service service;
[Export] private IDIS_TemplateService templateService;
[ExportCategory("UI 绑定")]
[Export] private NodeBuilder indexBuilder;
[Export] private NodeBuilder templateBuilder;
[Export] private LineEdit handleEdit;
private ButtonGroup _buttonGroup;
public override void _Ready()
{
_buttonGroup = new ButtonGroup();
Refresh();
}
private void Refresh()
{
templateBuilder.Clear();
indexBuilder.Clear();
foreach (var x in templateService.templates)
{
var container = indexBuilder.Build<UXContainer>();
container.button.Text = x.TemplateName;
container.button.ButtonPressed = true;
container.button.ButtonGroup = _buttonGroup;
container.button.Pressed +=()=> Entry(x);
}
}
private void Entry(IDIS_Template template)
{
templateBuilder.Clear();
foreach (var x in template.Formats)
{
var container = templateBuilder.Build<UXContainer>();
container.Text = x.format;
container.lineEdit.PlaceholderText = x.hint;
}
}
}