![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
cocos
Lost_the_wind
这个作者很懒,什么都没留下…
展开
-
cocos2dx 3.0 lua 关于listview和item点击和滑动的触摸吞噬问题
cocos版本3.15,使用studio编辑界面 -- 创建itemlocal item1 =Item:create(array[index])item1:setPosition(pos)self.ui.listview:addChild(item1)item是studio中的搭建的模版,根结点是layout,子节点bg是imageview,其他东西全在imageview下面我使用的bg作为点击对...原创 2018-04-21 14:51:15 · 2182 阅读 · 1 评论 -
Lua利用cjson读写json
解析JSON cjson.decodelocal cjson = require "cjson"local sampleJson = [[{"age":"23","testArray":{"array":[8,9,11,14,25]},"Himi":"himigame.com"}]];--解析json字符串local data = cjson.deco转载 2018-12-27 11:25:42 · 2871 阅读 · 0 评论 -
cocos lua 字符分割
function split(str, flag) local tab = {} while true do -- 在字符串中查找分割的标签 local n = string.find(str, flag) if n then -- 截取分割标签之前的字符串 local first =...原创 2018-12-05 17:24:01 · 653 阅读 · 0 评论 -
cocos2dx 3.0 lua 使用spine骨骼动画
以下使用spine的时候,spine动画是使用studio导出的,在studio中导出格式设置为JSON,导出目录任选,勾选Create Atlas,点击导出 ,然后把它放在了我的工程里面进行的操作为了不用在每次使用spine的时候都写一堆的重复代码,我把它的写在了公用的方法里面,方便调用直接上代码-- 创建动画 参数1:.json文件路径 参数2:.atlas文件路径 参数3:父...原创 2018-12-03 15:30:23 · 2208 阅读 · 0 评论 -
lua 数组随机排序
local result = {} -- 接收排序后的tablelocal obj = {1,2,"f",4,5,6,"a","b",1,3} -- 需要进行排序的tablefor i,v in ipairs(obj) do print("--排序前--",i,v)end-- 排序方法 参数为要排序的tablefunction shuffle(_table) -- 判...原创 2018-12-05 16:04:57 · 2844 阅读 · 0 评论 -
网络请求报错 code = 1002 处理
有时候网络请求会异常,比如报错:NSURLConnection finished with error - code -1002Response failed, error buffer: unsupported URL 处理方法:iOS 8 要用utf8转码:urlString = [urlString stringByAddingPercentEscapesUsingE...翻译 2018-12-01 13:30:25 · 5752 阅读 · 0 评论 -
粒子属性介绍
粒子属性介绍:Max Particles:全部粒子的总数量,也就是同时能够显示的最大粒子数量。Life span:粒子的生命值,此属性决定粒子会在多长时间内从生成到消失,此属性为单个粒子设置生命期。Life span Variance:生命值浮动值,每个粒子的具体生命时间由生命值和其浮动值一起计算,比如生命值是5秒,浮动值为1秒,则最终的生命值就是4~6秒之间的随机数值。Start...原创 2024-04-09 10:19:15 · 378 阅读 · 1 评论 -
获取时间戳
// 获取时间戳int getTimeStamp(){ timeval tm; gettimeofday(&tm, NULL); return tm.tv_sec; // 单位:秒// return tm.tv_usec; // 单位:毫秒}// //{ //获取本地时间 time_t t = ...原创 2018-11-19 16:07:50 · 243 阅读 · 0 评论 -
动态创建 精灵组成的数字
newNode:function(type) { var node = new cc.Node() if(type && global.core.isFunction(type)) { return node.addComponent(type) } return node...转载 2018-11-19 16:06:33 · 149 阅读 · 0 评论 -
Cocos2dx 常见动作
1. bool HelloWorld::init() { ////////////////////////////// // 1. super init first if ( !CCLayer::init() ) { return false; } CCSprite * ...转载 2018-11-19 14:42:04 · 124 阅读 · 0 评论 -
cocos edit编辑类型
-- 创建EditBoxfunction Method.createInputBox(_parent,_isNumber,_txt1,_txt2,_fontSize,_maxLength) local accedit = cc.EditBox:create(cc.size(_parent:getContentSize().width*1, _parent:getContentSize(...原创 2018-08-24 11:12:38 · 447 阅读 · 0 评论 -
根据手机设定的语言显示app的名称
1.添加语言包 2.新建string文件 名称使用InfoPlist3.选中string文件添加 4.设置对应语言显示的app名称原创 2018-12-11 11:29:04 · 653 阅读 · 0 评论