Пример #1
0
	void hide()
	{
		background->Hide();
		if( activeMenu ) activeMenu->hide();
		foreground->Hide();
	}
Пример #2
0
	MenuCollectionImpl( MenuCollection* self, Ogui* ogui, Game* game, int player ) :
	  self( self ),
	  ogui( ogui ),
	  game( game ),
	  activeMenu( NULL ),
	  backgroundVideo( NULL ),
	  backgroundButton( NULL ),
	  backgroundButtonData( NULL ),
	  logoButton( NULL ),
	  logoVideo( NULL ),
	  videoButton( NULL ),
	  background( NULL ),
	  foreground( NULL ),
	  transparency( 100 ),
	  fadeIn( true ),
		backgroundAlternativeFader( NULL ),
		backgroundAlternativeButton( NULL )
	{
		background = ogui->CreateSimpleWindow(	getLocaleGuiInt( "gui_menu_background_x", 0 ), 
												getLocaleGuiInt( "gui_menu_background_y", 0 ), 
												getLocaleGuiInt( "gui_menu_background_w", 1 ), 
												getLocaleGuiInt( "gui_menu_background_h", 1 ), 
												getLocaleGuiString( "gui_menu_background_img" ) );

		const char *alternatives_str = NULL;
		if(DHLocaleManager::getInstance()->getString(DHLocaleManager::BANK_GUI, "gui_menu_background_alternatives", &alternatives_str))
		{
			int alternatives = atoi(alternatives_str);
			if(alternatives > 0)
			{
				backgroundAlternativeButton = ogui->CreateSimpleImageButton(background,
					getLocaleGuiInt("gui_menu_background_alternatives_x", 0), getLocaleGuiInt("gui_menu_background_alternatives_y", 0),
					getLocaleGuiInt("gui_menu_background_alternatives_w", 0), getLocaleGuiInt("gui_menu_background_alternatives_h", 0),
					NULL, NULL, NULL, NULL, 0, NULL, false);
				backgroundAlternativeButton->SetDisabled(true);

				backgroundAlternativeFader = ogui->CreateSimpleImageButton(background,
					getLocaleGuiInt("gui_menu_background_alternatives_x", 0), getLocaleGuiInt("gui_menu_background_alternatives_y", 0),
					getLocaleGuiInt("gui_menu_background_alternatives_w", 0), getLocaleGuiInt("gui_menu_background_alternatives_h", 0),
					NULL, NULL, NULL, NULL, 0, NULL, false);
				backgroundAlternativeFader->SetDisabled(true);

				backgroundAlternatives.resize(alternatives);
				for(int i = 0; i < alternatives; i++)
				{
					std::string prefix = "gui_menu_background_alt" + boost::lexical_cast<std::string>(i);
					backgroundAlternatives[i].img = ogui->LoadOguiImage( getLocaleGuiString( (prefix+"_img").c_str() ) );
					backgroundAlternatives[i].time = getLocaleGuiInt( (prefix+"_time").c_str() , 0 );
					backgroundAlternatives[i].fade = getLocaleGuiInt( (prefix+"_fade").c_str() , 0 );
				}

				backgroundAlternativeButton->SetDisabledImage(backgroundAlternatives[0].img);
				currentBackgroundAlternative = 0;
				previousBackgroundAlternative = 0;
				lastBackgroundAlternativeSwitch = Timer::getTime();
			}
		}
	
		foreground = ogui->CreateSimpleWindow(	getLocaleGuiInt( "gui_menu_foreground_x", 0 ), 
												getLocaleGuiInt( "gui_menu_foreground_y", 0 ), 
												getLocaleGuiInt( "gui_menu_foreground_w", 1 ), 
												getLocaleGuiInt( "gui_menu_foreground_h", 1 ), 
												getLocaleGuiString( "gui_menu_foreground_img" ) );
		foreground->SetReactMask( 0 );
		
		


		videoButton = ogui->CreateSimpleImageButton( background, 
							getLocaleGuiInt( "gui_menu_video_x", 0 ), getLocaleGuiInt( "gui_menu_video_y", 0 ),
							getLocaleGuiInt( "gui_menu_video_w", 1024 ), getLocaleGuiInt( "gui_menu_video_h", 768 ), NULL, NULL, NULL );
		videoButton->SetDisabled( true );

		backgroundButton = ogui->CreateSimpleImageButton( background, 0, 0, 1024, 768, NULL, NULL, NULL );
		backgroundButton->SetDisabled( true );

		background->Hide();
		foreground->Hide();
		background->SetUnmovable();
		foreground->SetUnmovable();

		ogui->SetCursorImageState( 0, DH_CURSOR_ARROW );

		fonts.big.normal =			ogui->LoadFont( getLocaleGuiString( "gui_menu_font_big" ) );
		fonts.medium.normal =		ogui->LoadFont( getLocaleGuiString( "gui_menu_font_medium" ) );
		fonts.medium.highlighted =	ogui->LoadFont( getLocaleGuiString( "gui_menu_font_medium_high" ) );
		fonts.little.normal =		ogui->LoadFont( getLocaleGuiString( "gui_menu_font_little" ) );
		fonts.little.highlighted =	ogui->LoadFont( getLocaleGuiString( "gui_menu_font_little_high" ) );

		

		background->StartEffect( OGUI_WINDOW_EFFECT_FADEIN, 3000 );
		foreground->StartEffect( OGUI_WINDOW_EFFECT_FADEIN, 3000 );

		if( game->inCombat == false )
			transparencyFadeSpeed = 50.0f;
		else transparencyFadeSpeed = 20.0f;
		
		const int menu_to_be_opened = MenuCollection::MENU_TYPE_MAINMENU;
		openMenu( menu_to_be_opened );
	}