Esempio n. 1
0
Menu *MenuFactory::CreateChooseClassMenu(const sf::Vector2f &primaryDimensions) const
{
	Menu *menu = new Menu();
	MenuItem *item;

	item = new MenuItem();
	item->SetText(AvatarClass::GetClassName(ClassType::Warrior));
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText(AvatarClass::GetClassName(ClassType::Rogue));
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText(AvatarClass::GetClassName(ClassType::Mage));
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText("Back");
	menu->AddMenuItem(item);

	menu->SetPosition(75 + primaryDimensions.x, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50);

	return menu;
}
Esempio n. 2
0
Menu *MenuFactory::CreateTempBattleMenu() const
{
	Menu *menu = new Menu();
	MenuItem *item;

	item = new MenuItem();
	item->SetText("Choose Skill");
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText("Forfeit Match");
	menu->AddMenuItem(item);

	menu->SetPosition(50, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50);

	return menu;
}
Esempio n. 3
0
Menu *MenuFactory::CreateChooseAIDifficultyMenu(const sf::Vector2f &primaryDimensions) const
{
	Menu *menu = new Menu();
	MenuItem *item;

	for (auto &name : AIAvatar::DifficultyNames)
	{
		item = new MenuItem();
		item->SetText(name);
		menu->AddMenuItem(item);
	}
	
	item = new MenuItem();
	item->SetText("Back");
	menu->AddMenuItem(item);

	menu->SetPosition(75 + primaryDimensions.x, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50);

	return menu;
}
Esempio n. 4
0
Menu *MenuFactory::CreateMainMenu() const
{
	Menu *menu = new Menu();
	MenuItem *item;

	item = new MenuItem();
	item->SetText("Start Game");
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText("Toggle Audio");
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText("Quit Game");
	menu->AddMenuItem(item);

	menu->SetPosition(50, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50);

	return menu;
}
Esempio n. 5
0
Menu *MenuFactory::CreateTempSkillsMenu(const sf::Vector2f &battleDimensions, const Skill *skillArray) const
{
	Menu *menu = new Menu();
	MenuItem *item;

	item = new MenuItem();
	item->SetText(skillArray[0].name);
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText(skillArray[1].name);
	menu->AddMenuItem(item);

	item = new MenuItem();
	item->SetText(skillArray[2].name);
	menu->AddMenuItem(item);

	menu->SetPosition(75 + battleDimensions.x, GameManager::GetInstance().GetResolution().y - menu->GetDimensions().y - 50);

	return menu;
}
Esempio n. 6
0
//-----------------------------------------------------------------------------
// Purpose: Creates the build mode editing controls
//-----------------------------------------------------------------------------
void BuildModeDialog::CreateControls()
{
	int i;
	m_pPanelList = new PanelList;
	m_pPanelList->m_pResourceData = new KeyValues( "BuildDialog" );
	m_pPanelList->m_pControls = new PanelListPanel(this, "BuildModeControls");

	// file to edit combo box is first
	m_pFileSelectionCombo = new ComboBox(this, "FileSelectionCombo", 10, false);
	for ( i = 0; i < m_pBuildGroup->GetRegisteredControlSettingsFileCount(); i++)
	{
		m_pFileSelectionCombo->AddItem(m_pBuildGroup->GetRegisteredControlSettingsFileByIndex(i), NULL);
	}
	if (m_pFileSelectionCombo->GetItemCount() < 2)
	{
		m_pFileSelectionCombo->SetEnabled(false);
	}

	int buttonH = 18;

	// status info at top of dialog
	m_pStatusLabel = new Label(this, "StatusLabel", "[nothing currently selected]");
	m_pStatusLabel->SetTextColorState(Label::CS_DULL);
	m_pStatusLabel->SetTall( buttonH );
	m_pDivider = new Divider(this, "Divider");
	// drop-down combo box for adding new controls
	m_pAddNewControlCombo = new ComboBox(this, NULL, 30, false);
	m_pAddNewControlCombo->SetSize(116, buttonH);
	m_pAddNewControlCombo->SetOpenDirection(Menu::DOWN);

	m_pEditableParents = new CBuildModeNavCombo( this, NULL, 15, false, true, m_pBuildGroup->GetContextPanel() );
	m_pEditableParents->SetSize(116, buttonH);
	m_pEditableParents->SetOpenDirection(Menu::DOWN);

	m_pEditableChildren = new CBuildModeNavCombo( this, NULL, 15, false, false, m_pBuildGroup->GetContextPanel() );
	m_pEditableChildren->SetSize(116, buttonH);
	m_pEditableChildren->SetOpenDirection(Menu::DOWN);

	m_pNextChild = new Button( this, "NextChild", "Next", this );
	m_pNextChild->SetCommand( new KeyValues( "OnChangeChild", "direction", 1 ) );

	m_pPrevChild = new Button( this, "PrevChild", "Prev", this );
	m_pPrevChild->SetCommand( new KeyValues( "OnChangeChild", "direction", -1 ) );

	// controls that can be added
	// this list comes from controls EditablePanel can create by name.
	int defaultItem = m_pAddNewControlCombo->AddItem("None", NULL);

	CUtlVector< char const * >	names;
	CBuildFactoryHelper::GetFactoryNames( names );
	// Sort the names
	CUtlRBTree< char const *, int > sorted( 0, 0, StringLessThan );

	for ( i = 0; i < names.Count(); ++i )
	{
		sorted.Insert( names[ i ] );
	}

	for ( i = sorted.FirstInorder(); i != sorted.InvalidIndex(); i = sorted.NextInorder( i ) )
	{
		m_pAddNewControlCombo->AddItem( sorted[ i ], NULL );
	}

	m_pAddNewControlCombo->ActivateItem(defaultItem);

	m_pExitButton = new Button(this, "ExitButton", "&Exit");
	m_pExitButton->SetSize(64, buttonH);

	m_pSaveButton = new Button(this, "SaveButton", "&Save");
	m_pSaveButton->SetSize(64, buttonH);
	
	m_pApplyButton = new Button(this, "ApplyButton", "&Apply");
	m_pApplyButton->SetSize(64, buttonH);

	m_pReloadLocalization = new Button( this, "Localization", "&Reload Localization" );
	m_pReloadLocalization->SetSize( 100, buttonH );

	m_pExitButton->SetCommand("Exit");
	m_pSaveButton->SetCommand("Save");
	m_pApplyButton->SetCommand("Apply");
	m_pReloadLocalization->SetCommand( new KeyValues( "ReloadLocalization" ) );

	m_pDeleteButton = new Button(this, "DeletePanelButton", "Delete");
	m_pDeleteButton->SetSize(64, buttonH);
	m_pDeleteButton->SetCommand("DeletePanel");

	m_pVarsButton = new MenuButton(this, "VarsButton", "Variables");
	m_pVarsButton->SetSize(72, buttonH);
	m_pVarsButton->SetOpenDirection(Menu::UP);
	
	// iterate the vars
	KeyValues *vars = m_pBuildGroup->GetDialogVariables();
	if (vars && vars->GetFirstSubKey())
	{
		// create the menu
		m_pVarsButton->SetEnabled(true);
		Menu *menu = new Menu(m_pVarsButton, "VarsMenu");

		// set all the variables to be copied to the clipboard when selected
		for (KeyValues *kv = vars->GetFirstSubKey(); kv != NULL; kv = kv->GetNextKey())
		{
			char buf[32];
			_snprintf(buf, sizeof(buf), "%%%s%%", kv->GetName());
			menu->AddMenuItem(kv->GetName(), new KeyValues("SetClipboardText", "text", buf), this);
		}

		m_pVarsButton->SetMenu(menu);
	}
	else
	{
		// no variables
		m_pVarsButton->SetEnabled(false);
	}

	m_pApplyButton->SetTabPosition(1);
	m_pPanelList->m_pControls->SetTabPosition(2);
	m_pVarsButton->SetTabPosition(3);
	m_pDeleteButton->SetTabPosition(4);
	m_pAddNewControlCombo->SetTabPosition(5);
	m_pSaveButton->SetTabPosition(6);
	m_pExitButton->SetTabPosition(7);

	m_pEditableParents->SetTabPosition( 8 );
	m_pEditableChildren->SetTabPosition( 9 );

	m_pPrevChild->SetTabPosition( 10 );
	m_pNextChild->SetTabPosition( 11 );

	m_pReloadLocalization->SetTabPosition( 12 );
}
Esempio n. 7
0
//-----------------------------------------------------------------------------
// Constructor
//-----------------------------------------------------------------------------
CTileGenDialog::CTileGenDialog( Panel *parent, const char *name ) : BaseClass( parent, name )
{
	Assert( !g_pTileGenDialog );
	g_pTileGenDialog = this;

	m_pMapLayout = new CMapLayout();
	m_pLayoutSystem = NULL;
	m_VMFExporter = new VMFExporter();
	m_pGenerationOptions = new KeyValues( "EmptyOptions" );

	vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile( "tilegen/tilegen_scheme.res", "GAME" );
	SetScheme( scheme );

	if ( !g_bAddedTileGenLocalization )
	{
		g_pVGuiLocalize->AddFile( "tilegen/tilegen_english.txt" );
		g_bAddedTileGenLocalization = true;
	}

	m_fTileSize = 30.0f;

	m_bShowExits = true;
	m_bShowTileSquares = true;
	m_iStartDragX = -1;
	m_iStartDragY = -1;
	m_iStartRubberBandX = -1;
	
	SetSize(384, 420);
	SetMinimumSize(384, 420);
	
	m_pCurrentThemeDetails = new CThemeDetails(this, "CurrentThemeDetails", NULL);
	m_pCurrentThemeDetails->m_iDesiredWidth = 356;
	m_pTemplateListContainer = new CScrollingWindow(this, "TemplateListWindow");
	m_pTemplateListPanel = new CRoomTemplateListPanel(m_pTemplateListContainer, "TemplateListPanel");
	m_pTemplateFilter = new TextEntry( this, "TemplateFilter" );
	m_pShowExitsCheck = new vgui::CheckButton(this, "ShowExitsCheck", "");
	m_pShowExitsCheck->SetSelected(m_bShowExits);
	m_pShowTileSquaresCheck = new vgui::CheckButton(this, "ShowTileSquaresCheck", "");
	m_pShowTileSquaresCheck->SetSelected(m_bShowTileSquares);

	m_pPropertySheet = new vgui::PropertySheet( this, "PropertySheet" );
	m_pLayoutPage = new CTileGenLayoutPage( m_pPropertySheet, "TileGenLayoutPage" );
	m_pLayoutSystemPage = new CTilegenLayoutSystemPage( m_pPropertySheet, "TilegenLayoutSystemPage" );
	m_pLayoutSystemPage->UpdateList();
	m_pPropertySheet->AddPage( m_pLayoutPage, "Layout" );
	m_pPropertySheet->AddPage( m_pLayoutSystemPage, "Missions" );

	m_pCursorPanel = new CRoomTemplatePanel(this, "CursorRoomTemplatePanel");
	m_pCursorPanel->SetMouseInputEnabled(false);
	m_pCursorPanel->SetVisible(false);
	m_pCursorTemplate = NULL;

	m_pTemplateListContainer->SetChildPanel( m_pTemplateListPanel );

	CLevelTheme::LoadLevelThemes();
	OnUpdateCurrentTheme(NULL);

	// setup the menu
	m_pMenuBar = new MenuBar(this, "TileGenMenuBar");
	MenuButton *pFileMenuButton = new MenuButton(this, "FileMenuButton", "&File");
	Menu *pFileMenu = new Menu(pFileMenuButton, "TileGenFileMenu");	
	pFileMenu->AddMenuItem("&New Map Layout",  "NewMapLayout", this);
	pFileMenu->AddMenuItem("&Open Map Layout...",  "OpenMapLayout", this);
	pFileMenu->AddMenuItem("&Open Current Map Layout...",  "OpenCurrentMapLayout", this);
	pFileMenu->AddMenuItem("&Save Map Layout",  "SaveMapLayout", this);
	pFileMenu->AddMenuItem("&Save Map Layout As...",  "SaveMapLayoutAs", this);
	pFileMenu->AddSeparator();
	pFileMenu->AddMenuItem("&Export VMF", "ExportVMF", this);
	pFileMenu->AddMenuItem("&Export VMF and Play Map", "ExportAndPlay", this);
	pFileMenu->AddMenuItem("&Export VMF and Play Without Aliens", "ExportAndPlayClean", this);	
	pFileMenuButton->SetMenu(pFileMenu);
	m_pMenuBar->AddButton(pFileMenuButton);

	MenuButton *pToolsMenuButton = new MenuButton(this, "ToolsMenuButton", "&Tools");
	m_pToolsMenu = new Menu(pToolsMenuButton, "TileGenToolsMenu");	
	pToolsMenuButton->SetMenu(m_pToolsMenu);
	m_pMenuBar->AddButton(pToolsMenuButton);
	//m_pToolsMenu->AddMenuItem("Push Encounters Apart", "PushEncountersApart", this);		// used to debug encounter push apart
	m_pToolsMenu->AddMenuItem("Generate &Thumbnails", "GenerateThumbnails", this);
	//m_pToolsMenu->AddMenuItem("&Location Layout Editor", "LocationLayoutEditor", this);
	m_pToolsMenu->AddMenuItem("&Check Room Templates for Errors", "TileCheck", this);
	m_pToolsMenu->AddSeparator();
	m_nShowDefaultParametersMenuItemID = m_pToolsMenu->AddCheckableMenuItem( "&Show Optional Parameters", "ShowOptionalParameters", this );
	m_nShowAddButtonsMenuItemID = m_pToolsMenu->AddCheckableMenuItem( "&Show 'Add' Buttons", "ShowAddButtons", this );
	// Get the checked menu items in-sync with editor settings.
	m_pToolsMenu->SetMenuItemChecked( m_nShowDefaultParametersMenuItemID, true );
	m_pToolsMenu->SetMenuItemChecked( m_nShowAddButtonsMenuItemID, true );
	m_pLayoutSystemPage->GetEditor()->ShowOptionalValues( true );
	m_pLayoutSystemPage->GetEditor()->ShowAddButtons( true );

	// disable keyboard input on the menu, otherwise once you click there, this dialog never gets key input again (is there a better way to do this and maintain keyboard shortcuts for the menu?)
	pFileMenuButton->SetKeyBoardInputEnabled(false);
	pFileMenu->SetKeyBoardInputEnabled(false);
	m_pMenuBar->SetKeyBoardInputEnabled(false);

	m_pZoomInButton = new vgui::Button( this, "ZoomInButton", "+", this, "ZoomIn" );
	m_pZoomOutButton = new vgui::Button( this, "ZoomOutButton", "-", this, "ZoomOut" );
	m_pCoordinateLabel = new vgui::Label( this, "CoordinateLabel", "" );
	
	// make sure the window get a tick all the time (could change this to only tick on necessary states?)
	vgui::ivgui()->AddTickSignal( GetVPanel(), 0 );
}