mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 06:23:58 +00:00
TowerLevel_LevelSettlement ClimbTowerLogic_RecordProgres
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MikuSB.Data.Excel;
|
||||
|
||||
@@ -8,6 +10,8 @@ public class ClimbTowerTimeExcel : ExcelResource
|
||||
[JsonProperty("ID")] public uint ID { get; set; }
|
||||
[JsonProperty("StartTime")] public string StartTime { get; set; } = "";
|
||||
[JsonProperty("EndTime")] public string EndTime { get; set; } = "";
|
||||
[JsonProperty("Level1")] public List<List<uint>> Level1 { get; set; } = [];
|
||||
[JsonProperty("Level2")] public JToken? Level2Raw { get; set; }
|
||||
|
||||
public override uint GetId() => ID;
|
||||
|
||||
@@ -15,4 +19,39 @@ public class ClimbTowerTimeExcel : ExcelResource
|
||||
{
|
||||
GameData.ClimbTowerTimeData[ID] = this;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IReadOnlyList<uint>> GetLevelGroups(int type)
|
||||
{
|
||||
if (type == 1)
|
||||
return Level1;
|
||||
|
||||
if (Level2Raw == null)
|
||||
return [];
|
||||
|
||||
if (Level2Raw.Type == JTokenType.Array)
|
||||
{
|
||||
return Level2Raw
|
||||
.Children()
|
||||
.OfType<JArray>()
|
||||
.Select(x => (IReadOnlyList<uint>)x.Values<uint>().ToList())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (Level2Raw.Type == JTokenType.Object)
|
||||
{
|
||||
return Level2Raw
|
||||
.Children<JProperty>()
|
||||
.Select(x => new
|
||||
{
|
||||
Key = uint.TryParse(x.Name, CultureInfo.InvariantCulture, out var key) ? key : 0u,
|
||||
Value = x.Value.Type == JTokenType.Integer ? x.Value.Value<uint>() : 0u
|
||||
})
|
||||
.Where(x => x.Key > 0 && x.Value > 0)
|
||||
.OrderBy(x => x.Key)
|
||||
.Select(x => (IReadOnlyList<uint>)new List<uint> { x.Key, x.Value })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user