示例#1
0
/*
========================
idMenuScreen::HideScreen
========================
*/
void idMenuScreen::HideScreen( const mainMenuTransition_t transitionType )
{

	if( menuGUI == NULL )
	{
		return;
	}
	
	if( !BindSprite( menuGUI->GetRootObject() ) )
	{
		return;
	}
	
	if( transitionType == MENU_TRANSITION_SIMPLE )
	{
		GetSprite()->PlayFrame( "rollOff" );
	}
	else if( transitionType == MENU_TRANSITION_ADVANCE )
	{
		GetSprite()->PlayFrame( "rollOffBack" );
	}
	else
	{
		GetSprite()->PlayFrame( "rollOffFront" );
	}
	
	Update();
	
}
/*
========================
idMenuWidget_DynamicList::Update
========================
*/
void idMenuWidget_DynamicList::Update() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();

	if ( !BindSprite( root ) ) {
		return;
	}

	for ( int optionIndex = 0; optionIndex < GetNumVisibleOptions(); ++optionIndex ) {
		
		if ( optionIndex >= children.Num() ) {
			idSWFSpriteInstance * item = GetSprite()->GetScriptObject()->GetNestedSprite( va( "item%d", optionIndex ) );
			if ( item != NULL ) {
				item->SetVisible( false );
				continue;
			}
		}

		idMenuWidget & child = GetChildByIndex( optionIndex );
		const int childIndex = GetViewOffset() + optionIndex;
		bool shown = false;
		child.SetSpritePath( GetSpritePath(), va( "item%d", optionIndex ) );
		if ( child.BindSprite( root ) ) {
			
			if ( optionIndex >= GetTotalNumberOfOptions() ) {
				child.ClearSprite();
				continue;
			} else {
				//const int controlIndex = GetNumVisibleOptions() - Min( GetNumVisibleOptions(), GetTotalNumberOfOptions() ) + optionIndex;
				shown = PrepareListElement( child, childIndex );
				child.Update();
			}

			if ( !shown ) {
				child.SetState( WIDGET_STATE_HIDDEN );
			} else {
				if ( optionIndex == focusIndex ) {
					child.SetState( WIDGET_STATE_SELECTING );
				} else {
					child.SetState( WIDGET_STATE_NORMAL );
				}
			}
		}
	}

	idSWFSpriteInstance * const upSprite = GetSprite()->GetScriptObject()->GetSprite( "upIndicator" );
	if ( upSprite != NULL ) {
		upSprite->SetVisible( GetViewOffset() > 0 );
	}

	idSWFSpriteInstance * const downSprite = GetSprite()->GetScriptObject()->GetSprite( "downIndicator" );
	if ( downSprite != NULL ) {
		downSprite->SetVisible( GetViewOffset() + GetNumVisibleOptions() < GetTotalNumberOfOptions() );
	}

}
/*
========================
idMenuScreen_Shell_PressStart::ShowScreen
========================
*/
void idMenuScreen_Shell_PressStart::ShowScreen( const mainMenuTransition_t transitionType )
{

	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		if( g_demoMode.GetBool() )
		{
		
			idList<const idMaterial*> coverIcons;
			if( itemList != NULL )
			{
				itemList->SetListImages( coverIcons );
			}
			
			if( startButton != NULL )
			{
				startButton->BindSprite( root );
				startButton->SetLabel( idLocalization::GetString( "#str_swf_press_start" ) );
			}
			
			idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" );
			if( backing != NULL )
			{
				backing->SetVisible( false );
			}
			
		}
		else
		{
		
			idList<const idMaterial*> coverIcons;
			
			coverIcons.Append( doom3Cover );
			
			if( itemList != NULL )
			{
				itemList->SetListImages( coverIcons );
				itemList->SetFocusIndex( 1, true );
				itemList->SetViewIndex( 1 );
				itemList->SetMoveToIndex( 1 );
			}
			
			if( startButton != NULL )
			{
				startButton->BindSprite( root );
				startButton->SetLabel( "" );
			}
			
			idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" );
			if( backing != NULL )
			{
				backing->SetVisible( true );
			}
			
		}
	}
	
	idMenuScreen::ShowScreen( transitionType );
}
/*
========================
idMenuWidget_ScoreboardList::Update
========================
*/
void idMenuWidget_ScoreboardList::Update() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();

	if ( !BindSprite( root ) ) {
		return;
	}

	for ( int optionIndex = 0; optionIndex < GetNumVisibleOptions(); ++optionIndex ) {
		idMenuWidget & child = GetChildByIndex( optionIndex );
		const int childIndex = GetViewOffset() + optionIndex;
		bool shown = false;
		child.SetSpritePath( GetSpritePath(), va( "item%d", optionIndex ) );
		if ( child.BindSprite( root ) ) {
			shown = PrepareListElement( child, childIndex );

			if ( optionIndex == focusIndex && child.GetState() != WIDGET_STATE_SELECTED && child.GetState() != WIDGET_STATE_SELECTING ) {
				child.SetState( WIDGET_STATE_SELECTING );
			} else if ( optionIndex != focusIndex && child.GetState() != WIDGET_STATE_NORMAL ) {
				child.SetState( WIDGET_STATE_NORMAL );
			}

			child.Update();
		}
	}
}
/*
========================
idMenuWidget_InfoBox::Update
========================
*/
void idMenuWidget_InfoBox::Update() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( !BindSprite( root ) || GetSprite() == NULL ) {
		return;
	}

	idSWFTextInstance * txtHeading = GetSprite()->GetScriptObject()->GetNestedText( "info", "heading", "txtVal" );
	idSWFTextInstance * txtBody = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBody" );

	if ( txtHeading != NULL ) {
		txtHeading->SetText( heading );
	}

	if ( txtBody != NULL ) {
		txtBody->SetText( info );
	}

	if ( scrollbar != NULL && txtBody != NULL ) {
		txtBody->CalcMaxScroll();
		scrollbar->Update();
	}

	idSWFScriptObject * info = GetSprite()->GetScriptObject()->GetNestedObj( "info" );
	if ( info != NULL ) {
		info->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
		info->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
	}

}
/*
========================
idMenuScreen_Shell_Save::Update
========================
*/
void idMenuScreen_Shell_Save::Update()
{

	UpdateSaveEnumerations();
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			heading->SetText( "#str_02179" );	// SAVE GAME
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
/*
========================
idMenuScreen_Scoreboard::UpdateSpectating
========================
*/
void idMenuScreen_Scoreboard::UpdateSpectating( idStr spectating, idStr follow )
{

	if( GetSWFObject() )
	{
		idSWFScriptObject& root = GetSWFObject()->GetRootObject();
		if( BindSprite( root ) )
		{
		
			idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtSpectating" );
			if( txtVal != NULL )
			{
				txtVal->tooltip = true;
				txtVal->SetText( spectating );
				txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
			}
			
			txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtFollow" );
			if( txtVal != NULL )
			{
				txtVal->SetText( follow );
				txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
			}
		}
	}
}
/*
========================
idMenuWidget_ScrollBar::CalcTopAndBottom
========================
*/
void idMenuWidget_ScrollBar::CalcTopAndBottom() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( !BindSprite( root ) || GetSprite() == NULL ) {
		return;
	}

	int tempPos = 0.0f;
	idSWFSpriteInstance * curMC = GetSprite()->GetScriptObject()->GetNestedSprite( "top" );
	if ( curMC != NULL ) {
		tempPos = curMC->GetYPos();
		while ( curMC->parent != NULL ) {
			curMC = curMC->parent;
			tempPos += curMC->GetYPos();
		}
	}
	yTop = tempPos;

	tempPos = 0.0f;
	curMC = GetSprite()->GetScriptObject()->GetNestedSprite( "bottom" );
	if ( curMC != NULL ) {
		tempPos = curMC->GetYPos();
		while ( curMC->parent != NULL ) {
			curMC = curMC->parent;
			tempPos += curMC->GetYPos();
		}
	}
	yBot = tempPos;
}
/*
========================
idMenuScreen_Scoreboard::UpdateTeamScores
========================
*/
void idMenuScreen_Scoreboard::UpdateTeamScores( int r, int b )
{

	if( GetSWFObject() )
	{
		idSWFScriptObject& root = GetSWFObject()->GetRootObject();
		if( BindSprite( root ) )
		{
		
			idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtRedScore" );
			if( txtVal != NULL )
			{
				txtVal->SetText( va( "%i", r ) );
				txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
			}
			
			txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBlueScore" );
			if( txtVal != NULL )
			{
				txtVal->SetText( va( "%i", b ) );
				txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
			}
		}
	}
}
/*
========================
idMenuWidget_MenuBar::Update
========================
*/
void idMenuWidget_MenuBar::Update()
{

	if( GetSWFObject() == NULL )
	{
		return;
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	
	if( !BindSprite( root ) )
	{
		return;
	}
	
	totalWidth = 0.0f;
	buttonPos = 0.0f;
	
	for( int index = 0; index < GetNumVisibleOptions(); ++index )
	{
	
		if( index >= children.Num() )
		{
			break;
		}
		
		if( index != 0 )
		{
			totalWidth += rightSpacer;
		}
		
		idMenuWidget& child = GetChildByIndex( index );
		child.SetSpritePath( GetSpritePath(), va( "btn%d", index ) );
		if( child.BindSprite( root ) )
		{
			PrepareListElement( child, index );
			child.Update();
		}
	}
	
	// 640 is half the size of our flash files width
	float xPos = 640.0f - ( totalWidth / 2.0f );
	GetSprite()->SetXPos( xPos );
	
	idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" );
	if( backing != NULL )
	{
		if( menuData != NULL && menuData->GetPlatform() != 2 )
		{
			backing->SetVisible( false );
		}
		else
		{
			backing->SetVisible( true );
			backing->SetXPos( totalWidth / 2.0f );
		}
	}
	
}
/*
========================
idMenuScreen_Shell_Leaderboards::Update
========================
*/
void idMenuScreen_Shell_Leaderboards::Update()
{

	if( menuData != NULL )
	{
		idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
		if( cmdBar != NULL )
		{
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 );
			buttonInfo->label = "#str_online_leaderboards_toggle_filter";
			buttonInfo->action.Set( WIDGET_ACTION_JOY3_ON_PRESS );
			
			if( !lbCache->IsLoadingNewLeaderboard() && !lbCache->IsRequestingRows() && options != NULL && options->GetTotalNumberOfOptions() > 0 )
			{
				buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
				if( menuData->GetPlatform() != 2 )
				{
					buttonInfo->label = "#str_swf_view_profile";
				}
				buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
			}
		}
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			heading->SetText( lbCache->GetFilterStrType() );
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
/*
========================
idMenuScreen_Shell_ControllerLayout::Update
========================
*/
void idMenuScreen_Shell_ControllerLayout::Update() {

	if ( menuData != NULL ) {
		idMenuWidget_CommandBar * cmdBar = menuData->GetCmdBar();
		if ( cmdBar != NULL ) {
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t * buttonInfo;			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if ( menuData->GetPlatform() != 2 ) {
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );

			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
		}		
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( BindSprite( root ) ) {
		idSWFTextInstance * heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if ( heading != NULL ) {
			heading->SetText( "#str_swf_controller_layout" );	// CONTROLLER LAYOUT
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}

		idSWFSpriteInstance * gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if ( gradient != NULL && heading != NULL ) {
			gradient->SetXPos( heading->GetTextLength() );
		}

		if ( menuData != NULL ) {
			idSWFSpriteInstance * layout = NULL; 
			
			layout = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "controlInfo", "layout360" );
			
			if ( layout != NULL ) {
				if ( menuData->GetPlatform( true ) == 2 ) {
					layout->StopFrame( 1 );
				} else {
					layout->StopFrame( menuData->GetPlatform( true ) + 1 );
				}
			}
		}
	}

	if ( btnBack != NULL ) {
		btnBack->BindSprite( root );
	}



	idMenuScreen::Update();
}
void idMenuWidget_PDA_VideoInfo::Update()
{

	if( GetSWFObject() == NULL )
	{
		return;
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( !BindSprite( root ) || GetSprite() == NULL )
	{
		return;
	}
	
	idPlayer* player = gameLocal.GetLocalPlayer();
	if( player == NULL )
	{
		return;
	}
	
	idSWFTextInstance* txtHeading = GetSprite()->GetScriptObject()->GetNestedText( "txtName" );
	idSWFTextInstance* txtInfo = GetSprite()->GetScriptObject()->GetNestedText( "txtInfo" );
	
	int numVideos = player->GetInventory().videos.Num();
	if( numVideos != 0 )
	{
		const idDeclVideo* video = player->GetVideo( videoIndex );
		if( video != NULL )
		{
			if( txtHeading != NULL )
			{
				txtHeading->SetText( video->GetVideoName() );
			}
			
			if( txtInfo != NULL )
			{
				txtInfo->SetText( video->GetInfo() );
			}
		}
	}
	else
	{
		if( txtHeading != NULL )
		{
			txtHeading->SetText( "" );
		}
		
		if( txtInfo != NULL )
		{
			txtInfo->SetText( "" );
		}
	}
}
/*
========================
idMenuScreen_Shell_Controls::Update
========================
*/
void idMenuScreen_Shell_Controls::Update()
{

	if( menuData != NULL )
	{
		idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
		if( cmdBar != NULL )
		{
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_SWF_SELECT";
			}
			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
		}
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			idStr controls( idLocalization::GetString( "#str_04158" ) );
			controls.ToUpper();
			heading->SetText( controls );	// CONTROLS
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
/*
========================
idMenuWidget_ScrollBar::Update
========================
*/
void idMenuWidget_ScrollBar::Update() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( !BindSprite( root ) || GetSprite() == NULL ) {
		return;
	}

	if ( GetParent() == NULL ) {
		return;
	}

	CalcTopAndBottom();

	idSWFScriptObject * node = GetSprite()->GetScriptObject()->GetNestedObj( "node" );
	idSWFSpriteInstance * nodeSprite = GetSprite()->GetScriptObject()->GetNestedSprite( "node" );
	if ( node != NULL && nodeSprite != NULL ) {
		node->Set( "onDrag", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_DRAG_START, 0 ) );
		node->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_DRAG_STOP, 0 ) );
	
		const idMenuWidget_DynamicList * const list = dynamic_cast< const idMenuWidget_DynamicList * const >( GetParent() );
		if ( list != NULL ) {
			float percent = 0.0f;
			if ( ( list->GetTotalNumberOfOptions() - list->GetNumVisibleOptions() ) > 0 ) {
				percent = (float)list->GetViewOffset() / ( (float)list->GetTotalNumberOfOptions() - list->GetNumVisibleOptions() );
				float range = yBot - yTop;
				nodeSprite->SetVisible( true );
				nodeSprite->SetYPos( percent * range );
				//GetSprite()->StopFrame( int( ( percent * 100.0f ) + 2.0f ) );
			} else {
				nodeSprite->SetVisible( 0 );
			}
		}

		idMenuWidget_InfoBox * const infoBox = dynamic_cast< idMenuWidget_InfoBox * const >( GetParent() );
		if ( infoBox != NULL ) {
			float percent = 0.0f;
			if ( infoBox->GetMaxScroll() == 0 ) {
				nodeSprite->SetVisible( 0 );
			} else {
				percent = (float)infoBox->GetScroll() / (float)infoBox->GetMaxScroll();
				float range = yBot - yTop;
				nodeSprite->SetVisible( true );
				nodeSprite->SetYPos( percent * range );
				//GetSprite()->StopFrame( int( ( percent * 100.0f ) + 2.0f ) );
			}
		}
	}
}
/*
========================
idMenuScreen_Scoreboard::UpdateGameInfo
========================
*/
void idMenuScreen_Scoreboard::UpdateGameInfo( idStr gameInfo ) {

	if ( GetSWFObject() )  {
		idSWFScriptObject & root = GetSWFObject()->GetRootObject();
		if ( BindSprite( root ) ) {

			idSWFTextInstance * txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtGameInfo" );
			if ( txtVal != NULL ) {
				txtVal->SetText( gameInfo );
				txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
			}
		}
	}
}
/*
========================
idMenuWidget_LobbyList::Update
========================
*/
void idMenuWidget_LobbyList::Update()
{

	if( GetSWFObject() == NULL )
	{
		return;
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	
	if( !BindSprite( root ) )
	{
		return;
	}
	
	for( int i = 0; i < headings.Num(); ++i )
	{
		idSWFTextInstance* txtHeading = GetSprite()->GetScriptObject()->GetNestedText( va( "heading%d", i ) );
		if( txtHeading != NULL )
		{
			txtHeading->SetText( headings[i] );
			txtHeading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
	}
	
	for( int optionIndex = 0; optionIndex < GetNumVisibleOptions(); ++optionIndex )
	{
		bool shown = false;
		if( optionIndex < GetChildren().Num() )
		{
			idMenuWidget& child = GetChildByIndex( optionIndex );
			child.SetSpritePath( GetSpritePath(), va( "item%d", optionIndex ) );
			if( child.BindSprite( root ) )
			{
				shown = PrepareListElement( child, optionIndex );
				if( shown )
				{
					child.GetSprite()->SetVisible( true );
					child.Update();
				}
				else
				{
					child.GetSprite()->SetVisible( false );
				}
			}
		}
	}
}
示例#18
0
/*
========================
idMenuWidget_InfoBox::ObserveEvent
========================
*/
void idMenuWidget_InfoBox::ResetInfoScroll() {

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( !BindSprite( root ) || GetSprite() == NULL ){
		return;
	}

	idSWFTextInstance * txtBody = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBody" );
	if ( txtBody != NULL ) {
		txtBody->scroll = 0;
	}

	if ( scrollbar != NULL ) {
		scrollbar->Update();
	}
}
/*
========================
idMenuScreen_PDA_Inventory::Initialize
========================
*/
void idMenuScreen_PDA_Inventory::Initialize( idMenuHandler * data ) {

	AddEventAction( WIDGET_EVENT_TAB_NEXT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_NEXT, WIDGET_EVENT_TAB_NEXT ) );
	AddEventAction( WIDGET_EVENT_TAB_PREV ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_PREV, WIDGET_EVENT_TAB_PREV ) );

	if ( data != NULL ) {
		menuGUI = data->GetGUI();
	}
	SetSpritePath( "menuItems" );

	if ( menuGUI != NULL ) {
		idSWFScriptObject & root = menuGUI->GetRootObject();
		BindSprite( root );
	}

	infoBox.SetSpritePath( GetSpritePath(), "info", "details" );
	infoBox.Initialize( data );
	infoBox.SetNoAutoFree( true );
	
	itemList.SetSpritePath( GetSpritePath(), "info", "options" );
	itemList.SetNumVisibleOptions( NUM_INVENTORY_ITEMS_VISIBLE );
	itemList.SetNoAutoFree( true );
	while ( itemList.GetChildren().Num() < NUM_INVENTORY_ITEMS_VISIBLE ) {
		idMenuWidget_Button * const buttonWidget = new (TAG_SWF) idMenuWidget_Button();
		buttonWidget->Initialize( data );
		buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_SELECT_PDA_ITEM, itemList.GetChildren().Num() );		
		itemList.AddChild( buttonWidget );
	}
	itemList.Initialize( data );

	AddChild( &itemList );
	AddChild( &infoBox );
	//AddChild( assignment );

	AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT ) );
	AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT ) );
	AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_RELEASE ) );
	AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_RELEASE ) );
	AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK ) );
	AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK ) );
	AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ) );
	AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ) );


	idMenuScreen::Initialize( data );
}
/*
========================
idMenuScreen_Shell_Stereoscopics::Update
========================
*/
void idMenuScreen_Shell_Stereoscopics::Update()
{

	if( menuData != NULL )
	{
		idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
		if( cmdBar != NULL )
		{
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
		}
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			heading->SetText( "#str_swf_stereoscopics_heading" );	// STEREOSCOPIC RENDERING
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
/*
========================
idMenuScreen_Shell_GameBrowser::ShowScreen
========================
*/
void idMenuScreen_Shell_GameBrowser::ShowScreen( const mainMenuTransition_t transitionType ) {
	idMenuHandler_Shell * const mgr = dynamic_cast< idMenuHandler_Shell * >( menuData );
	if ( mgr == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
	if ( BindSprite( root ) ) {
		idSWFTextInstance * heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if ( heading != NULL ) {
			heading->SetText( "#str_swf_pwf_heading" );	// MULTIPLAYER
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}

		idSWFSpriteInstance * gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if ( gradient != NULL && heading != NULL ) {
			gradient->SetXPos( heading->GetTextLength() );
		}
	}

	listWidget->ClearGames();

	if ( mgr->GetCmdBar() != NULL ) {
		idMenuWidget_CommandBar::buttonInfo_t * buttonInfo;

		mgr->GetCmdBar()->ClearAllButtons();

		buttonInfo = mgr->GetCmdBar()->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
		if ( menuData->GetPlatform() != 2 ) {
			buttonInfo->label = "#str_00395";
		}
		buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );

		buttonInfo = mgr->GetCmdBar()->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 );
		buttonInfo->label = "#str_02276";
		buttonInfo->action.Set( WIDGET_ACTION_COMMAND, BROWSER_COMMAND_REFRESH_SERVERS );
	}

	mgr->HidePacifier();

	idMenuScreen::ShowScreen( transitionType );
	UpdateServerList();
}
示例#22
0
/*
========================
idMenuScreen::ShowScreen
========================
*/
void idMenuScreen::ShowScreen( const mainMenuTransition_t transitionType )
{
	if( menuGUI == NULL )
	{
		return;
	}
	
	if( !BindSprite( menuGUI->GetRootObject() ) )
	{
		return;
	}
	
	GetSprite()->SetVisible( true );
	if( transitionType == MENU_TRANSITION_SIMPLE )
	{
		if( menuData != NULL && menuData->ActiveScreen() != -1 )
		{
			menuData->PlaySound( GUI_SOUND_BUILD_ON );
		}
		GetSprite()->PlayFrame( "rollOn" );
	}
	else if( transitionType == MENU_TRANSITION_ADVANCE )
	{
		if( menuData != NULL && menuData->ActiveScreen() != -1 )
		{
			menuData->PlaySound( GUI_SOUND_BUILD_ON );
		}
		GetSprite()->PlayFrame( "rollOnFront" );
	}
	else
	{
		if( menuData != NULL )
		{
			menuData->PlaySound( GUI_SOUND_BUILD_OFF );
		}
		GetSprite()->PlayFrame( "rollOnBack" );
	}
	
	Update();
	
	SetFocusIndex( GetFocusIndex(), true );
}
示例#23
0
/*
========================
idMenuWidget::Hide
========================
*/
void idMenuWidget::Hide()
{
	if( GetSWFObject() == NULL )
	{
		return;
	}
	
	if( !BindSprite( GetSWFObject()->GetRootObject() ) )
	{
		return;
	}
	
	int currentFrame = GetSprite()->GetCurrentFrame();
	int findFrame = GetSprite()->FindFrame( "rollOff" );
	if( currentFrame >= findFrame || currentFrame == 1 )
	{
		return;
	}
	
	GetSprite()->PlayFrame( findFrame );
}
/*
========================
idMenuScreen_Shell_PartyLobby::ShowScreen
========================
*/
void idMenuScreen_Shell_PartyLobby::ShowScreen( const mainMenuTransition_t transitionType )
{

	isPeer = false;
	isHost = false;
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFSpriteInstance* waitTime = GetSprite()->GetScriptObject()->GetNestedSprite( "waitTime" );
		if( waitTime != NULL )
		{
			waitTime->SetVisible( false );
		}
	}
	
	if( session->GetPartyLobbyBase().IsHost() )
	{
		idMatchParameters matchParameters = session->GetPartyLobbyBase().GetMatchParms();
		if( net_inviteOnly.GetBool() )
		{
			matchParameters.matchFlags |= MATCH_INVITE_ONLY;
		}
		else
		{
			matchParameters.matchFlags &= ~MATCH_INVITE_ONLY;
		}
		
		matchParameters.numSlots = session->GetTitleStorageInt( "MAX_PLAYERS_ALLOWED", 4 );
		
		session->UpdatePartyParms( matchParameters );
	}
	
	idMenuScreen::ShowScreen( transitionType );
	if( lobby != NULL )
	{
		lobby->SetFocusIndex( 0 );
	}
}
示例#25
0
/*
========================
idMenuWidget::Show
========================
*/
void idMenuWidget::Show()
{
	if( GetSWFObject() == NULL )
	{
		return;
	}
	
	if( !BindSprite( GetSWFObject()->GetRootObject() ) )
	{
		return;
	}
	
	GetSprite()->SetVisible( true );
	int currentFrame = GetSprite()->GetCurrentFrame();
	int findFrame = GetSprite()->FindFrame( "rollOn" );
	int idleFrame = GetSprite()->FindFrame( "idle" );
	if( currentFrame == findFrame || ( currentFrame > 1 && currentFrame <= idleFrame ) )
	{
		return;
	}
	
	GetSprite()->PlayFrame( findFrame );
}
/*
========================
idMenuScreen_Shell_PartyLobby::Update
========================
*/
void idMenuScreen_Shell_PartyLobby::Update()
{

	idLobbyBase& activeLobby = session->GetPartyLobbyBase();
	if( lobby != NULL )
	{
		if( activeLobby.GetNumActiveLobbyUsers() != 0 )
		{
			if( lobby->GetFocusIndex() >= activeLobby.GetNumActiveLobbyUsers() )
			{
				lobby->SetFocusIndex( activeLobby.GetNumActiveLobbyUsers() - 1 );
				lobby->SetViewIndex( lobby->GetViewOffset() + lobby->GetFocusIndex() );
			}
		}
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			heading->SetText( "#str_swf_multiplayer" );	// MULTIPLAYER
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	UpdateOptions();
	
	if( menuData != NULL && menuData->NextScreen() == SHELL_AREA_PARTY_LOBBY )
	{
		idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
		if( cmdBar != NULL )
		{
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_SWF_SELECT";
			}
			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
			
			lobbyUserID_t luid;
			if( isHost && CanKickSelectedPlayer( luid ) )
			{
				buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY4 );
				buttonInfo->label = "#str_swf_kick";
				buttonInfo->action.Set( WIDGET_ACTION_JOY4_ON_PRESS );
			}
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_swf_view_profile";
			}
			buttonInfo->action.Set( WIDGET_ACTION_SELECT_GAMERTAG );
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
/*
========================
idMenuScreen_Shell_GameLobby::UpdateLobby
========================
*/
void idMenuScreen_Shell_GameLobby::UpdateLobby()
{

	if( menuData != NULL && menuData->ActiveScreen() != SHELL_AREA_GAME_LOBBY )
	{
		return;
	}
	
	// Keep this menu in sync with the session host/peer status.
	if( session->GetActivePlatformLobbyBase().IsHost() && !isHost )
	{
		Update();
	}
	
	if( session->GetActivePlatformLobbyBase().IsPeer() && !isPeer )
	{
		Update();
	}
	
	if( !privateGameLobby )
	{
		int ms = 0;
		if( session->GetActivePlatformLobbyBase().IsHost() )
		{
			idMenuHandler_Shell* handler = dynamic_cast< idMenuHandler_Shell* const >( menuData );
			if( handler != NULL )
			{
				if( session->GetActivePlatformLobbyBase().IsLobbyFull() )
				{
					longCountdown = Sys_Milliseconds() + longCountRemaining;
					int timeRemaining = shortCountdown - Sys_Milliseconds();
					if( timeRemaining < 0 )
					{
						timeRemaining = 0;
					}
					ms = ( int ) ceilf( timeRemaining / 1000.0f );
					handler->SetTimeRemaining( timeRemaining );
				}
				else if( session->GetActivePlatformLobbyBase().GetNumLobbyUsers() > 1 )
				{
					int timeRemaining = longCountdown - Sys_Milliseconds();
					if( timeRemaining > WAIT_START_TIME_SHORT )
					{
						shortCountdown = Sys_Milliseconds() + WAIT_START_TIME_SHORT;
					}
					else
					{
						shortCountdown = timeRemaining;
					}
					longCountRemaining = timeRemaining;
					if( timeRemaining < 0 )
					{
						timeRemaining = 0;
					}
					ms = ( int ) ceilf( timeRemaining / 1000.0f );
					handler->SetTimeRemaining( timeRemaining );
				}
				else
				{
					ms = 0;
					longCountdown = Sys_Milliseconds() + WAIT_START_TIME_LONG;
					longCountRemaining = longCountdown;
					shortCountdown = Sys_Milliseconds() + WAIT_START_TIME_SHORT;
					handler->SetTimeRemaining( longCountRemaining );
				}
			}
		}
		else
		{
			if( menuData != NULL )
			{
				idMenuHandler_Shell* handler = dynamic_cast< idMenuHandler_Shell* const >( menuData );
				if( handler != NULL )
				{
					ms = ( int ) ceilf( handler->GetTimeRemaining() / 1000.0f );
				}
			}
		}
		
		idSWFScriptObject& root = GetSWFObject()->GetRootObject();
		if( BindSprite( root ) )
		{
			idSWFTextInstance* waitTime = GetSprite()->GetScriptObject()->GetNestedText( "waitTime", "txtVal" );
			if( waitTime != NULL )
			{
				idStr status;
				if( ms == 1 )
				{
					status = idLocalization::GetString( "#str_online_game_starts_in_second" );
					status.Replace( "<DNT_VAL>", idStr( ms ) );
					waitTime->SetText( status );
				}
				else if( ms > 0 && ms < 30 )
				{
					status = idLocalization::GetString( "#str_online_game_starts_in_seconds" );
					status.Replace( "<DNT_VAL>", idStr( ms ) );
					waitTime->SetText( status );
				}
				else
				{
					waitTime->SetText( "" );
				}
				waitTime->SetStrokeInfo( true, 0.75f, 2.0f );
			}
		}
		Update();
		
	}
	else
	{
	
		if( isPeer )
		{
			Update();
		}
		
	}
	
	if( session->GetState() == idSession::GAME_LOBBY )
	{
	
		if( options != NULL )
		{
			if( options->GetFocusIndex() >= options->GetTotalNumberOfOptions() && options->GetTotalNumberOfOptions() > 0 )
			{
				options->SetViewIndex( options->GetTotalNumberOfOptions() - 1 );
				options->SetFocusIndex( options->GetTotalNumberOfOptions() - 1 );
			}
		}
		
		idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms();
		
		idSWFTextInstance* mapName = GetSprite()->GetScriptObject()->GetNestedText( "matchInfo", "txtMapName" );
		idSWFTextInstance* modeName = GetSprite()->GetScriptObject()->GetNestedText( "matchInfo", "txtModeName" );
		
		if( mapName != NULL )
		{
			const idList< mpMap_t > maps = common->GetMapList();
			idStr name = idLocalization::GetString( maps[ idMath::ClampInt( 0, maps.Num() - 1, matchParameters.gameMap ) ].mapName );
			mapName->SetText( name );
			mapName->SetStrokeInfo( true );
		}
		
		if( modeName != NULL )
		{
			const idStrList& modes = common->GetModeDisplayList();
			idStr mode = idLocalization::GetString( modes[ idMath::ClampInt( 0, modes.Num() - 1, matchParameters.gameMode ) ] );
			modeName->SetText( mode );
			modeName->SetStrokeInfo( true );
		}
		
		idSWFTextInstance* privacy = GetSprite()->GetScriptObject()->GetNestedText( "matchInfo", "txtPrivacy" );
		if( privacy != NULL )
		{
			if( isPeer || !privateGameLobby )
			{
				privacy->SetText( "" );
			}
			else
			{
				int bitSet = ( matchParameters.matchFlags & MATCH_INVITE_ONLY );
				bool privacySet = ( bitSet != 0 ? true : false );
				if( privacySet )
				{
					privacy->SetText( "#str_swf_privacy_closed" );
					privacy->SetStrokeInfo( true );
				}
				else if( !privacySet )
				{
					privacy->SetText( "#str_swf_privacy_open" );
					privacy->SetStrokeInfo( true );
				}
			}
		}
		
		idLocalUser* user = session->GetSignInManager().GetMasterLocalUser();
		if( user != NULL && options != NULL )
		{
			if( user->IsInParty() && user->GetPartyCount() > 1 && !session->IsPlatformPartyInLobby() && menuOptions.Num() > 0 )
			{
				if( menuOptions[ menuOptions.Num() - 1 ][0] != "#str_swf_invite_xbox_live_party" )
				{
					menuOptions[ menuOptions.Num() - 1 ][0] = "#str_swf_invite_xbox_live_party";	// invite Xbox LIVE party
					options->SetListData( menuOptions );
					options->Update();
				}
			}
			else if( menuOptions.Num() > 0 )
			{
				if( menuOptions[ menuOptions.Num() - 1 ][0] != "#str_swf_invite_friends" )
				{
					menuOptions[ menuOptions.Num() - 1 ][0] = "#str_swf_invite_friends";	// invite Xbox LIVE party
					options->SetListData( menuOptions );
					options->Update();
				}
			}
		}
	}
	
	// setup names for lobby;
	if( lobby != NULL )
	{
		idMenuHandler_Shell* mgr = dynamic_cast< idMenuHandler_Shell* >( menuData );
		if( mgr != NULL )
		{
			mgr->UpdateLobby( lobby );
			lobby->Update();
		}
		
		if( lobby->GetNumEntries() > 0 && lobby->GetFocusIndex() >= lobby->GetNumEntries() )
		{
			lobby->SetFocusIndex( lobby->GetNumEntries() - 1 );
			lobby->SetViewIndex( lobby->GetNumEntries() - 1 );
		}
	}
}
/*
========================
idMenuScreen_Shell_GameLobby::ShowScreen
========================
*/
void idMenuScreen_Shell_GameLobby::ShowScreen( const mainMenuTransition_t transitionType )
{

	if( options != NULL )
	{
		options->SetFocusIndex( 0 );
		options->SetViewIndex( 0 );
	}
	
	isHost = false;
	isPeer = false;
	
	idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms();
	
	// Make sure map name is up to date.
	if( matchParameters.gameMap >= 0 )
	{
		matchParameters.mapName = common->GetMapList()[ matchParameters.gameMap ].mapFile;
	}
	
	privateGameLobby = MatchTypeIsPrivate( matchParameters.matchFlags );
	
	if( !privateGameLobby )  	// Public Game Lobby
	{
		menuOptions.Clear();
		idList< idStr > option;
		
		if( options != NULL )
		{
			option.Append( "#str_swf_invite_friends" );	// Invite Friends
			menuOptions.Append( option );
			option.Clear();
			
			int index = 0;
			options->GetChildByIndex( index ).ClearEventActions();
			options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_INVITE, 0 );
			idMenuWidget_Button* buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) );
			if( buttonWidget != NULL )
			{
				buttonWidget->SetDescription( "#str_swf_invite_desc" );
			}
			
			options->SetListData( menuOptions );
		}
		
		longCountdown = Sys_Milliseconds() + WAIT_START_TIME_LONG;
		longCountRemaining = longCountdown;
		shortCountdown = Sys_Milliseconds() + WAIT_START_TIME_SHORT;
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFSpriteInstance* waitTime = GetSprite()->GetScriptObject()->GetNestedSprite( "waitTime" );
		if( waitTime != NULL )
		{
			waitTime->SetVisible( !privateGameLobby );
		}
	}
	
	idMenuScreen::ShowScreen( transitionType );
	
	if( lobby != NULL )
	{
		lobby->SetFocusIndex( 0 );
	}
	
	session->UpdateMatchParms( matchParameters );
}
/*
========================
idMenuScreen_Shell_GameLobby::Update
========================
*/
void idMenuScreen_Shell_GameLobby::Update()
{

	idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase();
	if( lobby != NULL )
	{
	
		if( activeLobby.GetNumActiveLobbyUsers() != 0 )
		{
			if( lobby->GetFocusIndex() >= activeLobby.GetNumActiveLobbyUsers() )
			{
				lobby->SetFocusIndex( activeLobby.GetNumActiveLobbyUsers() - 1 );
				lobby->SetViewIndex( lobby->GetViewOffset() + lobby->GetFocusIndex() );
			}
		}
	}
	
	idSWFScriptObject& root = GetSWFObject()->GetRootObject();
	if( BindSprite( root ) )
	{
		idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
		if( heading != NULL )
		{
			heading->SetText( "#str_swf_multiplayer" );	// MULTIPLAYER
			heading->SetStrokeInfo( true, 0.75f, 1.75f );
		}
		
		idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
		if( gradient != NULL && heading != NULL )
		{
			gradient->SetXPos( heading->GetTextLength() );
		}
	}
	
	if( privateGameLobby && options != NULL )
	{
	
		if( session->GetActivePlatformLobbyBase().IsHost() && !isHost )
		{
		
			menuOptions.Clear();
			idList< idStr > option;
			
			isHost = true;
			isPeer = false;
			
			option.Append( "#str_swf_start_match" );	// Start match
			menuOptions.Append( option );
			option.Clear();
			
			option.Append( "#str_swf_match_settings" );	// Match Settings
			menuOptions.Append( option );
			option.Clear();
			
			option.Append( "#str_swf_invite_only" );	// Toggle privacy
			menuOptions.Append( option );
			option.Clear();
			
			option.Append( "#str_swf_invite_friends" );	// Invite Friends
			menuOptions.Append( option );
			option.Clear();
			
			idMenuWidget_Button* buttonWidget = NULL;
			int index = 0;
			options->GetChildByIndex( index ).ClearEventActions();
			options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_START, 0 );
			buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) );
			if( buttonWidget != NULL )
			{
				buttonWidget->SetDescription( "#str_swf_quick_start_desc" );
			}
			index++;
			options->GetChildByIndex( index ).ClearEventActions();
			options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_SETTINGS, 1 );
			buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) );
			if( buttonWidget != NULL )
			{
				buttonWidget->SetDescription( "#str_swf_match_setting_desc" );
			}
			index++;
			options->GetChildByIndex( index ).ClearEventActions();
			options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_TOGGLE_PRIVACY, 2 );
			buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) );
			if( buttonWidget != NULL )
			{
				buttonWidget->SetDescription( "#str_swf_toggle_privacy_desc" );
			}
			index++;
			options->GetChildByIndex( index ).ClearEventActions();
			options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_INVITE, 3 );
			buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) );
			if( buttonWidget != NULL )
			{
				buttonWidget->SetDescription( "#str_swf_invite_desc" );
			}
			index++;
			
			options->SetListData( menuOptions );
			
		}
		else if( session->GetActivePlatformLobbyBase().IsPeer() )
		{
		
			if( !isPeer )
			{
			
				menuOptions.Clear();
				idList< idStr > option;
				
				option.Append( "#str_swf_invite_friends" );	// Invite Friends
				menuOptions.Append( option );
				option.Clear();
				
				idMenuWidget_Button* buttonWidget = NULL;
				int index = 0;
				options->GetChildByIndex( index ).ClearEventActions();
				options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_INVITE, 0 );
				buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) );
				if( buttonWidget != NULL )
				{
					buttonWidget->SetDescription( "#str_swf_invite_desc" );
				}
				
				options->SetListData( menuOptions );
			}
			
			isPeer = true;
			isHost = false;
		}
	}
	
	if( menuData != NULL )
	{
		idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
		if( cmdBar != NULL )
		{
			cmdBar->ClearAllButtons();
			idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_00395";
			}
			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_swf_view_profile";
			}
			buttonInfo->action.Set( WIDGET_ACTION_SELECT_GAMERTAG );
			
			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
			if( menuData->GetPlatform() != 2 )
			{
				buttonInfo->label = "#str_SWF_SELECT";
			}
			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
			
			lobbyUserID_t luid;
			if( isHost && CanKickSelectedPlayer( luid ) )
			{
				buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY4 );
				buttonInfo->label = "#str_swf_kick";
				buttonInfo->action.Set( WIDGET_ACTION_JOY4_ON_PRESS );
			}
		}
	}
	
	if( btnBack != NULL )
	{
		btnBack->BindSprite( root );
	}
	
	idMenuScreen::Update();
}
示例#30
0
/*
========================
idMenuWidget_CommandBar::Update
========================
*/
void idMenuWidget_CommandBar::Update() {

	if ( GetSWFObject() == NULL ) {
		return;
	}

	idSWFScriptObject & root = GetSWFObject()->GetRootObject();

	if ( !BindSprite( root ) ) {
		return;
	}

	const int BASE_PADDING			= 35;
	const int PER_BUTTON_PADDING	= 65;
	const int ALIGNMENT_SCALE		= ( GetAlignment() == LEFT ) ? 1 : -1;

	int xPos = ALIGNMENT_SCALE * BASE_PADDING;

	// Setup the button order.
	idStaticList< button_t, MAX_BUTTONS > buttonOrder;
	for ( int i = 0; i < buttonOrder.Max(); ++i ) {
		buttonOrder.Append( static_cast< button_t >( i ) );
	}

	// NOTE: Special consideration is done for JPN PS3 where the standard accept button is
	// swapped with the standard back button.  i.e. In US: X = Accept, O = Back, but in JPN
	// X = Back, O = Accept.
	if ( GetSWFObject()->UseCircleForAccept() ) {
		buttonOrder[ BUTTON_JOY2 ] = BUTTON_JOY1;
		buttonOrder[ BUTTON_JOY1 ] = BUTTON_JOY2;
	}

	// FIXME: handle animating in of the button bar?
	GetSprite()->SetVisible( true );

	idStr shortcutName;
	for ( int i = 0; i < buttonOrder.Num(); ++i ) {
		const char * const buttonName = BUTTON_NAMES[ buttonOrder[ i ] ];

		idSWFSpriteInstance * const buttonSprite = GetSprite()->GetScriptObject()->GetSprite( buttonName );
		if ( buttonSprite == NULL ) {
			continue;
		}
		idSWFTextInstance * const buttonText = buttonSprite->GetScriptObject()->GetText( "txt_info" );
		if ( buttonText == NULL ) {
			continue;
		}
		idSWFSpriteInstance * const imageSprite = buttonSprite->GetScriptObject()->GetSprite( "img" );
		if ( imageSprite == NULL ) {
			continue;
		}

		if ( buttons[ i ].action.GetType() != WIDGET_ACTION_NONE ) {
			idSWFScriptObject * const shortcutKeys = GetSWFObject()->GetGlobal( "shortcutKeys" ).GetObject();
			if ( verify( shortcutKeys != NULL ) ) {
				buttonSprite->GetScriptObject()->Set( "onPress", new WrapWidgetSWFEvent( this, WIDGET_EVENT_COMMAND, i ) );

				// bind the main action - need to use all caps here because shortcuts are stored that way
				shortcutName = buttonName;
				shortcutName.ToUpper();
				shortcutKeys->Set( shortcutName, buttonSprite->GetScriptObject()  );

				// Some other keys have additional bindings. Remember that the button here is
				// actually the virtual button, and the physical button could be swapped based
				// on the UseCircleForAccept business on JPN PS3.
				switch ( i ) {
					case BUTTON_JOY1: {
						shortcutKeys->Set( "ENTER", buttonSprite->GetScriptObject() );
						break;
					}
					case BUTTON_JOY2: {
						shortcutKeys->Set( "ESCAPE", buttonSprite->GetScriptObject() );
						shortcutKeys->Set( "BACKSPACE", buttonSprite->GetScriptObject() );
						break;
					}
					case BUTTON_TAB: {
						shortcutKeys->Set( "K_TAB", buttonSprite->GetScriptObject() );
						break;
					}
				}
			}

			if ( buttons[ i ].label.IsEmpty() ) {
				buttonSprite->SetVisible( false );
			} else {
				imageSprite->SetVisible( true );
				imageSprite->StopFrame( menuData->GetPlatform() + 1 );
				buttonSprite->SetVisible( true );
				buttonSprite->SetXPos( xPos );
				buttonText->SetText( buttons[ i ].label );
				xPos += ALIGNMENT_SCALE * ( buttonText->GetTextLength() + PER_BUTTON_PADDING );
			}			
		} else {
			buttonSprite->SetVisible( false );
			idSWFScriptObject * const shortcutKeys = GetSWFObject()->GetGlobal( "shortcutKeys" ).GetObject();
			if ( verify( shortcutKeys != NULL ) ) {
				buttonSprite->GetScriptObject()->Set( "onPress", 0 );
				 // bind the main action - need to use all caps here because shortcuts are stored that way
				shortcutName = buttonName;
				shortcutName.ToUpper();
				shortcutKeys->Set( shortcutName, buttonSprite->GetScriptObject()  );
			}
		}
	}
}