diff --git a/BGAnimations/ScreenEvaluation common/Shared/RestartHandler.lua b/BGAnimations/ScreenEvaluation common/Shared/RestartHandler.lua new file mode 100644 index 000000000..60ee4ce2f --- /dev/null +++ b/BGAnimations/ScreenEvaluation common/Shared/RestartHandler.lua @@ -0,0 +1,28 @@ +local RestartHandler = function(event) + if not event then return end + + if event.type == "InputEventType_FirstPress" then + if event.DeviceInput.button == "DeviceButton_left ctrl" then + holdingCtrl = true + elseif event.DeviceInput.button == "DeviceButton_r" then + if holdingCtrl then + SM("Replaying Song") + SCREENMAN:GetTopScreen():SetNextScreenName("ScreenGameplay"):StartTransitioningScreen("SM_GoToNextScreen") + end + end + elseif event.type == "InputEventType_Release" then + if event.DeviceInput.button == "DeviceButton_left ctrl" then + holdingCtrl = false + end + end +end + +local t = Def.ActorFrame{ + OnCommand=function(self) + if ThemePrefs.Get("KeyboardFeatures") and PREFSMAN:GetPreference("EventMode") and not GAMESTATE:IsCourseMode() then + SCREENMAN:GetTopScreen():AddInputCallback(RestartHandler) + end + end +} + +return t \ No newline at end of file diff --git a/BGAnimations/ScreenEvaluation common/default.lua b/BGAnimations/ScreenEvaluation common/default.lua index 9875f5571..161b21cbb 100755 --- a/BGAnimations/ScreenEvaluation common/default.lua +++ b/BGAnimations/ScreenEvaluation common/default.lua @@ -48,6 +48,9 @@ end -- code for triggering a screenshot and animating a "screenshot" texture t[#t+1] = LoadActor("./Shared/ScreenshotHandler.lua") +-- code for immediately retrying the song that was just played +t[#t+1] = LoadActor("./Shared/RestartHandler.lua") + -- the title of the song and its graphical banner, if there is one t[#t+1] = LoadActor("./Shared/TitleAndBanner.lua")