示例#1
0
Entity* GameCreate( Entity* pParentEnt )
{
	Config* config = Config::GetInstance();
	
	GetApp()->setContinueBtn( true );

	char path[256];
	sprintf( path, "%s%s", GetApp()->getResourceInstance()->getItem( GetApp()->getResolutionType(), RES_TYPE_MENU, RES_ID_NONE ).c_str(), s_gameMenuXml );

	XMLMenu* parser = new XMLMenu( path, pParentEnt, &GameOnSelect, config->getLangPack() );
	parser->Read();
	Entity* pBG = parser->createEntities();
	delete parser;

	Entity* pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGE_GAMEOVER_SPLASH );
	if( pEnt )
	{
		pEnt->GetVar( "visible" )->Set( uint32( 0 ) );
	}

	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_DOWN );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_LEFT );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_RIGHT );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_ROTATE );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}

	GetApp()->setGame( true );

	FadeInEntity( pBG, true, 1000 );

	config->FreeInstance();

	return pBG;
}
示例#2
0
Entity* SoundCreate( Entity* pParentEnt )
{
	GameState::GetCurrentState()->SetSubState( GS_Menu::k_substate_none );

	char path[256];
	sprintf( path, "%s%s", GetApp()->getResourceInstance()->getItem( GetApp()->getResolutionType(), RES_TYPE_MENU, RES_ID_NONE ).c_str(), s_soundMenuXml );

	Config* config = Config::GetInstance();

	XMLMenu* parser = new XMLMenu( path, pParentEnt, &SoundOnSelect, config->getLangPack() );
	parser->Read();
	Entity* pBG = parser->createEntities();
	delete parser;

	std::string cbEffects = GUI_CHECKBOX_CHECKBOX_EFFECTS;
	std::string cbMusic = GUI_CHECKBOX_CHECKBOX_MUSIC;
	std::string cbVibration = GUI_CHECKBOX_CHECKBOX_VIBRATION;
		
	Entity *pEnt = GetEntityRoot()->GetEntityByName( cbEffects );
	if( pEnt )
	{
		SetCheckBoxChecked( pEnt, !config->getSoundEffects(), false );
		pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	
	pEnt = GetEntityRoot()->GetEntityByName( cbMusic );
	if( pEnt )
	{
		SetCheckBoxChecked( pEnt, !config->getMusic(), false );
		pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	
	pEnt = GetEntityRoot()->GetEntityByName( cbVibration );
	if( pEnt )
	{
		SetCheckBoxChecked( pEnt, !config->getVibration(), false );
		pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	
	FadeInEntity( pBG, true, 1000 );

	config->FreeInstance();

	return pBG;
}
void VariantTuner::resetTunableVariant()
{
	Entity* rootEntity = GetBaseApp()->GetEntityRoot();
	VariantChangerComponent* varChanger = dynamic_cast<VariantChangerComponent*>(rootEntity->GetComponentByName("VariantChanger"));

	if (varChanger != NULL)
	{
		varChanger->SetChangeableVariant(NULL);
	}
}
示例#4
0
void GS_GamePlay::UpdateState( int frameTime )
{
	Entity* pEnt = GetEntityRoot()->GetEntityByName( GUI_TEXT_LEVEL_LABEL_BOX );
	if( pEnt )
	{
		pEnt->GetComponentByName( "TextRender" )->GetVar( "text" )->Set( m_tetris->getLevel() );
	}

	pEnt = GetEntityRoot()->GetEntityByName( GUI_TEXT_SCORE_LABEL_BOX );
	if( pEnt )
	{
		pEnt->GetComponentByName( "TextRender" )->GetVar( "text" )->Set( m_tetris->getScore() );
	}

	pEnt = GetEntityRoot()->GetEntityByName( GUI_TEXT_LINES_LABEL_BOX );
	if( pEnt )
	{
		pEnt->GetComponentByName( "TextRender" )->GetVar( "text" )->Set( m_tetris->getLines() );
	}
}
void VariantTuner::setTunableVariant(Variant& var, const Variant& step)
{
	Entity* rootEntity = GetBaseApp()->GetEntityRoot();
	VariantChangerComponent* varChanger = dynamic_cast<VariantChangerComponent*>(rootEntity->GetComponentByName("VariantChanger"));

	if (varChanger == NULL)
	{
		varChanger = new VariantChangerComponent;
		rootEntity->AddComponent(varChanger);
	}

	varChanger->SetChangeableVariant(&var);

	varChanger->GetVar("step")->Reset();
	varChanger->GetVar("step")->Set(step);
}