breakpoint

This commit is contained in:
CortexCore
2023-09-20 11:38:30 +08:00
parent a2d148cfa4
commit c59d513cca
8 changed files with 210 additions and 13 deletions

View File

@@ -3,8 +3,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using BITKit.Core.Entites;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace BITKit;
/// <summary>
@@ -29,11 +31,28 @@ public partial class Entity : Node,IEntity
/// IEntity.Id实现
/// </summary>
public ulong Id { get; private set; }
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
private CancellationTokenSource _cancellationTokenSource;
/// <summary>
/// 服务提供者
/// </summary>
public IServiceProvider ServiceProvider { get; private set; }
private IServiceCollection _serviceCollection;
public override void _EnterTree()
{
_cancellationTokenSource = new CancellationTokenSource();
}
public override void _ExitTree()
{
_cancellationTokenSource.Cancel();
}
/// <summary>
/// 加载所有EntityComponent的内部实现
/// </summary>
@@ -46,7 +65,6 @@ public partial class Entity : Node,IEntity
_serviceCollection = new ServiceCollection();
_serviceCollection.AddLogging();
foreach (var x in MathNode.GetAllNode(this))
{
GetInstanceId();

View File

@@ -14,4 +14,5 @@ public partial class EntityComponent : Node,IEntityComponent
public virtual void BuildService(IServiceCollection serviceCollection){}
public virtual void OnStart(){}
public virtual void OnAwake(){}
}