feature/TASK-4-Search-Bar-Rework #3

Merged
Kuenaimaku merged 3 commits from feature/TASK-4-Search-Bar-Rework into master 2022-03-12 23:48:51 +01:00
3 changed files with 41 additions and 12 deletions
Showing only changes of commit 59cf769508 - Show all commits

View File

@ -30,6 +30,7 @@ local filterInfoBgImage = gfx.CreateSkinImage("song_select/filter_info_bg.png",
local sortInfoBgImage = gfx.CreateSkinImage("song_select/sort_info_bg.png", 1) local sortInfoBgImage = gfx.CreateSkinImage("song_select/sort_info_bg.png", 1)
local searchBgImage = gfx.CreateSkinImage("song_select/search_bg.png", 1) local searchBgImage = gfx.CreateSkinImage("song_select/search_bg.png", 1)
local searchActiveImage = gfx.CreateSkinImage("song_select/search_active.png", 1)
local searchInfoPanelImage = gfx.CreateSkinImage("song_select/search_info_panel.png", 1) local searchInfoPanelImage = gfx.CreateSkinImage("song_select/search_info_panel.png", 1)
local defaultJacketImage = gfx.CreateSkinImage("song_select/loading.png", 0) local defaultJacketImage = gfx.CreateSkinImage("song_select/loading.png", 0)
@ -143,7 +144,9 @@ local transitionJacketBgScrollPosX = 0;
--search --search
local searchPreviousActiveState = false; local searchPreviousActiveState = false;
local searchInfoPreviousActiveState = false;
local transitionSearchEnterScale = 0; local transitionSearchEnterScale = 0;
local transitionSearchInfoEnterScale = 0;
local transitionSearchBackgroundAlpha = 0; local transitionSearchBackgroundAlpha = 0;
local transitionSearchbarOffsetY = 0; local transitionSearchbarOffsetY = 0;
local transitionSearchInfoOffsetY = 0; local transitionSearchInfoOffsetY = 0;
@ -678,11 +681,17 @@ function drawSearch()
game.PlaySample('sort_wheel/leave.wav'); game.PlaySample('sort_wheel/leave.wav');
end end
if (songwheel.searchText ~= '' and searchInfoPreviousActiveState == true) then
searchInfoPreviousActiveState = false;
elseif (songwheel.searchText == '' and searchInfoPreviousActiveState == false) then
searchInfoPreviousActiveState = true;
end
if (transitionSearchEnterScale == 0) then if (transitionSearchEnterScale == 0) then
return; return;
end end
-- Draw dark overlay over Songwheel
-- Draw dark overlay over Songwheel
gfx.BeginPath(); gfx.BeginPath();
gfx.FillColor(0, 0, 0, math.floor(transitionSearchBackgroundAlpha * 192)); gfx.FillColor(0, 0, 0, math.floor(transitionSearchBackgroundAlpha * 192));
gfx.Rect(0, 0, 1080, 1920); gfx.Rect(0, 0, 1080, 1920);
@ -690,23 +699,27 @@ function drawSearch()
-- Draw search info panel -- Draw search info panel
gfx.BeginPath(); gfx.BeginPath();
local infoAlpha = 0;
if (songwheel.searchText ~= '') then
infoAlpha = 0;
else
infoAlpha = 1;
end
local infoResize = 0.855; local infoResize = 0.855;
local sw, sh = gfx.ImageSize(searchInfoPanelImage) local sw, sh = gfx.ImageSize(searchInfoPanelImage)
sw = sw * infoResize; sw = sw * infoResize;
sh = sh * infoResize; sh = sh * infoResize;
local infoXPos = 0; local infoXPos = 0;
local infoYStartPos = desh - sh - 550; local infoYStartPos = desh - sh - 772 + 242;
local infoYPos = infoYStartPos + transitionSearchInfoOffsetY; local infoYPos = infoYStartPos + transitionSearchInfoOffsetY;
gfx.ImageRect(infoXPos, infoYPos, sw, sh, searchInfoPanelImage, infoAlpha, 0) gfx.ImageRect(infoXPos, infoYPos, sw, sh, searchInfoPanelImage, transitionSearchBackgroundInfoAlpha, 0)
-- Draw Search is Active text
gfx.BeginPath();
local activeResize = 0.855;
local activew, activeh = gfx.ImageSize(searchActiveImage)
activew = activew * activeResize;
activeh = activeh * activeResize;
local activeXPos = 0;
local activeYStartPos = desh - sh - 722;
local activeYPos = activeYStartPos + transitionSearchInfoOffsetY;
gfx.ImageRect(activeXPos, activeYPos, activew, activeh, searchActiveImage, 1, 0);
-- Draw Searchbox -- Draw Searchbox
gfx.BeginPath(); gfx.BeginPath();
@ -852,6 +865,22 @@ function tickTransitions(deltaTime)
transitionSearchbarOffsetY = Easing.inOutQuad(1 - transitionSearchEnterScale) * 300 transitionSearchbarOffsetY = Easing.inOutQuad(1 - transitionSearchEnterScale) * 300
transitionSearchBackgroundAlpha = Easing.inOutQuad(transitionSearchEnterScale) transitionSearchBackgroundAlpha = Easing.inOutQuad(transitionSearchEnterScale)
if not searchInfoPreviousActiveState then
if transitionSearchInfoEnterScale > 0 then
transitionSearchInfoEnterScale = transitionSearchInfoEnterScale - deltaTime / 0.25 -- transition should last for that time in seconds
else
transitionSearchInfoEnterScale = 0
end
else
if transitionSearchInfoEnterScale < 1 then
transitionSearchInfoEnterScale = transitionSearchInfoEnterScale + deltaTime / 0.25 -- transition should last for that time in seconds
else
transitionSearchInfoEnterScale = 1
end
end
transitionSearchBackgroundInfoAlpha = Easing.inOutQuad(transitionSearchInfoEnterScale)
-- Grade alpha -- Grade alpha
if transitionAfterscrollScale >= 0.03 and transitionAfterscrollScale < 0.033 then if transitionAfterscrollScale >= 0.03 and transitionAfterscrollScale < 0.033 then
transitionAfterscrollGradeAlpha = 0.5; transitionAfterscrollGradeAlpha = 0.5;

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB