Skip to content

Commit

Permalink
Allow toggling the song search behavior between Enter & per letter
Browse files Browse the repository at this point in the history
uhh i mean you either have to press enter to confirm or you just search for every letter you press
  • Loading branch information
poco0317 committed Nov 10, 2019
1 parent 4e0bbc4 commit cdc0abb
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local frameY = 180 + capWideScale(get43size(120), 120)
local active = false
local whee
local lastsearchstring = ""
local instantSearch = themeConfig:get_data().global.InstantSearch

local function searchInput(event)
if event.type ~= "InputEventType_Release" and active == true then
Expand All @@ -15,6 +16,9 @@ local function searchInput(event)
MESSAGEMAN:Broadcast("EndingSearch")
elseif event.button == "Start" then
resetTabIndex(0)
if not instantSearch then
whee:SongSearch(searchstring)
end
MESSAGEMAN:Broadcast("EndingSearch")
MESSAGEMAN:Broadcast("TabChanged")
elseif event.DeviceInput.button == "DeviceButton_space" then -- add space to the string
Expand All @@ -39,7 +43,9 @@ local function searchInput(event)
end
if lastsearchstring ~= searchstring then
MESSAGEMAN:Broadcast("UpdateString")
whee:SongSearch(searchstring)
if instantSearch then
whee:SongSearch(searchstring)
end
lastsearchstring = searchstring
end
end
Expand Down
2 changes: 2 additions & 0 deletions Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ MeasureLines = Measure Lines
ProgressBar = Progress Bar Location
ReceptorSize=Receptor Size
ShowVisualizer=Music Visualizer
InstantSearch=Instant Search
[OptionExplanations]
ReceptorSize = Scale the size of the receptors and notes. This will also indirectly scale your scrolling speed.
Expand Down Expand Up @@ -206,3 +207,4 @@ ReceptorSize=Sets the size of the receptors.
MeasureLines=Toggle whether to display measure lines on the notefield. Please reload metrics afterwards.
ProgressBar = Determines the location of the full progress bar during gameplay.
ShowVisualizer=Toggle whether to display the audio visualizer while on the Song Wheel
InstantSearch=Turn this on to have the Song Wheel update for every letter you put into the song search. If you lag when searching, turn this off.
3 changes: 2 additions & 1 deletion Themes/Til Death/Scripts/01 theme_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ local defaultConfig = {
ScoreBoardNag = false,
MeasureLines = false,
ProgressBar = 1, -- 0 = bottom, 1 = top
ShowVisualizer = true
ShowVisualizer = true,
InstantSearch = true, -- true = search per press, false = search on enter button
},
NPSDisplay = {
DynamicWindow = false,
Expand Down
32 changes: 32 additions & 0 deletions Themes/Til Death/Scripts/02 ThemePrefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,38 @@ function ShowVisualizer()
return t
end

function InstantSearch()
local t = {
Name = "InstantSearch",
LayoutType = "ShowAllInRow",
SelectType = "SelectOne",
OneChoiceForAllPlayers = true,
ExportOnChange = true,
Choices = {THEME:GetString("OptionNames", "Off"), THEME:GetString("OptionNames", "On")},
LoadSelections = function(self, list, pn)
local pref = themeConfig:get_data().global.InstantSearch
if pref then
list[2] = true
else
list[1] = true
end
end,
SaveSelections = function(self, list, pn)
local value
if list[1] then
value = false
else
value = true
end
themeConfig:get_data().global.InstantSearch = value
themeConfig:set_dirty()
themeConfig:save()
end
}
setmetatable(t, t)
return t
end

function ProgressBar()
local keymode = getCurrentKeyMode()
local t = {
Expand Down
3 changes: 2 additions & 1 deletion Themes/Til Death/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ LineInputOptions="gamecommand;screen,ScreenOptionsInputSub;name,InputOptions"
Fallback="ScreenOptionsServiceChild"
NextScreen="ScreenOptionsService"
PrevScreen="ScreenOptionsService"
LineNames="SongBGEnabled,EvalBGType,SongBGMouseEnabled,Particles,RateSort,HelpMenu,NPSWindow,MeasureLines,Visualizer"
LineNames="SongBGEnabled,EvalBGType,SongBGMouseEnabled,Particles,RateSort,HelpMenu,NPSWindow,MeasureLines,Visualizer,InstantSearch"
#LineDefaultScore="lua,DefaultScoreType()"
LineTipType="lua,TipType()"
LineSongBGEnabled="lua,SongBGEnabled()"
Expand All @@ -604,6 +604,7 @@ LineHelpMenu="lua,HelpMenu()"
LineNPSWindow="lua,NPSWindow()"
LineMeasureLines="lua,MeasureLines()"
LineVisualizer="lua,ShowVisualizer()"
LineInstantSearch="lua,InstantSearch()"


[ScreenThemeColorChange]
Expand Down

0 comments on commit cdc0abb

Please sign in to comment.