Skip to content

Commit

Permalink
add a session timer and shuffle around some playerinfo elements
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 18, 2016
1 parent f40bc89 commit 81b47c3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
local t = Def.ActorFrame{};
local t = Def.ActorFrame{}

t[#t+1] = LoadFont("Common Normal") .. {
Name = "currentTime";
InitCommand=cmd(xy,SCREEN_WIDTH-5,SCREEN_BOTTOM-5;halign,1;valign,1;zoom,0.45;);
};
Name = "currentTime",
InitCommand=cmd(xy,SCREEN_WIDTH-5,SCREEN_BOTTOM-5;halign,1;valign,1;zoom,0.45)
}

t[#t+1] = LoadFont("Common Normal") .. {
Name = "SessionTime",
InitCommand=cmd(xy,SCREEN_CENTER_X,SCREEN_BOTTOM-5;halign,0.5;valign,1;zoom,0.45)
}

local function Update(self)
local year = Year()
Expand All @@ -13,9 +18,11 @@ local function Update(self)
local minute = Minute()
local second = Second()
self:GetChild("currentTime"):settextf("%04d-%02d-%02d %02d:%02d:%02d",year,month,day,hour,minute,second)

local sessiontime = GAMESTATE:GetSessionTime()
self:GetChild("SessionTime"):settextf("Session Time: "..SecondsToHHMMSS(sessiontime))
self:diffuse(getMainColor('positive'))
end;
end

t.InitCommand=cmd(SetUpdateFunction,Update)

return t
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
local t = Def.ActorFrame{};
local t = Def.ActorFrame{}

t[#t+1] = LoadFont("Common Normal") .. {
Name = "currentTime";
InitCommand=cmd(xy,SCREEN_WIDTH-5,SCREEN_BOTTOM-5;halign,1;valign,1;zoom,0.45;);
};
Name = "currentTime",
InitCommand=cmd(xy,SCREEN_WIDTH-5,SCREEN_BOTTOM-5;halign,1;valign,1;zoom,0.45)
}

t[#t+1] = LoadFont("Common Normal") .. {
Name = "SessionTime",
InitCommand=cmd(xy,SCREEN_CENTER_X,SCREEN_BOTTOM-5;halign,0.5;valign,1;zoom,0.45)
}

local function Update(self)
local year = Year()
Expand All @@ -13,9 +18,11 @@ local function Update(self)
local minute = Minute()
local second = Second()
self:GetChild("currentTime"):settextf("%04d-%02d-%02d %02d:%02d:%02d",year,month,day,hour,minute,second)

local sessiontime = GAMESTATE:GetSessionTime()
self:GetChild("SessionTime"):settextf("Session Time: "..SecondsToHHMMSS(sessiontime))
self:diffuse(getMainColor('positive'))
end;
end

t.InitCommand=cmd(SetUpdateFunction,Update)

return t
6 changes: 3 additions & 3 deletions Themes/Til Death/BGAnimations/_PlayerInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ t[#t+1] = Def.ActorFrame{
PlayerUnjoinedMessageCommand=cmd(queuecommand,"Set"),
};
LoadFont("Common Normal") .. {
InitCommand=cmd(xy,SCREEN_WIDTH-5,AvatarY+7;halign,1;zoom,0.6;diffuse,getMainColor('positive')),
InitCommand=cmd(xy,SCREEN_WIDTH-5,AvatarY+20;halign,1;zoom,0.35;diffuse,getMainColor('positive')),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
self:settextf("Songs Loaded: %i", SONGMAN:GetNumSongs())
Expand All @@ -138,10 +138,10 @@ t[#t+1] = Def.ActorFrame{
PlayerUnjoinedMessageCommand=cmd(queuecommand,"Set"),
};
LoadFont("Common Normal") .. {
InitCommand=cmd(xy,SCREEN_WIDTH-5,AvatarY+25;halign,1;zoom,0.6;diffuse,getMainColor('positive')),
InitCommand=cmd(xy,SCREEN_WIDTH-5,AvatarY+30;halign,1;zoom,0.35;diffuse,getMainColor('positive')),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
self:settextf("Favorited Songs: %i", numfaves)
self:settextf("Songs Favorited: %i", numfaves)
end,
PlayerJoinedMessageCommand=cmd(queuecommand,"Set"),
PlayerUnjoinedMessageCommand=cmd(queuecommand,"Set"),
Expand Down
2 changes: 2 additions & 0 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,7 @@ class LunaGameState: public Luna<GameState>
DEFINE_METHOD( GetCoinMode, GetCoinMode() )
DEFINE_METHOD( GetPremium, GetPremium() )
DEFINE_METHOD( GetSongOptionsString, m_SongOptions.GetCurrent().GetString() )
static int GetSessionTime(T* p, lua_State *L) { lua_pushnumber(L, p->m_timeGameStarted.GetTimeSinceStart()); return 1; }
static int GetSongOptions( T* p, lua_State *L )
{
ModsLevel m = Enum::Check<ModsLevel>( L, 1 );
Expand Down Expand Up @@ -3259,6 +3260,7 @@ class LunaGameState: public Luna<GameState>
ADD_METHOD( GetCurrentCourse );
ADD_METHOD( SetCurrentCourse );
ADD_METHOD( GetCurrentTrail );
ADD_METHOD( GetSessionTime );
ADD_METHOD( SetCurrentTrail );
ADD_METHOD( SetPreferredSong );
ADD_METHOD( GetPreferredSong );
Expand Down

0 comments on commit 81b47c3

Please sign in to comment.