Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart on song results screen #537

Open
wants to merge 1 commit into
base: itgmania-beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions BGAnimations/ScreenEvaluation common/Shared/RestartHandler.lua
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions BGAnimations/ScreenEvaluation common/default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down