原文地址: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 2dxLuaand XXTEA by default. By adding  -k xxx -b xxx' to the command, developers can change thekeyandsign,-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 thekeyandsign,-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 thekeyandsign,-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 thekeyandsign,-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相关推荐

  1. cocos lua 加密方案

    cocos2d使用的是luajit,lua原生编译出来的bytecode和luajit是不兼容的,所以直接用luac法编译出来的bytecode脚本无法在cocos2d中使用. 目前所指的解决方案有2 ...

  2. cocos2dx-lua 批量打包及修改

    coco2dx目前大部分开发者肯定是用lua解决问题,问题来了,每次改一下lua配置可能你每次都得运行 cocos luacompile -p android 针对不同的平台,可能会有某些配置会略有不 ...

  3. cocos2d 3.3 lua 代码加密 luac

    1.0 cocos luacompile 用法 我用的普通的cocos2d lua,没用quick,quick好像可以对整个资源包括图像和音频都加密,打包成zip.我看了下luacompile 的 h ...

  4. 网狐荣耀,android编译

    我用的是微星版本,不过这个版本也是基于网狐荣耀版本,二次开发的,所以在编译android版本是,我也是用编译网狐荣耀的方法编译的. 在客户端下,有一个info目录,找到GloryProjectR.ba ...

  5. cocos2dx 3.4 lua加密 setXXTEAKeyAndSign

    1.在自己项目的根目录下按住Shift键, 右击鼠标, 点击"在此处打开命令窗口" 然后输入 cocos luacompile -s src/ -d out/ -e -k test ...

  6. 使用xxtea加密或者解密文件

    转载自:https://blog.csdn.net/themagickeyjianan/article/details/71211303 预览 将 .lua 文件编译为 .luac 所涉及到的加密方法 ...

  7. xxtea 文件加密与解密

    加密 cocos luacompile -s src -d dst_dir -e -b xxxxx -k xxxxx --disable-compile 解密 cocos luacompile -s ...

  8. cocos2dx-lua 使用 luajit 加密 Android工程

    前言 当前版本: cocos2dx-lua-3.17.2 LuaJIT 2.1.0-beta2 Lua 5.1 工具环境: Visual Studio 2015 Android Studio Arct ...

  9. 它需要一个平台才能实现6代Wi-Fi互联,可为第十代平台提供连接

    Author: Ryan Shrout, Chief Performance Strategist at Intel 作者:英特尔首席绩效战略家Ryan Shrout As we head into ...

最新文章

  1. 机器学习--Gradient Boosting Machine(GBM)调参方法详解 转 面试问到的
  2. BarTender安装常见问题集结
  3. 卸载angular版本
  4. html表格极细边框,html中表格细边框的四种实现及其比较
  5. Java加载sklearn训练好的模型进行预测(无法搞定)
  6. Item9:总是要改写toString
  7. php ping主机名,PHP PING值函数
  8. Avalonia跨平台入门第三篇之Popup
  9. 又一辆特斯拉电动汽车撞上警车,都是因为这个功能
  10. 软件交接需要交接哪些内容_从代理记账公司交接,需要交接哪些财务资料?
  11. ABAQUS2017安装问题:以下应用程序正在锁定 VC11 dll :C:\WINDOWS\system32\msvcr110.dll 继续前先终止这些应用程序。
  12. 七款顶级HTML5编辑器带你飞
  13. 超酷计算机病毒,世界上十种最强的计算机病毒,最著名的计算机病毒都在这里!...
  14. 中国动漫及计算机专业好的大学排名,全国大学动画专业排名
  15. 【技术答疑】Swarm BZZ常见技术问题解答
  16. 从程序员到项目经理(10):程序员加油站 --要执着但不要固执【转载】
  17. android 仿简书评论,Android 开发仿简书登录框可删除内容或显示密码框的内容
  18. 安装 torch-scatter,torch-sparse 出现error: Command errored out with exit status 1
  19. 记录一个数学知识:求向量在指定平面上的垂直向量
  20. 软件工程与计算II-22-软件开发过程模型

热门文章

  1. 2020年-2021年元宇宙发展研究报告
  2. win10ltsc安装后重启提示bitlocker有问题怎么办_U盘损坏五种常见问题的修复方式...
  3. CAD闭合多边形转为ARCGIS中面要素,遇到的几个问题
  4. Zen Coding: 一种快速编写HTML/CSS代码的方法
  5. 易拓大咖说|巧妙使用样式设置,提高 SAP 分析云表格的性能
  6. maya刷权重时有个叉_maya怎么为蘑菇刷权重?
  7. Python爬虫入门教程 100-100 我用了800天,才成为爬虫领域的一个新人
  8. 学习笔记:云原生容器化技术——Docker
  9. setAttribute 方法
  10. Teigha .dwg文件开发——基础概念