2using System.Collections.Generic;
18 foreach (
string file
in files)
35 private static readonly Dictionary<string, HashSet<Action<object>>>
_eventHandlers =
new Dictionary<string, HashSet<Action<object>>>();
42 public List<BaseModPackage>
packages =
new List<BaseModPackage>();
44 public virtual void Init(
string path,
string defaultPackage =
"_Elona")
46 Debug.Log(
"Initializing ModManager:" + defaultPackage +
"/" + path);
49 if (!defaultPackage.IsEmpty())
64 new DirectoryInfo(value.
dir);
65 FileInfo[] files =
new DirectoryInfo(value.
dir +
"Data").GetFiles();
66 foreach (FileInfo fileInfo
in files)
68 if (fileInfo.Name ==
"Alias.xlsx")
70 Lang.alias =
new ExcelData(fileInfo.FullName);
72 if (fileInfo.Name ==
"Name.xlsx")
74 Lang.names =
new ExcelData(fileInfo.FullName);
76 if (fileInfo.Name ==
"chara_talk.xlsx")
80 if (fileInfo.Name ==
"chara_tone.xlsx")
96 value =
new HashSet<Action<object>>();
106 value.Remove(handler);
107 if (value.Count == 0)
120 foreach (Action<object>
item in value.ToList())
126 catch (Exception arg)
128 Debug.LogError(
$"#event '{eventId}' throws error in one of the handlers\n{arg}");
138 return num.GetValueOrDefault() > 0;
void Parse< T >(ModItemList< T > list)
List< BaseModPackage > packages
static readonly Dictionary< string, HashSet< Action< object > > > _eventHandlers
virtual void Init(string path, string defaultPackage="_Elona")
static void UnsubscribeEvent(string eventId, Action< object > handler)
static bool isInitialized
static string rootDefaultPacakge
virtual void ParseExtra(DirectoryInfo dir, BaseModPackage package)
static BaseModManager Instance
static void PublishEvent(string eventId, object data=null)
static List< string > listChainLoad
static void SubscribeEvent(string eventId, Action< object > handler)
static bool HasEventSubscriber(string eventId)
DirectoryInfo dirWorkshop
static TalkDataList listTalk
static ToneDataList tones
static Dictionary< string, LangSetting > langs