@@ -56,7 +56,7 @@ public static IReloadableSettings[] SettingsList
56
56
}
57
57
58
58
#if UNITY_EDITOR
59
- [ UnityEditor . MenuItem ( "KEngine/Settings/Reload All Settings" ) ]
59
+ [ UnityEditor . MenuItem ( "KEngine/Settings/Try Reload All Settings Code " ) ]
60
60
#endif
61
61
public static void AllSettingsReload ( )
62
62
{
@@ -157,15 +157,29 @@ public void ReloadAll()
157
157
_ReloadAll ( false ) ;
158
158
}
159
159
160
+ /// <summary>
161
+ /// Do reload the setting class : Test, no exception when duplicate primary key, use custom string content
162
+ /// </summary>
163
+ public void ReloadAllWithString ( string context )
164
+ {
165
+ _ReloadAll ( false , context ) ;
166
+ }
167
+
160
168
/// <summary>
161
169
/// Do reload the setting file: Test
162
170
/// </summary>
163
- void _ReloadAll ( bool throwWhenDuplicatePrimaryKey )
171
+ void _ReloadAll ( bool throwWhenDuplicatePrimaryKey , string customContent = null )
164
172
{
165
173
for ( var j = 0 ; j < TabFilePaths . Length ; j ++ )
166
174
{
167
175
var tabFilePath = TabFilePaths [ j ] ;
168
- using ( var tableFile = SettingModule . Get ( tabFilePath , false ) )
176
+ TableFile tableFile ;
177
+ if ( customContent == null )
178
+ tableFile = SettingModule . Get ( tabFilePath , false ) ;
179
+ else
180
+ tableFile = TableFile . LoadFromString ( customContent ) ;
181
+
182
+ using ( tableFile )
169
183
{
170
184
foreach ( var row in tableFile )
171
185
{
@@ -270,7 +284,7 @@ public static string ParsePrimaryKey(TableRow row)
270
284
}
271
285
272
286
/// <summary>
273
- /// Auto Generate for Tab File: "GameConfig/+ Base.bytes", "GameConfig/+ TSV.bytes"
287
+ /// Auto Generate for Tab File: "GameConfig/# Base.bytes", "GameConfig/# TSV.bytes"
274
288
/// No use of generic and reflection, for better performance, less IL code generating
275
289
/// </summary>>
276
290
public partial class GameConfigSettings : IReloadableSettings
@@ -282,7 +296,7 @@ public partial class GameConfigSettings : IReloadableSettings
282
296
283
297
public static readonly string [ ] TabFilePaths =
284
298
{
285
- "GameConfig/+ Base.bytes" , "GameConfig/+ TSV.bytes"
299
+ "GameConfig/# Base.bytes" , "GameConfig/# TSV.bytes"
286
300
} ;
287
301
internal static GameConfigSettings _instance = new GameConfigSettings ( ) ;
288
302
Dictionary < string , GameConfigSetting > _dict = new Dictionary < string , GameConfigSetting > ( ) ;
@@ -348,15 +362,29 @@ public void ReloadAll()
348
362
_ReloadAll ( false ) ;
349
363
}
350
364
365
+ /// <summary>
366
+ /// Do reload the setting class : GameConfig, no exception when duplicate primary key, use custom string content
367
+ /// </summary>
368
+ public void ReloadAllWithString ( string context )
369
+ {
370
+ _ReloadAll ( false , context ) ;
371
+ }
372
+
351
373
/// <summary>
352
374
/// Do reload the setting file: GameConfig
353
375
/// </summary>
354
- void _ReloadAll ( bool throwWhenDuplicatePrimaryKey )
376
+ void _ReloadAll ( bool throwWhenDuplicatePrimaryKey , string customContent = null )
355
377
{
356
378
for ( var j = 0 ; j < TabFilePaths . Length ; j ++ )
357
379
{
358
380
var tabFilePath = TabFilePaths [ j ] ;
359
- using ( var tableFile = SettingModule . Get ( tabFilePath , false ) )
381
+ TableFile tableFile ;
382
+ if ( customContent == null )
383
+ tableFile = SettingModule . Get ( tabFilePath , false ) ;
384
+ else
385
+ tableFile = TableFile . LoadFromString ( customContent ) ;
386
+
387
+ using ( tableFile )
360
388
{
361
389
foreach ( var row in tableFile )
362
390
{
@@ -420,7 +448,7 @@ public static GameConfigSetting Get(string primaryKey)
420
448
}
421
449
422
450
/// <summary>
423
- /// Auto Generate for Tab File: "GameConfig/+ Base.bytes", "GameConfig/+ TSV.bytes"
451
+ /// Auto Generate for Tab File: "GameConfig/# Base.bytes", "GameConfig/# TSV.bytes"
424
452
/// Singleton class for less memory use
425
453
/// </summary>
426
454
public partial class GameConfigSetting : TableRowParser
0 commit comments