still working

This commit is contained in:
Ryan Ward 2020-02-19 23:08:37 -05:00
parent ae9f731c0d
commit e19dd94b6b
2 changed files with 23 additions and 6 deletions

View File

@ -93,7 +93,7 @@ local function init(page,workspace)
mangaViewer.Visible = false mangaViewer.Visible = false
end) end)
workspace.view:Goto() workspace.view:Goto()
workspace.view.doChapter(self.chapter) workspace.view.doChapter(self)
end end
goback.Color = theme.button goback.Color = theme.button
function setViewer(manga) function setViewer(manga)
@ -137,7 +137,9 @@ local function init(page,workspace)
Color = theme.menuitem Color = theme.menuitem
} }
for i,v in ipairs(manga.Chapters) do 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
end end
function addManga(manga,v) function addManga(manga,v)

View File

@ -1,10 +1,19 @@
local mangaReader = require("manga") local mangaReader = require("manga")
local chapters
local current
local function init(page) local function init(page)
local holder local holder
local masterI local masterI
page:OnMouseWheelMoved(function(self,x,y) page:OnMouseWheelMoved(function(self,x,y)
holder:Move(0,y*60) holder:Move(0,y*60)
end) 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) function buildPages(img,i)
masterI = masterI + 1 masterI = masterI + 1
local temp = holder:newImageLabel(nil,0,(masterI-1)*1210,800,1200) local temp = holder:newImageLabel(nil,0,(masterI-1)*1210,800,1200)
@ -12,7 +21,7 @@ local function init(page)
temp:centerX() temp:centerX()
return temp return temp
end end
queuePages = thread:newFunction(function(list) queuePages = thread:newFunction(function(list,link)
local last local last
for i = 1,#list do for i = 1,#list do
local img = mangaReader.getImage(list[i]).wait() local img = mangaReader.getImage(list[i]).wait()
@ -22,22 +31,28 @@ local function init(page)
if last.loaded then return end if last.loaded then return end
if last.y<_GuiPro.height then if last.y<_GuiPro.height then
last.loaded = true 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() queuePages(pages).wait()
end end
end) 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 masterI = 0
if holder then if holder then
holder:Destroy() holder:Destroy()
else else
holder = page:newFrame("",15,80,-30,-95,0,0,1,1) holder = page:newFrame("",15,80,-30,-95,0,0,1,1)
end end
print(masterI,current,chapters)
holder.Visibility = 0 holder.Visibility = 0
holder.BorderSize = 0 holder.BorderSize = 0
local pages = mangaReader.getPages(chapter) local pages = mangaReader.getPages(chapter)
print(queuePages(pages).wait()) queuePages(pages,chapter.Link).wait()
end) end)
return page return page
end end