+ match the songwheel/filterwheel transitions to be AC-like
This commit is contained in:
parent
d5f9faabf2
commit
bdfa9dfcb0
|
@ -91,6 +91,8 @@ local resx, resy = game.GetResolution()
|
||||||
local desw, desh = 1080, 1920
|
local desw, desh = 1080, 1920
|
||||||
local scale = 1;
|
local scale = 1;
|
||||||
|
|
||||||
|
local isFilterWheelActive = false;
|
||||||
|
|
||||||
local selectionMode = 'folders';
|
local selectionMode = 'folders';
|
||||||
local selectedFolder = 1;
|
local selectedFolder = 1;
|
||||||
local selectedLevel = 1;
|
local selectedLevel = 1;
|
||||||
|
@ -103,6 +105,10 @@ local transitionEnterReverse = false;
|
||||||
local transitionEnterScale = 0;
|
local transitionEnterScale = 0;
|
||||||
local transitionEnterOffsetY = 0;
|
local transitionEnterOffsetY = 0;
|
||||||
|
|
||||||
|
local transitionLeaveScale = 1;
|
||||||
|
local transitionLeaveReappearTimer = 0;
|
||||||
|
local TRANSITION_LEAVE_DURATION = 0.1;
|
||||||
|
|
||||||
function resetLayoutInformation()
|
function resetLayoutInformation()
|
||||||
resx, resy = game.GetResolution()
|
resx, resy = game.GetResolution()
|
||||||
scale = resx / desw
|
scale = resx / desw
|
||||||
|
@ -185,6 +191,8 @@ end
|
||||||
function drawFolder(label, y)
|
function drawFolder(label, y)
|
||||||
if (not label) then return end
|
if (not label) then return end
|
||||||
|
|
||||||
|
gfx.LoadSkinFont('NotoSans-Regular.ttf')
|
||||||
|
|
||||||
local x = desw / 2 + 0
|
local x = desw / 2 + 0
|
||||||
|
|
||||||
local folderData = getFolderData(label)
|
local folderData = getFolderData(label)
|
||||||
|
@ -204,6 +212,8 @@ function drawFolder(label, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawFolderList()
|
function drawFolderList()
|
||||||
|
gfx.GlobalAlpha(1-transitionLeaveScale)
|
||||||
|
|
||||||
local numOfItemsAround = 7;
|
local numOfItemsAround = 7;
|
||||||
local selectedIndex = 1;
|
local selectedIndex = 1;
|
||||||
local folderList = filters.folder;
|
local folderList = filters.folder;
|
||||||
|
@ -236,6 +246,8 @@ function drawFolderList()
|
||||||
desh / 2 - ITEM_HEIGHT / 2 + ITEM_HEIGHT * i + yOffset)
|
desh / 2 - ITEM_HEIGHT / 2 + ITEM_HEIGHT * i + yOffset)
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gfx.GlobalAlpha(1);
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawCursor()
|
function drawCursor()
|
||||||
|
@ -285,24 +297,26 @@ function tickTransitions(deltaTime)
|
||||||
-ITEM_HEIGHT;
|
-ITEM_HEIGHT;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ENTRY TRANSITION
|
-- LEAVE TRANSITION
|
||||||
if transitionEnterReverse then
|
if (not isFilterWheelActive) then
|
||||||
if transitionEnterScale > 0 then
|
if transitionLeaveScale < 1 then
|
||||||
transitionEnterScale = transitionEnterScale - deltaTime / 0.5 -- transition should last for that time in seconds
|
transitionLeaveScale = transitionLeaveScale + deltaTime / TRANSITION_LEAVE_DURATION -- transition should last for that time in seconds
|
||||||
else
|
else
|
||||||
transitionEnterScale = 0
|
transitionLeaveScale = 1
|
||||||
end
|
end
|
||||||
|
transitionLeaveReappearTimer = 1;
|
||||||
else
|
else
|
||||||
if transitionEnterScale < 1 then
|
if (transitionLeaveReappearTimer == 1) then
|
||||||
transitionEnterScale = transitionEnterScale + deltaTime / 0.5 -- transition should last for that time in seconds
|
-- This stuff happens right after filterwheel is deactivated
|
||||||
else
|
end
|
||||||
transitionEnterScale = 1
|
|
||||||
|
transitionLeaveReappearTimer = transitionLeaveReappearTimer - deltaTime / TRANSITION_LEAVE_DURATION + 0.05 -- same reasoning as in the songwheel
|
||||||
|
|
||||||
|
if (transitionLeaveReappearTimer <= 0) then
|
||||||
|
transitionLeaveScale = 0;
|
||||||
|
transitionLeaveReappearTimer = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
transitionEnterOffsetY = -Easing.inOutQuad(1 - transitionEnterScale) *
|
|
||||||
(desh + ITEM_HEIGHT * 2 + 145 +
|
|
||||||
(transitionEnterReverse and -4 or 0));
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawFilterWheel(deltatime)
|
function drawFilterWheel(deltatime)
|
||||||
|
@ -315,20 +329,17 @@ function drawFilterWheel(deltatime)
|
||||||
end
|
end
|
||||||
|
|
||||||
render = function(deltatime, shown)
|
render = function(deltatime, shown)
|
||||||
|
isFilterWheelActive = shown;
|
||||||
|
drawFilterWheel(deltatime)
|
||||||
|
|
||||||
if not shown then
|
if not shown then
|
||||||
game.SetSkinSetting('_songWheelOverlayActive', 0);
|
game.SetSkinSetting('_songWheelOverlayActive', 0);
|
||||||
transitionEnterReverse = true
|
if (transitionEnterScale <= 0) then
|
||||||
|
|
||||||
if (transitionEnterScale > 0) then
|
|
||||||
drawFilterWheel(deltatime)
|
|
||||||
else
|
|
||||||
game.SetSkinSetting('_songWheelDespawnSelectorElements', 0);
|
game.SetSkinSetting('_songWheelDespawnSelectorElements', 0);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
transitionEnterReverse = false
|
|
||||||
game.SetSkinSetting('_songWheelOverlayActive', 1);
|
game.SetSkinSetting('_songWheelOverlayActive', 1);
|
||||||
game.SetSkinSetting('_songWheelDespawnSelectorElements', 1);
|
game.SetSkinSetting('_songWheelDespawnSelectorElements', 1);
|
||||||
drawFilterWheel(deltatime)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
game.SetSkinSetting('_songWheelActiveFolderLabel', getFolderData(filters.folder[selectedFolder]).label);
|
game.SetSkinSetting('_songWheelActiveFolderLabel', getFolderData(filters.folder[selectedFolder]).label);
|
||||||
|
@ -345,9 +356,9 @@ render = function(deltatime, shown)
|
||||||
gfx.FontSize(18)
|
gfx.FontSize(18)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
||||||
gfx.FillColor(255, 255, 255, 255);
|
gfx.FillColor(255, 255, 255, 255);
|
||||||
-- gfx.Text('S_M: ' .. selectionMode .. ' // S_F: ' .. selectedFolder ..
|
gfx.Text('S_M: ' .. selectionMode .. ' // S_F: ' .. selectedFolder ..
|
||||||
-- ' // S_L: ' .. selectedLevel .. ' // T_E_S: ' ..
|
' // S_L: ' .. selectedLevel .. ' // L_TS: ' ..
|
||||||
-- transitionEnterScale, 8, 1870);
|
transitionLeaveScale, 8, 1870);
|
||||||
end
|
end
|
||||||
|
|
||||||
set_selection = function(newIndex, isFolder)
|
set_selection = function(newIndex, isFolder)
|
||||||
|
|
|
@ -131,9 +131,11 @@ local transitionLaserY = 0;
|
||||||
local transitionFlashScale = 0;
|
local transitionFlashScale = 0;
|
||||||
local transitionFlashAlpha = 1;
|
local transitionFlashAlpha = 1;
|
||||||
|
|
||||||
local transitionLeaveReverse = false;
|
local isFilterWheelActive = false;
|
||||||
|
local transitionLeaveReappearTimer = 0;
|
||||||
local transitionLeaveScale = 0;
|
local transitionLeaveScale = 0;
|
||||||
local transitionLeaveOffsetY = 0;
|
local TRANSITION_LEAVE_DURATION = 0.1;
|
||||||
|
local transitionLeaveOffsetY = 0; -- TODO: remove
|
||||||
|
|
||||||
function resetLayoutInformation()
|
function resetLayoutInformation()
|
||||||
resx, resy = game.GetResolution()
|
resx, resy = game.GetResolution()
|
||||||
|
@ -234,28 +236,31 @@ end
|
||||||
function drawBackground(deltaTime)
|
function drawBackground(deltaTime)
|
||||||
Background.draw(deltaTime)
|
Background.draw(deltaTime)
|
||||||
|
|
||||||
-- If the score for song exists
|
|
||||||
local song = songwheel.songs[selectedIndex];
|
local song = songwheel.songs[selectedIndex];
|
||||||
local diff = song and song.difficulties[selectedDifficulty] or false;
|
local diff = song and song.difficulties[selectedDifficulty] or false;
|
||||||
if song and diff then
|
|
||||||
local jacketImage = getJacketImage(song);
|
if (not isFilterWheelActive) then
|
||||||
gfx.BeginPath()
|
-- If the score for song exists
|
||||||
gfx.ImageRect(transitionJacketBgScrollPosX, 0, 900, 900, jacketImage or defaultJacketImage, transitionJacketBgScrollAlpha, 0)
|
if song and diff then
|
||||||
|
local jacketImage = getJacketImage(song);
|
||||||
|
gfx.BeginPath()
|
||||||
|
gfx.ImageRect(transitionJacketBgScrollPosX, 0, 900, 900, jacketImage or defaultJacketImage, transitionJacketBgScrollAlpha, 0)
|
||||||
|
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.FillColor(0,0,0,math.floor(transitionJacketBgScrollAlpha*64));
|
gfx.FillColor(0,0,0,math.floor(transitionJacketBgScrollAlpha*64));
|
||||||
gfx.Rect(0,0,900,900);
|
gfx.Rect(0,0,900,900);
|
||||||
gfx.Fill();
|
gfx.Fill();
|
||||||
gfx.ClosePath();
|
gfx.ClosePath();
|
||||||
gfx.BeginPath();
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(0, 0, desw, desh, dataPanelImage, 1, 0)
|
gfx.ImageRect(0, 0, desw, desh, dataPanelImage, 1, 0)
|
||||||
|
|
||||||
drawLaserAnim()
|
drawLaserAnim()
|
||||||
|
|
||||||
if song and diff then
|
if song and diff and (not isFilterWheelActive) then
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(0, 0, desw, desh, dataGlowOverlayImage, transitionAfterscrollDataOverlayAlpha, 0)
|
gfx.ImageRect(0, 0, desw, desh, dataGlowOverlayImage, transitionAfterscrollDataOverlayAlpha, 0)
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
|
@ -351,6 +356,8 @@ function drawSong(song, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawSongList()
|
function drawSongList()
|
||||||
|
gfx.GlobalAlpha(1-transitionLeaveScale);
|
||||||
|
|
||||||
local numOfSongsAround = 7; -- How many songs should be up and how many should be down of the selected one
|
local numOfSongsAround = 7; -- How many songs should be up and how many should be down of the selected one
|
||||||
|
|
||||||
local yOffset = transitionLeaveOffsetY + transitionScrollOffsetY;
|
local yOffset = transitionLeaveOffsetY + transitionScrollOffsetY;
|
||||||
|
@ -371,10 +378,15 @@ function drawSongList()
|
||||||
drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2+songPlateHeight*i + yOffset)
|
drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2+songPlateHeight*i + yOffset)
|
||||||
i=i+1;
|
i=i+1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
gfx.GlobalAlpha(1);
|
||||||
end
|
end
|
||||||
|
|
||||||
local scoreNumbers = load_number_image("score_num");
|
local scoreNumbers = load_number_image("score_num");
|
||||||
function drawData() -- Draws the song data on the left panel
|
function drawData() -- Draws the song data on the left panel
|
||||||
|
|
||||||
|
if isFilterWheelActive then return false end;
|
||||||
|
|
||||||
local song = songwheel.songs[selectedIndex];
|
local song = songwheel.songs[selectedIndex];
|
||||||
local diff = song and song.difficulties[selectedDifficulty] or false;
|
local diff = song and song.difficulties[selectedDifficulty] or false;
|
||||||
local bestScore = diff and diff.scores[1];
|
local bestScore = diff and diff.scores[1];
|
||||||
|
@ -689,21 +701,26 @@ function tickTransitions(deltaTime)
|
||||||
transitionFlashAlpha = 1+transitionFlashAlpha*0.5
|
transitionFlashAlpha = 1+transitionFlashAlpha*0.5
|
||||||
|
|
||||||
-- Leave transition
|
-- Leave transition
|
||||||
if (transitionLeaveReverse) then
|
if (isFilterWheelActive) then
|
||||||
if transitionLeaveScale > 0 then
|
|
||||||
transitionLeaveScale = transitionLeaveScale - deltaTime / 0.5 -- transition should last for that time in seconds
|
|
||||||
else
|
|
||||||
transitionLeaveScale = 0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if transitionLeaveScale < 1 then
|
if transitionLeaveScale < 1 then
|
||||||
transitionLeaveScale = transitionLeaveScale + deltaTime / 0.5 -- transition should last for that time in seconds
|
transitionLeaveScale = transitionLeaveScale + deltaTime / TRANSITION_LEAVE_DURATION -- transition should last for that time in seconds
|
||||||
else
|
else
|
||||||
transitionLeaveScale = 1
|
transitionLeaveScale = 1
|
||||||
end
|
end
|
||||||
end
|
transitionLeaveReappearTimer = 1;
|
||||||
|
transitionAfterscrollScale = 0; -- Keep songwheel in the "afterscroll" state while the filterwheel is active
|
||||||
|
else
|
||||||
|
if (transitionLeaveReappearTimer == 1) then
|
||||||
|
-- This stuff happens right after filterwheel is deactivated
|
||||||
|
end
|
||||||
|
|
||||||
transitionLeaveOffsetY = Easing.inOutQuad(transitionLeaveScale) * (desh+songPlateHeight*2+145);
|
transitionLeaveReappearTimer = transitionLeaveReappearTimer - deltaTime / TRANSITION_LEAVE_DURATION + 0.05 -- 0.05s is a few frames between the completetion of the fade out and songs reappearing in the AC
|
||||||
|
|
||||||
|
if (transitionLeaveReappearTimer <= 0) then
|
||||||
|
transitionLeaveScale = 0;
|
||||||
|
transitionLeaveReappearTimer = 0;
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -720,24 +737,20 @@ render = function (deltaTime)
|
||||||
|
|
||||||
drawSongList()
|
drawSongList()
|
||||||
|
|
||||||
|
isFilterWheelActive = game.GetSkinSetting('_songWheelOverlayActive') == 1;
|
||||||
|
|
||||||
drawData()
|
drawData()
|
||||||
|
|
||||||
drawFilterInfo(deltaTime)
|
drawFilterInfo(deltaTime)
|
||||||
|
|
||||||
drawSearch();
|
drawSearch();
|
||||||
|
|
||||||
if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then
|
|
||||||
transitionLeaveReverse = true;
|
|
||||||
else
|
|
||||||
transitionLeaveReverse = false;
|
|
||||||
end
|
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.FontSize(18)
|
gfx.FontSize(18)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
||||||
local debugScrollingUp= "FALSE"
|
local debugScrollingUp= "FALSE"
|
||||||
if scrollingUp then debugScrollingUp = "TRUE" end;
|
if scrollingUp then debugScrollingUp = "TRUE" end;
|
||||||
-- gfx.Text('S_I: ' .. selectedIndex .. ' // S_D: ' .. selectedDifficulty .. ' // S_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale, 8, 8);
|
gfx.Text('S_I: ' .. selectedIndex .. ' // S_D: ' .. selectedDifficulty .. ' // S_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale .. ' // L_TS: ' .. transitionLeaveScale, 8, 8);
|
||||||
end
|
end
|
||||||
|
|
||||||
songs_changed = function (withAll)
|
songs_changed = function (withAll)
|
||||||
|
|
Loading…
Reference in New Issue