Skip to content

Commit

Permalink
playlists improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulti-FD committed Jul 6, 2021
1 parent 55d4d54 commit 2ad81f5
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local function genericHighlight(self, highlight, base, clickaction)
if self:IsVisible() then
self:RunCommandsOnChildren(
function(self)
if isOver(self) then
if isOver(self) and self:getaux() ~= 1 then
self:diffusealpha(highlight)
else
self:diffusealpha(base)
Expand All @@ -18,12 +18,17 @@ local function genericHighlight(self, highlight, base, clickaction)
self:SetUpdateFunctionInterval(0.025)
if clickaction then
self:RunCommandsOnChildren(
function(self)
function(self)
self:addcommand("LeftClickMessage", clickaction)
end
)
end
end
local function highlight(self)
if self:IsVisible() then
self:queuecommand("Highlight")
end
end

local update = false
local t =
Expand Down Expand Up @@ -109,30 +114,30 @@ local translated_info = {
t[#t + 1] =
Def.Quad {
InitCommand = function(self)
self:xy(frameX, frameY):zoomto(frameWidth, frameHeight):halign(0):valign(0):diffuse(color("#333333CC"))
self:xy(frameX, frameY):zoomto(frameWidth, frameHeight):halign(0):valign(0):diffuse(getMainColor("tabs"))
end
}
t[#t + 1] =
Def.Quad {
InitCommand = function(self)
self:xy(frameX, frameY):zoomto(frameWidth, offsetY):halign(0):valign(0):diffuse(getMainColor("frames")):diffusealpha(
0.5
)
self:xy(frameX, frameY):zoomto(frameWidth, offsetY):halign(0):valign(0)
self:diffuse(getMainColor("frames")):diffusealpha(0.5)
end
}
t[#t + 1] =
LoadFont("Common Normal") ..
{
InitCommand = function(self)
self:xy(frameX + 5, frameY + offsetY - 9):zoom(0.6):halign(0):diffuse(getMainColor("positive"))
self:xy(frameX + 5, frameY + offsetY - 9):zoom(0.6):halign(0)
self:diffuse(Saturation(getMainColor("positive"), 0.1))
self:settext(translated_info["Title"])
end
}
t[#t + 1] =
LoadFont("Common Normal") ..
{
InitCommand = function(self)
self:xy(frameWidth, frameY + offsetY - 9):zoom(0.6):halign(1):diffuse(getMainColor("positive"))
self:xy(frameWidth, frameY + offsetY - 9):zoom(0.6):halign(1)
end,
DisplaySinglePlaylistMessageCommand = function(self)
self:settext(translated_info["ExplainAdd"])
Expand Down Expand Up @@ -188,7 +193,7 @@ local r =
LoadFont("Common Large") ..
{
InitCommand = function(self)
self:xy(rankingX, rankingY):zoom(0.4):halign(0):maxwidth(360)
self:xy(frameX, rankingY):zoom(0.4):halign(0):maxwidth(460)
end,
DisplaySinglePlaylistMessageCommand = function(self)
pl = SONGMAN:GetActivePlaylist()
Expand All @@ -209,7 +214,7 @@ local function RateDisplayButton(i)
Name = "RateDisplay",
InitCommand = function(self)
genericHighlight(self)
self:x(220)
self:x(220):diffuse(getMainColor("positive"))
end,
LoadFont("Common Large") ..
{
Expand Down Expand Up @@ -243,9 +248,28 @@ local function TitleDisplayButton(i)
Def.ActorFrame {
Name = "TitleDisplay",
InitCommand = function(self)
genericHighlight(self)
self:x(15)
self:SetUpdateFunction(highlight):SetUpdateFunctionInterval(0.025)
end,
Def.Quad {
InitCommand = function(self)
self:x(-22):zoomto(212, scoreYspacing):halign(0):diffusealpha(0)
end,
MouseLeftClickMessageCommand = function(self)
if
ButtonActive(self) and chartlist[i + ((currentchartpage - 1) * chartsperplaylist)] and
chartlist[i + ((currentchartpage - 1) * chartsperplaylist)]:IsLoaded() and
singleplaylistactive
then
whee:SelectSong(songlist[i + ((currentchartpage - 1) * chartsperplaylist)])
end
end,
HighlightCommand = function(self)
local alph = 1
if isOver(self) then alph = .7 end
self:GetParent():GetChild("Text"):diffusealpha(alph)
end,
},
LoadFont("Common Large") ..
{
Name = "Text",
Expand All @@ -262,15 +286,6 @@ local function TitleDisplayButton(i)
self:diffuse(byJudgment("TapNoteScore_Miss"))
end
end,
MouseLeftClickMessageCommand = function(self)
if
ButtonActive(self) and chartlist[i + ((currentchartpage - 1) * chartsperplaylist)] and
chartlist[i + ((currentchartpage - 1) * chartsperplaylist)]:IsLoaded() and
singleplaylistactive
then
whee:SelectSong(songlist[i + ((currentchartpage - 1) * chartsperplaylist)])
end
end
}
}
return o
Expand Down Expand Up @@ -337,18 +352,21 @@ local function rankingLabel(i)
self:GetChild("TitleDisplay"):visible(true)
self:GetChild("RateDisplay"):visible(true)
self:GetChild("PackMouseOver"):visible(true)
self:GetChild("ChartNumber"):visible(true)
else
self:GetChild("DeleteButton"):visible(false)
self:GetChild("TitleDisplay"):visible(false)
self:GetChild("RateDisplay"):visible(false)
self:GetChild("PackMouseOver"):visible(false)
self:GetChild("ChartNumber"):visible(false)
end
else
self:visible(true)
end
end,
LoadFont("Common Large") ..
{
Name = "ChartNumber",
InitCommand = function(self)
self:maxwidth(100)
self:halign(0):zoom(fontScale)
Expand All @@ -362,16 +380,16 @@ local function rankingLabel(i)
Def.ActorFrame {
Name = "PackMouseOver",
InitCommand = function(self)
self:SetUpdateFunction(function(self)
self:SetUpdateFunction(function(self)
if self:IsVisible() then
self:queuecommand("PackMouseover")
end
end
end)
end,
Def.Quad {
InitCommand = function(self)
Name = "mouseover",
self:x(15):zoomto(180, 8):halign(0):diffusealpha(0)
self:x(-7):zoomto(212, scoreYspacing):halign(0):diffusealpha(0)
end,
PackMouseoverMessageCommand = function(self)
if isOver(self) then
Expand All @@ -392,7 +410,7 @@ local function rankingLabel(i)
self:linear(0.25)
self:diffusealpha(0)
end
end
end
}
},
LoadFont("Common Large") ..
Expand Down Expand Up @@ -458,7 +476,7 @@ b2[#b2 + 1] =
LoadFont("Common Large") ..
{
InitCommand = function(self)
self:zoom(0.3):x(85)
self:zoom(0.3):x(capWideScale(86,107)):diffuse(getMainColor("positive"))
self:settext(translated_info["PlayAsCourse"])
end,
MouseLeftClickMessageCommand = function(self)
Expand All @@ -473,7 +491,7 @@ b2[#b2 + 1] =
LoadFont("Common Large") ..
{
InitCommand = function(self)
self:zoom(0.3)
self:zoom(0.3):x(capWideScale(5,20)):diffuse(getMainColor("positive"))
self:settext(translated_info["Back"])
end,
MouseLeftClickMessageCommand = function(self)
Expand Down Expand Up @@ -535,7 +553,8 @@ r[#r + 1] =
LoadFont("Common Large") ..
{
InitCommand = function(self)
self:x(175):halign(0.5):zoom(0.3):diffuse(getMainColor("positive"))
self:x(175):halign(0.5):zoom(0.3)
self:aux(1)
end,
SetCommand = function(self)
self:settextf(
Expand All @@ -559,28 +578,40 @@ local function PlaylistTitleDisplayButton(i)
local o =
Def.ActorFrame {
InitCommand = function(self)
genericHighlight(self)
self:x(15)
self:SetUpdateFunction(highlight):SetUpdateFunctionInterval(0.025)
end,
Def.Quad {
InitCommand = function(self)
self:xy(-21,-5):zoomto(rankingWidth - 30, scoreYspacing * 2.25):align(0,0)
self:diffusealpha(0)
end,
HighlightCommand = function(self)
local alph = 1
if isOver(self) then alph = .7 end
self:GetParent():GetChild("Text"):diffusealpha(alph)
end,
MouseLeftClickMessageCommand = function(self)
if ButtonActive(self) and allplaylistsactive then
SONGMAN:SetActivePlaylist(allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]:GetName())
pl = allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]
MESSAGEMAN:Broadcast("DisplaySinglePlaylist")
end
end
},
LoadFont("Common Large") ..
{
Name = "Text",
InitCommand = function(self)
self:halign(0):maxwidth(frameWidth * 3 + 140)
self:diffuse(getMainColor("positive"))
end,
AllDisplayMessageCommand = function(self)
self:zoom(fontScale)
if allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)] then
self:settext(allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]:GetName())
end
end,
MouseLeftClickMessageCommand = function(self)
if ButtonActive(self) and allplaylistsactive then
SONGMAN:SetActivePlaylist(allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]:GetName())
pl = allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]
MESSAGEMAN:Broadcast("DisplaySinglePlaylist")
end
end
}
}
return o
Expand All @@ -606,10 +637,12 @@ local function DeletePlaylistButton(i)
self:diffuse(byJudgment("TapNoteScore_Miss"))
end

if allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]:GetName() == "Favorites" then
self:visible(false)
else
self:visible(true)
if allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)] then
if allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)]:GetName() == "Favorites" then
self:visible(false)
else
self:visible(true)
end
end
end,
MouseLeftClickMessageCommand = function(self)
Expand Down Expand Up @@ -657,7 +690,6 @@ local function PlaylistSelectLabel(i)
InitCommand = function(self)
self:halign(0):zoom(fontScale)
self:xy(15, row2Yoffset)
self:diffuse(getMainColor("positive"))
end,
AllDisplayMessageCommand = function(self)
if allplaylists[i + ((currentplaylistpage - 1) * playlistsperpage)] then
Expand All @@ -674,7 +706,6 @@ local function PlaylistSelectLabel(i)
InitCommand = function(self)
self:halign(0):zoom(fontScale)
self:xy(200, row2Yoffset)
self:diffuse(getMainColor("positive"))
end,
AllDisplayMessageCommand = function(self)
self:settextf("%s:", translated_info["AverageRating"])
Expand Down Expand Up @@ -785,7 +816,8 @@ r[#r + 1] =
LoadFont("Common Large") ..
{
InitCommand = function(self)
self:x(175):halign(0.5):zoom(0.3):diffuse(getMainColor("positive"))
self:x(175):halign(0.5):zoom(0.3)
self:aux(1)
end,
SetCommand = function(self)
self:settextf(
Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ FilterCompleted=Completed
FilterIncomplete=Incomplete
[TabPlaylists]
Title=Playlists (WIP)
Title=Playlists
ExplainAddChart=Ctrl+A to add a new chart
ExplainNewPlaylist=Ctrl+P to add a new playlist
Delete=Del
Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/Languages/zh.ini
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ FilterCompleted=已完成
FilterIncomplete=未完成
[TabPlaylists]
Title=歌單 (待完成)
Title=歌單
ExplainAddChart=Ctrl+A 添加譜面
ExplainNewPlaylist=Ctrl+P 新建歌單
Delete=刪除
Expand Down

0 comments on commit 2ad81f5

Please sign in to comment.