lua
文章平均质量分 52
流星丿点
这个作者很懒,什么都没留下…
展开
-
cocos2dx_lua卡牌翻转
local fun = function(curNode, BgNode) local scaleToHide = cc.ScaleTo:create(0.1, 0, 1.0) local function funcScaleToShow() local scaleToShow = cc.ScaleTo:create(0.1, 1.0, 1.0) BgNode:setVisible(true) BgNode:run...原创 2022-02-12 16:49:05 · 2006 阅读 · 0 评论 -
cocos_lua listView加载超多数据
创建QuickCell文件local QuickCell = class("QuickCell", function() return ccui.Widget:create()end)-- self._data.wid default 100-- self._data.hei default 50-- self._data.anchor default {x=0, y=0}-- self._data.t...原创 2022-01-18 09:45:27 · 393 阅读 · 0 评论 -
数据以table表的形式存储
LUA学习笔记-----数据以table表的形式存储(2013-08-23 16:39:10)转载▼ 分类: LUA脚本开发 实现思路:table表===》》》转为字符串(这里利用json库)===》》》存储===》》》读取达成目的解决字符串拼接问题 用最简单办法将table表存入文件,方便游戏存档、游戏关卡、等等第一步:将table...原创 2019-11-22 18:00:43 · 821 阅读 · 0 评论 -
cocos2dx Lua 注册触摸事件并检测点击坐标是否在指定区域内
注册触摸事件:function RankCenterPanel:registerTouchListener() local listener = cc.EventListenerTouchOneByOne:create() listener:setSwallowTouches(true) listener:registerScriptHandler(function(t...原创 2019-01-09 14:58:46 · 1391 阅读 · 0 评论 -
lua GBK与utf8互转
function Helper.utf8ToGBK(str) if true then return str end if device.platform == "android" then return AppUtils:utf8ToGBK(str) else local convertStr = str...原创 2019-03-05 11:18:37 · 5766 阅读 · 1 评论 -
lua 判断当前时间是否为当天时间
function isToday(timestamp) local today = os.date("*t") local secondOfToday = os.time({day=today.day, month=today.month,year=today.year, hour=0, minute=0, second=0}) if timestamp >= se...转载 2019-03-28 15:37:26 · 3093 阅读 · 0 评论 -
cocos_lua加载BMFont 生成的文件fnt
local winTextArea = cc.Label:createWithBMFont("mywwww.fnt", string.format("-%d",200))winTextArea:setString("-2000")addChild(self ,winTextArea )原创 2019-04-02 18:29:10 · 491 阅读 · 0 评论 -
lua 微信头像url
function App.createHeadSprite(url,userID) local name = md5.sumhexa(url) local headPicName = name..".png" local filepath = cc.FileUtils:getInstance():getWritablePath() filepath = filep...原创 2019-05-21 18:12:48 · 980 阅读 · 0 评论 -
cocos2dx_lua 粒子系统
--流星 local meteor = cc.ParticleMeteor:createWithTotalParticles(130) -- meteor:setTexture(cc.Director:getInstance():getTextureCache():addImage("wsk1.png")) meteor:setPosition(cc.p( 250, 200)...原创 2019-09-18 10:42:32 · 588 阅读 · 0 评论 -
cocos进度条 ProgressTimer
进度条ProgressTimer,c++圆形进度条Sprite *bgSprite = Sprite::create("red.png"); addChild(bgSprite, 1, 1); Sprite *hpSprite = Sprite::create("green.png"); progressTimer = ProgressTimer::creat...原创 2018-11-02 15:02:13 · 1401 阅读 · 0 评论 -
cocos2dx Lua利用scrollview实现自动滚动效果动画
function UIFlowerFish:ctor() self.rootWidget = cc.CSLoader:createWidget("UI/flowerFish.csb"); --获取scrollview控件: local scroll_view = ccui.Helper:seekWidgetByName(self.rootWidget,"ScrollView_1"); --设置s...原创 2018-07-07 14:19:29 · 4022 阅读 · 0 评论 -
cocos2dx加载csb动画
cocos2dx lua: local effect = cc.CSLoader:createNode("UI/Colour.csb")effect:setPosition(self.rootWidget:getContentSize().width/2,self.rootWidget:getContentSize().height/2)self.rootWidget:addChild(effe...原创 2018-05-29 16:20:00 · 2371 阅读 · 0 评论 -
cocos2dx c++.lua +listView
cocos2dx c++ listView://总成绩ListView*m_gameList = ListView::create();m_gameList->setDirection(ListView::Direction::VERTICAL);m_gameList->setAnchorPoint(Vec2::ANCHOR_MIDDLE);m_gameList->原创 2017-10-16 15:46:25 · 587 阅读 · 0 评论 -
cocos2dx_lua 触摸监听
cocos2dx_lua 触摸监听 local function onTouchBegin() cclog("onTouchBegin"); return true end local function onTouchMoved() cclog("onTouchMoved"); end loca原创 2017-11-03 11:29:49 · 1131 阅读 · 0 评论 -
cocos2dx加载骨骼动画
cocos2dx c++://移除该骨骼动画 ArmatureDataManager::getInstance()->removeArmatureFileInfo("paobu.ExportJson"); // 连接该骨骼动画的资源 ArmatureDataManager::getInstance()->addArmatureFileInfo("paobu.Export...原创 2018-03-23 17:11:29 · 1205 阅读 · 0 评论 -
cocos2dx 数据存储
cocos2dx lua数据存储 cc.UserDefault:getInstance():setStringForKey("string", "value1")-- 字符串 cc.UserDefault:getInstance():setIntegerForKey("integer", 10)-- 整型 cc.UserDefault:getInstance():setFloatForKey...原创 2018-03-30 17:48:26 · 305 阅读 · 0 评论 -
修改cocostudio控件textfield的占位文本颜色
self.inputName = ccui.Helper:seekWidgetByName(self.rootWidget, "InputName"); --获取textField控件self.inputName:setPlaceHolder("点击编辑签名,最多40个汉字"); --输入占位文本内容self.inputName:setPlaceHolderCo...原创 2018-03-21 11:45:27 · 1498 阅读 · 0 评论 -
cocos2d-x lua 监听editBox
self.accountName = ccui.EditBox:create({width=335,height=74}, "Common2/M_LoginInputBg.png"); --创建一个EditBoxself.accountName:setPosition(350, 190); --设置EditBox位置self.accountName:setFont("Common2/FZY3...原创 2018-03-21 15:25:50 · 1306 阅读 · 0 评论 -
Cocos2d-x lua 使用定时器
打开一个定时器:schedulerID = cc.Director:getInstance():getScheduler():scheduleScriptFunc(调用的function, 定时时间(秒), 是否暂停(true, false))关闭定时器:cc.Director:getInstance():getScheduler():unscheduleScriptEntry(schedul...转载 2018-04-02 13:56:48 · 552 阅读 · 0 评论 -
cocos2dx lua解析json
cocos2dx lua解析jsonlua中的json解析相比c++的要简单点,lua中主要是通过table的格式,json中的json.lua有两个函数是我们需要用的,第一个叫做 encode,用于将一个数据编码成json格式,第二个是 decode,用于将json解析成一个table格式需要 require("json")[plain] view plain copy-- 构造json ...转载 2018-05-28 18:22:33 · 882 阅读 · 0 评论 -
cocos2dx lua 触摸事件+计时器
cocos2dx lua 触摸事件 local function onTouchBegin(touch, event) cclog("触摸开始"); self:m_onTouchBegin(touch, event); return true end local function onTouchMoved(原创 2017-09-02 17:09:39 · 486 阅读 · 0 评论