Skip to content

Commit 6dacf8d

Browse files
committed
使用#号代码+号做分表;两个符号都兼容
1 parent 1e112fc commit 6dacf8d

File tree

8 files changed

+42
-9
lines changed

8 files changed

+42
-9
lines changed

KSFramework/Assets/AppSettings.cs

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static IReloadableSettings[] SettingsList
5656
}
5757

5858
#if UNITY_EDITOR
59-
[UnityEditor.MenuItem("KEngine/Settings/Reload All Settings")]
59+
[UnityEditor.MenuItem("KEngine/Settings/Try Reload All Settings Code")]
6060
#endif
6161
public static void AllSettingsReload()
6262
{
@@ -157,15 +157,29 @@ public void ReloadAll()
157157
_ReloadAll(false);
158158
}
159159

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+
160168
/// <summary>
161169
/// Do reload the setting file: Test
162170
/// </summary>
163-
void _ReloadAll(bool throwWhenDuplicatePrimaryKey)
171+
void _ReloadAll(bool throwWhenDuplicatePrimaryKey, string customContent = null)
164172
{
165173
for (var j = 0; j < TabFilePaths.Length; j++)
166174
{
167175
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)
169183
{
170184
foreach (var row in tableFile)
171185
{
@@ -270,7 +284,7 @@ public static string ParsePrimaryKey(TableRow row)
270284
}
271285

272286
/// <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"
274288
/// No use of generic and reflection, for better performance, less IL code generating
275289
/// </summary>>
276290
public partial class GameConfigSettings : IReloadableSettings
@@ -282,7 +296,7 @@ public partial class GameConfigSettings : IReloadableSettings
282296

283297
public static readonly string[] TabFilePaths =
284298
{
285-
"GameConfig/+Base.bytes", "GameConfig/+TSV.bytes"
299+
"GameConfig/#Base.bytes", "GameConfig/#TSV.bytes"
286300
};
287301
internal static GameConfigSettings _instance = new GameConfigSettings();
288302
Dictionary<string, GameConfigSetting> _dict = new Dictionary<string, GameConfigSetting>();
@@ -348,15 +362,29 @@ public void ReloadAll()
348362
_ReloadAll(false);
349363
}
350364

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+
351373
/// <summary>
352374
/// Do reload the setting file: GameConfig
353375
/// </summary>
354-
void _ReloadAll(bool throwWhenDuplicatePrimaryKey)
376+
void _ReloadAll(bool throwWhenDuplicatePrimaryKey, string customContent = null)
355377
{
356378
for (var j = 0; j < TabFilePaths.Length; j++)
357379
{
358380
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)
360388
{
361389
foreach (var row in tableFile)
362390
{
@@ -420,7 +448,7 @@ public static GameConfigSetting Get(string primaryKey)
420448
}
421449

422450
/// <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"
424452
/// Singleton class for less memory use
425453
/// </summary>
426454
public partial class GameConfigSetting : TableRowParser

KSFramework/Assets/Plugins/Slua_Managed.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

KSFramework/Assets/SLua/Editor/LuaCodeGen.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,8 @@ private void WriteFunctionCall(MethodInfo m, StreamWriter file, Type t,BindingFl
19771977
Write(file, "{0}a1/a2;", ret);
19781978
else if (m.Name == "op_UnaryNegation")
19791979
Write(file, "{0}-a1;", ret);
1980+
else if (m.Name == "op_UnaryPlus")
1981+
Write(file, "{0}+a1;", ret);
19801982
else if (m.Name == "op_Equality")
19811983
Write(file, "{0}(a1==a2);", ret);
19821984
else if (m.Name == "op_Inequality")

0 commit comments

Comments
 (0)