New wip system to safely save away elements from a screen for reuse on another screen...
authorCameron Ball <c.ball1729@gmail.com>
Mon, 9 Dec 2013 17:48:30 +0000 (01:48 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Mon, 9 Dec 2013 17:48:30 +0000 (01:48 +0800)
Themes/GrooveNights/BGAnimations/ScreenPlayerOptions overlay/default.xml
Themes/GrooveNights/Scripts/Globals.lua [new file with mode: 0644]
Themes/GrooveNights/Scripts/Other.lua
Themes/GrooveNights/metrics.ini

index 9bdd1fd..35a6ada 100644 (file)
                        Text=""
                        Condition="GAMESTATE:IsPlayerEnabled(PLAYER_1)"
                        File="_eurostile blue glow"
-                       InitCommand="%function(self)  self:horizalign('left'); self:shadowlength(0); self:zoom(0.5); self:x(SCREEN_CENTER_X-200); self:y(SCREEN_CENTER_Y+166); self:queuecommand('loop'); end"
-                       loopCommand="%function(self)
-                       self:stoptweening();
-                       if curRate ~= 1 then self:settext(gnSongLength..' (x'..curRate..' Music Rate)'); else self:settext(gnSongLength); end
-                       self:sleep(0.03);
-                       self:queuecommand('loop');
-                       end"
+                       InitCommand="%function(self)  self:horizalign('left'); self:shadowlength(0); self:zoom(0.5); self:x(SCREEN_CENTER_X-200); self:y(SCREEN_CENTER_Y+166); end"
+                       RateModChangedMessageCommand="%function(self) self:settext(DisplaySongLength()) end"
                />
        <!--Player 2's BPM & Speed Display-->
                <BitmapText
                        Text=""
                        Condition="GAMESTATE:IsPlayerEnabled(PLAYER_2)"
                        File="_eurostile blue glow"
-                       InitCommand="%function(self)  self:horizalign('left'); self:shadowlength(0); self:zoom(0.5); self:x(SCREEN_CENTER_X+119); self:y(SCREEN_CENTER_Y+166); self:queuecommand('loop'); end"
-                       loopCommand="%function(self)
-                       self:stoptweening();
-                       if curRate ~= 1 then self:settext(gnSongLength..' (x'..curRate..' Music Rate)'); else self:settext(gnSongLength); end
-                       self:sleep(0.03);
-                       self:queuecommand('loop');
-                       end"
+                       InitCommand="%function(self)  self:horizalign('left'); self:shadowlength(0); self:zoom(0.5); self:x(SCREEN_CENTER_X+119); self:y(SCREEN_CENTER_Y+166); end"
+                       RateModChangedMessageCommand="%function(self) self:settext(DisplaySongLength()) end"
                />
                
        <Layer
diff --git a/Themes/GrooveNights/Scripts/Globals.lua b/Themes/GrooveNights/Scripts/Globals.lua
new file mode 100644 (file)
index 0000000..ea44226
--- /dev/null
@@ -0,0 +1,10 @@
+local GlobalsTable = {}\r
+\r
+function RegisterGlobal(Actor, name)\r
+       -- Todo: check that this global isn't already registered        \r
+       GlobalsTable[name] = Actor:GetText()    \r
+end\r
+\r
+function GetGlobal(name)\r
+       return GlobalsTable[name]\r
+end
\ No newline at end of file
index 0158902..7f761dd 100644 (file)
@@ -489,4 +489,18 @@ function DisplayScrollSpeed(pn)
     if highBPM ~= "" then highScrollBPM = math.floor(highBPM *speedMod * rateMod) end
 
     if highBPM == "" then return tostring(lowScrollBPM) else return lowScrollBPM .. "-" .. highScrollBPM end
+end
+
+function DisplaySongLength()
+       local SongLength = GetGlobal("TotalTime")
+       local RateMod = string.gsub(GetRateMod(), "x" ,"");
+       local ratio = 1/RateMod
+       
+       local pos = string.find(SongLength, ':')
+       local minutes = string.sub(SongLength, 1, pos-1)
+       local seconds = string.sub(SongLength, pos+1)
+       
+       seconds = (seconds + (minutes*60))*ratio
+       
+       return string.format("%.2d:%.2d", math.mod(seconds/60,60), math.mod(seconds,60))
 end
\ No newline at end of file
index 22b11ee..9e4a587 100644 (file)
@@ -786,7 +786,7 @@ TipY=0
 [ScreenSelectMusic]
 TotalTimeX=SCREEN_CENTER_X 
 TotalTimeY=SCREEN_CENTER_Y+10000
-TotalTimeOnCommand=diffusealpha,0;
+TotalTimeOnCommand=%function(self) self:diffusealpha(0); RegisterGlobal(self, "TotalTime") end
 TotalTimeOffCommand=
 CDTitleX=SCREEN_CENTER_X+268 
 CDTitleY=SCREEN_CENTER_Y-50