Skip to content

Commit cc42c9d

Browse files
finish working draft of bundle downloader in packs tab
1 parent 384d004 commit cc42c9d

File tree

1 file changed

+22
-4
lines changed
  • Themes/Til Death/BGAnimations/ScreenSelectMusic decorations

1 file changed

+22
-4
lines changed

Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/downloads.lua

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ local bundleinfo
716716
local bundlename
717717
local bundleindex
718718

719+
local bundlerating
720+
local bundlesize
719721

720722
local function makedoots(i)
721723
local packinfo
@@ -732,7 +734,21 @@ local function makedoots(i)
732734
selectedbundle = true
733735
bundlename = minidoots[i]
734736
bundleindex = i
737+
738+
packlist = DLMAN:GetCoreBundle(bundlename:lower())
739+
740+
local sumrating = 0
741+
local sumsize = 0
742+
for i=1,#packlist do
743+
sumsize = sumsize + packlist[i]:GetSize()
744+
sumrating = sumrating + packlist[i]:GetAvgDifficulty()
745+
end
746+
747+
bundlerating = sumrating/#packlist
748+
bundlesize = sumsize/1024/1024
749+
735750
MESSAGEMAN:Broadcast("bundletime")
751+
MESSAGEMAN:Broadcast("UpdatePacks")
736752
end
737753
end,
738754
bundletimeMessageCommand=function(self)
@@ -812,7 +828,7 @@ t[#t+1] = LoadFont("Common normal") .. {
812828
self:settext("Core Bundles (Expanded):")
813829
end,
814830
bundletimeMessageCommand=function(self)
815-
self:settext("Total Size:")
831+
self:settextf("Total Size: %d(MB)", bundlesize)
816832
end,
817833
MouseRightClickMessageCommand=function(self)
818834
if update then
@@ -826,7 +842,8 @@ t[#t+1] = LoadFont("Common normal") .. {
826842
self:xy(250+noiamspartacus,bundlegumbley - 36):zoom(0.5):halign(0):valign(0):visible(false)
827843
end,
828844
bundletimeMessageCommand=function(self)
829-
self:settext("Avg: ")
845+
self:settextf("Avg: %5.2f", bundlerating)
846+
self:diffuse(byMSD(bundlerating))
830847
self:visible(true)
831848
end,
832849
MouseRightClickMessageCommand=function(self)
@@ -855,11 +872,12 @@ t[#t+1] = Def.Quad{
855872
InitCommand=function(self)
856873
self:xy(290+noiamspartacus,bundlegumbley - 20):zoomto(80,20):valign(0):diffusealpha(0)
857874
end,
858-
bundletimeMessageCommand=function(self)
859-
end,
860875
MouseLeftClickMessageCommand=function(self)
861876
if update and selectedbundle and isOver(self) then
862877
DLMAN:DownloadCoreBundle(bundlename:lower())
878+
MESSAGEMAN:Broadcast("MouseRightClick")
879+
packlist = DLMAN:GetPackList()
880+
MESSAGEMAN:Broadcast("UpdatePacks")
863881
end
864882
end,
865883
MouseRightClickMessageCommand=function(self)

0 commit comments

Comments
 (0)