LuaFramework_UGUI学习--一个热更新框架
链接:https://www.cnblogs.com/imteach/p/10604891.html
所用框架下载链接:https://files.cnblogs.com/files/imteach/LuaFramework_UGUI-master-20190327.zip
第一步-测试
框架下载解压后是一个unity工程,在unity工程中打开
点击菜单选项中的:LuaFramework->Build Windows Resouce
点击运行:出现一个面板 == 成功
第二步-创建自定义的面板Test
在Assets/LuaFramework/Lua文件夹下
1.在Conroller中创建TestCtrl.lua
ps:其中代码可按照MessageCtrl的格式
2.在View中创建TestPanel.lua
3.修改Common中的define.lua{
在CtrlNames中添加Test="TestCtrl"
在PanelNames中添加"TestPanel"
}
4.修改Logic中的CtrlManager.lua{
function CtrlManager.Init()
logWarn("CtrlManager.Init----->>>");
ctrlList[CtrlNames.Prompt] = PromptCtrl.New();
ctrlList[CtrlNames.Message] = MessageCtrl.New();
ctrlList[CtrlNames.Test] = TestCtrl.New(); --这个是要新加的
return this;
end
}
还有Game.lua{
function Game.OnInitOK()
修改51行为:local ctrl=CtrlManager.GetCtrl(CtrlNames.Test);
}
5.在Assets/LuaFramework/Editor文件夹中的Packager.cs
164行后面新加:AddBuildMap("test" + AppConst.ExtName, "*.prefab", "Assets/LuaFramework/Examples/Builds/Test");
ps:为了创建一个test.unity3d的文件,不然会报错
6.回到unity
在LuaFramework/Examples/Builds/Test创建一个预制体TestPanel
点击菜单选项中的:LuaFramework->Build Windows Resouce
点击运行,就能看到自定义的面板了

浙公网安备 33010602011771号