当前位置: 首页>>代码示例>>C++>>正文


C++ Ufo::getId方法代码示例

本文整理汇总了C++中Ufo::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ Ufo::getId方法的具体用法?C++ Ufo::getId怎么用?C++ Ufo::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ufo的用法示例。


在下文中一共展示了Ufo::getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

/**
 * Initializes all the elements in the Geoscape Craft window.
 * @param game Pointer to the core game.
 * @param craft Pointer to the craft to display.
 * @param globe Pointer to the Geoscape globe.
 * @param waypoint Pointer to the last UFO position (if redirecting the craft).
 */
GeoscapeCraftState::GeoscapeCraftState(Game *game, Craft *craft, Globe *globe, Waypoint *waypoint) : State(game), _craft(craft), _globe(globe), _waypoint(waypoint)
{
	_screen = false;

	// Create objects
	_window = new Window(this, 240, 184, 8, 8, POPUP_BOTH);
	_btnBase = new TextButton(192, 12, 32, 124);
	_btnTarget = new TextButton(192, 12, 32, 140);
	_btnPatrol = new TextButton(192, 12, 32, 156);
	_btnCancel = new TextButton(192, 12, 32, 172);
	_txtTitle = new Text(200, 17, 32, 20);
	_txtStatus = new Text(210, 17, 32, 36);
	_txtBase = new Text(200, 9, 32, 52);
	_txtSpeed = new Text(200, 9, 32, 60);
	_txtMaxSpeed = new Text(200, 9, 32, 68);
	_txtAltitude = new Text(200, 9, 32, 76);
	_txtFuel = new Text(120, 9, 32, 84);
	_txtDamage = new Text(75, 9, 164, 84);
	_txtW1Name = new Text(120, 9, 32, 92);
	_txtW1Ammo = new Text(80, 9, 164, 92);
	_txtW2Name = new Text(120, 9, 32, 100);
	_txtW2Ammo = new Text(80, 9, 164, 100);
	_txtRedirect = new Text(230, 17, 13, 108);
	_txtSoldier = new Text(60, 9, 164, 68);
	_txtHWP = new Text(80, 9, 164, 76);

	// Set palette
	_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(4)), Palette::backPos, 16);

	add(_window);
	add(_btnBase);
	add(_btnTarget);
	add(_btnPatrol);
	add(_btnCancel);
	add(_txtTitle);
	add(_txtStatus);
	add(_txtBase);
	add(_txtSpeed);
	add(_txtMaxSpeed);
	add(_txtAltitude);
	add(_txtFuel);
	add(_txtDamage);
	add(_txtW1Name);
	add(_txtW1Ammo);
	add(_txtW2Name);
	add(_txtW2Ammo);
	add(_txtRedirect);
	add(_txtSoldier);
	add(_txtHWP);

	centerAllSurfaces();

	// Set up objects
	_window->setColor(Palette::blockOffset(15)-1);
	_window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR"));

	_btnBase->setColor(Palette::blockOffset(8)+5);
	_btnBase->setText(tr("STR_RETURN_TO_BASE"));
	_btnBase->onMouseClick((ActionHandler)&GeoscapeCraftState::btnBaseClick);

	_btnTarget->setColor(Palette::blockOffset(8)+5);
	_btnTarget->setText(tr("STR_SELECT_NEW_TARGET"));
	_btnTarget->onMouseClick((ActionHandler)&GeoscapeCraftState::btnTargetClick);

	_btnPatrol->setColor(Palette::blockOffset(8)+5);
	_btnPatrol->setText(tr("STR_PATROL"));
	_btnPatrol->onMouseClick((ActionHandler)&GeoscapeCraftState::btnPatrolClick);

	_btnCancel->setColor(Palette::blockOffset(8)+5);
	_btnCancel->setText(tr("STR_CANCEL_UC"));
	_btnCancel->onMouseClick((ActionHandler)&GeoscapeCraftState::btnCancelClick);
	_btnCancel->onKeyboardPress((ActionHandler)&GeoscapeCraftState::btnCancelClick, (SDLKey)Options::getInt("keyCancel"));

	_txtTitle->setColor(Palette::blockOffset(15)-1);
	_txtTitle->setBig();
	_txtTitle->setText(_craft->getName(_game->getLanguage()));

	_txtStatus->setColor(Palette::blockOffset(15)-1);
	_txtStatus->setSecondaryColor(Palette::blockOffset(8)+10);
	_txtStatus->setWordWrap(true);
	std::wstring status;
	if (_waypoint != 0)
	{
		status = tr("STR_INTERCEPTING_UFO").arg(_waypoint->getId());
	}
	else if (_craft->getLowFuel())
	{
		status = tr("STR_LOW_FUEL_RETURNING_TO_BASE");
	}
	else if (_craft->getDestination() == 0)
	{
		status = tr("STR_PATROLLING");
	}
//.........这里部分代码省略.........
开发者ID:AngelusEV,项目名称:OpenXcom,代码行数:101,代码来源:GeoscapeCraftState.cpp

