Skip to content

Commit 688a1ac

Browse files
committed
[增加]1. 补全代码的文档注释
1 parent b1ee2e1 commit 688a1ac

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

GameFrameX.Core/Actors/ActorManager.cs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public static class ActorManager
2121
/// 根据ActorId获取对应的IComponentAgent对象
2222
/// </summary>
2323
/// <param name="actorId">ActorId</param>
24-
/// <typeparam name="T"></typeparam>
25-
/// <returns></returns>
24+
/// <typeparam name="T">组件代理类型</typeparam>
25+
/// <returns>组件代理任务</returns>
2626
public static async Task<T> GetComponentAgent<T>(long actorId) where T : IComponentAgent
2727
{
2828
var actor = await GetOrNew(actorId);
@@ -33,7 +33,7 @@ public static async Task<T> GetComponentAgent<T>(long actorId) where T : ICompon
3333
/// 是否存在指定的Actor
3434
/// </summary>
3535
/// <param name="actorId">ActorId</param>
36-
/// <returns></returns>
36+
/// <returns>是否存在</returns>
3737
public static bool HasActor(long actorId)
3838
{
3939
return ActorMap.ContainsKey(actorId);
@@ -43,7 +43,7 @@ public static bool HasActor(long actorId)
4343
/// 根据ActorId获取对应的Actor
4444
/// </summary>
4545
/// <param name="actorId">ActorId</param>
46-
/// <returns></returns>
46+
/// <returns>Actor对象</returns>
4747
internal static Actor GetActor(long actorId)
4848
{
4949
ActorMap.TryGetValue(actorId, out var actor);
@@ -55,7 +55,7 @@ internal static Actor GetActor(long actorId)
5555
/// </summary>
5656
/// <param name="actorId">ActorId</param>
5757
/// <param name="agentType">组件类型</param>
58-
/// <returns></returns>
58+
/// <returns>组件代理任务</returns>
5959
internal static async Task<IComponentAgent> GetComponentAgent(long actorId, Type agentType)
6060
{
6161
var actor = await GetOrNew(actorId);
@@ -65,8 +65,8 @@ internal static async Task<IComponentAgent> GetComponentAgent(long actorId, Type
6565
/// <summary>
6666
/// 根据组件类型获取对应的IComponentAgent数据
6767
/// </summary>
68-
/// <typeparam name="T"></typeparam>
69-
/// <returns></returns>
68+
/// <typeparam name="T">组件代理类型</typeparam>
69+
/// <returns>组件代理任务</returns>
7070
public static Task<T> GetComponentAgent<T>() where T : IComponentAgent
7171
{
7272
var compType = HotfixManager.GetCompType(typeof(T));
@@ -79,7 +79,7 @@ public static Task<T> GetComponentAgent<T>() where T : IComponentAgent
7979
/// 根据actorId获取对应的actor实例,不存在则新生成一个Actor对象
8080
/// </summary>
8181
/// <param name="actorId">actorId</param>
82-
/// <returns></returns>
82+
/// <returns>Actor对象任务</returns>
8383
internal static async Task<Actor> GetOrNew(long actorId)
8484
{
8585
var actorType = ActorIdGenerator.GetActorType(actorId);
@@ -111,7 +111,7 @@ internal static async Task<Actor> GetOrNew(long actorId)
111111
/// <summary>
112112
/// 全部完成
113113
/// </summary>
114-
/// <returns></returns>
114+
/// <returns>任务集合</returns>
115115
public static Task AllFinish()
116116
{
117117
var tasks = new List<Task>();
@@ -139,16 +139,17 @@ static ActorManager()
139139
/// <summary>
140140
/// 根据ActorId 获取玩家
141141
/// </summary>
142-
/// <param name="actorId"></param>
143-
/// <returns></returns>
142+
/// <param name="actorId">ActorId</param>
143+
/// <returns>WorkerActor对象</returns>
144144
private static WorkerActor GetLifeActor(long actorId)
145145
{
146146
return WorkerActors[(int)(actorId % WorkerCount)];
147147
}
148148

149149
/// <summary>
150-
/// 目前只回收玩家
150+
/// 检查并回收空闲的Actor
151151
/// </summary>
152+
/// <returns>任务</returns>
152153
public static Task CheckIdle()
153154
{
154155
foreach (var actor in ActorMap.Values)
@@ -191,10 +192,10 @@ async Task<bool> Work()
191192
return Task.CompletedTask;
192193
}
193194

194-
195195
/// <summary>
196196
/// 保存所有数据
197197
/// </summary>
198+
/// <returns>任务</returns>
198199
public static async Task SaveAll()
199200
{
200201
try
@@ -221,13 +222,12 @@ async void M()
221222
}
222223
}
223224

224-
//public static readonly StatisticsTool statisticsTool = new();
225225
private const int OnceSaveCount = 1000;
226226

227227
/// <summary>
228228
/// 定时回存所有数据
229229
/// </summary>
230-
/// <returns></returns>
230+
/// <returns>任务</returns>
231231
public static async Task TimerSave()
232232
{
233233
try
@@ -236,7 +236,7 @@ public static async Task TimerSave()
236236
var taskList = new List<Task>();
237237
foreach (var actor in ActorMap.Values)
238238
{
239-
//如果定时回存的过程中关服了,直接终止定时回存,因为关服时会调用SaveAll以保证数据回存
239+
// 如果定时回存的过程中关服了,直接终止定时回存,因为关服时会调用SaveAll以保证数据回存
240240
if (!GlobalTimer.IsWorking)
241241
{
242242
return;
@@ -268,12 +268,11 @@ async void Work()
268268
}
269269
}
270270

271-
272271
/// <summary>
273272
/// 角色跨天
274273
/// </summary>
275274
/// <param name="openServerDay">开服天数</param>
276-
/// <returns></returns>
275+
/// <returns>任务</returns>
277276
public static Task RoleCrossDay(int openServerDay)
278277
{
279278
foreach (var actor in ActorMap.Values)
@@ -294,7 +293,8 @@ public static Task RoleCrossDay(int openServerDay)
294293
/// 跨天
295294
/// </summary>
296295
/// <param name="openServerDay">开服天数</param>
297-
/// <param name="driverActorType">driverActorType</param>
296+
/// <param name="driverActorType">驱动Actor类型</param>
297+
/// <returns>任务</returns>
298298
public static async Task CrossDay(int openServerDay, ActorType driverActorType)
299299
{
300300
// 驱动actor优先执行跨天
@@ -371,6 +371,7 @@ async Task Work()
371371
/// <summary>
372372
/// 删除所有actor
373373
/// </summary>
374+
/// <returns>任务</returns>
374375
public static async Task RemoveAll()
375376
{
376377
var tasks = new List<Task>();
@@ -386,7 +387,7 @@ public static async Task RemoveAll()
386387
/// 删除actor
387388
/// </summary>
388389
/// <param name="actorId">actorId</param>
389-
/// <returns></returns>
390+
/// <returns>任务</returns>
390391
public static Task Remove(long actorId)
391392
{
392393
if (ActorMap.Remove(actorId, out var actor))
@@ -401,7 +402,7 @@ public static Task Remove(long actorId)
401402
/// 遍历所有actor
402403
/// </summary>
403404
/// <param name="func">遍历actor回调</param>
404-
/// <typeparam name="T"></typeparam>
405+
/// <typeparam name="T">组件代理类型</typeparam>
405406
public static void ActorForEach<T>(Func<T, Task> func) where T : IComponentAgent
406407
{
407408
var agentType = typeof(T);
@@ -426,7 +427,7 @@ async Task Work()
426427
/// 遍历所有actor
427428
/// </summary>
428429
/// <param name="action">遍历actor回调</param>
429-
/// <typeparam name="T"></typeparam>
430+
/// <typeparam name="T">组件代理类型</typeparam>
430431
public static void ActorForEach<T>(Action<T> action) where T : IComponentAgent
431432
{
432433
var agentType = typeof(T);

0 commit comments

Comments
 (0)