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
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)

View File

@ -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