cocos2dx之商店源码
来源:互联网 发布:知识竞赛软件免费版 编辑:程序博客网 时间:2024/05/16 23:01
function shopLayer.initShopGoods(iTabelIndex) -- body print("---- Enter shopLayer.initShopGoods ----") --高亮选中项 shopLayer._shopTabel[iTabelIndex]._Selected:setVisible(true) shopLayer._shopTabel[iTabelIndex]._Normal:setVisible(false) if shopLayer._shopTabel[iTabelIndex]._Panel ~= nil and shopLayer._ListView ~= nil then --todo --商店总共6项 ,这个值可以随意变化 local panelMode = shopLayer._shopTabel[iTabelIndex]._Panel shopLayer._ListView:setItemModel(panelMode) for i = 1, 6 do shopLayer._ListView:pushBackDefaultItem() end local ViewWidth = shopLayer._ListView:getContentSize().width local iID = shopLayer._shopTabel[iTabelIndex]._id print("iID: "..iID) for i = 0, 5 do --lua里面ListView是从0开始的 local iItem = shopLayer._ListView:getItem(i) local btnResID = shopLayer._ButtonRes[iID][i + 1].buy_btn local btn = ccui.Button:create(btnResID) local itemHeight = iItem:getContentSize().height btn:setPosition(ViewWidth - btn:getContentSize().width / 2, itemHeight / 2) btn:setAnchorPoint(cc.p(0.5, 0.5)) btn:setTouchEnabled(true) btn.shopType = iTabelIndex; --商店类型 btn.id = i + 1 --商店按钮ID btn:addTouchEventListener(function (sender, eventType) --这里回调到每个按钮所对应的信息 -- body if eventType == 2 then --todo local CostType = sender.shopType local CostID = sender.id local iCount = shopLayer._ButtonRes[CostType][CostID].count if sender.shopType == 1 then --萌币 cpp_SaveBudCoinCount(iCount) print("shopType ____1, Button ID: "..sender.id) else print("shopType ____2, Button ID: "..sender.id) end end end) iItem:addChild(btn) end end print("---- Exit shopLayer.initShopGoods ----")end
0 0
- cocos2dx之商店源码
- cocos2dx源码之 选择器
- cocos2dx源码之 CREATE_FUNC宏
- cocos2dx 源码分析之 CCPoolManager
- 小卫源码商店
- cocos2dx游戏源码之《德州扑克》
- Cocos2dx源码分析之JumpBy的实现
- cocos2dx源码阅读之万能的Value
- cocos2dx《单机斗地主》源码解剖之三 发牌
- cocos2dx《单机斗地主》源码解剖之五 叫地主
- cocos2dx源码之 引用计数及自动释放
- cocos2dx 源码分析 之Widget 头文件 (3.11.1)
- 桌面应用程序商店之争
- ASP.NET MVC 音乐商店源码解析
- 安卓助手应用商店全部源码
- cocos2dx CCScrollView 源码分析
- cocos2dx-CCControlButton源码分析
- cocos2dx源码分析:ActionManager
- 既然抓不住,何不送一程!(一篇让数万人开悟的文章)
- 枚举定义的两种方法
- 查询技术
- iOS 判断GPS是否开启
- mysql 解决数据库连接变慢
- cocos2dx之商店源码
- Linux 下的 CONFIG_OF 选项
- Oracle中merge into的使用
- iOS 实时定位功能
- 属性的小问题
- java.lang.IllegalArgumentException:No view found for id for fragment 的解决
- Unity如何在Android上弹出通知消息
- hdu 5335 Walk Out 搜索+贪心
- UserDefault