using System.Threading.Tasks;
using ColdMint.scripts.levelGraphEditor;
using ColdMint.scripts.serialization;
using Godot;
namespace ColdMint.scripts.map.layoutStrategy;
///
/// Layout selection strategy to use at test time
/// 测试时使用的布局选择策略
///
public class TestLayoutStrategy : ILayoutStrategy
{
private const string Path = "res://data/levelGraphs/test.yaml";
public Task GetLayout()
{
var exists = FileAccess.FileExists(Path);
if (!exists)
{
return Task.FromResult(null);
}
var json = FileAccess.GetFileAsString(Path);
if (json == null)
{
return Task.FromResult(null);
}
return Task.FromResult(YamlSerialization.Deserialize(json));
}
}