class ControlledDeviceLogicController extends inkLogicController
{
	private var m_deviceIcon : weak< inkImage >;
	private var m_nestIcon : weak< inkImage >;
	private var m_activeBg : weak< inkRectangle >;

	protected event OnInitialize()
	{
		m_deviceIcon = ( ( inkImage )( GetWidget( 'device_icon' ) ) );
		m_nestIcon = ( ( inkImage )( GetWidget( 'nest_icon' ) ) );
		m_activeBg = ( ( inkRectangle )( GetWidget( 'activeBg' ) ) );
		m_deviceIcon.SetVisible( true );
		m_nestIcon.SetVisible( false );
		m_activeBg.SetVisible( true );
	}

	public virtual function Initialize( gameController : ControlledDevicesInkGameController, const widgetData : ref< SWidgetPackage > )
	{
		var customData : ControlledDeviceData;
		customData = ( ( ControlledDeviceData )( widgetData.customData ) );
		if( customData && customData.m_isNest )
		{
			m_nestIcon.SetVisible( true );
			m_deviceIcon.SetVisible( false );
		}
		else
		{
			m_nestIcon.SetVisible( false );
			m_deviceIcon.SetVisible( true );
		}
		if( customData && customData.m_isActive )
		{
			if( customData.m_isNest )
			{
				m_nestIcon.SetState( 'Active' );
			}
			else
			{
				m_deviceIcon.SetState( 'Active' );
			}
			m_activeBg.SetState( 'Active' );
		}
		else
		{
			if( customData.m_isNest )
			{
				m_nestIcon.SetState( 'Default' );
			}
			else
			{
				m_deviceIcon.SetState( 'Default' );
			}
			m_activeBg.SetState( 'Default' );
		}
	}

}

