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