调整了模板

This commit is contained in:
CortexCore
2023-07-17 04:10:14 +08:00
parent 498b0617f8
commit e27cce2ac3
56 changed files with 2165 additions and 581 deletions

View File

@@ -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);