示例2: if

/**
 * Initializes all the elements in the Geoscape Craft window.
 * @param game Pointer to the core game.
 * @param craft Pointer to the craft to display.
 * @param globe Pointer to the Geoscape globe.
 * @param waypoint Pointer to the last UFO position (if redirecting the craft).
 */
GeoscapeCraftState::GeoscapeCraftState(Game *game, Craft *craft, Globe *globe, Waypoint *waypoint) : State(game), _craft(craft), _globe(globe), _waypoint(waypoint)
{
	_screen = false;

	// Create objects
	_window = new Window(this, 240, 184, 8, 8, POPUP_BOTH);
	_btnBase = new TextButton(192, 12, 32, 124);
	_btnTarget = new TextButton(192, 12, 32, 140);
	_btnPatrol = new TextButton(192, 12, 32, 156);
	_btnCancel = new TextButton(192, 12, 32, 172);
	_txtTitle = new Text(200, 16, 32, 20);
	_txtStatus = new Text(200, 9, 32, 36);
	_txtBase = new Text(200, 9, 32, 52);
	_txtSpeed = new Text(200, 9, 32, 60);
	_txtMaxSpeed = new Text(200, 9, 32, 68);
	_txtAltitude = new Text(200, 9, 32, 76);
	_txtFuel = new Text(200, 9, 32, 84);
	_txtW1Name = new Text(120, 9, 32, 92);
	_txtW1Ammo = new Text(60, 9, 164, 92);
	_txtW2Name = new Text(120, 9, 32, 100);
	_txtW2Ammo = new Text(60, 9, 164, 100);
	_txtRedirect = new Text(230, 16, 13, 108);

	// Set palette
	_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(4)), Palette::backPos, 16);

	add(_window);
	add(_btnBase);
	add(_btnTarget);
	add(_btnPatrol);
	add(_btnCancel);
	add(_txtTitle);
	add(_txtStatus);
	add(_txtBase);
	add(_txtSpeed);
	add(_txtMaxSpeed);
	add(_txtAltitude);
	add(_txtFuel);
	add(_txtW1Name);
	add(_txtW1Ammo);
	add(_txtW2Name);
	add(_txtW2Ammo);
	add(_txtRedirect);

	// Set up objects
	_window->setColor(Palette::blockOffset(15)-1);
	_window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR"));

	_btnBase->setColor(Palette::blockOffset(8)+5);
	_btnBase->setText(_game->getLanguage()->getString("STR_RETURN_TO_BASE"));
	_btnBase->onMouseClick((ActionHandler)&GeoscapeCraftState::btnBaseClick);

	_btnTarget->setColor(Palette::blockOffset(8)+5);
	_btnTarget->setText(_game->getLanguage()->getString("STR_SELECT_NEW_TARGET"));
	_btnTarget->onMouseClick((ActionHandler)&GeoscapeCraftState::btnTargetClick);

	_btnPatrol->setColor(Palette::blockOffset(8)+5);
	_btnPatrol->setText(_game->getLanguage()->getString("STR_PATROL"));
	_btnPatrol->onMouseClick((ActionHandler)&GeoscapeCraftState::btnPatrolClick);

	_btnCancel->setColor(Palette::blockOffset(8)+5);
	_btnCancel->setText(_game->getLanguage()->getString("STR_CANCEL_UC"));
	_btnCancel->onMouseClick((ActionHandler)&GeoscapeCraftState::btnCancelClick);

	_txtTitle->setColor(Palette::blockOffset(15)-1);
	_txtTitle->setBig();
	_txtTitle->setText(_craft->getName(_game->getLanguage()));

	_txtStatus->setColor(Palette::blockOffset(15)-1);
	_txtStatus->setSecondaryColor(Palette::blockOffset(8)+10);
	std::wstringstream ss;
	ss << _game->getLanguage()->getString("STR_STATUS_") << L'\x01';
	if (_waypoint != 0)
	{
		ss << _game->getLanguage()->getString("STR_INTERCEPTING_UFO") << _waypoint->getId();
	}
	else if (_craft->getLowFuel())
	{
		ss << _game->getLanguage()->getString("STR_LOW_FUEL_RETURNING_TO_BASE");
	}
	else if (_craft->getDestination() == 0)
	{
		ss << _game->getLanguage()->getString("STR_PATROLLING");
	}
	else if (_craft->getDestination() == (Target*)_craft->getBase())
	{
		ss << _game->getLanguage()->getString("STR_RETURNING_TO_BASE");
	}
	else
	{
		Ufo *u = dynamic_cast<Ufo*>(_craft->getDestination());
		if (u != 0)
		{
//.........这里部分代码省略.........
开发者ID:rickyah,项目名称:OpenXcom,代码行数:101,代码来源:GeoscapeCraftState.cpp

示例3: if

/**
 * Initializes all the elements in the Geoscape Craft window.
 * @param game Pointer to the core game.
 * @param craft Pointer to the craft to display.
 * @param globe Pointer to the Geoscape globe.
 * @param waypoint Pointer to the last UFO position (if redirecting the craft).
 */
GeoscapeCraftState::GeoscapeCraftState(Craft *craft, Globe *globe, Waypoint *waypoint) : _craft(craft), _globe(globe), _waypoint(waypoint)
{
	_screen = false;

	// Create objects
	_window = new Window(this, 240, 184, 8, 8, POPUP_BOTH);
	_btnBase = new TextButton(212, 12, 22, 124);
	_btnTarget = new TextButton(212, 12, 22, 140);
	_btnPatrol = new TextButton(212, 12, 22, 156);
	_btnCancel = new TextButton(212, 12, 22, 172);
	_txtTitle = new Text(210, 17, 32, 20);
	_txtStatus = new Text(210, 17, 32, 36);
	_txtBase = new Text(210, 9, 32, 52);
	_txtSpeed = new Text(210, 9, 32, 60);
	_txtMaxSpeed = new Text(210, 9, 32, 68);
	_txtAltitude = new Text(210, 9, 32, 76);
	_txtFuel = new Text(130, 9, 32, 84);
	_txtDamage = new Text(80, 9, 164, 84);
	_txtW1Name = new Text(130, 9, 32, 92);
	_txtW1Ammo = new Text(80, 9, 164, 92);
	_txtW2Name = new Text(130, 9, 32, 100);
	_txtW2Ammo = new Text(80, 9, 164, 100);
	_txtRedirect = new Text(230, 17, 13, 108);
	_txtSoldier = new Text(60, 9, 164, 68);
	_txtHWP = new Text(80, 9, 164, 76);

	// Set palette
	setInterface("geoCraft");

	add(_window, "window", "geoCraft");
	add(_btnBase, "button", "geoCraft");
	add(_btnTarget, "button", "geoCraft");
	add(_btnPatrol, "button", "geoCraft");
	add(_btnCancel, "button", "geoCraft");
	add(_txtTitle, "text1", "geoCraft");
	add(_txtStatus, "text1", "geoCraft");
	add(_txtBase, "text3", "geoCraft");
	add(_txtSpeed, "text3", "geoCraft");
	add(_txtMaxSpeed, "text3", "geoCraft");
	add(_txtAltitude, "text3", "geoCraft");
	add(_txtFuel, "text3", "geoCraft");
	add(_txtDamage, "text3", "geoCraft");
	add(_txtW1Name, "text3", "geoCraft");
	add(_txtW1Ammo, "text3", "geoCraft");
	add(_txtW2Name, "text3", "geoCraft");
	add(_txtW2Ammo, "text3", "geoCraft");
	add(_txtRedirect, "text3", "geoCraft");
	add(_txtSoldier, "text3", "geoCraft");
	add(_txtHWP, "text3", "geoCraft");

	centerAllSurfaces();

	// Set up objects
	_window->setBackground(_game->getMod()->getSurface("BACK12.SCR"));

	_btnBase->setText(tr("STR_RETURN_TO_BASE"));
	_btnBase->onMouseClick((ActionHandler)&GeoscapeCraftState::btnBaseClick);

	_btnTarget->setText(tr("STR_SELECT_NEW_TARGET"));
	_btnTarget->onMouseClick((ActionHandler)&GeoscapeCraftState::btnTargetClick);

	_btnPatrol->setText(tr("STR_PATROL"));
	_btnPatrol->onMouseClick((ActionHandler)&GeoscapeCraftState::btnPatrolClick);

	_btnCancel->setText(tr("STR_CANCEL_UC"));
	_btnCancel->onMouseClick((ActionHandler)&GeoscapeCraftState::btnCancelClick);
	_btnCancel->onKeyboardPress((ActionHandler)&GeoscapeCraftState::btnCancelClick, Options::keyCancel);

	_txtTitle->setBig();
	_txtTitle->setText(_craft->getName(_game->getLanguage()));

	_txtStatus->setWordWrap(true);
	std::wstring status;
	if (_waypoint != 0)
	{
		status = tr("STR_INTERCEPTING_UFO").arg(_waypoint->getId());
	}
	else if (_craft->getLowFuel())
	{
		status = tr("STR_LOW_FUEL_RETURNING_TO_BASE");
	}
	else if (_craft->getMissionComplete())
	{
		status = tr("STR_MISSION_COMPLETE_RETURNING_TO_BASE");
	}
	else if (_craft->getDestination() == 0)
	{
		status = tr("STR_PATROLLING");
	}
	else if (_craft->getDestination() == (Target*)_craft->getBase())
	{
		status = tr("STR_RETURNING_TO_BASE");
	}
//.........这里部分代码省略.........
开发者ID:DiceMaster,项目名称:OpenXcom,代码行数:101,代码来源:GeoscapeCraftState.cpp


注:本文中的Ufo::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。