-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b12858
commit ab1dde3
Showing
2 changed files
with
207 additions
and
153 deletions.
There are no files selected for viewing
262 changes: 206 additions & 56 deletions
262
Themes/Til Death/BGAnimations/ScreenSelectMusic StepsDisplayList.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,217 @@ | ||
return Def.StepsDisplayList { | ||
Name = "StepsDisplayList", | ||
CursorP1 = Def.ActorFrame { | ||
local itsOn = false | ||
local stepsdisplayx = SCREEN_WIDTH * 0.56 - capWideScale(48, 56) | ||
local thesteps | ||
|
||
local rowspacingy = 10 | ||
local rowwidth = 60 | ||
local rowheight = 20 | ||
local cursorwidth = 6 | ||
local cursorheight = 20 | ||
|
||
local numshown = 7 | ||
local currentidx = 1 | ||
local displayindexoffset = 0 | ||
|
||
local sd = | ||
Def.ActorFrame { | ||
Name = "StepsDisplay", | ||
InitCommand = function(self) | ||
self:xy(stepsdisplayx, 70):valign(0) | ||
end, | ||
OffCommand = function(self) | ||
self:visible(false) | ||
end, | ||
OnCommand = function(self) | ||
self:visible(true) | ||
end, | ||
TabChangedMessageCommand = function(self, params) | ||
self:finishtweening() | ||
if getTabIndex() < 3 and GAMESTATE:GetCurrentSong() then | ||
-- dont display this if the score nested tab is already online | ||
-- prevents repeat 3 presses to break the display | ||
-- (let page 2 handle this specifically) | ||
if params.to == 2 then | ||
return | ||
end | ||
self:playcommand("On") | ||
else | ||
self:playcommand("Off") | ||
end | ||
end, | ||
CurrentSongChangedMessageCommand = function(self, song) | ||
local song = song.ptr | ||
if song and getTabIndex() < 3 then | ||
thesteps = song:GetChartsOfCurrentGameMode() | ||
self:playcommand("On") | ||
self:queuecommand("UpdateStepsRows") | ||
elseif not song then | ||
self:playcommand("Off") | ||
end | ||
end, | ||
DelayedChartUpdateMessageCommand = function(self) | ||
local leaderboardEnabled = | ||
playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).leaderboardEnabled and DLMAN:IsLoggedIn() | ||
if leaderboardEnabled and GAMESTATE:GetCurrentSteps(PLAYER_1) then | ||
local chartkey = GAMESTATE:GetCurrentSteps(PLAYER_1):GetChartKey() | ||
if SCREENMAN:GetTopScreen():GetMusicWheel():IsSettled() then | ||
DLMAN:RequestChartLeaderBoardFromOnline( | ||
chartkey, | ||
function(leaderboard) | ||
end | ||
) | ||
end | ||
end | ||
end, | ||
ChartPreviewOnMessageCommand = function(self) | ||
if not itsOn then | ||
self:addx(capWideScale(12, 0)):addy(capWideScale(18, 0)) | ||
itsOn = true | ||
end | ||
end, | ||
ChartPreviewOffMessageCommand = function(self) | ||
if itsOn then | ||
self:addx(capWideScale(-12, 0)):addy(capWideScale(-18, 0)) | ||
itsOn = false | ||
end | ||
end, | ||
CalcInfoOnMessageCommand = function(self) | ||
self:x(20) | ||
end, | ||
CalcInfoOffMessageCommand = function(self) | ||
self:x(stepsdisplayx) | ||
end | ||
} | ||
|
||
|
||
|
||
local function stepsRows(i) | ||
local o = Def.ActorFrame { | ||
InitCommand = function(self) | ||
self:x(-128 + 16):player(PLAYER_1) | ||
self:y(rowheight * (i - 1)) | ||
end, | ||
PlayerJoinedMessageCommand = function(self, params) | ||
if params.Player == PLAYER_1 then | ||
self:visible(true) | ||
self:bounceend(0.3):zoom(1) | ||
Def.Quad { | ||
InitCommand = function(self) | ||
self:zoomto(rowwidth, rowheight):halign(0) | ||
end, | ||
UpdateStepsRowsCommand = function(self) | ||
local steps = thesteps[i + displayindexoffset] | ||
if steps then | ||
self:visible(true) | ||
local diff = steps:GetDifficulty() | ||
self:diffuse(Saturation(byDifficulty(diff), 2.25)) | ||
else | ||
self:visible(false) | ||
end | ||
end, | ||
MouseLeftClickMessageCommand = function(self) | ||
local steps = thesteps[i + displayindexoffset] | ||
if steps and isOver(self) then | ||
GAMESTATE:SetCurrentSteps(PLAYER_1, steps) | ||
end | ||
end | ||
end, | ||
PlayerUnjoinedMessageCommand = function(self, params) | ||
if params.Player == PLAYER_1 then | ||
self:visible(true) | ||
self:bounceend(0.3):zoom(0) | ||
}, | ||
Def.Quad { | ||
InitCommand = function(self) | ||
self:zoomto(24, rowheight):halign(0) | ||
end, | ||
UpdateStepsRowsCommand = function(self) | ||
local steps = thesteps[i + displayindexoffset] | ||
if steps then | ||
self:visible(true) | ||
local diff = steps:GetDifficulty() | ||
self:diffuse(byDifficulty(diff)) | ||
else | ||
self:visible(false) | ||
end | ||
end | ||
end, | ||
LoadFont("Common Normal") .. | ||
{ | ||
Text = "P1", | ||
InitCommand = function(self) | ||
self:x(-4):diffuse(PlayerColor(PLAYER_1)):shadowlength(1) | ||
end, | ||
OnCommand = function(self) | ||
self:zoom(0.75) | ||
}, | ||
-- Chart defined "Meter" value, not msd (useful to have this for reference) | ||
LoadFont("Common Large") .. { | ||
InitCommand = function(self) | ||
self:x(rowwidth - cursorwidth - 5):addy(-1):zoom(0.4):settext(""):halign(1) | ||
end, | ||
UpdateStepsRowsCommand = function(self) | ||
local steps = thesteps[i + displayindexoffset] | ||
if steps then | ||
self:settext(steps:GetMeter()) | ||
else | ||
self:settext("") | ||
end | ||
} | ||
}, | ||
CursorP2 = Def.ActorFrame { | ||
InitCommand = function(self) | ||
self:x(128 - 16):player(PLAYER_2) | ||
end, | ||
PlayerJoinedMessageCommand = function(self, params) | ||
if params.Player == PLAYER_2 then | ||
self:visible(true) | ||
self:bounceend(0.3):zoom(1) | ||
end | ||
end, | ||
PlayerUnjoinedMessageCommand = function(self, params) | ||
if params.Player == PLAYER_2 then | ||
self:visible(true) | ||
self:bounceend(0.3):zoom(0) | ||
}, | ||
LoadFont("Common Large") .. { | ||
InitCommand = function(self) | ||
self:x(12):zoom(0.2):settext(""):halign(0.5):valign(0) | ||
end, | ||
UpdateStepsRowsCommand = function(self) | ||
local steps = thesteps[i + displayindexoffset] | ||
if steps then | ||
local diff = steps:GetDifficulty() | ||
self:settext(getShortDifficulty(diff)) | ||
else | ||
self:settext("") | ||
end | ||
end | ||
end, | ||
LoadFont("Common Normal") .. | ||
{ | ||
Text = "P2", | ||
InitCommand = function(self) | ||
self:x(8):diffuse(PlayerColor(PLAYER_2)):shadowlength(1) | ||
end, | ||
OnCommand = function(self) | ||
self:zoom(0.75) | ||
}, | ||
LoadFont("Common Large") .. { | ||
InitCommand = function(self) | ||
self:x(12):addy(-9):zoom(0.2):settext(""):halign(0.5):valign(0):maxwidth(20 / 0.2) | ||
end, | ||
UpdateStepsRowsCommand = function(self) | ||
local steps = thesteps[i + displayindexoffset] | ||
if steps then | ||
local st = THEME:GetString("StepsDisplay StepsType", ToEnumShortString(steps:GetStepsType())) | ||
self:settext(st) | ||
else | ||
self:settext("") | ||
end | ||
} | ||
}, | ||
CursorP1Frame = Def.Actor { | ||
ChangeCommand = function(self) | ||
self:stoptweening():decelerate(0.125) | ||
end | ||
} | ||
} | ||
|
||
return o | ||
end | ||
|
||
local sdr = | ||
Def.ActorFrame { | ||
Name = "StepsRows" | ||
} | ||
|
||
for i = 1, numshown do | ||
sdr[#sdr + 1] = stepsRows(i) | ||
end | ||
sd[#sd + 1] = sdr | ||
|
||
local center = 4 | ||
-- cursor goes on top | ||
sd[#sd + 1] = Def.Quad { | ||
InitCommand = function(self) | ||
self:x(rowwidth):zoomto(cursorwidth, cursorheight):halign(1):valign(0.5):diffusealpha(0.6) | ||
end, | ||
CurrentStepsChangedMessageCommand = function(self, steps) | ||
for i = 1, 20 do | ||
if thesteps[i] and thesteps[i] == steps.ptr then | ||
currentidx = i | ||
break | ||
end | ||
end | ||
}, | ||
CursorP2Frame = Def.Actor { | ||
ChangeCommand = function(self) | ||
self:stoptweening():decelerate(0.125) | ||
|
||
if currentidx <= center then | ||
displayindexoffset = 0 | ||
elseif #thesteps - displayindexoffset > numshown then | ||
displayindexoffset = currentidx - center | ||
currentidx = center | ||
else | ||
currentidx = currentidx - displayindexoffset | ||
end | ||
} | ||
|
||
if #thesteps - displayindexoffset < numshown then | ||
displayindexoffset = #thesteps - numshown | ||
end | ||
|
||
self:y(cursorheight * (currentidx - 1)) | ||
self:GetParent():GetChild("StepsRows"):queuecommand("UpdateStepsRows") | ||
end | ||
} | ||
|
||
return sd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters