This commit is contained in:
CortexCore 2023-07-18 16:42:33 +08:00
parent 5f6975ca67
commit 37f46e6d16
25 changed files with 335 additions and 105 deletions

View File

@ -1,15 +0,0 @@
using Godot;
using RosSharp.RosBridgeClient.Protocols;
namespace BITKit;
/// <summary>
/// 使用Godot.Node作为容器的RosClient
/// </summary>
public partial class ROSClientService : Node
{
public override void _Ready()
{
WebSocketNetProtocol protocol = new("ws://");
RosSharp.RosBridgeClient.RosSocket client = new(protocol);
}
}

View File

@ -26,9 +26,12 @@ public partial class RotationComponent : EntityComponent
/// 可读可写的当前角度
/// </summary>
public float CurrentAngle;
[ExportCategory("Nodes")]
[Export] public Node3D node3D;
public override void _Ready()
{
//保存默认角度
OriginalEuler = Rotation;
OriginalEuler = node3D.RotationDegrees;
}
}

View File

@ -148,7 +148,7 @@ public partial class SCADAService : Node,IProvider<string>,IActivable
euler.X = Mathf.DegToRad(euler.X);
euler.Y = Mathf.DegToRad(euler.Y);
euler.Z = Mathf.DegToRad(euler.Z);
rotationComponent.Rotation = euler;
rotationComponent.node3D.Rotation = euler;
//rotationComponent.RotationDegrees = euler;

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b32l3iwogkdf5"]
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/GodotEntitiesService.cs" id="1_ewsld"]
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/Core/GodotEntitiesService.cs" id="1_5wmjb"]
[node name="EntitiesManager" type="Node"]
script = ExtResource("1_ewsld")
script = ExtResource("1_5wmjb")

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,7 @@ public partial class Entity : Node,IEntity
GetInstanceId();
if (x is not IEntityComponent component) continue;
component.Entity = this;
TypeComponents.TryAdd(x.GetType(),component);
TypeComponents.TryAdd(component.BaseType,component);
//BIT4Log.Log<Entity>($"已加载组件:{x.Name}");
component.OnAwake();
entityComponents.Add(component);

View File

