class UISL_PostSquadSelectPhotograph extends UIScreenListener;

event OnRemoved(UIScreen Screen)
{
	local StateObjectReference UnitRef;
	// Force everyone in the squad to cache a photograph

	if (UISquadSelect(Screen) != none)
	{
		`log("Taking photos for everyone!",, 'QuickInfoPhotos');
		foreach `XCOMHQ.Squad(UnitRef)
		{
			TakeCrewPhotograph(UnitRef, true, true);
		}
	}
}

event OnReceivedFocus(UIScreen Screen)
{
	local StateObjectReference UnitRef;

	if (UISquadSelect(Screen) != none)
	{
		`log("Taking photos for everyone! (quick)",, 'QuickInfoPhotos');
		foreach `XCOMHQ.Squad(UnitRef)
		{
			TakeCrewPhotograph(UnitRef);
		}
	}
}

function TakeCrewPhotograph(StateObjectReference UnitRef, bool bForce = false, bool bHighPriority = false )
{
	`HQPRES.GetPhotoboothAutoGen().AddHeadShotRequest(UnitRef, 128, 128, OnSoldierHeadCaptureFinished, class'X2StrategyElement_DefaultSoldierPersonalities'.static.Personality_ByTheBook(),, bHighPriority);
}

private function OnSoldierHeadCaptureFinished(StateObjectReference UnitRef)
{
	// Empty, no longer need to store these as the photobooth manager already handles saving them.
}

defaultproperties
{
	ScreenClass = UISquadSelect;
}