#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif
using XLua;
using System.Collections.Generic;
<%ForEachCsList(namespaces, function(namespace)%>using <%=namespace%>;<%end)%>
<%
require "TemplateCommon"
local OpNameMap = {
op_Addition = "__AddMeta",
op_Subtraction = "__SubMeta",
op_Multiply = "__MulMeta",
op_Division = "__DivMeta",
op_Equality = "__EqMeta",
op_UnaryNegation = "__UnmMeta",
op_LessThan = "__LTMeta",
op_LessThanOrEqual = "__LEMeta",
op_Modulus = "__ModMeta",
op_BitwiseAnd = "__BandMeta",
op_BitwiseOr = "__BorMeta",
op_ExclusiveOr = "__BxorMeta",
op_OnesComplement = "__BnotMeta",
op_LeftShift = "__ShlMeta",
op_RightShift = "__ShrMeta",
}
local OpCallNameMap = {
op_Addition = "+",
op_Subtraction = "-",
op_Multiply = "*",
op_Division = "/",
op_Equality = "==",
op_UnaryNegation = "-",
op_LessThan = "<",
op_LessThanOrEqual = "<=",
op_Modulus = "%",
op_BitwiseAnd = "&",
op_BitwiseOr = "|",
op_ExclusiveOr = "^",
op_OnesComplement = "~",
op_LeftShift = "<<",
op_RightShift = ">>",
}
local obj_method_count = 0
local obj_getter_count = 0
local obj_setter_count = 0
local meta_func_count = operators.Count
local cls_field_count = 1
local cls_getter_count = 0
local cls_setter_count = 0
ForEachCsList(methods, function(method)
if method.IsStatic then
cls_field_count = cls_field_count + 1
else
obj_method_count = obj_method_count + 1
end
end)
ForEachCsList(events, function(event)
if event.IsStatic then
cls_field_count = cls_field_count + 1
else
obj_method_count = obj_method_count + 1
end
end)
ForEachCsList(getters, function(getter)
if getter.IsStatic then
if getter.ReadOnly then
cls_field_count = cls_field_count + 1
else
cls_getter_count = cls_getter_count + 1
end
else
obj_getter_count = obj_getter_count + 1
end
end)
ForEachCsList(setters, function(setter)
if setter.IsStatic then
cls_setter_count = cls_setter_count + 1
else
obj_setter_count = obj_setter_count + 1
end
end)
ForEachCsList(lazymembers, function(lazymember)
if lazymember.IsStatic == 'true' then
if 'CLS_IDX' == lazymember.Index then
cls_field_count = cls_field_count + 1
elseif 'CLS_GETTER_IDX' == lazymember.Index then
cls_getter_count = cls_getter_count + 1
elseif 'CLS_SETTER_IDX' == lazymember.Index then
cls_setter_count = cls_setter_count + 1
end
else
if 'METHOD_IDX' == lazymember.Index then
obj_method_count = obj_method_count + 1
elseif 'GETTER_IDX' == lazymember.Index then
obj_getter_count = obj_getter_count + 1
elseif 'SETTER_IDX' == lazymember.Index then
obj_setter_count = obj_setter_count + 1
end
end
end)
local generic_arg_list, type_constraints = GenericArgumentList(type)
%>
namespace XLua.CSObjectWrap
{
using Utils = XLua.Utils;
public class <%=CSVariableName(type)%>Wrap<%=generic_arg_list%> <%=type_constraints%>
{
public static void __Register(RealStatePtr L)
{
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
System.Type type = typeof(<%=CsFullTypeName(type)%>);
Utils.BeginObjectRegister(type, L, translator, <%=meta_func_count%>, <%=obj_method_count%>, <%=obj_getter_count%>, <%=obj_setter_count%>);
<%ForEachCsList(operators, function(operator)%>Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "<%=(OpNameMap[operator.Name]):gsub('Meta', ''):lower()%>", <%=OpNameMap[operator.Name]%>);
<%end)%>
<%ForEachCsList(methods, function(method) if not method.IsStatic then %>Utils.RegisterFunc(L, Utils.METHOD_IDX, "<%=method.Name%>", _m_<%=method.Name%>);
<% end end)%>
<%ForEachCsList(events, function(event) if not event.IsStatic then %>Utils.RegisterFunc(L, Utils.METHOD_IDX, "<%=event.Name%>", _e_<%=event.Name%>);
<% end end)%>
<%ForEachCsList(getters, function(getter) if not getter.IsStatic then %>Utils.RegisterFunc(L, Utils.GETTER_IDX, "<%=getter.Name%>", _g_get_<%=getter.Name%>);
<%end end)%>
<%ForEachCsList(setters, function(setter) if not setter.IsStatic then %>Utils.RegisterFunc(L, Utils.SETTER_IDX, "<%=setter.Name%>", _s_set_<%=setter.Name%>);
<%end end)%>
<%ForEachCsList(lazymembers, function(lazymember) if lazymember.IsStatic == 'false' then %>Utils.RegisterLazyFunc(L, Utils.<%=lazymember.Index%>, "<%=lazymember.Name%>", type, <%=lazymember.MemberType%>, <%=lazymember.IsStatic%>);
<%end end)%>
Utils.EndObjectRegister(type, L, translator, <% if type.IsArray or ((indexers.Count or 0) > 0) then %>__CSIndexer<%else%>null<%end%>, <%if type.IsArray or ((newindexers.Count or 0) > 0) then%>__NewIndexer<%else%>null<%end%>,
null, null, null);
Utils.BeginClassRegister(type, L, __CreateInstance, <%=cls_field_count%>, <%=cls_getter_count%>, <%=cls_setter_count%>);
<%ForEachCsList(methods, function(method) if method.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_IDX, "<%=method.Overloads[0].Name%>", _m_<%=method.Name%>);
<% end end)%>
<%ForEachCsList(events, function(event) if event.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_IDX, "<%=event.Name%>", _e_<%=event.Name%>);
<% end end)%>
<%ForEachCsList(getters, function(getter) if getter.IsStatic and getter.ReadOnly then %>Utils.RegisterObject(L, translator, Utils.CLS_IDX, "<%=getter.Name%>", <%=CsFullTypeName(type).."."..getter.Name%>);
<%end end)%>
<%ForEachCsList(getters, function(getter) if getter.IsStatic and (not getter.ReadOnly) then %>Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "<%=getter.Name%>", _g_get_<%=getter.Name%>);
<%end end)%>
<%ForEachCsList(setters, function(setter) if setter.IsStatic then %>Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "<%=setter.Name%>", _s_set_<%=setter.Name%>);
<%end end)%>
<%ForEachCsList(lazymembers, function(lazymember) if lazymember.IsStatic == 'true' then %>Utils.RegisterLazyFunc(L, Utils.<%=lazymember.Index%>, "<%=lazymember.Name%>", type, <%=lazymember.MemberType%>, <%=lazymember.IsStatic%>);
<%end end)%>
Utils.EndClassRegister(type, L, translator);
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int __CreateInstance(RealStatePtr L)
{
<%
if constructors.Count == 0 and (not type.IsValueType) then
%>return LuaAPI.luaL_error(L, "<%=CsFullTypeName(type)%> does not have a constructor!");<%
else %>
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
<%
local hasZeroParamsCtor = false
ForEachCsList(constructors, function(constructor, ci)
local parameters = constructor:GetParameters()
if parameters.Length == 0 then
hasZeroParamsCtor = true
end
local def_count = constructor_def_vals[ci]
local param_count = parameters.Length
local in_num = CalcCsList(parameters, function(p) return not (p.IsOut and p.ParameterType.IsByRef) end)
local out_num = CalcCsList(parameters, function(p) return p.IsOut or p.ParameterType.IsByRef end)
local real_param_count = param_count - def_count
local has_v_params = param_count > 0 and IsParams(parameters[param_count - 1])
local in_pos = 0
%>if(LuaAPI.lua_gettop(L) <%=has_v_params and ">=" or "=="%> <%=in_num + 1 - def_count - (has_v_params and 1 or 0)%><%ForEachCsList(parameters, function(parameter, pi)
if pi >= real_param_count then return end
没有合适的资源?快使用搜索试试~ 我知道了~
Unity3d 基于xlua热更新实现系列三:生成AB包导出并实现AB包动态加载源码
共661个文件
meta:358个
cs:127个
txt:28个
需积分: 44 9 下载量 194 浏览量
2022-03-24
17:30:07
上传
评论 1
收藏 3MB 7Z 举报
温馨提示
建议先看说明:https://blog.csdn.net/qq_33789001/article/details/123716922 Unity3d 基于xlua热更新实现系列三:生成AB包导出并实现AB包动态加载源码
资源详情
资源评论
资源推荐
收起资源包目录
Unity3d 基于xlua热更新实现系列三:生成AB包导出并实现AB包动态加载源码 (661个子文件)
hotfix_id_map.lua.txt.20220321140305441 13B
hotfix_id_map.lua.txt.20220321140501717 13B
hotfix_id_map.lua.txt.20220321141147977 13B
hotfix_id_map.lua.txt.20220321141502540 13B
hotfix_id_map.lua.txt.20220321142023336 13B
hotfix_id_map.lua.txt.20220321142346679 13B
hotfix_id_map.lua.txt.20220321150321689 13B
hotfix_id_map.lua.txt.20220321152338546 13B
hotfix_id_map.lua.txt.20220324172437876 13B
libxlua.a 2.45MB
ABPacks 1KB
ABPacks 1KB
Unity.AssetBundleBrowser.Editor.asmdef 155B
ProjectSettings.asset 18KB
InputManager.asset 10KB
QualitySettings.asset 7KB
GraphicsSettings.asset 2KB
Physics2DSettings.asset 2KB
NavMeshAreas.asset 1KB
DynamicsManager.asset 1KB
EditorSettings.asset 1KB
PackageManagerSettings.asset 1002B
UnityConnectSettings.asset 898B
AudioManager.asset 432B
TagManager.asset 421B
VFXManager.asset 320B
EditorBuildSettings.asset 319B
TimeManager.asset 211B
VersionControlSettings.asset 188B
XRSettings.asset 167B
NetworkManager.asset 159B
PresetManager.asset 153B
ClusterInputManager.asset 120B
build.bat 900B
signatured1.lua.bytes 200B
signatured2.lua.bytes 177B
signatured3.lua.bytes 177B
xlua_webgl.cpp 1KB
HotfixFlags.cpp 959B
CodeEmit.cs 85KB
Generator.cs 79KB
Hotfix.cs 74KB
ObjectTranslator.cs 63KB
UnityEngine_ParticleSystemWrap.cs 62KB
UnityEngine_TransformWrap.cs 60KB
UnityEngine_Vector3Wrap.cs 59KB
UnityEngine_LightWrap.cs 57KB
UnityEngine_MathfWrap.cs 55KB
Utils.cs 49KB
System_Collections_Generic_List_1_System_Int32_Wrap.cs 48KB
UnityEngine_Vector2Wrap.cs 48KB
UnityEngine_RendererWrap.cs 48KB
StaticLuaCallbacks.cs 47KB
WrapPusher.cs 43KB
UnityEngine_Vector4Wrap.cs 42KB
UnityEngine_QuaternionWrap.cs 42KB
UnityEngine_GameObjectWrap.cs 40KB
UnityEngine_DebugWrap.cs 37KB
ABModelBundleInfo.cs 36KB
UnityEngine_ColorWrap.cs 35KB
ABModel.cs 31KB
ObjectCasters.cs 28KB
UnityEngine_BoundsWrap.cs 27KB
UnityEngine_ComponentWrap.cs 27KB
LuaDLL.cs 26KB
AssetBundleTree.cs 26KB
UnityEngine_ObjectWrap.cs 26KB
DelegatesGensBridge.cs 25KB
LuaEnv.cs 25KB
MethodWarpsCache.cs 23KB
Tutorial_DerivedClassWrap.cs 20KB
UnityEngine_AnimationCurveWrap.cs 20KB
UnityEngine_AnimationClipWrap.cs 19KB
PackUnpack.cs 19KB
AssetBundleBuildTab.cs 18KB
UnityEngine_TimeWrap.cs 17KB
UnityEngine_SkinnedMeshRendererWrap.cs 17KB
AssetListTree.cs 17KB
AssetBundleInspectTab.cs 17KB
UnityEngine_MonoBehaviourWrap.cs 15KB
ExampleConfig.cs 14KB
XLuaTest_NoGcWrap.cs 13KB
UnityEngine_KeyframeWrap.cs 13KB
UnityEngine_ResourcesWrap.cs 13KB
HotfixTest2.cs 12KB
LuaTable.cs 11KB
BundleDetailList.cs 11KB
AssetBundleManageTab.cs 11KB
ABModelAssetInfo.cs 9KB
TemplateEngine.cs 9KB
UnityEngine_Ray2DWrap.cs 9KB
UnityEngine_RayWrap.cs 9KB
LuaCallCs.cs 8KB
AssetBundleBrowserMain.cs 8KB
GenericDelegateBridge.cs 8KB
XLuaGenAutoRegister.cs 8KB
LuaFunction.cs 8KB
DelegateBridge.cs 8KB
MessageSystem.cs 8KB
XLuaTest_MyStructWrap.cs 8KB
共 661 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
十幺卜入
- 粉丝: 7949
- 资源: 51
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 人工智能ai相关教学课程快
- Suno的冲击-AI音乐来了-学习备用.pdf
- KIMI大模型浏览器插件
- b61fa64a08a02de0e0d49d53bb84c444.amr
- 分布式系统中Java后端开发技术及其应用实践.pdf
- 5ffd9193f6aec31bbf16030a46680dc7.avi
- DA14531-蓝牙传感器连接传输数据固件
- 极限存在准则与两个重要极限
- logisim实验MIPS运算器(ALU)设计(内含4位先行进位74182、四位快速加法器、32位快速加法器)-Educoder_logisim里面连线,实现4位先行进位74182和4位快速加法器-C
- 高等数学第一章第二节数列的极限
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0