From af5f17d79ec6ad8c54da1793aef352b9e3df4591 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Mon, 26 Apr 2010 12:47:27 -0500 Subject: [PATCH] various theme changes from Midiman --- .../ScreenSelectProfile overlay.lua | 297 ++++++++++++++++++ Themes/_fallback/Scripts/02 Branches.lua | 3 + Themes/_fallback/metrics.ini | 4 +- .../ScreenSelectProfile overlay.lua | 3 +- ...le Icon.lua => ScreenSelectStyle Icon.lua} | 0 5 files changed, 304 insertions(+), 3 deletions(-) create mode 100644 Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua rename Themes/default/Graphics/{ScreenSelectPlayStyle Icon.lua => ScreenSelectStyle Icon.lua} (100%) diff --git a/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua new file mode 100644 index 0000000000..03141d7451 --- /dev/null +++ b/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua @@ -0,0 +1,297 @@ +function GetLocalProfiles() + local ret = {}; + + for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do + local profile=PROFILEMAN:GetLocalProfileFromIndex(p); + local item = Def.ActorFrame { +--[[ Def.Quad { + InitCommand=cmd(zoomto,200,1;y,40/2); + OnCommand=cmd(diffuse,Color('Outline');); + }; --]] + LoadFont("Common Normal") .. { + Text=profile:GetDisplayName(); + InitCommand=cmd(shadowlength,1;y,-9;zoom,0.95;ztest,true); + }; + LoadFont("Common Normal") .. { + Text=profile:GetNumTotalSongsPlayed() .. " Songs Played"; + InitCommand=cmd(shadowlength,1;y,9;zoom,0.5;vertspacing,-8;ztest,true); + }; + }; + table.insert( ret, item ); + end; + + return ret; +end; + +function LoadPlayerStuff(Player) + local ret = {}; + + local pn; + if Player == PLAYER_1 then + pn = 1; + else + pn = 2; + end; + +--[[ local t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 200, 230) .. { + Name = 'BigFrame'; + }; --]] + local t = Def.ActorFrame { + Name = 'JoinFrame'; + Def.Quad { + InitCommand=cmd(zoomto,200+4,230+4); + OnCommand=cmd(shadowlength,1;diffuse,color("0,0,0,0.5")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,230); + OnCommand=cmd(diffuse,Color('Orange');diffusealpha,0.5); + }; + LoadFont("Common Normal") .. { + Text="Press &START; to join."; + InitCommand=cmd(shadowlength,1); + OnCommand=cmd(diffuseshift;effectcolor1,Color('White');effectcolor2,color("0.5,0.5,0.5")); + }; + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = 'BigFrame'; + Def.Quad { + InitCommand=cmd(zoomto,200+4,230+4); + OnCommand=cmd(shadowlength,1); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,230); + OnCommand=cmd(diffuse,PlayerColor(Player)); + }; + }; + table.insert( ret, t ); + +--[[ t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 170, 20) .. { + Name = 'SmallFrame'; + }; --]] + t = Def.ActorFrame { + Name = 'SmallFrame'; +--[[ Def.Quad { + InitCommand=cmd(zoomto,170+4,32+4); + OnCommand=cmd(shadowlength,1); + }; --]] + InitCommand=cmd(y,-2); + Def.Quad { + InitCommand=cmd(zoomto,200,40+2); + OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,40); + OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,40;y,-40/2+20); + OnCommand=cmd(diffuse,Color("Black");fadebottom,1;diffusealpha,0.35); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,1;y,-40/2+1); + OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); + }; + }; + table.insert( ret, t ); + + t = Def.ActorScroller{ + Name = 'Scroller'; + NumItemsToDraw=6; +-- InitCommand=cmd(y,-230/2+20;); + OnCommand=cmd(SetFastCatchup,true;SetMask,200,50;SetSecondsPerItem,0.15); + TransformFunction=function(self, offset, itemIndex, numItems) + local focus = scale(math.abs(offset),0,2,1,0); + self:visible(false); + self:y(math.floor( offset*40 )); +-- self:zoomy( focus ); +-- self:z(-math.abs(offset)); +-- self:zoom(focus); + end; + children = GetLocalProfiles(); + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = "EffectFrame"; + Def.Quad { + InitCommand=cmd(y,-230/2;vertalign,top;zoomto,200,8;fadebottom,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + Def.Quad { + InitCommand=cmd(y,230/2;vertalign,bottom;zoomto,200,8;fadetop,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + }; + table.insert( ret, t ); +--[[ t = Def.BitmapText { + OnCommand = cmd(y,160); + Name = 'SelectedProfileText'; + Font = "Common Normal"; + Text = 'No profile'; + }; --]] + t = LoadFont("Common Normal") .. { + Name = 'SelectedProfileText'; + InitCommand=cmd(y,160); + OnCommand=cmd(shadowlength,1); + }; + table.insert( ret, t ); + + return ret; +end; + +function UpdateInternal3(self, Player) + local pn; + if Player == PLAYER_1 then + pn = 1; + else + pn = 2; + end; + local frame = self:GetChild(string.format('P%uFrame', pn)); + local scroller = frame:GetChild('Scroller'); + local seltext = frame:GetChild('SelectedProfileText'); + local smallframe = frame:GetChild('SmallFrame'); + local bigframe = frame:GetChild('BigFrame'); + + if GAMESTATE:IsHumanPlayer(Player) then + frame:visible(true); + if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then + --using profile if any + smallframe:visible(true); + bigframe:visible(true); + seltext:visible(true); + scroller:visible(true); + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); + if ind > 0 then + scroller:SetDestinationItem(ind-1); + seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); + else + if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then + scroller:SetDestinationItem(0); + self:queuecommand('UpdateInternal2'); + else + smallframe:visible(false); + bigframe:visible(false); + scroller:visible(false); + seltext:settext('No profile'); + end; + end; + else + --using card + smallframe:visible(false); + scroller:visible(false); + seltext:settext('CARD'); + SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); + end; + else + scroller:visible(false); + seltext:visible(false); + smallframe:visible(false); + bigframe:visible(false); + end; +end; + +local t = Def.ActorFrame { + + StorageDevicesChangedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + CodeMessageCommand = function(self, params) + if params.Name == 'Start' then + MESSAGEMAN:Broadcast("StartButton"); + if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); + else + SCREENMAN:GetTopScreen():Finish(); + end; + end; + if params.Name == 'Up' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 1 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Down' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 0 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Back' then + if GAMESTATE:GetNumPlayersEnabled()==0 then + SCREENMAN:GetTopScreen():Cancel(); + else + MESSAGEMAN:Broadcast("BackButton"); + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); + end; + end; + end; + + PlayerJoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + PlayerUnjoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + OnCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + UpdateInternal2Command=function(self) + UpdateInternal3(self, PLAYER_1); + UpdateInternal3(self, PLAYER_2); + end; + + children = { + Def.ActorFrame { + Name = 'P1Frame'; + InitCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); + PlayerJoinedMessageCommand=function(self,param) + if param.Player == PLAYER_1 then + (cmd(bouncebegin,0.175;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_1); + }; + Def.ActorFrame { + Name = 'P2Frame'; + InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); + PlayerJoinedMessageCommand=function(self,param) + if param.Player == PLAYER_2 then + (cmd(bouncebegin,0.175;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_2); + }; + -- sounds + LoadActor( THEME:GetPathS("Common","start") )..{ + StartButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","cancel") )..{ + BackButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","value") )..{ + DirectionButtonMessageCommand=cmd(play); + }; + }; +}; + +return t; diff --git a/Themes/_fallback/Scripts/02 Branches.lua b/Themes/_fallback/Scripts/02 Branches.lua index aae6252222..69460fc16c 100644 --- a/Themes/_fallback/Scripts/02 Branches.lua +++ b/Themes/_fallback/Scripts/02 Branches.lua @@ -27,6 +27,9 @@ end; Branch = { TitleMenu = "ScreenTitleMenu", AfterProfileLoad = function() + return "ScreenSelectProfile" + end, + AfterSelectProfile = function() if ( THEME:GetMetric("Common","AutoSetStyle") == true ) then if IsNetConnected() then -- use SelectStyle in online... diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index db3cd37349..66873e0774 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -1502,9 +1502,9 @@ LoadEdits=true Fallback="ScreenWithMenuElements" Class="ScreenSelectProfile" # -NextScreen="ScreenProfileLoad" +NextScreen=Branch.AfterSelectProfile() PrevScreen="ScreenTitleMenu" -StartScreen="ScreenProfileLoad" +StartScreen=Branch.AfterSelectProfile() # TimerSeconds=40 # diff --git a/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua index f3f28d038a..c24eb8b3e7 100644 --- a/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua +++ b/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua @@ -10,7 +10,7 @@ function GetLocalProfiles() }; --]] LoadFont("Common Normal") .. { Text=profile:GetDisplayName(); - InitCommand=cmd(shadowlength,1;y,-9;ztest,true); + InitCommand=cmd(shadowlength,1;y,-9;zoom,0.95;ztest,true); }; LoadFont("Common Normal") .. { InitCommand=cmd(shadowlength,1;y,9;zoom,0.5;vertspacing,-8;ztest,true); @@ -76,6 +76,7 @@ function LoadPlayerStuff(Player) InitCommand=cmd(zoomto,170+4,32+4); OnCommand=cmd(shadowlength,1); }; --]] + InitCommand=cmd(y,-2); Def.Quad { InitCommand=cmd(zoomto,200,40+2); OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); diff --git a/Themes/default/Graphics/ScreenSelectPlayStyle Icon.lua b/Themes/default/Graphics/ScreenSelectStyle Icon.lua similarity index 100% rename from Themes/default/Graphics/ScreenSelectPlayStyle Icon.lua rename to Themes/default/Graphics/ScreenSelectStyle Icon.lua