|
|
@ -27,9 +27,9 @@ function AutoTurn:_schedule(settings_id)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if self.settings_id ~= settings_id then
|
|
|
|
if self.settings_id ~= settings_id then
|
|
|
|
logger.dbg("AutoTurn:_schedule registered settings_id ",
|
|
|
|
logger.dbg("AutoTurn:_schedule registered settings_id",
|
|
|
|
settings_id,
|
|
|
|
settings_id,
|
|
|
|
" does not equal to current one ",
|
|
|
|
"does not equal to current one",
|
|
|
|
self.settings_id)
|
|
|
|
self.settings_id)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -41,10 +41,10 @@ function AutoTurn:_schedule(settings_id)
|
|
|
|
logger.dbg("AutoTurn: go to next page")
|
|
|
|
logger.dbg("AutoTurn: go to next page")
|
|
|
|
self.ui:handleEvent(Event:new("GotoViewRel", self.autoturn_distance))
|
|
|
|
self.ui:handleEvent(Event:new("GotoViewRel", self.autoturn_distance))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
logger.dbg("AutoTurn: schedule at ", os.time() + self.autoturn_sec)
|
|
|
|
logger.dbg("AutoTurn: schedule in", self.autoturn_sec)
|
|
|
|
UIManager:scheduleIn(self.autoturn_sec, function() self:_schedule(settings_id) end)
|
|
|
|
UIManager:scheduleIn(self.autoturn_sec, function() self:_schedule(settings_id) end)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
logger.dbg("AutoTurn: schedule at ", os.time() + delay)
|
|
|
|
logger.dbg("AutoTurn: schedule in", delay)
|
|
|
|
UIManager:scheduleIn(delay, function() self:_schedule(settings_id) end)
|
|
|
|
UIManager:scheduleIn(delay, function() self:_schedule(settings_id) end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -52,14 +52,15 @@ end
|
|
|
|
function AutoTurn:_deprecateLastTask()
|
|
|
|
function AutoTurn:_deprecateLastTask()
|
|
|
|
PluginShare.pause_auto_suspend = false
|
|
|
|
PluginShare.pause_auto_suspend = false
|
|
|
|
self.settings_id = self.settings_id + 1
|
|
|
|
self.settings_id = self.settings_id + 1
|
|
|
|
logger.dbg("AutoTurn: deprecateLastTask ", self.settings_id)
|
|
|
|
logger.dbg("AutoTurn: deprecateLastTask", self.settings_id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function AutoTurn:_start()
|
|
|
|
function AutoTurn:_start()
|
|
|
|
if self:_enabled() then
|
|
|
|
if self:_enabled() then
|
|
|
|
logger.dbg("AutoTurn: start at ", os.time())
|
|
|
|
local now_ts = os.time()
|
|
|
|
|
|
|
|
logger.dbg("AutoTurn: start at", now_ts)
|
|
|
|
PluginShare.pause_auto_suspend = true
|
|
|
|
PluginShare.pause_auto_suspend = true
|
|
|
|
self.last_action_sec = os.time()
|
|
|
|
self.last_action_sec = now_ts
|
|
|
|
self:_schedule(self.settings_id)
|
|
|
|
self:_schedule(self.settings_id)
|
|
|
|
|
|
|
|
|
|
|
|
local text
|
|
|
|
local text
|
|
|
|