@@ -37,13 +37,13 @@ public class Stats
3737
3838 public ref Stats GetStats ( ) { return ref LoadStats ; }
3939
40- public abstract bool Load ( string dir , Format fmt , LoadOptions ? options = null ) ;
40+ public abstract bool Load ( string dir , Format fmt , in LoadOptions ? options = null ) ;
4141
4242 protected virtual bool ProcessAfterLoad ( ) { return true ; }
4343
4444 public virtual bool ProcessAfterLoadAll ( in Hub hub ) { return true ; }
4545
46- internal bool LoadMessageByPath < T > ( out T msg , string dir , Format fmt , LoadOptions ? options = null ) where T : Google . Protobuf . IMessage < T > , new ( )
46+ internal bool LoadMessageByPath < T > ( out T msg , string dir , Format fmt , in LoadOptions ? options = null ) where T : Google . Protobuf . IMessage < T > , new ( )
4747 {
4848 msg = new T ( ) ;
4949 string name = msg . Descriptor . Name ;
@@ -94,8 +94,62 @@ internal string Format2Ext(Format fmt)
9494
9595 internal class MessagerContainer
9696 {
97- public Dictionary < string , Messager > MessagerMap = new Dictionary < string , Messager > ( ) ;
97+ public Dictionary < string , Messager > MessagerMap ;
9898 public DateTime LastLoadedTime ;
99+ public HeroConf ? HeroConf ;
100+ public HeroBaseConf ? HeroBaseConf ;
101+ public ItemConf ? ItemConf ;
102+ public PatchReplaceConf ? PatchReplaceConf ;
103+ public PatchMergeConf ? PatchMergeConf ;
104+ public RecursivePatchConf ? RecursivePatchConf ;
105+ public ActivityConf ? ActivityConf ;
106+ public ChapterConf ? ChapterConf ;
107+ public ThemeConf ? ThemeConf ;
108+
109+ public MessagerContainer ( in Dictionary < string , Messager > ? messagerMap = null )
110+ {
111+ MessagerMap = messagerMap ?? new Dictionary < string , Messager > ( ) ;
112+ LastLoadedTime = DateTime . Now ;
113+ if ( messagerMap != null )
114+ {
115+ if ( messagerMap . ContainsKey ( "HeroConf" ) )
116+ {
117+ HeroConf = ( HeroConf ) messagerMap [ "HeroConf" ] ;
118+ }
119+ if ( messagerMap . ContainsKey ( "HeroBaseConf" ) )
120+ {
121+ HeroBaseConf = ( HeroBaseConf ) messagerMap [ "HeroBaseConf" ] ;
122+ }
123+ if ( messagerMap . ContainsKey ( "ItemConf" ) )
124+ {
125+ ItemConf = ( ItemConf ) messagerMap [ "ItemConf" ] ;
126+ }
127+ if ( messagerMap . ContainsKey ( "PatchReplaceConf" ) )
128+ {
129+ PatchReplaceConf = ( PatchReplaceConf ) messagerMap [ "PatchReplaceConf" ] ;
130+ }
131+ if ( messagerMap . ContainsKey ( "PatchMergeConf" ) )
132+ {
133+ PatchMergeConf = ( PatchMergeConf ) messagerMap [ "PatchMergeConf" ] ;
134+ }
135+ if ( messagerMap . ContainsKey ( "RecursivePatchConf" ) )
136+ {
137+ RecursivePatchConf = ( RecursivePatchConf ) messagerMap [ "RecursivePatchConf" ] ;
138+ }
139+ if ( messagerMap . ContainsKey ( "ActivityConf" ) )
140+ {
141+ ActivityConf = ( ActivityConf ) messagerMap [ "ActivityConf" ] ;
142+ }
143+ if ( messagerMap . ContainsKey ( "ChapterConf" ) )
144+ {
145+ ChapterConf = ( ChapterConf ) messagerMap [ "ChapterConf" ] ;
146+ }
147+ if ( messagerMap . ContainsKey ( "ThemeConf" ) )
148+ {
149+ ThemeConf = ( ThemeConf ) messagerMap [ "ThemeConf" ] ;
150+ }
151+ }
152+ }
99153 }
100154
101155 public class HubOptions
@@ -113,7 +167,7 @@ public Hub(HubOptions? options = null)
113167 Options = options ?? new HubOptions ( ) ;
114168 }
115169
116- public bool Load ( string dir , Format fmt , LoadOptions ? options = null )
170+ public bool Load ( string dir , Format fmt , in LoadOptions ? options = null )
117171 {
118172 var messagerMap = NewMessagerMap ( ) ;
119173 foreach ( var messager in messagerMap . Values )
@@ -124,7 +178,7 @@ public bool Load(string dir, Format fmt, LoadOptions? options = null)
124178 }
125179 }
126180 var tmpHub = new Hub ( ) ;
127- tmpHub . SetMessagerMap ( MessagerContainer . MessagerMap ) ;
181+ tmpHub . SetMessagerMap ( messagerMap ) ;
128182 foreach ( var messager in messagerMap . Values )
129183 {
130184 if ( ! messager . ProcessAfterLoadAll ( tmpHub ) )
@@ -143,8 +197,7 @@ public ref Dictionary<string, Messager> GetMessagerMap()
143197
144198 public void SetMessagerMap ( in Dictionary < string , Messager > map )
145199 {
146- MessagerContainer . MessagerMap = map ;
147- MessagerContainer . LastLoadedTime = DateTime . Now ;
200+ MessagerContainer = new MessagerContainer ( map ) ;
148201 }
149202
150203 public T ? Get < T > ( ) where T : Messager , IMessagerName , new ( )
@@ -157,6 +210,51 @@ public void SetMessagerMap(in Dictionary<string, Messager> map)
157210 return default ;
158211 }
159212
213+ public HeroConf ? GetHeroConf ( )
214+ {
215+ return MessagerContainer . HeroConf ;
216+ }
217+
218+ public HeroBaseConf ? GetHeroBaseConf ( )
219+ {
220+ return MessagerContainer . HeroBaseConf ;
221+ }
222+
223+ public ItemConf ? GetItemConf ( )
224+ {
225+ return MessagerContainer . ItemConf ;
226+ }
227+
228+ public PatchReplaceConf ? GetPatchReplaceConf ( )
229+ {
230+ return MessagerContainer . PatchReplaceConf ;
231+ }
232+
233+ public PatchMergeConf ? GetPatchMergeConf ( )
234+ {
235+ return MessagerContainer . PatchMergeConf ;
236+ }
237+
238+ public RecursivePatchConf ? GetRecursivePatchConf ( )
239+ {
240+ return MessagerContainer . RecursivePatchConf ;
241+ }
242+
243+ public ActivityConf ? GetActivityConf ( )
244+ {
245+ return MessagerContainer . ActivityConf ;
246+ }
247+
248+ public ChapterConf ? GetChapterConf ( )
249+ {
250+ return MessagerContainer . ChapterConf ;
251+ }
252+
253+ public ThemeConf ? GetThemeConf ( )
254+ {
255+ return MessagerContainer . ThemeConf ;
256+ }
257+
160258 private Messager GetMessager ( string name )
161259 {
162260 return GetMessagerMap ( ) [ name ] ;
0 commit comments