@ -1,3 +1,4 @@
using System;
using BITKit.Core.Entites;
using Godot;
@ -5,8 +6,9 @@ namespace BITKit;
/// <summary>
/// 基于Godot.Node3D的IEntityComponent实现
/// </summary>
public partial class EntityComponent : Node3D,IEntityComponent
public partial class EntityComponent : Node,IEntityComponent
{
public virtual Type BaseType => GetType();
public IEntity Entity { get; set; }
public virtual void OnStart(){}
public virtual void OnAwake(){}

View File

@ -0,0 +1,97 @@
using System;
using Godot;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using BITKit.Core.Entites;
// ReSharper disable All
namespace BITKit;
/// <summary>
/// 基于Godot.Node的IEntitiesService实现
/// </summary>
public partial class GodotEntitiesService : Node,IEntitiesService
{
public GodotEntitiesService()
{
DI.Register<IEntitiesService>(this);
}
private readonly Dictionary<ulong,IEntity> _entities=new ();
private CancellationTokenSource _cancellationTokenSource;
public IEntity[] Entities => _entities.Values.ToArray();
public bool Register(IEntity entity)
{
return _entities.TryAdd(entity.Id, entity);
}
public bool UnRegister(IEntity entity)
{
return _entities.TryRemove(entity.Id);
}
public override void _Ready()
{
_cancellationTokenSource = new();
}
protected override void Dispose(bool disposing)
{
if(disposing)_cancellationTokenSource.Cancel();
}
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
public IEntity[] Query<T>() where T : IEntityComponent
{
return _entities.Values.Where(x => x.TryGetComponent<T>(out _)).ToArray();
}
public ValueTuple<T>[] QueryComponents<T>() where T : IEntityComponent
{
return _entities.Values
.Where(x => x.TryGetComponent<T>(out _))
.Select(x =>
{
var component = x.Components.Single(x => x is T);
return (T)component;
})
.Select(x => new ValueTuple<T>(x))
.ToArray();
}
public (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
{
// return _entities.Values
// .Where(x => x.TryGetComponent<T>(out _) && x.TryGetComponent<T1>(out _))
// .Select(x =>
// {
// var component = (T)x.Components.Single(x => x is T);
// var component1 = (T1)x.Components.Single(x => x is T1);
// (T, T1) value = new(component, component1);
// return value;
// })
// .ToArray();
var entities = _entities.Values.Where(x => x.TryGetComponent<T>(out _) && x.TryGetComponent<T1>(out _));
var result = new List<(T, T1)>();
foreach (var entity in entities)
{
var t = (T)entity.Components.Single(x => x is T);
var t1 = (T1)entity.Components.Single(x => x is T1);
result.Add(new(t,t1));
}
return result.ToArray();
}
public (T, T1, T2)[] QueryComponents<T, T1, T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent
{
return _entities.Values
.Where(x => x.TryGetComponent<T>(out _) && x.TryGetComponent<T1>(out _) && x.TryGetComponent<T2>(out _))
.Select(x =>
{
var component = (T)x.Components.Single(x => x is T);
var component1 = (T1)x.Components.Single(x => x is T1);
var component2 = (T2)x.Components.Single(x => x is T2);
(T, T1, T2) value = new(component, component1, component2);
return value;
})
.ToArray();
}
}

View File

@ -1,46 +0,0 @@
using Godot;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using BITKit.Core.Entites;
// ReSharper disable All
namespace BITKit;
/// <summary>
/// 基于Godot.Node的IEntitiesService实现
/// </summary>
public partial class GodotEntitiesService : Node,IEntitiesService
{
public GodotEntitiesService()
{
DI.Register<IEntitiesService>(this);
}
private readonly Dictionary<ulong,IEntity> _entities=new ();
private CancellationTokenSource _cancellationTokenSource;
public IEntity[] Entities => _entities.Values.ToArray();
public bool Register(IEntity entity)
{
return _entities.TryAdd(entity.Id, entity);
}
public bool UnRegister(IEntity entity)
{
return _entities.TryRemove(entity.Id);
}
public override void _Ready()
{
_cancellationTokenSource = new();
}
protected override void Dispose(bool disposing)
{
if(disposing)_cancellationTokenSource.Cancel();
}
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
public IEntity[] Query<T>() where T : IEntityComponent
{
return _entities.Values.Where(x => x.TryGetComponent<T>(out _)).ToArray();
}
}

View File

@ -0,0 +1,6 @@
namespace BITKit;
public abstract partial class ConditionComponent:EntityComponent,ICondition
{
public abstract bool OnCheck();
}

View File

@ -0,0 +1,9 @@
using Godot;
using System;
using BITKit;
namespace BITKit;
public partial class QuestComponent : EntityComponent
{
[Export] public string QuestName;
[Export] public bool QuestCompleted;
}

View File

@ -0,0 +1,28 @@
using Godot;
using System;
using System.Text;
using BITKit.Core.Entites;
namespace BITKit;
[Tool]
public partial class QuestService : Node
{
private static IEntitiesService entitiesService => DI.Get<IEntitiesService>();
[Export]
[ReadOnly]
public string quests;
public override void _Process(double delta)
{
if (Engine.IsEditorHint()) return;
var stringBuilder= new StringBuilder();
foreach (var (quest, condition) in entitiesService.QueryComponents<QuestComponent, ConditionComponent>())
{
quest.QuestCompleted = condition.OnCheck();
//stringBuilder.AppendLine($"{quest.Name}:{quest.QuestCompleted?"已完成":"未完成"}");
}
quests = stringBuilder.ToString();
}
}

View File

@ -0,0 +1,15 @@
using Godot;
using System;
namespace BITKit;
public partial class VideoPlayer : VideoStreamPlayer
{
[Export] private bool loop;
public override void _Ready()
{
if (loop)
{
Finished += Play;
}
}
}

BIN
EXE/ModbusSlave.exe Normal file

Binary file not shown.

View File

@ -48,6 +48,9 @@ public partial class IDIS_TemplateWeaver : FormWeaverResource
typeButton.GetPopup().AddItem("h_site");
typeButton.GetPopup().AddItem("base64");
typeButton.GetPopup().AddItem("guid");
typeButton.GetPopup().AddItem("url");
typeButton.GetPopup().AddItem("dateTime");
typeButton.GetPopup().AddItem("float");
typeButton.Selected = 0;

View File

@ -48,7 +48,7 @@ public partial class IDIS_SearchService : Node
MathNode.ClearChild(searchCandidateContainer);
if (service.Query(word, out IDIS_Query[] queries) is false) return;
if(queries.Length is 1 && queries.First().Handle == word)return;
foreach (var query in queries)
foreach (var query in queries.Take(3))
{
var button = new Button();

View File

@ -8,9 +8,7 @@ using BITKit;
using Cysharp.Threading.Tasks;
using Godot;
using Microsoft.EntityFrameworkCore;
using RosSharp.RosBridgeClient.MessageTypes.Sensor;
using Constant = BITKit.Constant;
using String = RosSharp.RosBridgeClient.MessageTypes.Std.String;
namespace BITFactory;
// ReSharper disable once IdentifierTypo

View File

@ -0,0 +1,17 @@
using Godot;
using System;
using System.Linq;
using BITKit;
namespace BITKit;
public partial class TemplateCondition : ConditionComponent
{
public override Type BaseType => typeof(ConditionComponent);
[Export] private TemplateResource templateResource;
[Export] private string templateName;
public override bool OnCheck()
{
return templateResource.GetTemplates().Any(x => x.Name == templateName);
}
}

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=59 format=3 uid="uid://cngf2h2a5ne4a"]
[gd_scene load_steps=66 format=3 uid="uid://cngf2h2a5ne4a"]
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXPanel.cs" id="1_c78kh"]
[ext_resource type="PackedScene" uid="uid://d1po2qljd0jh2" path="res://Mods/教育平台/教程header.tscn" id="2_mn1rn"]
@ -15,6 +15,7 @@
[ext_resource type="Texture2D" uid="uid://b3tqua2bt1ix2" path="res://addons/ui_design_tool/assets/icons/format-color-text.png" id="11_h2x7p"]
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXServiceProxy.cs" id="11_qsxmx"]
[ext_resource type="Texture2D" uid="uid://dv24ghy23fnje" path="res://Artists/Art/Icons/icon_file-ppt-filled.png" id="12_2u0af"]
[ext_resource type="Texture2D" uid="uid://cll880ni5wb3b" path="res://Artists/Art/Icons/Arrows/icon__keyboard-arrow-down-rounded.png" id="12_qxqew"]
[ext_resource type="Script" path="res://BITKit/Scripts/Components/OpenUrl.cs" id="13_6a13i"]
[ext_resource type="StyleBox" uid="uid://be603nq0xbeaa" path="res://Artists/Themes/Factory-Panel.tres" id="13_6i2vs"]
[ext_resource type="PackedScene" uid="uid://dqd08tc6xidpy" path="res://Artists/Templates/标题栏Template.tscn" id="13_7vm0l"]
@ -36,6 +37,7 @@
[ext_resource type="VideoStream" path="res://Mods/工业数据采集与分析应用分享/Arts/Videos/生产过程模拟.ogv" id="27_laoxb"]
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/温湿度Reader.cs" id="27_q8j7q"]
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/IDIS_THService.cs" id="30_jn688"]
[ext_resource type="Script" path="res://BITKit/Scripts/Video/VideoPlayer.cs" id="31_0moq5"]
[ext_resource type="Script" path="res://BITKit/Scripts/Builder/Form/FormBuilder.cs" id="37_pcw20"]
[ext_resource type="Script" path="res://BITKit/Scripts/Builder/TemplateBuilder/TemplateBuilder.cs" id="38_fhmdw"]
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/Builder/IDIS_RegisterDB.cs" id="39_d5jaq"]
@ -47,6 +49,10 @@
[ext_resource type="Resource" uid="uid://b38onsp3c3jem" path="res://Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度/温度.tres" id="43_qidfp"]
[ext_resource type="Resource" uid="uid://d3xam2no2uaas" path="res://Mods/工业数据采集与分析应用分享/Resource/自动标识模板/温湿度/湿度.tres" id="44_0hai5"]
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/Temp/生成温湿度.cs" id="45_pngx2"]
[ext_resource type="Script" path="res://BITKit/Scripts/Quest/QuestService.cs" id="50_1qkmw"]
[ext_resource type="Script" path="res://BITKit/Scripts/ECS/Core/Entity.cs" id="51_kq8q8"]
[ext_resource type="Script" path="res://BITKit/Scripts/Quest/QuestComponent.cs" id="52_qa8xx"]
[ext_resource type="Script" path="res://Mods/工业数据采集与分析应用分享/Scripts/Quest/TemplateCondition.cs" id="53_lsbwj"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nfm72"]
bg_color = Color(1, 1, 1, 0.0313726)
@ -90,6 +96,9 @@ generateButtonPath = NodePath("../../Layout/UX Window Service/Horizontal Layout/
[sub_resource type="Resource" id="Resource_3wa3y"]
script = ExtResource("39_d5jaq")
[sub_resource type="Resource" id="Resource_1df3p"]
script = ExtResource("39_p2ycf")
[node name="标识注册与解析" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -252,7 +261,7 @@ layout_mode = 2
theme_type_variation = &"SideTab"
toggle_mode = true
button_group = ExtResource("3_wv1s6")
text = "注册标识模板"
text = "注册标识"
icon = ExtResource("11_h2x7p")
expand_icon = true
@ -265,6 +274,13 @@ text = "模拟生产"
icon = ExtResource("11_h2x7p")
expand_icon = true
[node name="TextureRect" type="TextureRect" parent="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout"]
custom_minimum_size = Vector2(0, 128)
layout_mode = 2
texture = ExtResource("12_qxqew")
expand_mode = 1
stretch_mode = 5
[node name="Label2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout"]
layout_mode = 2
theme_type_variation = &"AccentBox"
@ -1028,31 +1044,38 @@ layout_mode = 2
theme_type_variation = &"HeaderSmall"
text = "引用的标识"
[node name="引用标识" type="HFlowContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2"]
[node name="VBoxContainer" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2"]
layout_mode = 2
theme_override_constants/h_separation = 16
[node name="标识引用模板" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
[node name="ScrollContainer" type="ScrollContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="引用标识" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer"]
layout_mode = 2
[node name="标识引用模板" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
layout_mode = 2
buttons = []
optionButtons = []
[node name="标识引用模板2" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
[node name="标识引用模板2" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
layout_mode = 2
buttons = []
optionButtons = []
[node name="标识引用模板3" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
[node name="标识引用模板3" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
layout_mode = 2
buttons = []
optionButtons = []
[node name="标识引用模板4" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
[node name="标识引用模板4" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
layout_mode = 2
buttons = []
optionButtons = []
[node name="标识引用模板5" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
[node name="标识引用模板5" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer/引用标识" node_paths=PackedStringArray("buttons", "optionButtons") instance=ExtResource("14_0l0dn")]
layout_mode = 2
buttons = []
optionButtons = []
@ -1632,10 +1655,7 @@ layout_mode = 2
text = "模拟生产-自动注册标识"
[node name="Context" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/标题栏Template" index="1"]
text = "好的我知道你不会喜欢手动注册一大堆的标识,因为这通常在生产过程中时自动注册的
你现在需要手动注册所有的标识,但是你不太想一次手动整十多个标识出来
对了,这个自动注册的过程只能一次批量注册
因为单独注册的话就不能自动引用标识码了"
text = "很明显,现在我们有生产任务:根据下面的模拟生产步骤,根据指示一步一步完成模拟生产"
[node name="占位符" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/标题栏Template" index="2"]
custom_minimum_size = Vector2(0, 32)
@ -1654,8 +1674,8 @@ text = "模拟生产"
[node name="GridContainer" type="GridContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/h_separation = 8
columns = 2
theme_override_constants/v_separation = 0
columns = 3
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1664,6 +1684,12 @@ text = "订单信息"
[node name="ProgressBar" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1672,6 +1698,12 @@ text = "温湿度传感器"
[node name="ProgressBar2" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button2" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label3" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1680,6 +1712,12 @@ text = "温度数据"
[node name="ProgressBar3" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button3" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label4" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1688,6 +1726,12 @@ text = "湿度数据"
[node name="ProgressBar4" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button4" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label5" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1696,6 +1740,12 @@ text = "AGV"
[node name="ProgressBar5" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button5" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label6" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1704,6 +1754,12 @@ text = "装配机械臂SR7C1L"
[node name="ProgressBar6" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button6" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label7" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1712,6 +1768,12 @@ text = "装配机械臂SR7C1L"
[node name="ProgressBar7" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button7" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label8" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1720,6 +1782,12 @@ text = "AGV机械臂I5外发"
[node name="ProgressBar8" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button8" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label9" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1728,6 +1796,12 @@ text = "装配夹爪"
[node name="ProgressBar9" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button9" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label10" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
@ -1736,6 +1810,12 @@ text = "AGV夹爪"
[node name="ProgressBar10" type="ProgressBar" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Button10" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer/GridContainer"]
layout_mode = 2
disabled = true
text = "等待执行中"
[node name="Label2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识/HFlowContainer/VBoxContainer"]
layout_mode = 2
@ -1752,6 +1832,8 @@ layout_mode = 2
stream = ExtResource("27_laoxb")
autoplay = true
expand = true
script = ExtResource("31_0moq5")
loop = true
[node name="HSeparator" type="HSeparator" parent="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/自动注册标识"]
layout_mode = 2
@ -1787,7 +1869,7 @@ handleLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/Mar
createTimeLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin/GridContainer/label[1]")
updateTimeLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin/GridContainer/label[2]")
valueContainer = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析数据")
referenceContainer = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/引用标识")
referenceContainer = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/ScrollContainer/Layout/标识解析结果/VBoxContainer/UXContainer/Margin2/VBoxContainer/ScrollContainer/引用标识")
valueTemplate = ExtResource("19_abuse")
referenceTemplate = ExtResource("14_0l0dn")
categoryTemplate = ExtResource("20_kicyn")
@ -1852,6 +1934,21 @@ script = ExtResource("45_pngx2")
count = 256
_lineEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2/LineEdit-0")
[node name="模拟生产任务服务" type="Node" parent="."]
script = ExtResource("50_1qkmw")
[node name="注册订单信息" type="Node" parent="模拟生产任务服务"]
script = ExtResource("51_kq8q8")
[node name="Quest" type="Node" parent="模拟生产任务服务/注册订单信息"]
script = ExtResource("52_qa8xx")
QuestName = "注册订单信息"
[node name="Condition" type="Node" parent="模拟生产任务服务/注册订单信息"]
script = ExtResource("53_lsbwj")
templateResource = SubResource("Resource_1df3p")
templateName = "订单信息"
[connection signal="pressed" from="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout/Button" to="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout/Button" method="Execute"]
[connection signal="pressed" from="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout/Button5" to="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout/Button5" method="Return"]
[connection signal="pressed" from="Layout/UX Window Service/Horizontal Layout/内容/MarginContainer/标识解析/Search/SearchEdit/HBoxContainer/refresh-button" to="标识搜索服务" method="Search"]

View File

@ -92,5 +92,12 @@
- [ ] 解析错误
- [ ] 给出错误提示和原因
## 更改记录
- 完成部分功能
- 创建文档
### 新增issue date:2023年7月18日
- [ ] 添加完成的引导,告诉用户下一步具体该点击什么按钮
- [ ] 添加可以删除模板的按钮
- [ ] 添加模板后自动进入新创建的模板
- [ ] 修复NodeBuilder的空提示
- [ ] 添加根据标识模板搜索已注册的标识的功能
- [ ] 修复标识解析的搜索框`搜索按钮`无效的问题
### 完成部分功能
### 创建文档

View File

@ -65,7 +65,7 @@
* `订单类型` `string` `测试订单` `订单信息`
* `订单地址` `url` `https://www.baidu.com` `订单信息`
* `订单图片` `url` `https://www.baidu.com/img/bd_logo1.png` `订单信息`
* 已完成订单信息的创建,保存按钮其实没用,只是为了让你点一下安心
* 点击保存
### 温湿度传感器本身标识
* 点击`创建标识模板`
* 输入模板名称,例如:`温湿度传感器模板`

View File

@ -4,10 +4,9 @@ using System;
#if TOOLS
namespace BITKit;
[Tool]
public partial class ReferencePlugins : EditorPlugin
public partial class BITGodotPlugins : EditorPlugin
{
private InspectorPlugins _plugin;
private PackedScene _containerTemplate = GD.Load<PackedScene>("res://addons/BITPlugins/ReferenceContainer.tscn");
public override void _EnterTree()
{
_plugin = new InspectorPlugins();

View File

@ -1,5 +1,6 @@
using Godot;
using System;
using System.Reflection;
namespace BITKit;
#if TOOLS
@ -20,13 +21,18 @@ public partial class InspectorPlugins : EditorInspectorPlugin
string hintString,
PropertyUsageFlags usageFlags, bool wide)
{
// We handle properties of type integer.
if (type != Variant.Type.Int) return false;
// Create an instance of the custom property editor and register
// it to a specific property path.
AddPropertyEditor(name, new RandomIntEditor());
// Inform the editor to remove the default property editor for
// this property type.
switch (type)
{
case Variant.Type.String:
var field = @object.GetType().GetField(name);
var att = field?.GetCustomAttribute<ReadOnlyAttribute>();
if (att is null) return false;
var label = new Label();
AddPropertyEditor(name, label);
break;
default:
return false;
}
return true;
}
}

View File

@ -4,4 +4,4 @@ name="BITPlugins"
description="BITKit为Godot支持的插件 "
author="军火商小火柴"
version=""
script="ReferencePlugins.cs"
script="BITGodotPlugins.cs"

View File

@ -40,6 +40,10 @@ mouse_cursor/stretch/aspect="keep"
project/assembly_name="iFactory"
export/ssil/half_size=true
[editor_plugins]
enabled=PackedStringArray("res://addons/BITPlugins/plugin.cfg")
[filesystem]
import/fbx/enabled=false