Files
Gen_Hack-and-Slash-Roguelit…/Client/Assets/Scripts/Managers/DefineManager.cs
2025-07-13 15:51:21 +08:00

43 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.Generic;
using System.IO;
using Data;
using Utils;
namespace Managers
{
public class DefineManager : Singleton<DefineManager>
{
private const string coreNamespace = "Data";
private static readonly string[] dataSetFilePath = { "Data", "Mod" };
public Dictionary<string, Dictionary<string, Define>> defines = new();
public Dictionary<string, DefinePack> packs = new();
public void Init()
{
var packFolder = Configs.ConfigProcessor.GetSubFolders(new(dataSetFilePath));
foreach (var folder in packFolder)
{
var pack = new DefinePack();
if (pack.LoadPack(folder)) packs.Add(pack.packID, pack);
}
}
public override string ToString()
{
if (packs == null || packs.Count == 0)
{
return "No packs available"; // 如果集合为空或为 null返回默认信息
}
var result = new System.Text.StringBuilder();
foreach (var definePack in packs)
{
result.AppendLine(definePack.ToString()); // 每个元素占一行
}
return result.ToString();
}
}
}