?/???
??????Unity3D???????????????????????????????LuaFramework???????tolua?????????????????????????????????????????????????????4??????LuaFramework????????????????lua???????????
1?????
???http://www.ulua.org/index.html??LuaFramework????Unity3D????????LuaFramework_UGUI-1.0.4.109????Unity3D 5.2??????????????????lua?????Generate All?LuaFramework???Build XXX Resources????????????
????????http://pan.baidu.com/s/1gd8fG4N???01_uLua_Windows.avi?02_SimpleFramework_UGUI_Windows.avi????????windows????????????http://doc.ulua.org/article/ngui/simpleframework_base1.html????????
????????????????????????????
???????????????????????
2???Lua??
???????????????????????lua???????helloWorld????????????????
1?????
????????Main?????Main?????????AppFacade.Instance.StartUp()??????????????????????????????
??Main??
2????????
??????????????????????????????????lua?????Assets\LuaFramework\Scripts\Manager\GameManager.cs??OnInitalize????????????lua?????????Main.lua?Main???
??GameManager?lua??
3???lua??
??Assets\LuaFramework\Lua\main.lua???lua??????????LuaFramework.Util.Log("HelloWorld");??????????????Debug.Log("HelloWorld")?
--???????????lua??
- --???????????lua??
- function Main()
- LuaFramework.Util.Log("HelloWorld");
- end
复制代码
LuaFramework.Util.Log("HelloWorld")??Util?c#???????lua????????Assets\LuaFramework\Editor\CustomSettings.cs???????lua?????????CustomSettings.cs??????
CustomSettings.cs?????
?????????????API??????????????Util???????
Util??Assets\LuaFramework\Scripts\Utility\Util.cs??????
4?????
??????LuaFramework?Build Windows Resource????????????????????????????HelloWorld?
??????
????
?????????????lua????????Build XXX Resource??????????Assets\LuaFramework\Scripts\ConstDefine\AppConst.cs??LuaBundleMode???false???????????AssetBundle?????????????????
??LuaBundleMode
3???????
???????????????????????lua???????????????????????Unity3D???????????????Unity3D???????3????
??????
???????????Unity3D???StreamingAssets??????????????????????????????????????????????????????????????windows?????
Mac OS?Windows?Application.dataPath+"/StreamingAssets";
IOS?Application.dataPath+"/Raw";
Android?jar:file://"+Application.dataPath+"!/assets/";
??????????????Android?IOS???????????????????????????????????????????????????????????????????????????1?????????????????????????????????????????????????????3???????????????????LuaFramework??????
Android?IOS?Application.persistentDataPath+"/LuaFramework"
Mac OS?Windows?c:/LuaFramework/
??????Application.dataPath+"/StreamingAssets/"
??LuaFramework?StreamingAssets????????????
????????????????????????????????????????????????
??????????????????????????files.txt?Files.txt??????????????????????md5????????????????files.txt????????????md5????????????????2??
files.txt
LuaFramework?????????Assets\LuaFramework\Scripts\Manager\GameManager.cs?????????????????
4??????????
???????????????????????HelloWorld?
1?????
????????????????????AppConst.cs?UpdateMode???true???????2???LuaBundleMode???true??WebUrl???????????????
AppConst???
2???????
????iis???????????StreamingAssets???????????????????????????????????????
????????
3??????
???Lua?????HelloWorld??Hello Lpy2????Build Windows Resource??????/StreamingAssets??????????????????????????Build Windows Resource????????????????????Hello Lpy2?????????????????
?????
????????LuaFramework???????????????????????ToLua?LuaFramework?????????????????LuaFramework???????????????
???????
?????????Unity3D??????Unity3D?????????????????????????????????????????????????????????????????????UI??????????????????????Unity3D?????????????????????????????????????????
???Unity3D?????????????????????????
?????https://zhuanlan.zhihu.com/p/21386682
|