diff --git a/Themes/Rebirth/BGAnimations/ScreenSelectMusic decorations/generalPages/profile.lua b/Themes/Rebirth/BGAnimations/ScreenSelectMusic decorations/generalPages/profile.lua index 00765f1980..8b54d51540 100644 --- a/Themes/Rebirth/BGAnimations/ScreenSelectMusic decorations/generalPages/profile.lua +++ b/Themes/Rebirth/BGAnimations/ScreenSelectMusic decorations/generalPages/profile.lua @@ -571,48 +571,6 @@ local function createList() local profile = GetPlayerOrMachineProfile(PLAYER_1) local pname = profile:GetDisplayName() - -- convenience to control the rename profile dialogue logic and input redir scope - local function renameProfileDialogue(profile) - local redir = SCREENMAN:get_input_redirected(PLAYER_1) - local function off() - if redir then - SCREENMAN:set_input_redirected(PLAYER_1, false) - end - end - local function on() - if redir then - SCREENMAN:set_input_redirected(PLAYER_1, true) - end - end - off() - - local function f(answer) - profile:RenameProfile(answer) - MESSAGEMAN:Broadcast("ProfileRenamed") - on() - end - local question = "RENAME PROFILE\nPlease enter a new profile name." - askForInputStringWithFunction( - question, - 255, - false, - f, - function(answer) - local result = answer ~= nil and answer:gsub("^%s*(.-)%s*$", "%1") ~= "" and not answer:match("::") and answer:gsub("^%s*(.-)%s*$", "%1"):sub(-1) ~= ":" - if not result then - SCREENMAN:GetTopScreen():GetChild("Question"):settext(question .. "\nDo not leave this space blank. Do not use ':'\nTo exit, press Esc.") - end - return result, "Response invalid." - end, - function() - -- upon exit, do nothing - -- profile name is unchanged - MESSAGEMAN:Broadcast("ProfileRenamed") - on() - end - ) - end - -- list of skillsets mapped to number of plays -- sorted immediately after being emplaced here local playsbyskillset = SCOREMAN:GetPlaycountPerSkillset(profile) diff --git a/Themes/Rebirth/BGAnimations/ScreenTitleMenu overlay/profileSelect.lua b/Themes/Rebirth/BGAnimations/ScreenTitleMenu overlay/profileSelect.lua index 3beb376bcc..81615be948 100644 --- a/Themes/Rebirth/BGAnimations/ScreenTitleMenu overlay/profileSelect.lua +++ b/Themes/Rebirth/BGAnimations/ScreenTitleMenu overlay/profileSelect.lua @@ -118,50 +118,6 @@ local function deleteProfileDialogue(id) ) end --- convenience to control the rename profile dialogue logic and input redir scope --- difference between this function and the other RenameProfile dialogue way down below is this can be repeated --- the one way down below cannot be repeated in all contexts because input redir may or may not be on in some situations -local function renameProfileDialogue(profile, listframe) - local redir = SCREENMAN:get_input_redirected(PLAYER_1) - local function off() - if redir then - SCREENMAN:set_input_redirected(PLAYER_1, false) - end - end - local function on() - if redir then - SCREENMAN:set_input_redirected(PLAYER_1, true) - end - end - off() - - local function f(answer) - profile:RenameProfile(answer) - listframe:playcommand("UpdateProfiles") - on() - end - local question = "RENAME PROFILE\nPlease enter a new profile name." - askForInputStringWithFunction( - question, - 64, - false, - f, - function(answer) - local result = answer ~= nil and answer:gsub("^%s*(.-)%s*$", "%1") ~= "" and not answer:match("::") and answer:gsub("^%s*(.-)%s*$", "%1"):sub(-1) ~= ":" - if not result then - SCREENMAN:GetTopScreen():GetChild("Question"):settext(question .. "\nDo not leave this space blank. Do not use ':'\nTo exit, press Esc.") - end - return result, "Response invalid." - end, - function() - -- upon exit, do nothing - -- profile name is unchanged - listframe:playcommand("UpdateProfiles") - on() - end - ) -end - local function generateItems() -- add 1 to number of profiles so we can have a button to add profiles always as the last item local maxPage = math.ceil((#profileIDs) / numItems) @@ -248,7 +204,7 @@ local function generateItems() BeginCommand = function(self) self:playcommand("Set") end, - UpdateProfilesCommand = function(self) + ProfileRenamedMessageCommand = function(self) self:playcommand("Set") end, MovedPageMessageCommand = function(self) @@ -530,7 +486,7 @@ local function generateItems() local profile = PROFILEMAN:GetLocalProfile(profileIDs[1]) local function f(answer) profile:RenameProfile(answer) - self:playcommand("UpdateProfiles") + self:playcommand("ProfileRenamed") end local question = "No Profiles detected! A new one was made for you.\nPlease enter a new profile name." askForInputStringWithFunction( diff --git a/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua b/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua index 0871b0be9e..a68f103719 100644 --- a/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua +++ b/Themes/Rebirth/BGAnimations/playerInfoFrame/main.lua @@ -257,49 +257,6 @@ local function loginStep2() ) end --- convenience to control the rename profile dialogue logic and input redir scope -local function renameProfileDialogue(profile) - local redir = SCREENMAN:get_input_redirected(PLAYER_1) - local function off() - if redir then - SCREENMAN:set_input_redirected(PLAYER_1, false) - end - end - local function on() - if redir then - SCREENMAN:set_input_redirected(PLAYER_1, true) - end - end - off() - - local function f(answer) - profile:RenameProfile(answer) - MESSAGEMAN:Broadcast("ProfileRenamed") - on() - end - local question = "RENAME PROFILE\nPlease enter a new profile name." - askForInputStringWithFunction( - question, - 255, - false, - f, - function(answer) - local result = answer ~= nil and answer:gsub("^%s*(.-)%s*$", "%1") ~= "" and not answer:match("::") and answer:gsub("^%s*(.-)%s*$", "%1"):sub(-1) ~= ":" - if not result then - SCREENMAN:GetTopScreen():GetChild("Question"):settext(question .. "\nDo not leave this space blank. Do not use ':'\nTo exit, press Esc.") - end - return result, "Response invalid." - end, - function() - -- upon exit, do nothing - -- profile name is unchanged - MESSAGEMAN:Broadcast("ProfileRenamed") - on() - end - ) -end - - t[#t+1] = Def.Quad { Name = "BG", diff --git a/Themes/Rebirth/Scripts/98 util.lua b/Themes/Rebirth/Scripts/98 util.lua index a35eeb3732..4194f490aa 100644 --- a/Themes/Rebirth/Scripts/98 util.lua +++ b/Themes/Rebirth/Scripts/98 util.lua @@ -407,3 +407,45 @@ function updateNowPlaying() File.Write("nowplaying.txt", fout) end + +-- convenience to control the rename profile dialogue logic and input redir scope +function renameProfileDialogue(profile) + local redir = SCREENMAN:get_input_redirected(PLAYER_1) + local function off() + if redir then + SCREENMAN:set_input_redirected(PLAYER_1, false) + end + end + local function on() + if redir then + SCREENMAN:set_input_redirected(PLAYER_1, true) + end + end + off() + + local function f(answer) + profile:RenameProfile(answer) + MESSAGEMAN:Broadcast("ProfileRenamed") + on() + end + local question = "RENAME PROFILE\nPlease enter a new profile name." + askForInputStringWithFunction( + question, + 255, + false, + f, + function(answer) + local result = answer ~= nil and answer:gsub("^%s*(.-)%s*$", "%1") ~= "" and not answer:match("::") and answer:gsub("^%s*(.-)%s*$", "%1"):sub(-1) ~= ":" + if not result then + SCREENMAN:GetTopScreen():GetChild("Question"):settext(question .. "\nDo not leave this space blank. Do not use ':'\nTo exit, press Esc.") + end + return result, "Response invalid." + end, + function() + -- upon exit, do nothing + -- profile name is unchanged + MESSAGEMAN:Broadcast("ProfileRenamed") + on() + end + ) +end \ No newline at end of file