@@ -21,8 +21,8 @@ public static class ActorManager
21
21
/// 根据ActorId获取对应的IComponentAgent对象
22
22
/// </summary>
23
23
/// <param name="actorId">ActorId</param>
24
- /// <typeparam name="T"></typeparam>
25
- /// <returns></returns>
24
+ /// <typeparam name="T">组件代理类型 </typeparam>
25
+ /// <returns>组件代理任务 </returns>
26
26
public static async Task < T > GetComponentAgent < T > ( long actorId ) where T : IComponentAgent
27
27
{
28
28
var actor = await GetOrNew ( actorId ) ;
@@ -33,7 +33,7 @@ public static async Task<T> GetComponentAgent<T>(long actorId) where T : ICompon
33
33
/// 是否存在指定的Actor
34
34
/// </summary>
35
35
/// <param name="actorId">ActorId</param>
36
- /// <returns></returns>
36
+ /// <returns>是否存在 </returns>
37
37
public static bool HasActor ( long actorId )
38
38
{
39
39
return ActorMap . ContainsKey ( actorId ) ;
@@ -43,7 +43,7 @@ public static bool HasActor(long actorId)
43
43
/// 根据ActorId获取对应的Actor
44
44
/// </summary>
45
45
/// <param name="actorId">ActorId</param>
46
- /// <returns></returns>
46
+ /// <returns>Actor对象 </returns>
47
47
internal static Actor GetActor ( long actorId )
48
48
{
49
49
ActorMap . TryGetValue ( actorId , out var actor ) ;
@@ -55,7 +55,7 @@ internal static Actor GetActor(long actorId)
55
55
/// </summary>
56
56
/// <param name="actorId">ActorId</param>
57
57
/// <param name="agentType">组件类型</param>
58
- /// <returns></returns>
58
+ /// <returns>组件代理任务 </returns>
59
59
internal static async Task < IComponentAgent > GetComponentAgent ( long actorId , Type agentType )
60
60
{
61
61
var actor = await GetOrNew ( actorId ) ;
@@ -65,8 +65,8 @@ internal static async Task<IComponentAgent> GetComponentAgent(long actorId, Type
65
65
/// <summary>
66
66
/// 根据组件类型获取对应的IComponentAgent数据
67
67
/// </summary>
68
- /// <typeparam name="T"></typeparam>
69
- /// <returns></returns>
68
+ /// <typeparam name="T">组件代理类型 </typeparam>
69
+ /// <returns>组件代理任务 </returns>
70
70
public static Task < T > GetComponentAgent < T > ( ) where T : IComponentAgent
71
71
{
72
72
var compType = HotfixManager . GetCompType ( typeof ( T ) ) ;
@@ -79,7 +79,7 @@ public static Task<T> GetComponentAgent<T>() where T : IComponentAgent
79
79
/// 根据actorId获取对应的actor实例,不存在则新生成一个Actor对象
80
80
/// </summary>
81
81
/// <param name="actorId">actorId</param>
82
- /// <returns></returns>
82
+ /// <returns>Actor对象任务 </returns>
83
83
internal static async Task < Actor > GetOrNew ( long actorId )
84
84
{
85
85
var actorType = ActorIdGenerator . GetActorType ( actorId ) ;
@@ -111,7 +111,7 @@ internal static async Task<Actor> GetOrNew(long actorId)
111
111
/// <summary>
112
112
/// 全部完成
113
113
/// </summary>
114
- /// <returns></returns>
114
+ /// <returns>任务集合 </returns>
115
115
public static Task AllFinish ( )
116
116
{
117
117
var tasks = new List < Task > ( ) ;
@@ -139,16 +139,17 @@ static ActorManager()
139
139
/// <summary>
140
140
/// 根据ActorId 获取玩家
141
141
/// </summary>
142
- /// <param name="actorId"></param>
143
- /// <returns></returns>
142
+ /// <param name="actorId">ActorId </param>
143
+ /// <returns>WorkerActor对象 </returns>
144
144
private static WorkerActor GetLifeActor ( long actorId )
145
145
{
146
146
return WorkerActors [ ( int ) ( actorId % WorkerCount ) ] ;
147
147
}
148
148
149
149
/// <summary>
150
- /// 目前只回收玩家
150
+ /// 检查并回收空闲的Actor
151
151
/// </summary>
152
+ /// <returns>任务</returns>
152
153
public static Task CheckIdle ( )
153
154
{
154
155
foreach ( var actor in ActorMap . Values )
@@ -191,10 +192,10 @@ async Task<bool> Work()
191
192
return Task . CompletedTask ;
192
193
}
193
194
194
-
195
195
/// <summary>
196
196
/// 保存所有数据
197
197
/// </summary>
198
+ /// <returns>任务</returns>
198
199
public static async Task SaveAll ( )
199
200
{
200
201
try
@@ -221,13 +222,12 @@ async void M()
221
222
}
222
223
}
223
224
224
- //public static readonly StatisticsTool statisticsTool = new();
225
225
private const int OnceSaveCount = 1000 ;
226
226
227
227
/// <summary>
228
228
/// 定时回存所有数据
229
229
/// </summary>
230
- /// <returns></returns>
230
+ /// <returns>任务 </returns>
231
231
public static async Task TimerSave ( )
232
232
{
233
233
try
@@ -236,7 +236,7 @@ public static async Task TimerSave()
236
236
var taskList = new List < Task > ( ) ;
237
237
foreach ( var actor in ActorMap . Values )
238
238
{
239
- //如果定时回存的过程中关服了,直接终止定时回存,因为关服时会调用SaveAll以保证数据回存
239
+ // 如果定时回存的过程中关服了,直接终止定时回存,因为关服时会调用SaveAll以保证数据回存
240
240
if ( ! GlobalTimer . IsWorking )
241
241
{
242
242
return ;
@@ -268,12 +268,11 @@ async void Work()
268
268
}
269
269
}
270
270
271
-
272
271
/// <summary>
273
272
/// 角色跨天
274
273
/// </summary>
275
274
/// <param name="openServerDay">开服天数</param>
276
- /// <returns></returns>
275
+ /// <returns>任务 </returns>
277
276
public static Task RoleCrossDay ( int openServerDay )
278
277
{
279
278
foreach ( var actor in ActorMap . Values )
@@ -294,7 +293,8 @@ public static Task RoleCrossDay(int openServerDay)
294
293
/// 跨天
295
294
/// </summary>
296
295
/// <param name="openServerDay">开服天数</param>
297
- /// <param name="driverActorType">driverActorType</param>
296
+ /// <param name="driverActorType">驱动Actor类型</param>
297
+ /// <returns>任务</returns>
298
298
public static async Task CrossDay ( int openServerDay , ActorType driverActorType )
299
299
{
300
300
// 驱动actor优先执行跨天
@@ -371,6 +371,7 @@ async Task Work()
371
371
/// <summary>
372
372
/// 删除所有actor
373
373
/// </summary>
374
+ /// <returns>任务</returns>
374
375
public static async Task RemoveAll ( )
375
376
{
376
377
var tasks = new List < Task > ( ) ;
@@ -386,7 +387,7 @@ public static async Task RemoveAll()
386
387
/// 删除actor
387
388
/// </summary>
388
389
/// <param name="actorId">actorId</param>
389
- /// <returns></returns>
390
+ /// <returns>任务 </returns>
390
391
public static Task Remove ( long actorId )
391
392
{
392
393
if ( ActorMap . Remove ( actorId , out var actor ) )
@@ -401,7 +402,7 @@ public static Task Remove(long actorId)
401
402
/// 遍历所有actor
402
403
/// </summary>
403
404
/// <param name="func">遍历actor回调</param>
404
- /// <typeparam name="T"></typeparam>
405
+ /// <typeparam name="T">组件代理类型 </typeparam>
405
406
public static void ActorForEach < T > ( Func < T , Task > func ) where T : IComponentAgent
406
407
{
407
408
var agentType = typeof ( T ) ;
@@ -426,7 +427,7 @@ async Task Work()
426
427
/// 遍历所有actor
427
428
/// </summary>
428
429
/// <param name="action">遍历actor回调</param>
429
- /// <typeparam name="T"></typeparam>
430
+ /// <typeparam name="T">组件代理类型 </typeparam>
430
431
public static void ActorForEach < T > ( Action < T > action ) where T : IComponentAgent
431
432
{
432
433
var agentType = typeof ( T ) ;
0 commit comments