1
This commit is contained in:
@@ -22,7 +22,6 @@ public partial class BITAppForGodot : Node
|
||||
BIT4Log.OnWarning += GD.PushWarning;
|
||||
BIT4Log.OnNextLine += () => GD.Print();
|
||||
BIT4Log.OnException += x=>GD.PrintErr(x.ToString());
|
||||
BIT4Log.UseLogTime();
|
||||
|
||||
//启动BITApp
|
||||
BITApp.Start(ProjectSettings.GetSetting("application/config/name").AsString());
|
||||
|
@@ -17,7 +17,7 @@ public partial class Exec : Node
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT4Log.Warnning<Exec>($"未加载:{path}");
|
||||
BIT4Log.Warning<Exec>($"未加载:{path}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@ public partial class GodotEntitiesService : Node,IEntitiesService
|
||||
}
|
||||
private readonly Dictionary<ulong,IEntity> _entities=new ();
|
||||
private CancellationTokenSource _cancellationTokenSource;
|
||||
public event Action<IEntity> OnAdd;
|
||||
public event Action<IEntity> OnRemove;
|
||||
public IEntity[] Entities => _entities.Values.ToArray();
|
||||
public bool Register(IEntity entity)
|
||||
{
|
||||
@@ -40,11 +42,28 @@ public partial class GodotEntitiesService : Node,IEntitiesService
|
||||
|
||||
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
|
||||
|
||||
public IEntity Get(ulong id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEntity[] Query<T>() where T : IEntityComponent
|
||||
{
|
||||
return _entities.Values.Where(x => x.TryGetComponent<T>(out _)).ToArray();
|
||||
}
|
||||
|
||||
T[] IEntitiesService.QueryComponents<T>()
|
||||
{
|
||||
return _entities.Values
|
||||
.Where(x => x.TryGetComponent<T>(out _))
|
||||
.Select(x =>
|
||||
{
|
||||
var component = x.Components.Single(x => x is T);
|
||||
return (T)component;
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public ValueTuple<T>[] QueryComponents<T>() where T : IEntityComponent
|
||||
{
|
||||
return _entities.Values
|
||||
@@ -59,16 +78,6 @@ public partial class GodotEntitiesService : Node,IEntitiesService
|
||||
}
|
||||
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)
|
||||
|
@@ -23,7 +23,7 @@ public static class LabelExtensions
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
BIT4Log.Warnning(path);
|
||||
BIT4Log.Warning(path);
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,7 @@ public partial class HttpGet : Node,IActivable
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
BIT4Log.Warnning(url);
|
||||
BIT4Log.Warning(url);
|
||||
//返回并发数量
|
||||
limitConcurrent.Release();
|
||||
}
|
||||
|
Reference in New Issue
Block a user