Пример #1
0
		GroupMenu::GroupMenu(const SmashData&smashData) : SmashBros::Menu::BaseMenuScreen(smashData)
		{
			smashButton = getItem(addItem(RectD(0.05, 0.2, 0.55, 0.6), new Animation(1, smashData.getMenuData()->getAssetManager(), "buttons/group/smash.png")));
			specialSmashButton = nullptr;//specialSmashButton = getItem(addItem(RectD(0.45f,0.25f,0.5f,0.5f), new Animation(smashData.getMenuData().getAssetManager(), 1, "buttons/group/specialsmash.png"));
			rulesButton = getItem(addItem(RectD(0.275, 0.6, 0.725, 0.9), new Animation(1, smashData.getMenuData()->getAssetManager(), "buttons/group/rules.png")));
			
			groupSmashData = new GroupSmashData();
			//TODO make the character select screen be loaded when the screen fades to black
			//(create an intermediate screen for while it's loading)
			smashMenu = new GroupSmashCharacterSelectMenu(smashData, *groupSmashData);
			rulesMenu = new GroupRulesMenu(smashData, *groupSmashData);
		}
		void CharacterSelectScreen::reloadPlayerPanels(const SmashData&smashData)
		{
			autoPanelLayoutMgr.clear();
			
			for(unsigned int i=0; i<panels.size(); i++)
			{
				delete panels.get(i);
			}
			panels.clear();
			for(unsigned int i = 0; i < chips.size(); i++)
			{
				delete chips.get(i);
			}
			chips.clear();
			
			unsigned int playerCount = rules->getPlayerCount();
			if(playerCount==0)
			{
				return;
			}
			
			RectD panelBounds(0.0, 0.6, 1.0, 1.0);
			
			double panelBounds_w = panelBounds.right - panelBounds.left;
			double panelBounds_h = panelBounds.bottom - panelBounds.top;

			double panel_width = panelBounds_w/(double)playerCount;
			double panel_height = panelBounds_h;
			Vector2d screenSize = smashData.getScreenCoords(1.0,1.0);
			Vector2d chipSize((panel_width*screenSize.x)/3, (panel_height*screenSize.y)/3);
			
			const Dictionary& panelProperties = smashData.getMenuData()->getCharacterSelectPanelProperties();
			
			for(unsigned int i = 0; i < playerCount; i++)
			{
				unsigned int playerNum = i+1;
				
				PlayerPanel* panel = new PlayerPanel(playerNum, this, 0, 0, panelProperties, smashData.getMenuData()->getAssetManager());
				double panel_left = panelBounds.left + (panel_width*((double)i));
				double panel_top = panelBounds.top;
				autoPanelLayoutMgr.add(RectD(panel_left, panel_top, panel_left+panel_width, panelBounds.bottom), panel);
				panels.add(panel);

				double chipX = (panel_left*screenSize.x)+(chipSize.x/2);
				double chipY = (panel_top+(panel_height/2))*screenSize.y;
				
				PlayerChip* chip = new PlayerChip(playerNum, this, chipX, chipY, smashData.getMenuData()->getAssetManager());
				chip->Actor::scaleToFit(chipSize);
				chips.add(chip);
			}
		}
Пример #3
0
		BaseMenuScreen::BaseMenuScreen(const SmashData&smashData)
		{
			AssetManager* assetManager = smashData.getMenuData()->getAssetManager();
			
			img_headerbar_small = assetManager->getTexture("elements/headerbar_small.png");
			img_headerbar_full = assetManager->getTexture("elements/headerbar_full.png");
			
			hoverPulseScale = 1;
			hoverPulseGrowing = true;
			hoverPulseEnabled = false;
			hoverPressed = false;
			
			ScreenElement* element = getElement();
			
			backgroundElement = new ImageElement(assetManager->getTexture("backgrounds/main.png"), ImageElement::DISPLAY_ZOOM);
			backgroundElement->setLayoutRule(LAYOUTRULE_LEFT,   0, LAYOUTVALUE_RATIO);
			backgroundElement->setLayoutRule(LAYOUTRULE_TOP,    0, LAYOUTVALUE_RATIO);
			backgroundElement->setLayoutRule(LAYOUTRULE_RIGHT,  1, LAYOUTVALUE_RATIO);
			backgroundElement->setLayoutRule(LAYOUTRULE_BOTTOM, 1, LAYOUTVALUE_RATIO);
			element->addChildElement(backgroundElement);
			
			headerbarElement = new ImageElement(img_headerbar_full, ImageElement::DISPLAY_ZOOM);
			headerbarElement->setLayoutRule(LAYOUTRULE_LEFT,   0.0,   LAYOUTVALUE_RATIO);
			headerbarElement->setLayoutRule(LAYOUTRULE_TOP,    0.0,   LAYOUTVALUE_RATIO);
			headerbarElement->setLayoutRule(LAYOUTRULE_RIGHT,  1.0,   LAYOUTVALUE_RATIO);
			headerbarElement->setLayoutRule(LAYOUTRULE_BOTTOM, 0.134, LAYOUTVALUE_RATIO);
			element->addChildElement(headerbarElement);
			
			element->sendChildElementToBack(headerbarElement);
			element->sendChildElementToBack(backgroundElement);
			
			backButton = (SpriteActor*)getItem(addItem(RectD(0, 0, 0.145, 0.145), new Animation(1, assetManager, "buttons/back.png")));
		}
		CharacterSelectScreen::CharacterSelectScreen(const SmashData&smashData, Rules*ruleData) : SmashBros::Menu::BaseMenuScreen(smashData)
		{
			RectangleD frame = getFrame();
			autoIconLayoutMgr.setFrame(RectangleD(0,0,frame.width,frame.height));
			autoPanelLayoutMgr.setFrame(RectangleD(0,0,frame.width,frame.height));
			
			rules = ruleData;
			characterLoader = smashData.getModuleData()->getCharacterLoader();
			readyToFightBanner = new ReadyToFightBanner(this, 0, 0, smashData.getMenuData()->getAssetManager());
			getElement()->getAutoLayoutManager().add(RectD(0, 0.5, 1.0, 0.7), readyToFightBanner);
		}
Пример #5
0
		SoloMenu::SoloMenu(const SmashData&smashData) : SmashBros::Menu::BaseMenuScreen(smashData)
		{
			trainingButton = getItem(addItem(RectD(0.1, 0.2, 0.9, 0.8), new Animation(1, smashData.getMenuData()->getAssetManager(), "buttons/solo/training.png")));
		}