mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-17 09:26:50 +08:00
24 lines
702 B
C#
24 lines
702 B
C#
using System;
|
|
using System.Collections.Concurrent;
|
|
|
|
namespace BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
|
|
|
public class ActionFactory
|
|
{
|
|
private static readonly ConcurrentDictionary<string, IActionHandler> _handlers = new();
|
|
|
|
public static IActionHandler GetHandler(string handlerType)
|
|
{
|
|
return _handlers.GetOrAdd(handlerType, (key) =>
|
|
{
|
|
return key switch
|
|
{
|
|
"nahida_collect" => new NahidaCollectHandler(),
|
|
"pick_around" => new PickAroundHandler(),
|
|
"fight" => new AutoFightHandler(),
|
|
_ => throw new ArgumentException("未知的 action 类型")
|
|
};
|
|
});
|
|
}
|
|
}
|