Breakpoint
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITKit;
|
||||
|
||||
namespace BITFactory;
|
||||
@@ -37,13 +36,20 @@ public partial class CourseElement : Node
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (CurrentScene?.Name == CourseScene?.ResourceName)
|
||||
{
|
||||
BIT4Log.Log<CourseElement>($"已返回当前课程");
|
||||
UXService.Open(CurrentScene as Control);
|
||||
return;
|
||||
}
|
||||
if (CurrentScene is not null)
|
||||
{
|
||||
BIT4Log.Log<CourseElement>($"正在释放课程:\t{CurrentScene.Name}");
|
||||
CurrentScene.QueueFree();
|
||||
BIT4Log.Log<CourseElement>($"已释放当前课程:\t{CurrentScene.Name}");
|
||||
}
|
||||
CurrentScene = CourseScene.Instantiate();
|
||||
CurrentScene = CourseScene!.Instantiate();
|
||||
GetTree().Root.AddChild(CurrentScene);
|
||||
UXService.Open(CurrentScene as Control);
|
||||
BIT4Log.Log<CourseElement>($"已加载新的课程:\t{CurrentScene.Name}");
|
||||
|
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BITKit;
|
||||
@@ -36,6 +37,7 @@ public class SearchResult:ISearchEntry
|
||||
public interface ISearchEngine
|
||||
{
|
||||
SearchResult[] GetSearchResults(string key);
|
||||
void SaveChanges();
|
||||
void Add(SearchResult result);
|
||||
void Remove(string key, string id);
|
||||
}
|
||||
@@ -91,11 +93,22 @@ public partial class SearchEngine:Node,ISearchEngine
|
||||
QueueContainerFree();
|
||||
searchProgressBar.Show();
|
||||
var list = await Context.context.ToListAsync();
|
||||
Spawn(string.IsNullOrEmpty(key) ? list : list.Where(x => x.Key.Contains(key)));
|
||||
var result = (string.IsNullOrEmpty(key) ? list : list.Where(x => x.Key.Contains(key))).ToArray();
|
||||
|
||||
//Fallback
|
||||
if (result.Any() is false)
|
||||
{
|
||||
result = list.Where(x => x.Display.Contains(key!)).ToArray();
|
||||
}
|
||||
if (result.Any() is false)
|
||||
{
|
||||
result = list.Where(x => x.Id.Contains(key!)).ToArray();
|
||||
}
|
||||
|
||||
Spawn(result);
|
||||
_logBuilder.AppendLine($"已获取到集合");
|
||||
_logBuilder.AppendLine($"{string.Join("\n",list)}");
|
||||
searchProgressBar.Hide();
|
||||
//searchLogLabel.Text = _logBuilder.ToString();
|
||||
}
|
||||
|
||||
private void QuickSearch()
|
||||
@@ -109,12 +122,6 @@ public partial class SearchEngine:Node,ISearchEngine
|
||||
var index = i;
|
||||
var element = searchResults[i];
|
||||
quickSearchButton.GetPopup().AddItem(element.Key);
|
||||
// quickSearchButton.GetPopup().IdPressed = id =>
|
||||
// {
|
||||
// var entry = searchResults[index];
|
||||
// searchInput.Text = entry.Key;
|
||||
// Search(entry.Key);
|
||||
// };
|
||||
}
|
||||
}
|
||||
private void OnPressedIndex(long index)
|
||||
@@ -133,6 +140,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +155,7 @@ public partial class SearchEngine:Node,ISearchEngine
|
||||
}
|
||||
|
||||
public SearchResult[] GetSearchResults(string key)=>Context.context.Where(x=>x.Key.Contains(key)).ToArray();
|
||||
public void SaveChanges() => Context.SaveChanges();
|
||||
|
||||
public void Add(SearchResult result)
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
using Godot;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -13,6 +14,7 @@ public partial class SearchRegister:Node
|
||||
[Export] private LineEdit idLine;
|
||||
[Export] private LineEdit registryRecordLine;
|
||||
[Export] private Button registryButton;
|
||||
[Export] private RichTextLabel registryResultLabel;
|
||||
public override void _Ready()
|
||||
{
|
||||
registryButton.Pressed += Create;
|
||||
@@ -20,16 +22,51 @@ public partial class SearchRegister:Node
|
||||
|
||||
private void Create()
|
||||
{
|
||||
var result = new SearchResult()
|
||||
var searchEngine = DI.Get<ISearchEngine>();
|
||||
registryResultLabel.Text = $"正在注册标识";
|
||||
|
||||
var current = searchEngine
|
||||
.GetSearchResults(keyLine.Text)
|
||||
.Where(x=>x.Key == keyLine.Text && x.Id == idLine.Text)
|
||||
;
|
||||
|
||||
SearchResult result=default;
|
||||
|
||||
var searchResults = current as SearchResult[] ?? current.ToArray();
|
||||
if (searchResults.Any())
|
||||
{
|
||||
Key = keyLine.Text,
|
||||
Value = valueLine.Text,
|
||||
Display = nameLine.Text,
|
||||
Id = idLine.Text,
|
||||
RegistryRecord = registryRecordLine.Text,
|
||||
CreateDate = DateTime.Now,
|
||||
UpdateDate = DateTime.Now,
|
||||
};
|
||||
DI.Get<ISearchEngine>().Add(result);
|
||||
result = searchResults.First();
|
||||
result.Value = valueLine.Text;
|
||||
result.Display = nameLine.Text;
|
||||
result.RegistryRecord = registryRecordLine.Text;
|
||||
result.UpdateDate = DateTime.Now;
|
||||
|
||||
searchEngine.SaveChanges();
|
||||
|
||||
registryResultLabel.Text = $"标识:{result.Key}已完成更新";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new SearchResult()
|
||||
{
|
||||
Key = keyLine.Text,
|
||||
Value = valueLine.Text,
|
||||
Display = nameLine.Text,
|
||||
Id = idLine.Text,
|
||||
RegistryRecord = registryRecordLine.Text,
|
||||
CreateDate = DateTime.Now,
|
||||
UpdateDate = DateTime.Now,
|
||||
};
|
||||
try
|
||||
{
|
||||
registryResultLabel.Text = $"标识:{result.Key}已完成注册";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
registryResultLabel.Text = $"标识:{result.Key}注册失败,原因:\n{e.Message}";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bu5w3n4me3xj2"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://bu5w3n4me3xj2"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://6dpw3hl2gu10" path="res://Mods/工业数据采集与分析应用分享/Arts/Illustrations/Illustration_ABB_Rotbotic_Arm_Rendering_DWADWFF.jpg" id="1_uwo3j"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwdlewpjrt8pf" path="res://Mods/教育平台/Templates/选择课程.tscn" id="2_rvvu8"]
|
||||
@@ -12,6 +12,13 @@
|
||||
[ext_resource type="Texture2D" uid="uid://2ka8taavxcn0" path="res://Mods/工业数据采集与分析应用分享/Arts/Images/实战-激光雷达数据采集.jpg" id="7_c28nt"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgocposhaflgj" path="res://Mods/工业数据采集与分析应用分享/激光雷达数据采集.tscn" id="8_uj17p"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0jsjw"]
|
||||
bg_color = Color(0, 0, 0, 0.501961)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
|
||||
[node name="教育平台主菜单" type="Node"]
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
@@ -120,12 +127,12 @@ layout_mode = 2
|
||||
[node name="Label" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "试用版"
|
||||
text = "CAICT定制版"
|
||||
|
||||
[node name="Label2" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "仅包括2个课程"
|
||||
text = "仅包括1个课程"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
@@ -148,12 +155,15 @@ theme_override_constants/separation = 32
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
text = "最后更新时间:
|
||||
2023年6月28日13:46:24
|
||||
|
||||
中安颖立智能科技有限公司
|
||||
Powered By
|
||||
[url]中安颖立智能科技有限公司[/url]
|
||||
|
||||
地址:"
|
||||
地址:
|
||||
重庆市渝北区宝圣湖街道食品城大道18号重庆广告产业园15幢1单元2-3"
|
||||
fit_content = true
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="UXPanel/ReferenceRect/HBoxContainer"]
|
||||
@@ -165,12 +175,8 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 16
|
||||
|
||||
[node name="Label" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "数据采集实训"
|
||||
|
||||
[node name="NinePatchRect" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("2_rvvu8")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
CourseScene = ExtResource("5_2s7gj")
|
||||
|
||||
@@ -182,6 +188,7 @@ texture = ExtResource("5_5ul10")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="NinePatchRect2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("2_rvvu8")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect2/MarginContainer/HBoxContainer/VBoxContainer" index="0"]
|
||||
@@ -191,6 +198,7 @@ text = "实战-模拟量数字量采集"
|
||||
texture = ExtResource("6_6n5xr")
|
||||
|
||||
[node name="NinePatchRect3" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("2_rvvu8")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
CourseScene = ExtResource("8_uj17p")
|
||||
|
||||
@@ -213,6 +221,36 @@ CourseName = "标注解析与注册"
|
||||
[node name="Label" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer" index="0"]
|
||||
text = "工业互联网标识解析"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer" index="1"]
|
||||
text = "#371647"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer2" index="1"]
|
||||
text = "2"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer3" index="1"]
|
||||
text = "0"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer6" index="1"]
|
||||
text = "30"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/MarginContainer/VBoxContainer2" index="2"]
|
||||
text = "2023年7月3日"
|
||||
|
||||
[node name="Label" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "更多实训"
|
||||
|
||||
[node name="Label3" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 128)
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_0jsjw")
|
||||
text = "该版本为定制版,只有定制课程"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[editable path="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect"]
|
||||
[editable path="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect2"]
|
||||
[editable path="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect3"]
|
||||
|
Reference in New Issue
Block a user