class UnlockMinigameProgramEffector extends Effector
{
	var m_minigameProgram : MinigameProgramData;

	protected export override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		var actionID : TweakDBID;
		actionID = TDBID.Create( TweakDBInterface.GetString( record + T".networkAction", "" ) );
		m_minigameProgram.actionID = actionID;
		m_minigameProgram.programName = StringToName( LocKeyToString( TweakDBInterface.GetObjectActionRecord( actionID ).ObjectActionUI().Caption() ) );
	}

	protected export override function ActionOn( owner : GameObject )
	{
		var player : PlayerPuppet;
		player = ( ( PlayerPuppet )( owner ) );
		if( player )
		{
			StoreMinigameProgramsOnPlayer( m_minigameProgram, player, true );
		}
	}

	protected export override function Uninitialize( game : GameInstance )
	{
		var player : PlayerPuppet;
		player = GetPlayer( game );
		if( player )
		{
			StoreMinigameProgramsOnPlayer( m_minigameProgram, player, false );
		}
	}

	private function StoreMinigameProgramsOnPlayer( program : MinigameProgramData, player : PlayerPuppet, addOrRemove : Bool )
	{
		var evt : UpdateMiniGameProgramsEvent;
		evt = new UpdateMiniGameProgramsEvent;
		evt.program = program;
		evt.add = addOrRemove;
		player.QueueEvent( evt );
	}

}

