00003 不思议迷宫.0009.6:一键翻开石板捡取物品

本文介绍了如何在不思议迷宫游戏中实现一键自动翻开石板并捡取物品的代码逻辑,包括核心的lua脚本和辅助函数,详细解析了代码中的关键部分,并探讨了不同版本可能导致的问题。
摘要由CSDN通过智能技术生成

00003 不思议迷宫.0009.6:一键翻开石板捡取物品

         先上主要代码:

         local function onMyButton_AutoPickUpAllItems(sender, eventType)

                  if eventType ~= ccui.TouchEventType.ended then return; end

 

                  local function pickAllItems()

                          for i=1,#self.grids do

                                   local g = self.grids[i];

                                   if tiewen_canPickUpItem(g) and g.pickItemClick ~= nil then

                                            g.pickItemClick(nil, ccui.TouchEventType.began);

                                   end

                          end

                  end

 

                  local o = {};

                  o.timer = cc.Director:getInstance():getScheduler():scheduleScriptFunc(function ()

                           if self.cacheOpenGrids and #self.cacheOpenGrids > 0 then return; end

                          local g = tiewen_findGridCanBeOpenedButNotMonster(self.grids);

                          if g == nil then

                                   cc.Director:getInstance():getScheduler():unscheduleScriptEntry(o.timer);

                                   pickAllItems();

                          else

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值