class IncomingCallLogicController extends inkLogicController { private editable var m_contactNameWidget : inkTextRef; private editable var m_buttonHint : inkWidgetRef; private editable var m_avatar : inkImageRef; private var m_animProxy : inkAnimProxy; protected event OnInitialize() { GetRootWidget().SetVisible( false ); } public function SetCallInfo( const contactName : ref< String >, contactEntry : weak< JournalContact >, journalMgr : weak< JournalManager >, isRejectable : Bool ) { inkTextRef.SetLetterCase( m_contactNameWidget, textLetterCase.UpperCase ); inkTextRef.SetText( m_contactNameWidget, contactName ); InkImageUtils.RequestAvatarOrUnknown( this, m_avatar, contactEntry.GetAvatarID( journalMgr ) ); inkWidgetRef.SetVisible( m_buttonHint, isRejectable ); GetRootWidget().SetVisible( true ); if( m_animProxy ) { m_animProxy.UnregisterFromAllCallbacks( inkanimEventType.OnFinish ); m_animProxy.Stop(); m_animProxy = NULL; } m_animProxy = PlayLibraryAnimation( 'ring' ); m_animProxy.RegisterToCallback( inkanimEventType.OnFinish, this, 'OnRingAnimFinished' ); } protected event OnRingAnimFinished( proxy : inkAnimProxy ) { GetRootWidget().CallCustomCallback( 'OnIncomingCallFinished' ); } public function SetCallingPaused( pause : Bool ) { if( !( m_animProxy ) ) { return; } if( pause ) { m_animProxy.Pause(); } else { m_animProxy.Resume(); } } } class IncomingCallGameController extends gameuiNewPhoneRelatedHUDGameController { private editable var m_contactNameWidget : inkTextRef; private editable var m_buttonHint : inkWidgetRef; private var m_phoneBlackboard : weak< IBlackboard >; private var m_phoneBBDefinition : UI_ComDeviceDef; private var m_phoneCallInfoBBID : CallbackHandle; private var m_animProxy : inkAnimProxy; protected event OnInitialize() { if( !( isNewPhoneEnabled ) ) { m_phoneBBDefinition = GetAllBlackboardDefs().UI_ComDevice; m_phoneBlackboard = GetBlackboardSystem().Get( m_phoneBBDefinition ); if( m_phoneBlackboard ) { m_phoneCallInfoBBID = m_phoneBlackboard.RegisterDelayedListenerVariant( m_phoneBBDefinition.PhoneCallInformation, this, 'OnPhoneCall' ); } } GetRootWidget().SetVisible( false ); } protected event OnUninitialize() { if( m_phoneBlackboard ) { m_phoneBlackboard.UnregisterDelayedListener( m_phoneBBDefinition.PhoneCallInformation, m_phoneCallInfoBBID ); } } private function GetIncomingContact( phoneCallInfo : PhoneCallInformation ) : weak< JournalContact > { var i, limit : Int32; var currContact : weak< JournalContact >; var contactsList : array< weak< JournalEntry > >; var contactName : CName; var context : JournalRequestContext; var m_JournalMgr : weak< JournalManager >; m_JournalMgr = GameInstance.GetJournalManager( m_player.GetGame() ); context.stateFilter.active = true; context.stateFilter.inactive = true; contactName = phoneCallInfo.contactName; m_JournalMgr.GetContacts( context, contactsList ); for( i = 0, limit = contactsList.Size(); i < limit; i += 1 ) { currContact = ( ( JournalContact )( contactsList[ i ] ) ); if( currContact.GetId() == NameToString( contactName ) ) { return currContact; } } return NULL; } protected event OnPhoneCall( value : Variant ) { var shouldDisplay : Bool; var phoneCallInfo : PhoneCallInformation; var contact : weak< JournalContact >; var dummyJournalManager : IJournalManager; phoneCallInfo = ( ( PhoneCallInformation )value ); contact = GetIncomingContact( phoneCallInfo ); shouldDisplay = phoneCallInfo.callPhase == questPhoneCallPhase.IncomingCall && !( phoneCallInfo.isPlayerCalling ); inkTextRef.SetLetterCase( m_contactNameWidget, textLetterCase.UpperCase ); inkTextRef.SetText( m_contactNameWidget, contact.GetLocalizedName( dummyJournalManager ) ); inkWidgetRef.SetVisible( m_buttonHint, phoneCallInfo.isRejectable ); GetRootWidget().SetVisible( shouldDisplay ); if( m_animProxy ) { m_animProxy.Stop(); m_animProxy = NULL; } if( shouldDisplay ) { m_animProxy = PlayLibraryAnimation( 'ring' ); } } }