怎样使用Cocos LUACompile
原文地址:http://www.cocos2d-x.org/wiki/Cocos_luacompile
怎样使用Cocos LUACompile
- 怎样使用cocos luacompile
- 预览
- 环境设置
- 使用方法
- 可用的参数
- 例子
预览
将 .lua
文件编译为 .luac
所涉及到的加密方法
环境配置
如果是cocos2d-x V3.3 或者更高级的版本, 你需要配置 cocos consol
(请查看 https://github.com/cocos2d/cocos2d-x/blob/v3/README.md)
如果版本是cocos2d-x V2.2.6, 你应该安装 Python
, 然后设置Python的环境变量.
使用方法
如果是cocos2d-x V3.3 或者更高级的版本, 在终端里输入 cocos luacompile [arguments]
如果版本是cocos2d-x V2.2.6, 在终端里,首先 cd
进目录tools/cocos2d-console/console
, 然后输入 ./cocos2d.py luacompile [arguments]
.
可用的参数(在终端里)
参数 | 参数的值 | 例子 | 描述 | 是否必须 |
---|---|---|---|---|
-h, --help | - | - | Show the help message and exit | no |
-v, --verbose | - | - | verbose output | no |
-s, --src | source directory |
./projects/MyLuaGame/src
|
Specify source directory of lua files needed to be compiled,support mutiple source directory | yes |
-d, --dst | destination directory |
./projects/MyLuaGame/dst
|
Specify destination directory which bytecode files to be stored. | yes |
-e, --encrypt | bool | True | Whether or not to encrypt lua files. | no |
-k, --encryptkey | any string |
MyLuaKey
|
Specify the encrypt key for encrypting lua scripts. It's only take effect when -e, --encrypt is enabled. Default value is 2dxLua .
|
no |
-b, --encryptsign | any string |
MyLuaSign
|
Specify the encrypt sign for encrypting lua scripts. It's only take effect when --encrypt is enabled. Default value is XXTEA .
|
no |
--disable-compile | bool | True | Whether or not to compile lua scripts | no |
例子
使用luacompile时,有以下几种方式
方式 | cocos2d-x 版本 | 描述 |
---|---|---|
cocos luacompile -h | cocos2d-x V3.3 or higher version | Show the help message |
cocos luacompile -s src_dir -d dst_dir | cocos2d-x V3.3 or higher version |
Precompile the Lua files in the src_dir directory to bytecode files which luajit supports, then store them in the dst_dir directory by the same directory structure.
|
cocos luacompile -s src_dir -d dst_dir -e True | cocos2d-x V3.3 or higher version |
Precompile the Lua files in the src_dir directory to bytecode files which luajit supports, then encrypt this bytecoed files by xxtea .The key and sign for encrypting are 2dxLua and XXTEA by default. By adding -k xxx -b xxx' to the command, developers can change the keyand sign, -k xxxset the key value and -b xxx` set the sign value. The encrypted files are stored in the dst_dir directory by the same directory structure.
|
cocos luacompile -s src_dir -d dst_dir -e True --disable-compile True | cocos2d-x V3.3 or higher version |
Encrypt the Lua files in the src_dir by xxtea , then store them in the dst_dir directory by the same directory structure. The key and sign for encrypting are 2dxLua and XXTEA by default. By adding -k xxx -b xxx' to the command, developers can change the keyand sign, -k xxxset the key value and -b xxx` set the sign value. This command is mainly used to make a set of encrypted files run both 32bit and 64bit iOS devices at the same time. Because Apple demand new app must support 64bit,but the stable luajit doesn't support the arm64bit, so providing this command to encrypt the lua files directly.
|
./cocos2d.py luacompile -h | cocos2d-x V2.2.6 | Show the help message |
./cocos2d.py luacompile -s src_dir -d dst_dir | cocos2d-x V2.2.6 |
Precompile the Lua files in the src_dir directory to bytecode files which luajit supports, then store them in the dst_dir directory by the same directory structure.
|
./cocos2d.py luacompile -s src_dir -d dst_dir -e True | cocos2d-x V2.2.6 |
Precompile the Lua files in the src_dir directory to bytecode files which luajit supports, then encrypt this bytecoed files by xxtea .TThe key and sign for encrypting are 2dxLua and XXTEA by default. By adding -k xxx -b xxx' to the command, developers can change the keyand sign, -k xxxset the key value and -b xxx` set the sign value. The encrypted files are stored in the dst_dir directory by the same directory structure.
|
./cocos2d.py luacompile -s src_dir -d dst_dir -e True --disable-compile True | cocos2d-x V2.2.6 |
Encrypt the Lua files in the src_dir by xxtea , then store them in the dst_dir directory by the same directory structure. The key and sign for encrypting are 2dxLua and XXTEA by default, by adding -k xxx -b xxx' to the command, developers can change the keyand sign, -k xxxset the key value and -b xxx` set the sign value. This command is mainly used to make a set of encrypted files run both 32bit and 64bit iOS devices at the same time.
|
注意: 如果在游戏里使用了xxtea加密,你必须调用在c++代码里,调用LuaStack里的setXXTEAKeyAndSign方法以设置key和sign来解密文件。
怎样使用Cocos LUACompile相关推荐
- cocos lua 加密方案
cocos2d使用的是luajit,lua原生编译出来的bytecode和luajit是不兼容的,所以直接用luac法编译出来的bytecode脚本无法在cocos2d中使用. 目前所指的解决方案有2 ...
- cocos2dx-lua 批量打包及修改
coco2dx目前大部分开发者肯定是用lua解决问题,问题来了,每次改一下lua配置可能你每次都得运行 cocos luacompile -p android 针对不同的平台,可能会有某些配置会略有不 ...
- cocos2d 3.3 lua 代码加密 luac
1.0 cocos luacompile 用法 我用的普通的cocos2d lua,没用quick,quick好像可以对整个资源包括图像和音频都加密,打包成zip.我看了下luacompile 的 h ...
- 网狐荣耀,android编译
我用的是微星版本,不过这个版本也是基于网狐荣耀版本,二次开发的,所以在编译android版本是,我也是用编译网狐荣耀的方法编译的. 在客户端下,有一个info目录,找到GloryProjectR.ba ...
- cocos2dx 3.4 lua加密 setXXTEAKeyAndSign
1.在自己项目的根目录下按住Shift键, 右击鼠标, 点击"在此处打开命令窗口" 然后输入 cocos luacompile -s src/ -d out/ -e -k test ...
- 使用xxtea加密或者解密文件
转载自:https://blog.csdn.net/themagickeyjianan/article/details/71211303 预览 将 .lua 文件编译为 .luac 所涉及到的加密方法 ...
- xxtea 文件加密与解密
加密 cocos luacompile -s src -d dst_dir -e -b xxxxx -k xxxxx --disable-compile 解密 cocos luacompile -s ...
- cocos2dx-lua 使用 luajit 加密 Android工程
前言 当前版本: cocos2dx-lua-3.17.2 LuaJIT 2.1.0-beta2 Lua 5.1 工具环境: Visual Studio 2015 Android Studio Arct ...
- 它需要一个平台才能实现6代Wi-Fi互联,可为第十代平台提供连接
Author: Ryan Shrout, Chief Performance Strategist at Intel 作者:英特尔首席绩效战略家Ryan Shrout As we head into ...
最新文章
- 伍六七带你学算法 入门篇-最长回文串
- Java并发编程艺术----读书笔记(二)
- 递归实现数字排列组合
- gprs连接中断记录_请收好!脉搏波血压计连接天天血压APP使用指南
- Dev控件GridControl 的使用
- python中pandas是指什么_Python中的神器Pandas,但是有人说Pandas慢...
- 计算机学硕缩招,专硕扩招、学硕缩招!又有院校初试科目改了!本周这些院校发布最新消息!...
- 计算机英语教程第6版,计算机英语教程(第6版)
- 常见笔顺错误的字_容易出错的汉字|汉字中哪些字笔顺容易错
- c语言读取三菱plc数据,c#通过网线读取三菱PLC数据
- w10系统桌面的计算机找不到,w10桌面我的电脑图标不见了怎么办
- java 计算球体积方法,球体体积计算公式 我计算求得的球体和球壳的转动惯量都是实际值的一......
- if...elseif....else 语句 2020年周易起名系统开发,生辰八字,周易
- Hexo 搭建博客提交百度 sitemap 抓取失败
- 押上声誉百亿豪赌,雷军几分胜算?
- 【react-hook】 useCallback
- MyBatis批量插入几千条数据,慎用Foreach
- 大数据征信迎爆发时机 这几家企业或将率先破局
- 卫星位置计算的c语言,C语言-详细计算GPS卫星位置.doc
- scrapy - 美团民宿 实战练习