Skip to content

Commit

Permalink
使用#号代码+号做分表;两个符号都兼容
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-kelly committed Aug 31, 2016
1 parent 1e112fc commit 6dacf8d
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 9 deletions.
44 changes: 36 additions & 8 deletions KSFramework/Assets/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static IReloadableSettings[] SettingsList
}

#if UNITY_EDITOR
[UnityEditor.MenuItem("KEngine/Settings/Reload All Settings")]
[UnityEditor.MenuItem("KEngine/Settings/Try Reload All Settings Code")]
#endif
public static void AllSettingsReload()
{
Expand Down Expand Up @@ -157,15 +157,29 @@ public void ReloadAll()
_ReloadAll(false);
}

/// <summary>
/// Do reload the setting class : Test, no exception when duplicate primary key, use custom string content
/// </summary>
public void ReloadAllWithString(string context)
{
_ReloadAll(false, context);
}

/// <summary>
/// Do reload the setting file: Test
/// </summary>
void _ReloadAll(bool throwWhenDuplicatePrimaryKey)
void _ReloadAll(bool throwWhenDuplicatePrimaryKey, string customContent = null)
{
for (var j = 0; j < TabFilePaths.Length; j++)
{
var tabFilePath = TabFilePaths[j];
using (var tableFile = SettingModule.Get(tabFilePath, false))
TableFile tableFile;
if (customContent == null)
tableFile = SettingModule.Get(tabFilePath, false);
else
tableFile = TableFile.LoadFromString(customContent);

using (tableFile)
{
foreach (var row in tableFile)
{
Expand Down Expand Up @@ -270,7 +284,7 @@ public static string ParsePrimaryKey(TableRow row)
}

/// <summary>
/// Auto Generate for Tab File: "GameConfig/+Base.bytes", "GameConfig/+TSV.bytes"
/// Auto Generate for Tab File: "GameConfig/#Base.bytes", "GameConfig/#TSV.bytes"
/// No use of generic and reflection, for better performance, less IL code generating
/// </summary>>
public partial class GameConfigSettings : IReloadableSettings
Expand All @@ -282,7 +296,7 @@ public partial class GameConfigSettings : IReloadableSettings

public static readonly string[] TabFilePaths =
{
"GameConfig/+Base.bytes", "GameConfig/+TSV.bytes"
"GameConfig/#Base.bytes", "GameConfig/#TSV.bytes"
};
internal static GameConfigSettings _instance = new GameConfigSettings();
Dictionary<string, GameConfigSetting> _dict = new Dictionary<string, GameConfigSetting>();
Expand Down Expand Up @@ -348,15 +362,29 @@ public void ReloadAll()
_ReloadAll(false);
}

/// <summary>
/// Do reload the setting class : GameConfig, no exception when duplicate primary key, use custom string content
/// </summary>
public void ReloadAllWithString(string context)
{
_ReloadAll(false, context);
}

/// <summary>
/// Do reload the setting file: GameConfig
/// </summary>
void _ReloadAll(bool throwWhenDuplicatePrimaryKey)
void _ReloadAll(bool throwWhenDuplicatePrimaryKey, string customContent = null)
{
for (var j = 0; j < TabFilePaths.Length; j++)
{
var tabFilePath = TabFilePaths[j];
using (var tableFile = SettingModule.Get(tabFilePath, false))
TableFile tableFile;
if (customContent == null)
tableFile = SettingModule.Get(tabFilePath, false);
else
tableFile = TableFile.LoadFromString(customContent);

using (tableFile)
{
foreach (var row in tableFile)
{
Expand Down Expand Up @@ -420,7 +448,7 @@ public static GameConfigSetting Get(string primaryKey)
}

/// <summary>
/// Auto Generate for Tab File: "GameConfig/+Base.bytes", "GameConfig/+TSV.bytes"
/// Auto Generate for Tab File: "GameConfig/#Base.bytes", "GameConfig/#TSV.bytes"
/// Singleton class for less memory use
/// </summary>
public partial class GameConfigSetting : TableRowParser
Expand Down
3 changes: 3 additions & 0 deletions KSFramework/Assets/Plugins/Slua_Managed.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions KSFramework/Assets/SLua/Editor/LuaCodeGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,8 @@ private void WriteFunctionCall(MethodInfo m, StreamWriter file, Type t,BindingFl
Write(file, "{0}a1/a2;", ret);
else if (m.Name == "op_UnaryNegation")
Write(file, "{0}-a1;", ret);
else if (m.Name == "op_UnaryPlus")
Write(file, "{0}+a1;", ret);
else if (m.Name == "op_Equality")
Write(file, "{0}(a1==a2);", ret);
else if (m.Name == "op_Inequality")
Expand Down

0 comments on commit 6dacf8d

Please sign in to comment.