From f265c0151ff7ef2d867d0bfcaea8f2f463e68414 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 30 Nov 2018 22:12:53 -0300 Subject: [PATCH] Force start and rdy buttons --- .../wifeTwirl.lua | 614 ++++++++++-------- Themes/Til Death/Scripts/10 Widgets.lua | 20 +- .../ScreenChatOverlay overlay.lua | 17 +- 3 files changed, 361 insertions(+), 290 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua index a701ad8f0b..9052f591a9 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua @@ -48,7 +48,7 @@ local t = end end if getTabIndex() == 0 then - if heyiwasusingthat and GAMESTATE:GetCurrentSong() and noteField then -- these can prolly be wrapped better too -mina + if heyiwasusingthat and GAMESTATE:GetCurrentSong() and noteField then -- these can prolly be wrapped better too -mina mcbootlarder:visible(true) mcbootlarder:GetChild("NoteField"):visible(true) MESSAGEMAN:Broadcast("ChartPreviewOn") @@ -61,7 +61,7 @@ local t = self:queuecommand("On") update = true else - if GAMESTATE:GetCurrentSong() and noteField and mcbootlarder:IsVisible() then + if GAMESTATE:GetCurrentSong() and noteField and mcbootlarder:IsVisible() then mcbootlarder:visible(false) mcbootlarder:GetChild("NoteField"):visible(false) MESSAGEMAN:Broadcast("ChartPreviewOff") @@ -71,8 +71,8 @@ local t = update = false end end, - MilkyTartsCommand=function(self) -- when entering pack screenselectmusic explicitly turns visibilty on notefield off -mina - if noteField and mcbootlarder:IsVisible() then + MilkyTartsCommand = function(self) -- when entering pack screenselectmusic explicitly turns visibilty on notefield off -mina + if noteField and mcbootlarder:IsVisible() then mcbootlarder:visible(false) MESSAGEMAN:Broadcast("ChartPreviewOff") heyiwasusingthat = true @@ -93,7 +93,8 @@ local t = InitCommand = function(self) self:xy(frameX, frameY - 76):zoomto(8, 144):halign(0):valign(0):diffuse(getMainColor("highlight")):diffusealpha(0.5) end - },Def.Quad { + }, + Def.Quad { InitCommand = function(self) self:xy(frameX, frameY + 18):zoomto(frameWidth + 4, 50):halign(0):valign(0):diffuse(color("#333333A6")) end @@ -102,10 +103,12 @@ local t = -- Music Rate Display t[#t + 1] = - LoadFont("Common Large") .. { + LoadFont("Common Large") .. + { InitCommand = function(self) self:xy(18, SCREEN_BOTTOM - 225):visible(true):halign(0):zoom(0.4):maxwidth( - capWideScale(get43size(360), 360) / capWideScale(get43size(0.45), 0.45)) + capWideScale(get43size(360), 360) / capWideScale(get43size(0.45), 0.45) + ) end, MintyFreshCommand = function(self) self:settext(getCurRateDisplayString()) @@ -121,19 +124,20 @@ t[#t + 1] = } local function toggleNoteField() - if song and not noteField then -- first time setup + if song and not noteField then -- first time setup noteField = true MESSAGEMAN:Broadcast("ChartPreviewOn") -- for banner reaction... lazy -mina mcbootlarder:playcommand("SetupNoteField") - mcbootlarder:xy(prevX,prevY) - mcbootlarder:GetChild("NoteField"):y(prevY*1.5) + mcbootlarder:xy(prevX, prevY) + mcbootlarder:GetChild("NoteField"):y(prevY * 1.5) if usingreverse then - mcbootlarder:GetChild("NoteField"):y(prevY*1.5 + prevrevY) + mcbootlarder:GetChild("NoteField"):y(prevY * 1.5 + prevrevY) end - song:Borp() -- catches a dumb bug that isn't worth explaining -mina - return end + song:Borp() -- catches a dumb bug that isn't worth explaining -mina + return + end - if song then + if song then if mcbootlarder:IsVisible() then mcbootlarder:visible(false) mcbootlarder:GetChild("NoteField"):visible(false) @@ -143,7 +147,7 @@ local function toggleNoteField() mcbootlarder:GetChild("NoteField"):visible(true) if boolthatgetssettotrueonsongchangebutonlyifonatabthatisntthisone then song:Borp() - boolthatgetssettotrueonsongchangebutonlyifonatabthatisntthisone = false + boolthatgetssettotrueonsongchangebutonlyifonatabthatisntthisone = false end MESSAGEMAN:Broadcast("ChartPreviewOn") end @@ -167,189 +171,200 @@ t[#t + 1] = end } -t[#t + 1] = Def.ActorFrame { - Name = "RateDependentStuff", -- msd/display score/bpm/songlength -mina +t[#t + 1] = + Def.ActorFrame { + Name = "RateDependentStuff", -- msd/display score/bpm/songlength -mina MintyFreshCommand = function() score = GetDisplayScore() end, CurrentRateChangedMessageCommand = function(self) - self:queuecommand("MintyFresh") --steps stuff + self:queuecommand("MintyFresh") --steps stuff self:queuecommand("MortyFarts") --songs stuff end, - LoadFont("Common Large") .. { - Name = "MSD", - InitCommand = function(self) - self:xy(frameX + 58, frameY - 62):halign(0.5):zoom(0.6):maxwidth(110 / 0.6) - end, - MintyFreshCommand = function(self) - if song then - if steps:GetStepsType() == "StepsType_Dance_Single" then - local meter = steps:GetMSD(getCurRateValue(), 1) - self:settextf("%05.2f", meter) - self:diffuse(byMSD(meter)) + LoadFont("Common Large") .. + { + Name = "MSD", + InitCommand = function(self) + self:xy(frameX + 58, frameY - 62):halign(0.5):zoom(0.6):maxwidth(110 / 0.6) + end, + MintyFreshCommand = function(self) + if song then + if steps:GetStepsType() == "StepsType_Dance_Single" then + local meter = steps:GetMSD(getCurRateValue(), 1) + self:settextf("%05.2f", meter) + self:diffuse(byMSD(meter)) + else + self:settextf("%5.2f", steps:GetMeter()) -- fallthrough to pre-defined meters for non 4k charts -mina + self:diffuse(byDifficulty(steps:GetDifficulty())) + end else - self:settextf("%5.2f", steps:GetMeter()) -- fallthrough to pre-defined meters for non 4k charts -mina - self:diffuse(byDifficulty(steps:GetDifficulty())) + self:settext("") end - else - self:settext("") end - end - }, + }, -- skillset suff (these 3 can prolly be wrapped) - LoadFont("Common Normal") .. { - InitCommand = function(self) - self:xy(frameX + 120, frameY - 60):halign(0):zoom(0.6, maxwidth, 125) - end, - MintyFreshCommand = function(self) - if song then - self:settext(steps:GetRelevantSkillsetsByMSDRank(getCurRateValue(), 1)) - else - self:settext("") + LoadFont("Common Normal") .. + { + InitCommand = function(self) + self:xy(frameX + 120, frameY - 60):halign(0):zoom(0.6, maxwidth, 125) + end, + MintyFreshCommand = function(self) + if song then + self:settext(steps:GetRelevantSkillsetsByMSDRank(getCurRateValue(), 1)) + else + self:settext("") + end + end, + ChartPreviewOnMessageCommand = function(self) + self:visible(false) + end, + ChartPreviewOffMessageCommand = function(self) + self:visible(true) end - end, - ChartPreviewOnMessageCommand = function(self) - self:visible(false) - end, - ChartPreviewOffMessageCommand = function(self) - self:visible(true) - end - }, - LoadFont("Common Normal") .. { - InitCommand = function(self) - self:xy(frameX + 120, frameY - 30):halign(0):zoom(0.6, maxwidth, 125) - end, - MintyFreshCommand = function(self) - if song then - self:settext(steps:GetRelevantSkillsetsByMSDRank(getCurRateValue(), 2)) - else - self:settext("") + }, + LoadFont("Common Normal") .. + { + InitCommand = function(self) + self:xy(frameX + 120, frameY - 30):halign(0):zoom(0.6, maxwidth, 125) + end, + MintyFreshCommand = function(self) + if song then + self:settext(steps:GetRelevantSkillsetsByMSDRank(getCurRateValue(), 2)) + else + self:settext("") + end + end, + ChartPreviewOnMessageCommand = function(self) + self:visible(false) + end, + ChartPreviewOffMessageCommand = function(self) + self:visible(true) end - end, - ChartPreviewOnMessageCommand = function(self) - self:visible(false) - end, - ChartPreviewOffMessageCommand = function(self) - self:visible(true) - end - }, - LoadFont("Common Normal") .. { - InitCommand = function(self) - self:xy(frameX + 120, frameY):halign(0):zoom(0.6, maxwidth, 125) - end, - MintyFreshCommand = function(self) - if song then - self:settext(steps:GetRelevantSkillsetsByMSDRank(getCurRateValue(), 3)) - else - self:settext("") + }, + LoadFont("Common Normal") .. + { + InitCommand = function(self) + self:xy(frameX + 120, frameY):halign(0):zoom(0.6, maxwidth, 125) + end, + MintyFreshCommand = function(self) + if song then + self:settext(steps:GetRelevantSkillsetsByMSDRank(getCurRateValue(), 3)) + else + self:settext("") + end + end, + ChartPreviewOnMessageCommand = function(self) + self:visible(false) + end, + ChartPreviewOffMessageCommand = function(self) + self:visible(true) end - end, - ChartPreviewOnMessageCommand = function(self) - self:visible(false) - end, - ChartPreviewOffMessageCommand = function(self) - self:visible(true) - end - }, + }, -- **score related stuff** These need to be updated with rate changed commands -- Primary percent score - LoadFont("Common Large") .. { - InitCommand = function(self) - self:xy(frameX + 55, frameY + 50):zoom(0.6):halign(0.5):maxwidth(125):valign(1) - end, - MintyFreshCommand = function(self) - if song and score then - self:settextf("%05.2f%%", notShit.floor(score:GetWifeScore() * 10000) / 100) - self:diffuse(getGradeColor(score:GetWifeGrade())) - else - self:settext("") + LoadFont("Common Large") .. + { + InitCommand = function(self) + self:xy(frameX + 55, frameY + 50):zoom(0.6):halign(0.5):maxwidth(125):valign(1) + end, + MintyFreshCommand = function(self) + if song and score then + self:settextf("%05.2f%%", notShit.floor(score:GetWifeScore() * 10000) / 100) + self:diffuse(getGradeColor(score:GetWifeGrade())) + else + self:settext("") + end end - end, - }, + }, -- Rate for the displayed score - LoadFont("Common Normal") .. { - InitCommand = function(self) - self:xy(frameX + 55, frameY + 58):zoom(0.5):halign(0.5) - end, - MintyFreshCommand = function(self) - if song and score then - local rate = notShit.round(score:GetMusicRate(), 3) - local notCurRate = notShit.round(getCurRateValue(), 3) ~= rate + LoadFont("Common Normal") .. + { + InitCommand = function(self) + self:xy(frameX + 55, frameY + 58):zoom(0.5):halign(0.5) + end, + MintyFreshCommand = function(self) + if song and score then + local rate = notShit.round(score:GetMusicRate(), 3) + local notCurRate = notShit.round(getCurRateValue(), 3) ~= rate local rate = string.format("%.2f", rate) - if rate:sub(#rate, #rate) == "0" then - rate = rate:sub(0, #rate - 1) - end - rate = rate .. "x" + if rate:sub(#rate, #rate) == "0" then + rate = rate:sub(0, #rate - 1) + end + rate = rate .. "x" if notCurRate then - self:settext("(" .. rate .. ")") + self:settext("(" .. rate .. ")") + else + self:settext(rate) + end else - self:settext(rate) + self:settext("") end - else - self:settext("") end - end - }, + }, -- goal for current rate if there is one stuff - LoadFont("Common Normal") .. { - Name = "Goalll", - InitCommand = function(self) - self:xy(frameX + 135, frameY + 33):zoom(0.6):halign(0.5):valign(0) - end, - MintyFreshCommand = function(self) - if song and steps then - local goal = profile:GetEasiestGoalForChartAndRate(steps:GetChartKey(), getCurRateValue()) - if goal then - self:settextf("Target\n%.2f%%", goal:GetPercent() * 100) + LoadFont("Common Normal") .. + { + Name = "Goalll", + InitCommand = function(self) + self:xy(frameX + 135, frameY + 33):zoom(0.6):halign(0.5):valign(0) + end, + MintyFreshCommand = function(self) + if song and steps then + local goal = profile:GetEasiestGoalForChartAndRate(steps:GetChartKey(), getCurRateValue()) + if goal then + self:settextf("Target\n%.2f%%", goal:GetPercent() * 100) + else + self:settext("") + end else self:settext("") end - else - self:settext("") end - end - }, + }, -- Date score achieved on - LoadFont("Common Normal") .. { - InitCommand = function(self) - self:xy(frameX + 185, frameY + 59):zoom(0.4):halign(0) - end, - MintyFreshCommand = function(self) - if song and score then - self:settext(score:GetDate()) - else - self:settext("") + LoadFont("Common Normal") .. + { + InitCommand = function(self) + self:xy(frameX + 185, frameY + 59):zoom(0.4):halign(0) + end, + MintyFreshCommand = function(self) + if song and score then + self:settext(score:GetDate()) + else + self:settext("") + end end - end - }, + }, -- MaxCombo - LoadFont("Common Normal") .. { - InitCommand = function(self) - self:xy(frameX + 185, frameY + 49):zoom(0.4):halign(0) - end, - MintyFreshCommand = function(self) - if song and score then - self:settextf("Max Combo: %d", score:GetMaxCombo()) - else - self:settext("") + LoadFont("Common Normal") .. + { + InitCommand = function(self) + self:xy(frameX + 185, frameY + 49):zoom(0.4):halign(0) + end, + MintyFreshCommand = function(self) + if song and score then + self:settextf("Max Combo: %d", score:GetMaxCombo()) + else + self:settext("") + end end - end - }, - LoadFont("Common Normal") .. { - Name = "ClearType", - InitCommand = function(self) - self:xy(frameX + 185, frameY + 35):zoom(0.6):halign(0) - end, - MintyFreshCommand = function(self) - if song and score then - self:visible(true) - self:settext(getClearTypeFromScore(PLAYER_1, score, 0)) - self:diffuse(getClearTypeFromScore(PLAYER_1, score, 2)) - else - self:visible(false) + }, + LoadFont("Common Normal") .. + { + Name = "ClearType", + InitCommand = function(self) + self:xy(frameX + 185, frameY + 35):zoom(0.6):halign(0) + end, + MintyFreshCommand = function(self) + if song and score then + self:visible(true) + self:settext(getClearTypeFromScore(PLAYER_1, score, 0)) + self:diffuse(getClearTypeFromScore(PLAYER_1, score, 2)) + else + self:visible(false) + end end - end - }, + }, -- **song stuff that scales with rate** Def.BPMDisplay { File = THEME:GetPathF("BPMDisplay", "bpm"), @@ -366,30 +381,32 @@ t[#t + 1] = Def.ActorFrame { end end }, - LoadFont("Common Large") .. { - Name = "PlayableDuration", - InitCommand = function(self) - self:xy((capWideScale(get43size(384), 384)) + 62, SCREEN_BOTTOM - 85):visible(true):halign(1):zoom( - capWideScale(get43size(0.6), 0.6) - ):maxwidth(capWideScale(get43size(360), 360) / capWideScale(get43size(0.45), 0.45)) - end, - MortyFartsCommand = function(self) - if song then - local playabletime = GetPlayableTime() - self:settext(SecondsToMMSS(playabletime)) - self:diffuse(byMusicLength(playabletime)) - else - self:settext("") + LoadFont("Common Large") .. + { + Name = "PlayableDuration", + InitCommand = function(self) + self:xy((capWideScale(get43size(384), 384)) + 62, SCREEN_BOTTOM - 85):visible(true):halign(1):zoom( + capWideScale(get43size(0.6), 0.6) + ):maxwidth(capWideScale(get43size(360), 360) / capWideScale(get43size(0.45), 0.45)) + end, + MortyFartsCommand = function(self) + if song then + local playabletime = GetPlayableTime() + self:settext(SecondsToMMSS(playabletime)) + self:diffuse(byMusicLength(playabletime)) + else + self:settext("") + end end - end - } + } } -- "Radar values", noteinfo that isn't rate dependent -mina local function radarPairs(i) local o = Def.ActorFrame { - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(frameX + 13, frameY - 52 + 13 * i):zoom(0.5):halign(0):maxwidth(120) end, @@ -401,7 +418,8 @@ local function radarPairs(i) end end }, - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(frameX + 105, frameY + -52 + 13 * i):zoom(0.5):halign(1):maxwidth(60) end, @@ -417,7 +435,8 @@ local function radarPairs(i) return o end -local r = Def.ActorFrame{ +local r = + Def.ActorFrame { Name = "RadarValues" } @@ -428,7 +447,8 @@ end -- putting neg bpm warning here i guess r[#r + 1] = - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(frameX, frameY - 120):halign(0):zoom(0.6) end, @@ -445,7 +465,8 @@ t[#t + 1] = r -- song only stuff that doesnt change with rate t[#t + 1] = - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(capWideScale(get43size(384), 384) + 41, SCREEN_BOTTOM - 100):halign(1):zoom(0.50) end, @@ -466,82 +487,117 @@ t[#t + 1] = end, MortyFartsCommand = function(self) self:finishtweening() - if song then - if song:HasCDTitle() then - self:visible(true) - self:Load(song:GetCDTitlePath()) - else - self:visible(false) - end + if song then + if song:HasCDTitle() then + self:visible(true) + self:Load(song:GetCDTitlePath()) else self:visible(false) end - local height = self:GetHeight() - local width = self:GetWidth() + else + self:visible(false) + end + local height = self:GetHeight() + local width = self:GetWidth() - if height >= 60 and width >= 75 then - if height * (75 / 60) >= width then - self:zoom(60 / height) - else - self:zoom(75 / width) - end - elseif height >= 60 then + if height >= 60 and width >= 75 then + if height * (75 / 60) >= width then self:zoom(60 / height) - elseif width >= 75 then - self:zoom(75 / width) else - self:zoom(1) + self:zoom(75 / width) end + elseif height >= 60 then + self:zoom(60 / height) + elseif width >= 75 then + self:zoom(75 / width) + else + self:zoom(1) + end end, - ChartPreviewOnMessageCommand=function(self) - self:addx(capWideScale(34,0)) + ChartPreviewOnMessageCommand = function(self) + self:addx(capWideScale(34, 0)) end, - ChartPreviewOffMessageCommand=function(self) - self:addx(capWideScale(-34,0)) + ChartPreviewOffMessageCommand = function(self) + self:addx(capWideScale(-34, 0)) end } -t[#t + 1] = +t[#t + 1] = Def.Sprite { - Name = "Banner", - InitCommand = function(self) - self:x(10):y(61):halign(0):valign(0) - self:scaletoclipped(capWideScale(get43size(384), 384), capWideScale(get43size(120), 120)):diffusealpha(1) - end, - MintyFreshCommand=function(self) - if INPUTFILTER:IsBeingPressed("tab") then - self:finishtweening():smooth(0.25):diffusealpha(0):sleep(0.2):queuecommand("ModifyBanner") - else - self:finishtweening():queuecommand("ModifyBanner") + Name = "Banner", + InitCommand = function(self) + self:x(10):y(61):halign(0):valign(0) + self:scaletoclipped(capWideScale(get43size(384), 384), capWideScale(get43size(120), 120)):diffusealpha(1) + end, + MintyFreshCommand = function(self) + if INPUTFILTER:IsBeingPressed("tab") then + self:finishtweening():smooth(0.25):diffusealpha(0):sleep(0.2):queuecommand("ModifyBanner") + else + self:finishtweening():queuecommand("ModifyBanner") + end + end, + ModifyBannerCommand = function(self) + self:finishtweening() + if song then + local bnpath = GAMESTATE:GetCurrentSong():GetBannerPath() + if not bnpath then + bnpath = THEME:GetPathG("Common", "fallback banner") end - end, - ModifyBannerCommand = function(self) - self:finishtweening() - if song then - local bnpath = GAMESTATE:GetCurrentSong():GetBannerPath() - if not bnpath then - bnpath = THEME:GetPathG("Common", "fallback banner") - end - self:LoadBackground(bnpath) - else - local bnpath = SONGMAN:GetSongGroupBannerPath(SCREENMAN:GetTopScreen():GetMusicWheel():GetSelectedSection()) - if not bnpath or bnpath == "" then - bnpath = THEME:GetPathG("Common", "fallback banner") - end - self:LoadBackground(bnpath) + self:LoadBackground(bnpath) + else + local bnpath = SONGMAN:GetSongGroupBannerPath(SCREENMAN:GetTopScreen():GetMusicWheel():GetSelectedSection()) + if not bnpath or bnpath == "" then + bnpath = THEME:GetPathG("Common", "fallback banner") end - self:scaletoclipped(capWideScale(get43size(384), 384), capWideScale(get43size(120), 120)):diffusealpha(1) - end, - ChartPreviewOnMessageCommand = function(self) - self:visible(false) - end, - ChartPreviewOffMessageCommand = function(self) - self:visible(true) + self:LoadBackground(bnpath) end + self:scaletoclipped(capWideScale(get43size(384), 384), capWideScale(get43size(120), 120)):diffusealpha(1) + end, + ChartPreviewOnMessageCommand = function(self) + self:visible(false) + end, + ChartPreviewOffMessageCommand = function(self) + self:visible(true) + end } +local enabledC = "#099948" +local disabledC = "#ff6666" +local force = false +local ready = false +function toggleButton(textEnabled, textDisabled, msg, x) + local enabled = false + return Widg.Button { + text = textDisabled, + width = 50, + height = 25, + border = false, + bgColor = color(disabledC), + highlight = {color = getMainColor("highlight")}, + x = 10 - 100 + capWideScale(get43size(384), 384) + x, + y = 61 + capWideScale(get43size(120), 120), + onClick = function(self) + enabled = not enabled + local a = self.bg.actor + self:diffuse(color(enabled and enabledC or disabledC)) + self:settext(enabled and textEnabled or textDisabled) + NSMAN:SendChatMsg(msg, 1, NSMAN:GetCurrentRoomName()) + end + } +end +local forceStart = toggleButton("Unforce Start", "Force Start", "/force", 0) +local ready = toggleButton("Unready", "Ready", "/ready", 50) +t[#t + 1] = forceStart +t[#t + 1] = ready t[#t + 1] = Def.Quad { + -- Little hack to only show forceStart and ready in netselect + BeginCommand = function() + if SCREENMAN:GetTopScreen():GetName() ~= "ScreenNetSelectMusic" then + ready:Disable() + forceStart:Disable() + end + end, InitCommand = function(self) self:xy(frameX + 135, frameY + 45):zoomto(50, 40):diffusealpha(0) end, @@ -602,10 +658,10 @@ t[#t + 1] = -- end -- } - -- tags? t[#t + 1] = - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(frameX + 300, frameY - 60):halign(0):zoom(0.6):maxwidth(450) end, @@ -619,7 +675,8 @@ t[#t + 1] = } t[#t + 1] = - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(frameX + 300, frameY - 30):halign(0):zoom(0.6):maxwidth(450) end, @@ -633,7 +690,8 @@ t[#t + 1] = } t[#t + 1] = - LoadFont("Common Normal") .. { + LoadFont("Common Normal") .. + { InitCommand = function(self) self:xy(frameX + 300, frameY):halign(0):zoom(0.6):maxwidth(450) end, @@ -651,38 +709,40 @@ local yesiwantnotefield = false local oldstyle local function ihatestickinginputcallbackseverywhere(event) if event.type ~= "InputEventType_Release" and getTabIndex() == 0 then - if event.DeviceInput.button == "DeviceButton_space" then - toggleNoteField() - end - end + if event.DeviceInput.button == "DeviceButton_space" then + toggleNoteField() + end + end return false end -t[#t + 1] = LoadFont("Common Normal") .. { - Name = "PreviewViewer", - BeginCommand = function(self) - mcbootlarder = self:GetParent():GetChild("ChartPreview") - SCREENMAN:GetTopScreen():AddInputCallback(MPinput) - SCREENMAN:GetTopScreen():AddInputCallback(ihatestickinginputcallbackseverywhere) - self:xy(20, 235) - self:zoom(0.5) - self:halign(0) - self:settext("Toggle Preview") - end, - MouseLeftClickMessageCommand = function(self) - if isOver(self) and (song or noteField) then - toggleNoteField() - end - end, - CurrentStyleChangedMessageCommand=function(self) -- need to regenerate the notefield when changing styles or crashman appears -mina - if noteField and oldstyle ~= GAMESTATE:GetCurrentStyle() then - SCREENMAN:GetTopScreen():DeletePreviewNoteField(mcbootlarder) - noteField = false - toggleNoteField() +t[#t + 1] = + LoadFont("Common Normal") .. + { + Name = "PreviewViewer", + BeginCommand = function(self) + mcbootlarder = self:GetParent():GetChild("ChartPreview") + SCREENMAN:GetTopScreen():AddInputCallback(MPinput) + SCREENMAN:GetTopScreen():AddInputCallback(ihatestickinginputcallbackseverywhere) + self:xy(20, 235) + self:zoom(0.5) + self:halign(0) + self:settext("Toggle Preview") + end, + MouseLeftClickMessageCommand = function(self) + if isOver(self) and (song or noteField) then + toggleNoteField() + end + end, + CurrentStyleChangedMessageCommand = function(self) -- need to regenerate the notefield when changing styles or crashman appears -mina + if noteField and oldstyle ~= GAMESTATE:GetCurrentStyle() then + SCREENMAN:GetTopScreen():DeletePreviewNoteField(mcbootlarder) + noteField = false + toggleNoteField() + end + oldstyle = GAMESTATE:GetCurrentStyle() end - oldstyle = GAMESTATE:GetCurrentStyle() - end -} + } - t[#t + 1] = LoadActor("../_chartpreview.lua") -return t \ No newline at end of file +t[#t + 1] = LoadActor("../_chartpreview.lua") +return t diff --git a/Themes/Til Death/Scripts/10 Widgets.lua b/Themes/Til Death/Scripts/10 Widgets.lua index 09281a431b..121c44ab2c 100644 --- a/Themes/Til Death/Scripts/10 Widgets.lua +++ b/Themes/Til Death/Scripts/10 Widgets.lua @@ -96,6 +96,9 @@ Widg.Label = function(params) initText = text end end + label.GetText = function(label, text) + return label.actor and label.actor:GetText() or initText + end return label end @@ -335,7 +338,9 @@ Widg.Button = function(params) button = Widg.Container { onInit = function(self) - params.onInit(self) + if params.onInit then + params.onInit(self) + end if params.highlight then self:SetUpdateFunction(highlight) end @@ -440,15 +445,22 @@ Widg.Button = function(params) } button.settext = function(button, text) - button.label:settext(text) + return (button.label):settext(text) + end + button.GetText = function(button) + return (button.label):GetText() + end + button.diffuse = function(button, color) + params.bgColor = color + return (button.bg.actor):diffuse(color) end button.Enable = function(button) button.enabled = true - (button.actor):visible(button.enabled) + return (button.actor):visible(button.enabled) end button.Disable = function(button) button.enabled = false - (button.actor):visible(button.enabled) + return (button.actor):visible(button.enabled) end button:add(button.bg) diff --git a/Themes/_fallback/BGAnimations/ScreenChatOverlay overlay.lua b/Themes/_fallback/BGAnimations/ScreenChatOverlay overlay.lua index dd3404669e..c07d667b7e 100644 --- a/Themes/_fallback/BGAnimations/ScreenChatOverlay overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenChatOverlay overlay.lua @@ -91,8 +91,8 @@ chat.ScreenChangedMessageCommand = function(self) show = true end if currentScreen == "ScreenNetSelectMusic" then - for i=1, #tabs do - if tabs[i][2] == NSMAN:GetCurrentRoomName() then + for i = 1, #tabs do + if tabs[i] and tabs[i][2] == NSMAN:GetCurrentRoomName() then changeTab(tabs[i][2], tabs[i][1]) end end @@ -353,7 +353,6 @@ function overTab(mx, my) return nil, nil end - function MPinput(event) if (not show or not online) or isGameplay then return false @@ -365,7 +364,7 @@ function MPinput(event) end typing = false local mx, my = INPUTFILTER:GetMouseX(), INPUTFILTER:GetMouseY() - if isOver(minbar) then --hard mouse toggle -mina + if isOver(minbar) then --hard mouse toggle -mina minimised = not minimised MESSAGEMAN:Broadcast("Minimise") update = true @@ -408,7 +407,7 @@ function MPinput(event) end -- hard kb toggle - if event.type == "InputEventType_Release" and event.DeviceInput.button == "DeviceButton_insert" then + if event.type == "InputEventType_Release" and event.DeviceInput.button == "DeviceButton_insert" then minimised = not minimised MESSAGEMAN:Broadcast("Minimise") update = true @@ -418,7 +417,7 @@ function MPinput(event) end end - if not typing and event.type == "InputEventType_Release" then -- keys for auto turning on chat if not already on -mina + if not typing and event.type == "InputEventType_Release" then -- keys for auto turning on chat if not already on -mina if event.DeviceInput.button == "DeviceButton_/" then typing = true update = true @@ -437,7 +436,7 @@ function MPinput(event) NSMAN:SendChatMsg(typingText, currentTabType, currentTabName) typingText = "" elseif typingText == "" then - typing = false -- pressing enter when text is empty to deactive chat is expected behavior -mina + typing = false -- pressing enter when text is empty to deactive chat is expected behavior -mina end update = true end @@ -448,7 +447,7 @@ function MPinput(event) elseif event.DeviceInput.button == "DeviceButton_space" then typingText = typingText .. " " update = true - elseif event.DeviceInput.button == "DeviceButton_delete" then -- reset msg with delete (since there's no cursor) + elseif event.DeviceInput.button == "DeviceButton_delete" then -- reset msg with delete (since there's no cursor) typingText = "" update = true elseif @@ -501,7 +500,7 @@ function MPinput(event) end if update then - if minimised then -- minimise will be set in the above blocks, disable input and clear text -mina + if minimised then -- minimise will be set in the above blocks, disable input and clear text -mina typing = false typingText = "" end