Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestInfo.cs
gamer147 0d9d8acae0 feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
2026-06-05 16:57:20 -04:00

62 lines
1.7 KiB
C#

using System.Collections.Generic;
using System.Linq;
using LitJson;
namespace Wizard;
public class PuzzleQuestInfo
{
private Dictionary<string, string> _difficultyNameTable;
public int CharaId { get; }
public PuzzleQuestStatus Status { get; }
public List<PuzzleQuestSelectDialog.DisplayData> DisplayDatas { get; }
public PuzzleQuestInfo(JsonData data)
{
CharaId = data.GetValueOrDefault("puzzle_quest_chara_id", 0);
if (data.TryGetValue("puzzle_quest", out var value))
{
bool valueOrDefault = data.GetValueOrDefault("is_display_puzzle_new", defaultValue: false);
DisplayDatas = PuzzleQuestSelectDialog.CreateDisplayData(valueOrDefault, value);
_difficultyNameTable = CreateDifficultyNameTable(data["puzzle_difficulty_name_list"]);
}
else
{
DisplayDatas = new List<PuzzleQuestSelectDialog.DisplayData>();
}
Status = GetStatus(DisplayDatas);
}
public string GetDifficultyName(int difficulty)
{
return _difficultyNameTable[$"{difficulty}"];
}
private static PuzzleQuestStatus GetStatus(List<PuzzleQuestSelectDialog.DisplayData> displayDatas)
{
if (displayDatas.Count <= 0)
{
return PuzzleQuestStatus.None;
}
if (!displayDatas.All((PuzzleQuestSelectDialog.DisplayData x) => x.IsCleared))
{
return PuzzleQuestStatus.InProgress;
}
return PuzzleQuestStatus.Cleared;
}
private static Dictionary<string, string> CreateDifficultyNameTable(JsonData data)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (string key2 in data.Keys)
{
string key = data[key2].ToString();
dictionary[key] = key2;
}
return dictionary;
}
}