<ActorFrame InitCommand="%function(self)
	ProfileImageSize = 65
	end"><children>

	<Layer Type="Quad" OnCommand="queuecommand,PlaySound" PlaySoundCommand="%function(self) AudioPlay('Internal/profile') end" />


	<Layer
		File="@ThemeFile('p1bg_inactive')"
		Condition="not GAMESTATE:IsPlayerEnabled(PLAYER_1)"
		OnCommand="x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y-126"
		/>
	<Layer
		File="@ThemeFile('p1bg_active')"
		Condition="GAMESTATE:IsPlayerEnabled(PLAYER_1)"
		OnCommand="x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y+5"
		/>

		<!-- PLAYER 1 INFORMATION -->
		<Layer Type="ActorFrame" OnCommand="x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y-87" Condition="GAMESTATE:IsPlayerEnabled(PLAYER_1)"><children>
    
        <Layer
            Type="Quad"
            OnCommand="%function(self)
            self:zoomto(ProfileImageSize+2,ProfileImageSize+2,0,0)
            self:shadowlength(1)
            end"
            />
        <Layer
            Type="Quad"
            OnCommand="%function(self)
            self:zoomto(ProfileImageSize-2,ProfileImageSize-2,0,0)
            self:shadowlength(1)
            self:diffuse(0,0,0,1)
            end"
            />
           <Layer
        File="@ThemeFile('ProfileIcon/userP1')"
        OnCommand="%function(self)
        self:zoomto(ProfileImageSize,ProfileImageSize,0,0);
        end"
        />

        <Layer
            Font="_sui generis"
            Text="@GetProfileName(1)"
            OnCommand="addy,60;zoom,0.8;shadowlength,1;sleep,0.01;queuecommand,Update"
            UpdateCommand="%function(self)
            self:settext( GetProfileName(1) )
            end"
            />

        <Layer
            Font="_sui generis"
            Text=" "
            OnCommand="%function(self)
            self:addy(80)
            self:zoom(0.6)
            self:shadowlength(1)
            self:sleep(0.01)

            USBRemoved = false
            USBState = false

            self:queuecommand('Update')
            end"
            UpdateCommand="%function(self)

            if IsUsingMemoryCard( PLAYER_1 )  then
                self:settext( 'Using MemoryCard' )
                self:diffuse(230/255,142/255,27/255,1)
            else
                self:settext(' ')
            end

            --[[
            if IsUsingMemoryCard( PLAYER_1 ) and USBState == false and USBRemoved == false then
                self:settext( 'Using MemoryCard' )
                self:diffuse(230/255,142/255,27/255,1)
                USBState = true;
                USBRemoved = false;
            end

            if not IsUsingMemoryCard( PLAYER_1 ) and USBState == true and USBRemoved == false then
                self:settext('MemoryCard Removed')
                self:diffuse(230/255,0/255,27/255,1)
                USBState = false;
                USBRemoved = true;
            end

            if not IsUsingMemoryCard( PLAYER_1 ) and not USBState == false and not USBRemoved == true then
                self:settext(' ')
            end
            ]]

            self:sleep(0.2)
            self:queuecommand('Update')

            end"
            />

        <Layer
            Font="_sui generis"
            Text="Total Songs"
            OnCommand="x,-140;y,100;zoom,0.6;shadowlength,1;horizalign,left"
            />
        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,140;y,100;zoom,0.6;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalSongsPlayedP1 then
            	self:settext('0')
            	Pr.DWITotalSongsPlayedP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalSongsPlayedP1 )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Total Steps"
            OnCommand="x,-140;y,118;zoom,0.6;shadowlength,1;horizalign,left"
            />
        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,140;y,118;zoom,0.6;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalStepsHitP1 then
            	self:settext('0')
            	Pr.DWITotalStepsHitP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalStepsHitP1 )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Machine Perfect: 0%"
            OnCommand="x,140;y,140;zoom,0.6;shadowlength,1;diffuse,1,1,0,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            self:settext( 'Machine Perfect: '.. FormatPercentScore( GetTotalPercentComplete(STEPS_TYPE_DANCE_SINGLE))  )
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Score"
            OnCommand="x,-140;y,160;zoom,0.6;shadowlength,1;horizalign,left;sleep,0.01;queuecommand,CheckLabel"
            CheckLabelCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if Pr.DWIHighestSessionScore then
            	self:settext('Highest Session Score')
            else
            	self:settext('Highest Score')
            end
            end"
            />

        <Layer
            Font="_score"
            Text="0"
            OnCommand="x,135;y,185;zoom,1;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestScoreP1 or not Pr.DWIHighestSessionScoreP1 then
            	self:settext('          ')
            	Pr.DWIHighestScoreP1 = 0
            	Pr.DWIHighestSessionScoreP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	if Pr.DWIHighestSessionScore then
            		self:settext( string.format('% 9d', Pr.DWIHighestSessionScoreP1 ) )
            	else
            		self:settext( string.format('% 9d', Pr.DWIHighestScoreP1 ) )
            	end
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Combo"
            OnCommand="x,-140;y,210;zoom,0.6;shadowlength,1;horizalign,left"
            />

            <Layer
		File="@ThemeFile('Combo label')"
		OnCommand="x,110;y,240;zoom,0.65"
		/>

        <Layer
            Font="Combo numbers"
            Text="0"
            OnCommand="x,80;y,235;zoom,0.6;shadowlength,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestComboP1 then
            	self:settext('0')
            	Pr.DWIHighestComboP1 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWIHighestComboP1 )
            end
            end"
            />
    </children></Layer>








	<Layer
		File="@ThemeFile('p2bg_inactive')"
		Condition="not GAMESTATE:IsPlayerEnabled(PLAYER_2)"
		OnCommand="x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y-126"
		/>
	<Layer
		File="@ThemeFile('p2bg_active')"
		Condition="GAMESTATE:IsPlayerEnabled(PLAYER_2)"
		OnCommand="x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y+5"
		/>




		<!-- PLAYER 2 INFORMATION -->
		<Layer Type="ActorFrame" OnCommand="x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y-87" Condition="GAMESTATE:IsPlayerEnabled(PLAYER_2)"><children>
	<Layer
            Type="Quad"
            OnCommand="%function(self)
            self:zoomto(ProfileImageSize+2,ProfileImageSize+2,0,0)
            self:shadowlength(1)
            end"
            />
        <Layer
            Type="Quad"
            OnCommand="%function(self)
            self:zoomto(ProfileImageSize-2,ProfileImageSize-2,0,0)
            self:shadowlength(1)
            self:diffuse(0,0,0,1)
            end"
            />
           <Layer
        File="@ThemeFile('ProfileIcon/userP2')"
        OnCommand="%function(self)
        self:zoomto(ProfileImageSize,ProfileImageSize,0,0);
        end"
        />

        <Layer
            Font="_sui generis"
            Text="@GetProfileName(2)"
            OnCommand="addy,60;zoom,0.8;shadowlength,1;sleep,0.01;queuecommand,Update"
            UpdateCommand="%function(self)
            self:settext( GetProfileName(2) )
            end"
            />

        <Layer
            Font="_sui generis"
            Text=" "
            OnCommand="%function(self)
            self:addy(80)
            self:zoom(0.6)
            self:shadowlength(1)
            self:sleep(0.01)
            self:queuecommand('Update')
            end"
            UpdateCommand="%function(self)

            if IsUsingMemoryCard( PLAYER_2 )  then
                self:settext( 'Using MemoryCard' )
                self:diffuse(230/255,142/255,27/255,1)
            else
                self:settext(' ')
            end

            self:sleep(0.2)
            self:queuecommand('Update')

            end"
            />

        <Layer
            Font="_sui generis"
            Text="Total Songs"
            OnCommand="x,-140;y,100;zoom,0.6;shadowlength,1;horizalign,left"
            />
        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,140;y,100;zoom,0.6;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalSongsPlayedP2 then
            	self:settext('0')
            	Pr.DWITotalSongsPlayedP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalSongsPlayedP2 )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Total Steps"
            OnCommand="x,-140;y,118;zoom,0.6;shadowlength,1;horizalign,left"
            />
        <Layer
            Font="_sui generis"
            Text="0"
            OnCommand="x,140;y,118;zoom,0.6;shadowlength,1;diffuse,0,1,1,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWITotalStepsHitP2 then
            	self:settext('0')
            	Pr.DWITotalStepsHitP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWITotalStepsHitP2 )
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Machine Perfect: 0%"
            OnCommand="x,140;y,140;zoom,0.6;shadowlength,1;diffuse,1,1,0,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            self:settext( 'Machine Perfect: '.. FormatPercentScore( GetTotalPercentComplete(STEPS_TYPE_DANCE_SINGLE)) )
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Score"
            OnCommand="x,-140;y,160;zoom,0.6;shadowlength,1;horizalign,left;sleep,0.01;queuecommand,CheckLabel"
            CheckLabelCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if Pr.DWIHighestSessionScore then
            	self:settext('Highest Session Score')
            else
            	self:settext('Highest Score')
            end
            end"
            />

        <Layer
            Font="_score"
            Text="0"
            OnCommand="x,135;y,185;zoom,1;shadowlength,1;diffuse,1,1,0,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestScoreP2 or not Pr.DWIHighestSessionScoreP2 then
            	self:settext('          ')
            	Pr.DWIHighestScoreP2 = 0
            	Pr.DWIHighestSessionScoreP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	if Pr.DWIHighestSessionScore then
            		self:settext( string.format('% 9d', Pr.DWIHighestSessionScoreP2 ) )
            	else
            		self:settext( string.format('% 9d', Pr.DWIHighestScoreP2 ) )
            	end
            end
            end"
            />

        <Layer
            Font="_sui generis"
            Text="Highest Combo"
            OnCommand="x,-140;y,210;zoom,0.6;shadowlength,1;horizalign,left"
            />

            <Layer
		File="@ThemeFile('Combo label')"
		OnCommand="x,110;y,240;zoom,0.65"
		/>

        <Layer
            Font="Combo numbers"
            Text="0"
            OnCommand="x,80;y,235;zoom,0.6;shadowlength,1;horizalign,right;sleep,0.01;queuecommand,TotalSongCheck"
            TotalSongCheckCommand="%function(self)
            local Pr = PROFILEMAN:GetMachineProfile():GetSaved()
            if not Pr.DWIHighestComboP2 then
            	self:settext('0')
            	Pr.DWIHighestComboP2 = 0
            	PROFILEMAN:SaveMachineProfile()
            else
            	self:settext( Pr.DWIHighestComboP2 )
            end
            end"
            />
    </children></Layer>
</children></ActorFrame>