调整了模板
This commit is contained in:
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/AGV/AGV.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/AGV/AGV.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://cs0mh0ev6u0cf"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_vgs8l"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_vgs8l")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/i5外发机械臂/AGV机械臂i5外发.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/i5外发机械臂/AGV机械臂i5外发.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://574gf1b8pq71"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_xdojh"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_xdojh")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/拧紧SR7C1L/拧紧SR7C1L.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/拧紧SR7C1L/拧紧SR7C1L.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://vsysp5ftn5do"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_4uwqb"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_4uwqb")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/拧紧夹爪/拧紧夹爪.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/拧紧夹爪/拧紧夹爪.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://c2he5e5rahatp"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_b50nr"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_b50nr")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度/温度.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度/温度.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://b38onsp3c3jem"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_3kqe2"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_3kqe2")
|
||||
HandleSeed = "th.record"
|
||||
Format = "float"
|
||||
Category = "环境"
|
||||
Name = "温度"
|
||||
Value = "42"
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度/湿度.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度/湿度.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://d3xam2no2uaas"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_lqwbc"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_lqwbc")
|
||||
HandleSeed = "th.record"
|
||||
Format = "float"
|
||||
Category = "环境"
|
||||
Name = "湿度"
|
||||
Value = "50"
|
||||
RefHandleSeed = "th"
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度传感器/温湿度传感器.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度传感器/温湿度传感器.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://cgk1wmiqqedmi"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_8mak5"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_8mak5")
|
||||
HandleSeed = "th"
|
||||
Format = "string"
|
||||
Category = "参数"
|
||||
Name = "型号"
|
||||
Value = "th.sensor"
|
||||
RefHandleSeed = "th.record"
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/装配SR7C1L/装配SR7C1L.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/装配SR7C1L/装配SR7C1L.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://hixuaakj8opt"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_hthhx"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_hthhx")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/装配夹爪/装配夹爪.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/装配夹爪/装配夹爪.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://ngju0miy7a6b"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_brytp"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_brytp")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/订单信息/订单信息.tres
Normal file
12
Mods/工业数据采集与分析应用分享/Resource/自动标识模板/订单信息/订单信息.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Resource" script_class="IDIS_AutoRegResource" load_steps=2 format=3 uid="uid://c4a5buevs88ko"]
|
||||
|
||||
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs" id="1_25hnv"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_25hnv")
|
||||
HandleSeed = ""
|
||||
Format = ""
|
||||
Category = ""
|
||||
Name = ""
|
||||
Value = ""
|
||||
RefHandleSeed = ""
|
23
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_RegisterDB.cs
Normal file
23
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_RegisterDB.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace BITFactory;
|
||||
[GlobalClass]
|
||||
public partial class IDIS_RegisterDB : FormDBProvider
|
||||
{
|
||||
public override void Submit(string data)
|
||||
{
|
||||
var jObject = JsonConvert.DeserializeObject<JObject>(data);
|
||||
var handle = jObject["handle"]!.ToObject<string>();
|
||||
var values = jObject["values"]!.ToObject<List<IDIS_Data>>();
|
||||
|
||||
foreach (var x in values)
|
||||
{
|
||||
IDIS_Service.Singleton.Register(handle,x.Name, x.Format, x.Value,x.Category);
|
||||
}
|
||||
}
|
||||
}
|
77
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_RegisterWeaver.cs
Normal file
77
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_RegisterWeaver.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
|
||||
namespace BITFactory;
|
||||
[GlobalClass]
|
||||
public partial class IDIS_RegisterWeaver : FormWeaverResource
|
||||
{
|
||||
[Export] private NodePath handleEditPath;
|
||||
[Export] private NodePath generateButtonPath;
|
||||
|
||||
private LineEdit handleEdit=>formBuilder.GetNode<LineEdit>(handleEditPath);
|
||||
private Button generateButton=>formBuilder.GetNode<Button>(generateButtonPath);
|
||||
|
||||
private readonly List<IDIS_Data> _values=new();
|
||||
public override void Weaver(Control container, IFormField formField)
|
||||
{
|
||||
var field = (IDIS_TemplateForm)formField;
|
||||
|
||||
var data = new IDIS_Data();
|
||||
|
||||
var vBox = container.Create<HBoxContainer>();
|
||||
|
||||
var label = vBox.Create<Label>();
|
||||
var typeLabel = vBox.Create<Label>();
|
||||
var valueEdit = vBox.Create<LineEdit>();
|
||||
|
||||
var myIndex = _values.Count;
|
||||
_values.Add(data);
|
||||
|
||||
label.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
typeLabel.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
valueEdit.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
|
||||
label.Text = field.Name;
|
||||
typeLabel.Text = field.Type;
|
||||
valueEdit.PlaceholderText = field.DefaultValue;
|
||||
|
||||
data.Category = field.Category;
|
||||
data.Handle = handleEdit.Text;
|
||||
data.Format = field.Type;
|
||||
|
||||
valueEdit.TextChanged += x => data.Value = x;
|
||||
}
|
||||
|
||||
public override string GetContent()
|
||||
{
|
||||
if (string.IsNullOrEmpty(handleEdit.Text))
|
||||
{
|
||||
throw new InvalidOperationException("[color=red]输入的标识码为空[/color]");
|
||||
}
|
||||
|
||||
var value = new Dictionary<object, object>
|
||||
{
|
||||
{ "handle", handleEdit.Text },
|
||||
{ "values",_values},
|
||||
};
|
||||
|
||||
var json = JsonHelper.Get(value);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
_values.Clear();
|
||||
}
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
generateButton.Pressed += () =>
|
||||
{
|
||||
handleEdit.Text = IDIS_Service.GenerateHandle();
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITKit;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BITFactory;
|
||||
|
||||
[Serializable]
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class IDIS_TemplateForm:IFormField
|
||||
{
|
||||
[JsonProperty]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty]
|
||||
public string Type { get; set; }
|
||||
[JsonProperty]
|
||||
public string DefaultValue { get; set; }
|
||||
[JsonProperty]
|
||||
public string Category { get; set; }
|
||||
public int FieldCount => 4;
|
||||
public string[] FieldNames => new string[]
|
||||
{
|
||||
nameof(Name),
|
||||
nameof(Type),
|
||||
nameof(DefaultValue),
|
||||
nameof(Category),
|
||||
};
|
||||
public string[] FieldTypes => FieldNames;
|
||||
public string[] DefaultValues => FieldNames;
|
||||
}
|
||||
|
||||
[GlobalClass]
|
||||
public partial class IDIS_TemplateFormResource : FormResource
|
||||
{
|
||||
public override string Name { get; set; }
|
||||
public override IFormField[] Fields { get; set; }
|
||||
}
|
79
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_TemplateResource.cs
Normal file
79
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_TemplateResource.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
using BITKit.IO;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace BITFactory;
|
||||
[GlobalClass]
|
||||
public partial class IDIS_TemplateResource : TemplateResource
|
||||
{
|
||||
private static readonly List<FormResource> Templates=new();
|
||||
private static InitializationState state = InitializationState.None;
|
||||
private static string assetPath => PathHelper.GetPath("标识模板资源包.zip");
|
||||
private static string entryPath => "Templates.json";
|
||||
public override FormResource[] GetTemplates()
|
||||
{
|
||||
EnsureCreated();
|
||||
return Templates.ToArray();
|
||||
}
|
||||
public override string[] GetTemplateNames()
|
||||
{
|
||||
EnsureCreated();
|
||||
return Templates.Select(x => x.Name).ToArray();
|
||||
}
|
||||
public override FormResource GetTemplate(string name)
|
||||
{
|
||||
EnsureCreated();
|
||||
return Templates.Single(x => x.Name == name);
|
||||
}
|
||||
public override bool IsSupportCreateTemplate => true;
|
||||
public override void CreateTemplate()
|
||||
{
|
||||
Templates.Add(new IDIS_TemplateFormResource()
|
||||
{
|
||||
Name = "新的标识模板:"+Guid.NewGuid(),
|
||||
Fields = new IFormField[]
|
||||
{
|
||||
new IDIS_TemplateForm()
|
||||
}
|
||||
});
|
||||
}
|
||||
private void EnsureCreated()
|
||||
{
|
||||
if (state != InitializationState.None) return;
|
||||
if (File.Exists(assetPath))
|
||||
{
|
||||
foreach (var x in BITAssets.Read<KeyValuePair<string,IDIS_TemplateForm[]>[]>(assetPath, entryPath))
|
||||
{
|
||||
Templates.Add(new IDIS_TemplateFormResource()
|
||||
{
|
||||
Name = x.Key,
|
||||
Fields = x.Value.Select(_=>_ as IFormField).ToArray()
|
||||
});
|
||||
}
|
||||
}
|
||||
state = InitializationState.Initialized;
|
||||
}
|
||||
|
||||
public override void OnStop()
|
||||
{
|
||||
ManualSave();
|
||||
}
|
||||
|
||||
public override void ManualSave()
|
||||
{
|
||||
// var values = new System.Collections.Generic.Dictionary<string, List<IFormField>>(
|
||||
// Templates.Select(x=>new KeyValuePair<string, List<IFormField>>(
|
||||
// x.Key,x.Value.Fields.ToList()
|
||||
// ))
|
||||
// );
|
||||
var values = Templates.Select(x => new KeyValuePair<string, object>(
|
||||
x.Name, x.Fields
|
||||
));
|
||||
BITAssets.Build(assetPath,new BITAsset(entryPath,JsonHelper.Get(values)));
|
||||
}
|
||||
}
|
143
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_TemplateWeaver.cs
Normal file
143
Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_TemplateWeaver.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
|
||||
namespace BITFactory;
|
||||
[GlobalClass]
|
||||
public partial class IDIS_TemplateWeaver : FormWeaverResource
|
||||
{
|
||||
[Export] private NodePath addFieldsButtonPath;
|
||||
[Export] private NodePath templateBuilderPath;
|
||||
[Export] private NodePath templateNameEditPath;
|
||||
[Export] private NodePath saveTemplateNameButtonPath;
|
||||
private Button addFieldsButton => formBuilder.GetNode<Button>(addFieldsButtonPath);
|
||||
private TemplateBuilder templateBuilder => formBuilder.GetNode<TemplateBuilder>(templateBuilderPath);
|
||||
private LineEdit templateNameEdit => formBuilder.GetNode<LineEdit>(templateNameEditPath);
|
||||
private Button saveTemplateNameButton => formBuilder.GetNode<Button>(saveTemplateNameButtonPath);
|
||||
|
||||
private readonly List<IDIS_TemplateForm> fields = new();
|
||||
public override void Weaver(Control container, IFormField formField)
|
||||
{
|
||||
var field = formField as IDIS_TemplateForm;
|
||||
|
||||
fields.Add(field);
|
||||
|
||||
var hBox = container.Create<HBoxContainer>();
|
||||
var nameEdit = hBox.Create<LineEdit>();
|
||||
var typeButton = hBox.Create<OptionButton>();
|
||||
var defaultValueEdit = hBox.Create<LineEdit>();
|
||||
var categoryEdit = hBox.Create<LineEdit>();
|
||||
var removeButton = hBox.Create<Button>();
|
||||
|
||||
nameEdit.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
typeButton.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
defaultValueEdit.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
categoryEdit.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
|
||||
|
||||
nameEdit.PlaceholderText="名称";
|
||||
typeButton.Text = "类型";
|
||||
defaultValueEdit.PlaceholderText="默认值";
|
||||
categoryEdit.PlaceholderText="分类";
|
||||
|
||||
typeButton.GetPopup().AddItem("string");
|
||||
typeButton.GetPopup().AddItem("int");
|
||||
typeButton.GetPopup().AddItem("ulong");
|
||||
typeButton.GetPopup().AddItem("double");
|
||||
typeButton.GetPopup().AddItem("h_site");
|
||||
typeButton.GetPopup().AddItem("base64");
|
||||
typeButton.GetPopup().AddItem("guid");
|
||||
|
||||
typeButton.Selected = 0;
|
||||
|
||||
nameEdit.Text = field!.Name;
|
||||
typeButton.Text = field!.Type;
|
||||
defaultValueEdit.Text = field!.DefaultValue;
|
||||
categoryEdit.Text = field!.Category;
|
||||
removeButton.Text= "删除";
|
||||
|
||||
nameEdit.TextChanged+=x=>field!.Name=x;
|
||||
typeButton.ItemSelected+=x=>field!.Type=typeButton.GetPopup().GetItemText((int)x);
|
||||
defaultValueEdit.TextChanged+=x=>field!.DefaultValue=x;
|
||||
categoryEdit.TextChanged+=x=>field!.Category=x;
|
||||
|
||||
removeButton.Pressed+=()=>
|
||||
{
|
||||
fields.Remove(field!);
|
||||
container.QueueFree();
|
||||
|
||||
var current = templateBuilder.CurrentTemplate.Fields.ToList();
|
||||
current.Remove(formField);
|
||||
templateBuilder.CurrentTemplate.Fields = current.ToArray();
|
||||
};
|
||||
}
|
||||
|
||||
public override string GetContent()
|
||||
{
|
||||
if (fields.Any(x =>
|
||||
{
|
||||
switch (x.Name, x.Type, x.DefaultValue, x.Category)
|
||||
{
|
||||
case ("", _, _, _):
|
||||
case (_, "", _, _):
|
||||
case (_, _, "", _):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}))
|
||||
{
|
||||
throw new InvalidOperationException("请填写完整");
|
||||
}
|
||||
var value = JsonHelper.Get(fields);
|
||||
return value;
|
||||
}
|
||||
public override void Clear()
|
||||
{
|
||||
fields.Clear();
|
||||
templateNameEdit.Text = templateBuilder.CurrentTemplate?.Name;
|
||||
}
|
||||
public override void OnStart()
|
||||
{
|
||||
addFieldsButton.Pressed+=AddFields;
|
||||
|
||||
templateNameEdit.TextSubmitted+=ChangeCurrentTemplateName;
|
||||
saveTemplateNameButton.Pressed+=()=>
|
||||
{
|
||||
ChangeCurrentTemplateName(templateNameEdit.Text);
|
||||
};
|
||||
}
|
||||
private void AddFields()
|
||||
{
|
||||
var current = templateBuilder.CurrentTemplate.Fields.ToList();
|
||||
current.Add(new IDIS_TemplateForm()
|
||||
{
|
||||
|
||||
});
|
||||
templateBuilder.CurrentTemplate.Fields = current.ToArray();
|
||||
|
||||
templateBuilder.Rebuild();
|
||||
}
|
||||
|
||||
private void ChangeCurrentTemplateName(string newName)
|
||||
{
|
||||
if(templateBuilder.CurrentTemplate==null) return;
|
||||
|
||||
if (templateBuilder.template.GetTemplates().Any(x => x.Name == newName))
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
newName+=DateTime.Now.ToString("mmss");
|
||||
|
||||
templateBuilder.CurrentTemplate.Name = newName;
|
||||
|
||||
templateBuilder.template.ManualSave();
|
||||
|
||||
templateBuilder.Rebuild();
|
||||
|
||||
UXContextMenu
|
||||
.Create()
|
||||
.AddAction("New PopopMenu",null)
|
||||
.Build();
|
||||
|
||||
}
|
||||
}
|
19
Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs
Normal file
19
Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegResource.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace BITFactory;
|
||||
[GlobalClass]
|
||||
public partial class IDIS_AutoRegResource : Resource
|
||||
{
|
||||
[Export] public string HandleSeed;
|
||||
|
||||
[ExportCategory("IDIS")]
|
||||
[Export] public string Format;
|
||||
[Export] public string Category;
|
||||
[Export] public string Name;
|
||||
[Export] public string Value;
|
||||
|
||||
[ExportCategory("标识引用")]
|
||||
[Export] public string RefHandleSeed;
|
||||
|
||||
}
|
85
Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegister.cs
Normal file
85
Mods/工业数据采集与分析应用分享/Scripts/IDIS_AutoRegister.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BITFactory;
|
||||
using BITKit;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace BITFactory;
|
||||
public partial class IDIS_AutoRegister : Node
|
||||
{
|
||||
[Export] private Array<IDIS_AutoRegResource> regResources;
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private Array<ProgressBar> progressBars;
|
||||
[Export] private RichTextLabel logLabel;
|
||||
|
||||
private readonly Queue<ProgressBar> _progressQueue = new();
|
||||
private ProgressBar _currentProgressBar;
|
||||
|
||||
private void Register()
|
||||
{
|
||||
BIT4Log.Log<IDIS_AutoRegister>("开始自动注册中...");
|
||||
var seeds = new List<string>();
|
||||
foreach (var x in regResources)
|
||||
{
|
||||
seeds.Add(x.HandleSeed);
|
||||
if (string.IsNullOrEmpty(x.RefHandleSeed) is false)
|
||||
{
|
||||
seeds.Add(x.RefHandleSeed);
|
||||
}
|
||||
}
|
||||
|
||||
seeds = seeds.Distinct().ToList();
|
||||
|
||||
var handles =
|
||||
new System.Collections.Generic.Dictionary<string, string>(seeds.Select(x =>
|
||||
new KeyValuePair<string, string>(x, IDIS_Service.GenerateHandle())));
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var x in regResources)
|
||||
{
|
||||
var handle = handles[x.HandleSeed];
|
||||
IDIS_Service.Singleton.Register(handle, x.Name, x.Format, x.Value, x.Category);
|
||||
if (string.IsNullOrEmpty(x.RefHandleSeed) is false && handles.TryGetValue(x.RefHandleSeed, out var refHandle))
|
||||
{
|
||||
IDIS_Service.Singleton.RegisterReference(handle, refHandle);
|
||||
}
|
||||
logLabel.Text+=$"\n[{DateTime.Now}]{x.Name} 已注册,使用标识: {handle}";
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logLabel.Text += $"\n[color=red]错误:\n{e.Message}[/color]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var x in progressBars)
|
||||
{
|
||||
x.Value = x.MinValue;
|
||||
_progressQueue.Enqueue(x);
|
||||
}
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
switch (_currentProgressBar)
|
||||
{
|
||||
case null when _progressQueue.Count == 0:
|
||||
return;
|
||||
case null:
|
||||
_progressQueue.TryDequeue(out _currentProgressBar);
|
||||
return;
|
||||
case (var x) when x.Value >= x.MaxValue:
|
||||
_progressQueue.TryDequeue(out _currentProgressBar);
|
||||
return;
|
||||
default:
|
||||
_currentProgressBar.Value +=
|
||||
Mathf.Lerp(_currentProgressBar.MinValue, _currentProgressBar.MaxValue, delta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,155 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using BITKit;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||
|
||||
namespace BITFactory;
|
||||
|
||||
public partial class IDIS_RegisterService : Node
|
||||
{
|
||||
[ExportCategory("Services")]
|
||||
[Export] private IDIS_Service service;
|
||||
[Export] private IDIS_TemplateService templateService;
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private NodeBuilder templateIndexBuilder;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private Button generateHandleButton;
|
||||
[Export] private NodeBuilder templateFormatBuilder;
|
||||
[Export] private Button registerButton;
|
||||
[Export] private ProgressBar registerProgress;
|
||||
|
||||
[ExportCategory("Register Reference")]
|
||||
[Export] private Control referenceContainer;
|
||||
[Export] private Button addReferenceButton;
|
||||
|
||||
[ExportCategory("Hints")]
|
||||
[Export] private Label hints;
|
||||
|
||||
private readonly List<(string format,string value,string category)> _currentValues = new();
|
||||
private readonly List<string> _currentReferences = new();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
registerButton.Pressed += Register;
|
||||
|
||||
generateHandleButton.Pressed += ()=>handleEdit.Text = IDIS_Service.GenerateHandle();
|
||||
|
||||
addReferenceButton.Pressed += AddReferenceEdit;
|
||||
|
||||
handleEdit.Editable = false;
|
||||
registerButton.Disabled = true;
|
||||
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
private void Rebuild()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
templateIndexBuilder.Clear();
|
||||
templateFormatBuilder.Clear();
|
||||
foreach (var x in templateService.templates)
|
||||
{
|
||||
var container = templateIndexBuilder.Build<UXContainer>();
|
||||
container.button.Text = x.TemplateName;
|
||||
container.button.Pressed += () =>
|
||||
{
|
||||
Entry(x);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void Entry(IDIS_Template template)
|
||||
{
|
||||
_currentValues.Clear();
|
||||
templateFormatBuilder.Clear();
|
||||
var currentIndex = 0;
|
||||
foreach (var x in template.Formats)
|
||||
{
|
||||
var myIndex = currentIndex++;
|
||||
|
||||
_currentValues.Add((x.format, string.Empty, x.category));
|
||||
|
||||
var formatContainer = templateFormatBuilder.Build<UXContainer>();
|
||||
|
||||
formatContainer.labels[0].Text = x.format;
|
||||
formatContainer.lineEdits[0].PlaceholderText = x.hint;
|
||||
|
||||
formatContainer.lineEdits[0].TextChanged += s =>
|
||||
{
|
||||
var value = _currentValues[myIndex];
|
||||
value.value = s;
|
||||
_currentValues[myIndex] = value;
|
||||
};
|
||||
}
|
||||
|
||||
handleEdit.Editable = true;
|
||||
registerButton.Disabled = false;
|
||||
}
|
||||
|
||||
private void AddReferenceEdit()
|
||||
{
|
||||
var lineEdit = new LineEdit();
|
||||
|
||||
var currentIndex = referenceContainer.GetChildCount();
|
||||
|
||||
_currentReferences.Add(string.Empty);
|
||||
lineEdit.TextChanged += s =>
|
||||
{
|
||||
_currentReferences[currentIndex] = s;
|
||||
};
|
||||
|
||||
lineEdit.Text = "88.123.99/";
|
||||
|
||||
referenceContainer.AddChild(lineEdit);
|
||||
}
|
||||
private void Register()
|
||||
{
|
||||
if (_currentValues.Any(x =>
|
||||
string.IsNullOrEmpty(x.format) || string.IsNullOrEmpty(x.value) || string.IsNullOrEmpty(x.category)))
|
||||
{
|
||||
hints.SetTextAsync("请填写完整的数据格式");
|
||||
return;
|
||||
}
|
||||
|
||||
var handle = string.IsNullOrEmpty(handleEdit.Text) ? IDIS_Service.GenerateHandle() : handleEdit.Text;
|
||||
var dataJson = JsonHelper.Get(_currentValues);
|
||||
var referenceJson = JsonHelper.Get(_currentReferences);
|
||||
|
||||
BIT4Log.Log<IDIS_RegisterService>($"注册标识:{handle}");
|
||||
BIT4Log.Log<IDIS_RegisterService>($"\n{dataJson}");
|
||||
BIT4Log.Log<IDIS_RegisterService>("注册引用:");
|
||||
BIT4Log.Log<IDIS_RegisterService>($"\n{referenceJson}");
|
||||
|
||||
hints.Text="正在注册...";
|
||||
|
||||
service.Register(handle);
|
||||
foreach (var x in _currentValues)
|
||||
{
|
||||
service.Register(handle, x.format, x.value,x.category);
|
||||
}
|
||||
foreach (var x in _currentReferences)
|
||||
{
|
||||
service.RegisterReference(handle, x);
|
||||
}
|
||||
|
||||
var tween = CreateTween();
|
||||
registerButton.Disabled = true;
|
||||
registerProgress.Value = 0;
|
||||
tween.TweenProperty(registerProgress, "value", registerProgress.MaxValue, 0.5f);
|
||||
tween.Finished+= () =>
|
||||
{
|
||||
registerProgress.Value = 0;
|
||||
registerProgress.Visible = false;
|
||||
registerButton.Disabled = false;
|
||||
hints.Text = "注册成功";
|
||||
tween.Stop();
|
||||
};
|
||||
tween.Play();
|
||||
|
||||
handleEdit.Text = string.Empty;
|
||||
}
|
||||
}
|
@@ -95,7 +95,7 @@ public partial class IDIS_SearchService : Node
|
||||
{
|
||||
var container = valueTemplate.Instantiate<UXContainer>();
|
||||
|
||||
container.labels[0].Text = x.Format;
|
||||
container.labels[0].Text = x.Name;
|
||||
container.labels[1].Text = x.Value;
|
||||
container.labels[2].Text = x.UpdateTime.ToString(CultureInfo.InvariantCulture);
|
||||
container.labels[3].Text = x.CreateTime.ToString(CultureInfo.InvariantCulture);
|
||||
|
@@ -72,6 +72,10 @@ public class IDIS_Data:IDIS_Base
|
||||
/// </summary>
|
||||
public string Handle { get; set; }
|
||||
/// <summary>
|
||||
/// 记录的名称,通常为中文
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 值类型,例如string,url,site
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
@@ -184,7 +188,7 @@ public class IDIS_DBContext:DbContext
|
||||
SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
public void Register(string handle,string format, string value,string category)
|
||||
public void Register(string handle,string name,string format, string value,string category)
|
||||
{
|
||||
var handleExists = Values.Any(x => x.Handle == handle);
|
||||
if (!handleExists)
|
||||
@@ -193,6 +197,7 @@ public class IDIS_DBContext:DbContext
|
||||
}
|
||||
var data = new IDIS_Data()
|
||||
{
|
||||
Name = name,
|
||||
Handle = handle,
|
||||
Format = format,
|
||||
Value = value,
|
||||
@@ -228,6 +233,7 @@ public class IDIS_DBContext:DbContext
|
||||
/// </summary>
|
||||
public partial class IDIS_Service:Node
|
||||
{
|
||||
public static IDIS_Service Singleton { get; private set; }
|
||||
private static IDIS_DBContext Context;
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -236,6 +242,11 @@ public partial class IDIS_Service:Node
|
||||
UniTask.Run(()=>Context.Database.EnsureCreatedAsync());
|
||||
}
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
Singleton = this;
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
Context.Dispose();
|
||||
@@ -244,7 +255,7 @@ public partial class IDIS_Service:Node
|
||||
|
||||
public bool Query(string word,out IDIS_Query[] queries) => Context.Query(word, out queries);
|
||||
public bool Register(string handle) => Context.Register(handle);
|
||||
public void Register(string handle, string format, string value,string category) => Context.Register(handle, format, value,category);
|
||||
public void Register(string handle,string name, string format, string value,string category) => Context.Register(handle,name, format, value,category);
|
||||
public void RegisterReference(string handle,string refenceHandle) => Context.RegisterReference(handle,refenceHandle);
|
||||
public static string GenerateHandle() => $"88.123.99/{Mathf.Abs(Guid.NewGuid().GetHashCode())}";
|
||||
public bool Query(string key, out IDIS_Query query) => Context.Query(key, out query);
|
||||
|
@@ -99,8 +99,8 @@ public partial class IDIS_THService : Node
|
||||
switch (currentUpdateMode)
|
||||
{
|
||||
case UpdateMode.Insert:
|
||||
service.Register(handle ,"温度", temperature, "环境");
|
||||
service.Register(handle, "湿度", humidity, "环境");
|
||||
service.Register(handle,"温度" ,"float", temperature, "环境");
|
||||
service.Register(handle, "湿度","float", humidity, "环境");
|
||||
break;
|
||||
case UpdateMode.Update:
|
||||
if (service.Update(handle, "温度",temperature) is false)
|
||||
|
@@ -4,11 +4,13 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dyxw5ocfiamgi" path="res://Mods/工业数据采集与分析应用分享/Arts/Images/标准ModbusRTU图片.jpg" id="1_yd6oj"]
|
||||
[ext_resource type="PackedScene" uid="uid://dghty7km181mc" path="res://Mods/工业数据采集与分析应用分享/Templates/关联标识.tscn" id="2_so2ho"]
|
||||
|
||||
[node name="TrackContainer" type="PanelContainer" node_paths=PackedStringArray("labels", "lineEdits")]
|
||||
[node name="TrackContainer" type="PanelContainer" node_paths=PackedStringArray("labels", "buttons", "lineEdits", "optionButtons")]
|
||||
custom_minimum_size = Vector2(1280, 512)
|
||||
script = ExtResource("1_4faap")
|
||||
labels = []
|
||||
buttons = []
|
||||
lineEdits = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="VFlex" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
@@ -91,44 +93,60 @@ layout_mode = 2
|
||||
theme_type_variation = &"WhitePanel"
|
||||
text = "订单信息"
|
||||
|
||||
[node name="关联标识" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="Label2" type="Label" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"WhitePanel"
|
||||
text = "生产设备"
|
||||
|
||||
[node name="关联标识2" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识2" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="关联标识3" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识3" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="Label3" type="Label" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"WhitePanel"
|
||||
text = "生产环境"
|
||||
|
||||
[node name="关联标识4" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识4" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="关联标识5" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识5" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="关联标识6" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识6" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="关联标识7" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识7" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="关联标识8" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels") instance=ExtResource("2_so2ho")]
|
||||
[node name="关联标识8" parent="VFlex/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" node_paths=PackedStringArray("labels", "buttons", "optionButtons") instance=ExtResource("2_so2ho")]
|
||||
layout_mode = 2
|
||||
labels = []
|
||||
buttons = []
|
||||
optionButtons = []
|
||||
|
@@ -2,14 +2,16 @@
|
||||
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXContainer.cs" id="1_fp0bm"]
|
||||
|
||||
[node name="标识数据模板" type="PanelContainer" node_paths=PackedStringArray("label", "contextContainer", "labels", "lineEdits")]
|
||||
[node name="标识数据模板" type="PanelContainer" node_paths=PackedStringArray("label", "contextContainer", "labels", "buttons", "lineEdits", "optionButtons")]
|
||||
custom_minimum_size = Vector2(512, 100)
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource("1_fp0bm")
|
||||
label = NodePath("Layout/Label")
|
||||
contextContainer = NodePath("Layout/MarginContainer/UXContainer-Container")
|
||||
labels = []
|
||||
buttons = []
|
||||
lineEdits = []
|
||||
optionButtons = []
|
||||
|
||||
[node name="Layout" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
@@ -2,16 +2,18 @@
|
||||
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXContainer.cs" id="1_dre1u"]
|
||||
|
||||
[node name="标识模板格式" type="VBoxContainer" node_paths=PackedStringArray("button", "labels", "lineEdits")]
|
||||
[node name="标识模板格式" type="VBoxContainer" node_paths=PackedStringArray("labels", "button", "buttons", "lineEdits", "optionButtons")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_dre1u")
|
||||
button = NodePath("HBoxContainer/delete-button")
|
||||
labels = []
|
||||
button = NodePath("HBoxContainer/delete-button")
|
||||
buttons = []
|
||||
lineEdits = [NodePath("HBoxContainer/name-edit"), NodePath("HBoxContainer/hint-edit"), NodePath("HBoxContainer/category-edit")]
|
||||
optionButtons = []
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ namespace BITFactory;
|
||||
public partial class CourseElement : Node
|
||||
{
|
||||
private static Node CurrentScene;
|
||||
private static string CurrentScenePath=string.Empty;
|
||||
[Export]
|
||||
public PackedScene CourseScene;
|
||||
|
||||
@@ -41,7 +42,7 @@ public partial class CourseElement : Node
|
||||
|
||||
Stopwatch stopwatch = new();
|
||||
stopwatch.Start();
|
||||
if (CurrentScene?.Name == CourseScene?.ResourceName)
|
||||
if (CurrentScenePath == CourseScene?.ResourcePath)
|
||||
{
|
||||
BIT4Log.Log<CourseElement>($"已返回当前课程");
|
||||
UXService.Open(CurrentScene as Control);
|
||||
@@ -54,6 +55,7 @@ public partial class CourseElement : Node
|
||||
BIT4Log.Log<CourseElement>($"已释放当前课程:\t{CurrentScene.Name}");
|
||||
}
|
||||
CurrentScene = CourseScene!.Instantiate();
|
||||
CurrentScenePath = CourseScene.ResourcePath;
|
||||
GetTree().Root.AddChild(CurrentScene);
|
||||
UXService.Open(CurrentScene as Control);
|
||||
BIT4Log.Log<CourseElement>($"已加载新的课程:\t{CourseScene.ResourceName}");
|
||||
|
@@ -141,9 +141,9 @@ public partial class SearchEngine:Node,ISearchEngine
|
||||
|
||||
instance.titleLabel.Text = entry.Display ?? entry.Id ?? entry.Key;
|
||||
instance.Text = entry.Value;
|
||||
instance.updateTimeLabel.Text = entry.UpdateDate.ToString(CultureInfo.InvariantCulture);
|
||||
instance.createTimeLabel.Text = entry.CreateDate.ToString(CultureInfo.InvariantCulture);
|
||||
instance.headerLabel.Text = entry.Key;
|
||||
instance.labels[0].Text = entry.UpdateDate.ToString(CultureInfo.InvariantCulture);
|
||||
instance.labels[1].Text = entry.CreateDate.ToString(CultureInfo.InvariantCulture);
|
||||
instance.labels[2].Text = entry.Key;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user