From 3618d383e8699b4bcebc7e8d2e5ba94b9e471304 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 22 Jul 2018 16:28:06 -0400 Subject: [PATCH] use sys overlay for reload instead of screen (functional, not pretty) --- .../ScreenSystemLayer overlay/default.lua | 141 ++++++------------ Themes/Til Death/BGAnimations/_PlayerInfo.lua | 4 +- Themes/_fallback/metrics.ini | 4 +- src/DownloadManager.cpp | 4 +- src/ScreenNetSelectMusic.cpp | 3 +- src/ScreenReloadSongs.cpp | 6 +- src/ScreenSelectMusic.cpp | 3 +- src/SongManager.cpp | 27 ++-- src/SongManager.h | 3 +- 9 files changed, 69 insertions(+), 126 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua b/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua index f7c5518c82..7000a61549 100644 --- a/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua +++ b/Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua @@ -1,117 +1,68 @@ -local function CreditsText( pn ) - local text = LoadFont(Var "LoadingScreen","credits") .. { - InitCommand=function(self) - self:name("Credits" .. PlayerNumberToString(pn)) - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - UpdateTextCommand=function(self) - local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); - self:settext(str); - end; - UpdateVisibleCommand=function(self) - local screen = SCREENMAN:GetTopScreen(); - local bShow = true; - if screen then - local sClass = screen:GetName(); - bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); - end - - self:visible( bShow ); - end - }; - return text; -end; - ---[[ local function PlayerPane( PlayerNumber ) - local t = Def.ActorFrame { - InitCommand=function(self) - self:name("PlayerPane" .. PlayerNumberToString(PlayerNumber)); - -- ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end - }; - t[#t+1] = Def.ActorFrame { - Name = "Background"; - Def.Quad { - InitCommand=function(self) - self:zoomto(160,28):queuecommand("On") - end; - OnCommand=function(self) - self:diffuse(PlayerColor(PlayerNumber)):fadebottom(1) - end; - }; - }; - t[#t+1] = Def.BitmapText{ - Font="Common Normal"; - Name = "PlayerText"; - InitCommand=function(self) - self:x(-60):maxwidth(80/0.5):zoom(0.5):queuecommand("On") - end; - OnCommand=function(self) - self:playcommand("Set") - end; - SetCommand=function(self) - local profile = PROFILEMAN:GetProfile( PlayerNumber) or PROFILEMAN:GetMachineProfile() - if profile then - self:settext( profile:GetDisplayName() ); - else - self:settext( "NoProf" ); - end - end; - }; - return t -end --]] --- local t = Def.ActorFrame {} - -- Aux -t[#t+1] = LoadActor(THEME:GetPathB("ScreenSystemLayer","aux")); - -- Credits ---[[ -t[#t+1] = Def.ActorFrame { - PlayerPane( PLAYER_1 ) .. { - InitCommand=function(self) - self:x(scale(0.125,0,1,SCREEN_LEFT,SCREEN_WIDTH)):y(SCREEN_BOTTOM-16) - end - }; - CreditsText( PLAYER_1 ); - CreditsText( PLAYER_2 ); -};--]] -- Text t[#t+1] = Def.ActorFrame { Def.Quad { InitCommand=function(self) self:zoomtowidth(SCREEN_WIDTH):zoomtoheight(30):horizalign(left):vertalign(top):y(SCREEN_TOP):diffuse(color("0,0,0,0")) - end; + end, OnCommand=function(self) self:finishtweening():diffusealpha(0.85) - end; + end, OffCommand=function(self) self:sleep(3):linear(0.5):diffusealpha(0) - end; - }; + end + }, Def.BitmapText{ - Font="Common Normal"; - Name="Text"; + Font="Common Normal", + Name="Text", InitCommand=function(self) - self:maxwidth(750):horizalign(left):vertalign(top):y(SCREEN_TOP+10):x(SCREEN_LEFT+10):shadowlength(1):diffusealpha(0) - end; + self:maxwidth(SCREEN_WIDTH*0.8):horizalign(left):vertalign(top):y(SCREEN_TOP+10):x(SCREEN_LEFT+10):diffusealpha(0) + end, OnCommand=function(self) self:finishtweening():diffusealpha(1):zoom(0.5) - end; + end, OffCommand=function(self) self:sleep(3):linear(0.5):diffusealpha(0) - end; - }; + end + }, SystemMessageMessageCommand = function(self, params) - self:GetChild("Text"):settext( params.Message ); - self:playcommand( "On" ); + self:GetChild("Text"):settext( params.Message ) + self:playcommand( "On" ) if params.NoAnimate then - self:finishtweening(); + self:finishtweening() end - self:playcommand( "Off" ); - end; + self:playcommand( "Off" ) + end, HideSystemMessageMessageCommand = function(self) self:finishtweening() - end; -}; + end +} + +t[#t+1] = Def.ActorFrame { + DFRStartedMessageCommand=function(self) + self:visible(true) + end, + DFRFinishedMessageCommand=function(self,params) + self:visible(false) + end, + BeginCommand=function(self) + self:visible(false) + end, + Def.Quad { + InitCommand=function(self) + self:x(SCREEN_WIDTH/2):y(SCREEN_HEIGHT/2):zoomto(SCREEN_WIDTH/2, SCREEN_HEIGHT/2):diffuse(color("0.3,0.3,0.3,1")) + end, + }, + Def.BitmapText{ + Font="Common Normal", + InitCommand=function(self) + self:x(SCREEN_WIDTH/2):y(SCREEN_HEIGHT/2):diffusealpha(1):settext(""):maxwidth(SCREEN_WIDTH/2) + end, + DFRUpdateMessageCommand=function(self,params) + self:settext(params.txt) + end, + } +} + -return t; +return t diff --git a/Themes/Til Death/BGAnimations/_PlayerInfo.lua b/Themes/Til Death/BGAnimations/_PlayerInfo.lua index 41a7b2bf8d..e0d213ddba 100644 --- a/Themes/Til Death/BGAnimations/_PlayerInfo.lua +++ b/Themes/Til Death/BGAnimations/_PlayerInfo.lua @@ -214,9 +214,9 @@ t[#t+1] = Def.ActorFrame{ SetCommand=function(self) self:settextf("Songs Loaded: %i", SONGMAN:GetNumSongs()) end, - DifferentialReloadMessageCommand=function(self) + DFRFinishedMessageCommand=function(self) self:queuecommand("Set") - end + end, }, LoadFont("Common Normal") .. { InitCommand=function(self) diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 95631ef26f..7d18ba4d2e 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -2698,14 +2698,13 @@ Fallback="ScreenOptionsSimpleService" NextScreen=Branch.AfterInit() PrevScreen=Branch.AfterInit() -LineNames="GameType,GraphicSound,KeyConfig,Arcade,InputOptions,SoundGraphics,Profiles,Network,Advanced,Reload" +LineNames="GameType,GraphicSound,KeyConfig,Arcade,InputOptions,SoundGraphics,Profiles,Network,Advanced" LineSync="gamecommand;screen,ScreenGameplaySyncMachine;name,Calibrate Machine Sync" LineGameType="gamecommand;screen,ScreenSelectGame;name,Select Game" LineKeyConfig="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings" LineTestInput="gamecommand;screen,ScreenTestInput;name,Test Input" LineInput="gamecommand;screen,ScreenOptionsInput;name,Input Options" -LineReload="gamecommand;screen,ScreenReloadSongs;name,Reload Songs" LineArcade="gamecommand;screen,ScreenOptionsArcade;name,Arcade Options" LineAppearance="gamecommand;screen,ScreenAppearanceOptions;name,Appearance Options" LineBGFit="gamecommand;screen,ScreenSetBGFit;name,Set BG Fit Mode" @@ -3131,7 +3130,6 @@ TimerOnCommand=visible,false [ScreenReloadSongs] Class="ScreenReloadSongs" Fallback="Screen" -PrevScreen="ScreenSelectMusic" NextScreen=Branch.TitleMenu() [ScreenNetPlayerOptions] diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index 770cf52466..3020e8ab1b 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -476,7 +476,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds) if (screen && screen->GetName() == "ScreenNetSelectMusic") static_cast(screen)->DifferentialReload(); else - SCREENMAN->SetNewScreen("ScreenReloadSongs"); + SONGMAN->DifferentialReload(); } if (downloadingPacks < maxPacksToDownloadAtOnce && !DownloadQueue.empty() && timeSinceLastDownload > DownloadCooldownTime) { auto it = DownloadQueue.begin(); @@ -570,7 +570,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds) if (screen && screen->GetName() == "ScreenNetSelectMusic") static_cast(screen)->DifferentialReload(); else - SCREENMAN->SetNewScreen("ScreenReloadSongs"); + SONGMAN->DifferentialReload(); } return; } diff --git a/src/ScreenNetSelectMusic.cpp b/src/ScreenNetSelectMusic.cpp index 89bd9ac7e9..fdf8ab3fd1 100644 --- a/src/ScreenNetSelectMusic.cpp +++ b/src/ScreenNetSelectMusic.cpp @@ -107,7 +107,8 @@ void ScreenNetSelectMusic::Init() void ScreenNetSelectMusic::DifferentialReload() { - SCREENMAN->SetNewScreen("ScreenReloadSongs"); + SONGMAN->DifferentialReload(); + m_MusicWheel.ReloadSongList(false, ""); } diff --git a/src/ScreenReloadSongs.cpp b/src/ScreenReloadSongs.cpp index 42f7ef400d..579d3349d0 100644 --- a/src/ScreenReloadSongs.cpp +++ b/src/ScreenReloadSongs.cpp @@ -77,11 +77,7 @@ void ScreenReloadSongs::Update( float fDeltaTime ) return; ASSERT( !IsFirstUpdate() ); - - int newsongs = SONGMAN->DifferentialReload(m_pLoadingWindow); - SCREENMAN->SystemMessage(ssprintf("Differential reload of %i songs", newsongs)); - MESSAGEMAN->Broadcast("DifferentialReload"); - SCREENMAN->PostMessageToTopScreen( SM_GoToPrevScreen, 0 ); + SCREENMAN->PostMessageToTopScreen(SM_GoToNextScreen, 0); } /* diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 382d851b58..d96dc68a36 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -417,7 +417,8 @@ void ScreenSelectMusic::Update(float fDeltaTime) void ScreenSelectMusic::DifferentialReload() { - SCREENMAN->SetNewScreen("ScreenReloadSongs"); + SONGMAN->DifferentialReload(); + m_MusicWheel.ReloadSongList(false, ""); } bool ScreenSelectMusic::Input(const InputEventPlus &input) diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 2f036f70b1..2493b9fb86 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -33,6 +33,7 @@ #include "ThemeManager.h" #include "TitleSubstitution.h" #include "arch/LoadingWindow/LoadingWindow.h" +#include "ScreenManager.h" SongManager* SONGMAN = NULL; // global and accessible from anywhere in our program @@ -99,29 +100,23 @@ static LocalizedString SANITY_CHECKING_GROUPS("SongManager", "Sanity checking gr // See InitSongsFromDisk for any comment clarification -mina int SongManager::DifferentialReload() { + MESSAGEMAN->Broadcast("DFRStarted"); FILEMAN->FlushDirCache(SpecialFiles::SONGS_DIR); FILEMAN->FlushDirCache(ADDITIONAL_SONGS_DIR); FILEMAN->FlushDirCache(EDIT_SUBDIR); int newsongs = 0; - newsongs += DifferentialReloadDir(SpecialFiles::SONGS_DIR, NULL); - newsongs += DifferentialReloadDir(ADDITIONAL_SONGS_DIR, NULL); + newsongs += DifferentialReloadDir(SpecialFiles::SONGS_DIR); + newsongs += DifferentialReloadDir(ADDITIONAL_SONGS_DIR); LoadEnabledSongsFromPref(); - return newsongs; -} -int SongManager::DifferentialReload(LoadingWindow *ld) { - FILEMAN->FlushDirCache(SpecialFiles::SONGS_DIR); - FILEMAN->FlushDirCache(ADDITIONAL_SONGS_DIR); - FILEMAN->FlushDirCache(EDIT_SUBDIR); - int newsongs = 0; - newsongs += DifferentialReloadDir(SpecialFiles::SONGS_DIR, ld); - newsongs += DifferentialReloadDir(ADDITIONAL_SONGS_DIR, ld); - LoadEnabledSongsFromPref(); + Message msg("DFRFinished"); + msg.SetParam("newsongs", newsongs); + MESSAGEMAN->Broadcast(msg); return newsongs; } // See LoadStepManiaSongDir for any comment clarification -mina -int SongManager::DifferentialReloadDir(string dir, LoadingWindow *ld) { +int SongManager::DifferentialReloadDir(string dir) { if (dir.substr(dir.size()) != "/") dir += "/"; @@ -184,8 +179,10 @@ int SongManager::DifferentialReloadDir(string dir, LoadingWindow *ld) { index_entry.emplace_back(pNewSong); - if(ld) - ld->SetText("Loading:\n" + sGroupDirName + "\n" + pNewSong->GetMainTitle()); + Message msg("DFRUpdate"); + msg.SetParam("txt","Loading:\n" + sGroupDirName + "\n" + pNewSong->GetMainTitle()); + MESSAGEMAN->Broadcast(msg); + SCREENMAN->Draw(); // not sure if this needs to be handled better (more safely?) or if its fine-mina loaded++; songIndex++; diff --git a/src/SongManager.h b/src/SongManager.h index b6c5ef7b23..3a7ae105e9 100644 --- a/src/SongManager.h +++ b/src/SongManager.h @@ -94,8 +94,7 @@ class SongManager void InitAll( LoadingWindow *ld ); // songs, groups - everything. int DifferentialReload(); - int DifferentialReload(LoadingWindow * ld); - int DifferentialReloadDir(string dir, LoadingWindow *ld); + int DifferentialReloadDir(string dir); void PreloadSongImages(); bool IsGroupNeverCached(const RString& group) const;