using System.Threading.Tasks; using ColdMint.scripts.map.interfaces; using ColdMint.scripts.serialization; using Godot; namespace ColdMint.scripts.map.roomInjectionProcessor; /// /// Room injection processor template /// 房间注入处理器模板 /// /// public abstract class RoomInjectionProcessorTemplate : IRoomInjectionProcessor { public abstract string GetId(); public Task CanBePlaced(RandomNumberGenerator randomNumberGenerator, string? jsonConfigData) { if (jsonConfigData == null) { return Task.FromResult(false); } var configData = JsonSerialization.Deserialize(jsonConfigData); if (configData == null) { return Task.FromResult(false); } return OnCreateConfigData(randomNumberGenerator, configData); } /// /// When creating a configuration class /// 当创建配置类时 /// /// /// /// protected abstract Task OnCreateConfigData(RandomNumberGenerator randomNumberGenerator, TConfig configData); }