Skip to content

Commit

Permalink
display more detailed info about score uploads in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Apr 23, 2024
1 parent c960595 commit df05c14
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,12 @@ t[#t+1] = Def.ActorFrame {
ToolTipCommand = function(self)
-- weird check here to throw out nan
if isOver(self) and self.percent ~= nil and self.percent ~= 1 and self.percent == self.percent then
local st = string.format("%s: %5.2f%%", translations["UploadPercent"], self.percent * 100)
local st = string.format(
"%s: %5.2f%% (%d/%d)",
translations["UploadPercent"],
self.percent * 100,
DLMAN:GetQueuedScoreUploadTotal() * self.percent,
DLMAN:GetQueuedScoreUploadTotal())
TOOLTIP:SetText(st)
TOOLTIP:Show()
else
Expand Down
18 changes: 16 additions & 2 deletions Themes/Til Death/BGAnimations/_PlayerInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ t[#t + 1] = Def.ActorFrame {
},
-- ok coulda done this as a separate object to avoid copy paste but w.e
-- upload progress bar bg
Def.Quad {
UIElements.QuadButton(1,1) .. {
InitCommand = function(self)
self:xy(SCREEN_WIDTH * 2/3, AvatarY + 41):zoomto(uploadbarwidth, uploadbarheight)
self:diffuse(color("#111111")):diffusealpha(0):halign(0)
Expand All @@ -510,8 +510,22 @@ t[#t + 1] = Def.ActorFrame {
self:diffusealpha(1)
if params.percent == 1 then
self:diffusealpha(0)
if isOver(self) then
TOOLTIP:Hide()
end
end
end
end,
MouseOverCommand = function(self)
if not self:IsVisible() then return end
local remaining = DLMAN:GetQueuedScoreUploadsRemaining()
local total = DLMAN:GetQueuedScoreUploadTotal()
TOOLTIP:SetText("Remaining Scores: "..remaining.." out of "..total)
TOOLTIP:Show()
end,
MouseOutCommand = function(self)
if not self:IsVisible() then return end
TOOLTIP:Hide()
end,
},
-- fill bar
Def.Quad {
Expand Down
12 changes: 12 additions & 0 deletions src/Etterna/Singletons/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6475,6 +6475,16 @@ class LunaDownloadManager : public Luna<DownloadManager>
p->ForceUploadAllPBs();
return 0;
}
static int GetQueuedScoreUploadsRemaining(T* p, lua_State* L)
{
lua_pushnumber(L, DLMAN->ScoreUploadSequentialQueue.size());
return 1;
}
static int GetQueuedScoreUploadTotal(T* p, lua_State* L)
{
lua_pushnumber(L, DLMAN->sequentialScoreUploadTotalWorkload);
return 1;
}
LunaDownloadManager()
{
ADD_METHOD(GetUserCountryCode);
Expand Down Expand Up @@ -6511,6 +6521,8 @@ class LunaDownloadManager : public Luna<DownloadManager>
ADD_METHOD(UploadScoresForChart);
ADD_METHOD(UploadScoresForPack);
ADD_METHOD(UploadAllScores);
ADD_METHOD(GetQueuedScoreUploadsRemaining);
ADD_METHOD(GetQueuedScoreUploadTotal);
ADD_METHOD(Logout);
}
};
Expand Down

0 comments on commit df05c14

Please sign in to comment.