Skip to content

Commit

Permalink
修复hotfix打包问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chenggongchina committed May 10, 2023
1 parent f2ed2d8 commit 8beb913
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
26 changes: 25 additions & 1 deletion jyx2/Assets/Editor/HotfixConfig/HotfixConfigs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,33 @@ public static List<Type> by_property
get
{
return (from type in Assembly.Load("Assembly-CSharp").GetTypes()
where !type.IsGenericTypeDefinition && !type.IsNested
where !type.IsGenericTypeDefinition && !type.IsNested && !InBlackList(type)
select type).ToList();
}
}


/// <summary>
/// 不上xlua修复的黑名单
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
static bool InBlackList(Type type)
{
//这里需要屏蔽一些不支持xlua修复的第三方库或者类

if (type.Namespace != null)
{
if (type.Namespace.StartsWith("UnityEngine")) return true;
if (type.Namespace.StartsWith("UnityEditor")) return true;
if (type.Namespace.StartsWith("FastWater")) return true;
if (type.Namespace.StartsWith("StylizedWater")) return true;
}

if (type.Name.StartsWith("FastWater")) return true;
if (type.Name.StartsWith("StylizedWater")) return true;

return false;
}
}

7 changes: 7 additions & 0 deletions jyx2/Assets/Mods/SAMPLE/Lua/hotfix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ util.hotfix_ex(CS.Jyx2.Jyx2LuaBridge, "Talk", function(a,b,c)
end)

--修改UI的例子
util.hotfix_ex(CS.GameMainMenu, "OnCreate", function(self)
print("lua hot fix 生效:CS.GameMainMenu.OnCreate called!")
self:OnCreate()
end)


--通过热更新把版本号修改的例子
--[[
util.hotfix_ex(CS.GameInfoPanel, "OnShowPanel", function(self, paras)
print("lua hot fix 生效:CS.GameInfoPanel.OnShowPanel")
Expand Down

0 comments on commit 8beb913

Please sign in to comment.