diff --git a/GameFrameX.Core/Actors/ActorManager.cs b/GameFrameX.Core/Actors/ActorManager.cs index 557c514e..bdcf4884 100644 --- a/GameFrameX.Core/Actors/ActorManager.cs +++ b/GameFrameX.Core/Actors/ActorManager.cs @@ -21,8 +21,8 @@ public static class ActorManager /// 根据ActorId获取对应的IComponentAgent对象 /// /// ActorId - /// - /// + /// 组件代理类型 + /// 组件代理任务 public static async Task GetComponentAgent(long actorId) where T : IComponentAgent { var actor = await GetOrNew(actorId); @@ -33,7 +33,7 @@ public static async Task GetComponentAgent(long actorId) where T : ICompon /// 是否存在指定的Actor /// /// ActorId - /// + /// 是否存在 public static bool HasActor(long actorId) { return ActorMap.ContainsKey(actorId); @@ -43,7 +43,7 @@ public static bool HasActor(long actorId) /// 根据ActorId获取对应的Actor /// /// ActorId - /// + /// Actor对象 internal static Actor GetActor(long actorId) { ActorMap.TryGetValue(actorId, out var actor); @@ -55,7 +55,7 @@ internal static Actor GetActor(long actorId) /// /// ActorId /// 组件类型 - /// + /// 组件代理任务 internal static async Task GetComponentAgent(long actorId, Type agentType) { var actor = await GetOrNew(actorId); @@ -65,8 +65,8 @@ internal static async Task GetComponentAgent(long actorId, Type /// /// 根据组件类型获取对应的IComponentAgent数据 /// - /// - /// + /// 组件代理类型 + /// 组件代理任务 public static Task GetComponentAgent() where T : IComponentAgent { var compType = HotfixManager.GetCompType(typeof(T)); @@ -79,7 +79,7 @@ public static Task GetComponentAgent() where T : IComponentAgent /// 根据actorId获取对应的actor实例,不存在则新生成一个Actor对象 /// /// actorId - /// + /// Actor对象任务 internal static async Task GetOrNew(long actorId) { var actorType = ActorIdGenerator.GetActorType(actorId); @@ -111,7 +111,7 @@ internal static async Task GetOrNew(long actorId) /// /// 全部完成 /// - /// + /// 任务集合 public static Task AllFinish() { var tasks = new List(); @@ -139,16 +139,17 @@ static ActorManager() /// /// 根据ActorId 获取玩家 /// - /// - /// + /// ActorId + /// WorkerActor对象 private static WorkerActor GetLifeActor(long actorId) { return WorkerActors[(int)(actorId % WorkerCount)]; } /// - /// 目前只回收玩家 + /// 检查并回收空闲的Actor /// + /// 任务 public static Task CheckIdle() { foreach (var actor in ActorMap.Values) @@ -191,10 +192,10 @@ async Task Work() return Task.CompletedTask; } - /// /// 保存所有数据 /// + /// 任务 public static async Task SaveAll() { try @@ -221,13 +222,12 @@ async void M() } } - //public static readonly StatisticsTool statisticsTool = new(); private const int OnceSaveCount = 1000; /// /// 定时回存所有数据 /// - /// + /// 任务 public static async Task TimerSave() { try @@ -236,7 +236,7 @@ public static async Task TimerSave() var taskList = new List(); foreach (var actor in ActorMap.Values) { - //如果定时回存的过程中关服了,直接终止定时回存,因为关服时会调用SaveAll以保证数据回存 + // 如果定时回存的过程中关服了,直接终止定时回存,因为关服时会调用SaveAll以保证数据回存 if (!GlobalTimer.IsWorking) { return; @@ -268,12 +268,11 @@ async void Work() } } - /// /// 角色跨天 /// /// 开服天数 - /// + /// 任务 public static Task RoleCrossDay(int openServerDay) { foreach (var actor in ActorMap.Values) @@ -294,7 +293,8 @@ public static Task RoleCrossDay(int openServerDay) /// 跨天 /// /// 开服天数 - /// driverActorType + /// 驱动Actor类型 + /// 任务 public static async Task CrossDay(int openServerDay, ActorType driverActorType) { // 驱动actor优先执行跨天 @@ -371,6 +371,7 @@ async Task Work() /// /// 删除所有actor /// + /// 任务 public static async Task RemoveAll() { var tasks = new List(); @@ -386,7 +387,7 @@ public static async Task RemoveAll() /// 删除actor /// /// actorId - /// + /// 任务 public static Task Remove(long actorId) { if (ActorMap.Remove(actorId, out var actor)) @@ -401,7 +402,7 @@ public static Task Remove(long actorId) /// 遍历所有actor /// /// 遍历actor回调 - /// + /// 组件代理类型 public static void ActorForEach(Func func) where T : IComponentAgent { var agentType = typeof(T); @@ -426,7 +427,7 @@ async Task Work() /// 遍历所有actor /// /// 遍历actor回调 - /// + /// 组件代理类型 public static void ActorForEach(Action action) where T : IComponentAgent { var agentType = typeof(T);