Files
itgmania212121/Themes/default/Graphics/ScreenPlayerOptions PlayerNameplate.lua
T

94 lines
3.0 KiB
Lua
Raw Normal View History

2014-12-27 03:17:51 -08:00
local PlayerNumber = ...
assert( PlayerNumber )
2017-08-08 01:07:34 -06:00
local bpm_text_zoom = 0.6
2014-12-27 03:17:51 -08:00
local song_bpms= {}
local bpm_text= "??? - ???"
local function format_bpm(bpm)
return ("%.0f"):format(bpm)
end
-- Courses don't have GetDisplayBpms.
if GAMESTATE:GetCurrentSong() then
song_bpms= GAMESTATE:GetCurrentSong():GetDisplayBpms()
song_bpms[1]= math.round(song_bpms[1])
song_bpms[2]= math.round(song_bpms[2])
if song_bpms[1] == song_bpms[2] then
bpm_text= format_bpm(song_bpms[1])
else
bpm_text= format_bpm(song_bpms[1]) .. " - " .. format_bpm(song_bpms[2])
end
end
2014-12-27 03:17:51 -08:00
local t = Def.ActorFrame {
2017-08-08 01:07:34 -06:00
LoadActor(THEME:GetPathB("_frame","3x1"),"rounded light", 250-16) .. {
2018-02-08 23:35:28 -06:00
OnCommand=cmd(diffuse,ColorLightTone(PlayerColor(PlayerNumber));diffusealpha,0.8);
2014-12-27 03:17:51 -08:00
};
2017-08-08 01:07:34 -06:00
LoadFont("Common Condensed") .. {
2014-12-27 03:17:51 -08:00
Text=ToEnumShortString(PlayerNumber);
Name="PlayerShortName",
2018-08-14 14:19:02 -06:00
InitCommand=cmd(x,-127;maxwidth,32;zoom,0.75),
OnCommand=cmd(diffuse,ColorDarkTone(PlayerColor(PlayerNumber)))
2014-12-27 03:17:51 -08:00
},
2017-08-08 01:07:34 -06:00
LoadFont("_overpass 36px") .. {
Text=bpm_text;
2014-12-27 03:17:51 -08:00
Name="BPMRangeOld",
2017-08-08 01:07:34 -06:00
InitCommand=cmd(x,-60;maxwidth,88/bpm_text_zoom),
2018-08-14 14:19:02 -06:00
OnCommand=cmd(zoom,bpm_text_zoom;diffuse,ColorDarkTone(PlayerColor(PlayerNumber)))
2014-12-27 03:17:51 -08:00
},
LoadActor(THEME:GetPathG("_StepsDisplayListRow","arrow")) .. {
Name="Seperator",
2017-08-08 01:07:34 -06:00
InitCommand=cmd(x,4);
2018-08-14 14:19:02 -06:00
OnCommand=cmd(diffuse,ColorDarkTone(PlayerColor(PlayerNumber)))
2014-12-27 03:17:51 -08:00
},
2017-08-08 01:07:34 -06:00
LoadFont("_overpass 36px") .. {
Text="100 - 200000";
2014-12-27 03:17:51 -08:00
Text="100 - 200000";
Name="BPMRangeNew",
InitCommand= function(self)
2017-08-11 15:01:19 -06:00
self:x(68):maxwidth(88/bpm_text_zoom):zoom(bpm_text_zoom)
local speed, mode= GetSpeedModeAndValueFromPoptions(PlayerNumber)
self:playcommand("SpeedChoiceChanged", {pn= PlayerNumber, mode= mode, speed= speed})
end,
2018-08-14 14:19:02 -06:00
BPMWillNotChangeCommand=cmd(stopeffect;diffuse,ColorDarkTone(PlayerColor(PlayerNumber))),
BPMWillChangeCommand=cmd(diffuseshift;effectcolor1,Color.Black;effectcolor2,ColorMidTone(PlayerColor(PlayerNumber))),
SpeedChoiceChangedMessageCommand= function(self, param)
if param.pn ~= PlayerNumber then return end
local text= ""
local no_change= true
if param.mode == "x" then
if not song_bpms[1] then
text= "??? - ???"
elseif song_bpms[1] == song_bpms[2] then
text= format_bpm(song_bpms[1] * param.speed*.01)
else
text= format_bpm(song_bpms[1] * param.speed*.01) .. " - " ..
format_bpm(song_bpms[2] * param.speed*.01)
end
no_change= param.speed == 100
elseif param.mode == "C" then
text= param.mode .. param.speed
no_change= param.speed == song_bpms[2] and song_bpms[1] == song_bpms[2]
else
no_change= param.speed == song_bpms[2]
if song_bpms[1] == song_bpms[2] then
text= param.mode .. param.speed
else
local factor= song_bpms[1] / song_bpms[2]
text= param.mode .. format_bpm(param.speed * factor) .. " - "
.. param.mode .. param.speed
end
end
self:settext(text)
if no_change then
self:queuecommand("BPMWillNotChange")
else
self:queuecommand("BPMWillChange")
end
end
2014-12-27 03:17:51 -08:00
}
}
2017-08-08 01:07:34 -06:00
return t