From e19dd94b6bd19e2deb46539a7e4f88d9973a5b70 Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Wed, 19 Feb 2020 23:08:37 -0500 Subject: [PATCH] still working --- pages/search.lua | 6 ++++-- pages/view.lua | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/pages/search.lua b/pages/search.lua index 14d2f33..dc855b1 100644 --- a/pages/search.lua +++ b/pages/search.lua @@ -93,7 +93,7 @@ local function init(page,workspace) mangaViewer.Visible = false end) workspace.view:Goto() - workspace.view.doChapter(self.chapter) + workspace.view.doChapter(self) end goback.Color = theme.button function setViewer(manga) @@ -137,7 +137,9 @@ local function init(page,workspace) Color = theme.menuitem } for i,v in ipairs(manga.Chapters) do - menu:addItem(v.Lead, 20, 3).chapter = v + local item = menu:addItem(v.Lead, 20, 3) + item.chapter = v + item.manga = manga end end function addManga(manga,v) diff --git a/pages/view.lua b/pages/view.lua index 9949822..4ede8f7 100644 --- a/pages/view.lua +++ b/pages/view.lua @@ -1,10 +1,19 @@ local mangaReader = require("manga") +local chapters +local current local function init(page) local holder local masterI page:OnMouseWheelMoved(function(self,x,y) holder:Move(0,y*60) end) + function getNextChapter() + for i=1,#chapters do + if chapters[i].Link==current.Link then + return chapters[i+1] + end + end + end function buildPages(img,i) masterI = masterI + 1 local temp = holder:newImageLabel(nil,0,(masterI-1)*1210,800,1200) @@ -12,7 +21,7 @@ local function init(page) temp:centerX() return temp end - queuePages = thread:newFunction(function(list) + queuePages = thread:newFunction(function(list,link) local last for i = 1,#list do local img = mangaReader.getImage(list[i]).wait() @@ -22,22 +31,28 @@ local function init(page) if last.loaded then return end if last.y<_GuiPro.height then last.loaded = true - local pages = mangaReader.getPages(list.nextChapter) + current = getNextChapter() + if not current then print("Manga End") end + local pages = mangaReader.getPages(current) queuePages(pages).wait() end end) end) - page.doChapter = thread:newFunction(function(chapter) + page.doChapter = thread:newFunction(function(chap) + local chapter = chap.chapter + chapters = chap.manga.Chapters + current = chapter masterI = 0 if holder then holder:Destroy() else holder = page:newFrame("",15,80,-30,-95,0,0,1,1) end + print(masterI,current,chapters) holder.Visibility = 0 holder.BorderSize = 0 local pages = mangaReader.getPages(chapter) - print(queuePages(pages).wait()) + queuePages(pages,chapter.Link).wait() end) return page end