Files
DanhengServer-OpenSource/Common/Data/Config/LevelStartSequeceConfigInfo.cs
Somebody 72ddae8940 [BREAK CHANGE] Feature: Implement the basic task system
- Support for the 2.0&2.1 mission
- The story line is still not working
2024-07-16 14:15:07 +08:00

38 lines
1.1 KiB
C#

using EggLink.DanhengServer.Data.Config.Task;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EggLink.DanhengServer.Data.Config
{
public class LevelStartSequeceConfigInfo
{
public List<TaskConfigInfo> TaskList { get; set; } = [];
public bool IsLoop { get; set; } = false;
public int Order { get; set; }
public static LevelStartSequeceConfigInfo LoadFromJsonObject(JObject obj)
{
LevelStartSequeceConfigInfo info = new();
if (obj.ContainsKey(nameof(TaskList)))
{
info.TaskList = obj[nameof(TaskList)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
}
if (obj.ContainsKey(nameof(IsLoop)))
{
info.IsLoop = obj[nameof(IsLoop)]?.Value<bool>() ?? false;
}
if (obj.ContainsKey(nameof(Order)))
{
info.Order = obj[nameof(Order)]?.Value<int>() ?? 0;
}
return info;
}
}
}