Skip to content

Commit

Permalink
move download progress to screensystemoverlay, same as reload
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 25, 2018
1 parent 7990e8c commit 20ef02c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ t[#t+1] = Def.ActorFrame {
end
}

-- song reload
local www = 1366 * 0.8
local hhh = SCREEN_HEIGHT * 0.8
local rtzoom = 1

t[#t+1] = Def.ActorFrame {
DFRStartedMessageCommand=function(self)
self:visible(true)
Expand All @@ -59,13 +62,42 @@ t[#t+1] = Def.ActorFrame {
Def.BitmapText{
Font="Common Normal",
InitCommand=function(self)
self:diffusealpha(0.9):settext(""):maxwidth(www/4-40)
self:diffusealpha(0.9):settext(""):maxwidth(www/4-40/rtzoom):zoom(rtzoom)
end,
DFRUpdateMessageCommand=function(self,params)
self:settext(params.txt)
end,
}
}


local dltzoom = 0.5
-- download queue/progress
t[#t+1] = Def.ActorFrame {
AllDownloadsCompletedMessageCommand=function(self)
self:visible(false)
end,
DLProgressAndQueueUpdateMessageCommand=function(self)
self:visible(true)
end,
BeginCommand=function(self)
self:visible(false)
self:x(www/8 + 10):y(SCREEN_TOP + hhh/8 +10)
end,
Def.Quad {
Name = "BGQframe",
InitCommand=function(self)
self:zoomto(www/4, hhh/4):diffuse(color("0.1,0.1,0.1,0.8"))
end,
},
Def.BitmapText{
Font="Common Normal",
InitCommand=function(self)
self:xy(-www/8 + 10, -hhh/8):diffusealpha(0.9):settext("5 items in queue:\ndoot\nmcscoot"):maxwidth((www/4-40)/dltzoom):halign(0):valign(0):zoom(dltzoom)
end,
DLProgressAndQueueUpdateMessageCommand=function(self,params)
self:settext(params.dlsize.. " items currently downloading\n".. params.dlprogress.."\n\n"..params.queuesize.." items in download queue:\n"..params.queuedpacks)
self:GetParent():GetChild("BGQframe"):zoomy(self:GetHeight() - hhh/4)
end,
},
}
return t
33 changes: 23 additions & 10 deletions src/ScreenInstallOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,29 @@ void ScreenInstallOverlay::Update(float fDeltaTime)
DoInstalls(args);
}
#if !defined(WITHOUT_NETWORKING)
vector<RString> vsMessages;
if (!DLMAN->DownloadQueue.empty()) {
vsMessages.push_back(RString(to_string(DLMAN->DownloadQueue.size())) + " items left in download queue.\nCurrently downloading:");
}
for(auto &dl : DLMAN->downloads)
{
vsMessages.push_back(dl.second->Status());
}
m_textStatus.SetText(join("\n", vsMessages));

if (!DLMAN->downloads.empty()) {
Message msg("DLProgressAndQueueUpdate");

vector<RString> dls;
for (auto &dl : DLMAN->downloads) {
dls.push_back(dl.second->Status());
}
msg.SetParam("dlsize", DLMAN->downloads.size());
msg.SetParam("dlprogress", join("\n", dls));

if (!DLMAN->DownloadQueue.empty()) {
vector<RString> cue;
for (auto &q : DLMAN->DownloadQueue) {
cue.push_back(q->name);
}
msg.SetParam("queuesize", DLMAN->DownloadQueue.size());
msg.SetParam("queuedpacks", join("\n", cue));
}
msg.SetParam("queuesize", 0);
msg.SetParam("queuedpacks", RString(""));
MESSAGEMAN->Broadcast(msg);
} else
MESSAGEMAN->Broadcast("AllDownloadsCompleted"); // silly to handle this through updates but im not sure where is better atm -mina
#endif
}

Expand Down

0 comments on commit 20ef02c

Please sign in to comment.