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


C++ IBaseMenu::GetMenuOptionFlags方法代码示例

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


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

示例1: SetMenuNoVoteButton

static cell_t SetMenuNoVoteButton(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IBaseMenu *menu;

    if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    unsigned int flags = menu->GetMenuOptionFlags();

    if (params[2])
    {
        flags |= MENUFLAG_BUTTON_NOVOTE;
    } else {
        flags &= ~MENUFLAG_BUTTON_NOVOTE;
    }

    menu->SetMenuOptionFlags(flags);
    unsigned int new_flags = menu->GetMenuOptionFlags();

    return (flags == new_flags);
}
开发者ID:War3Evo,项目名称:sourcemod,代码行数:25,代码来源:smn_menus.cpp

示例2: GetMenuExitBackButton

static cell_t GetMenuExitBackButton(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IBaseMenu *menu;

    if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    return ((menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXITBACK) == MENUFLAG_BUTTON_EXIT) ? 1 : 0;
}
开发者ID:War3Evo,项目名称:sourcemod,代码行数:13,代码来源:smn_menus.cpp

示例3: GetMenuOptionFlags

static cell_t GetMenuOptionFlags(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IBaseMenu *menu;

    if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    return menu->GetMenuOptionFlags();
}
开发者ID:War3Evo,项目名称:sourcemod,代码行数:13,代码来源:smn_menus.cpp

示例4: ShowSkillMenu

void CRPGPlayer::ShowSkillMenu()
{
	if (GetCurrentClass() == RPG_CLASS_NONE )
	{
		ShowClassMenu( GetPlayerInfo()->GetTeamIndex());
		return;
	}

	if (GetFreeSkills() < 0)
	{
		ResetAccount();
		gamehelpers->TextMsg(GetIndex(), HUD_PRINTTALK, "[ZPS-RPG] Your skills have been reset because of an error.\n");
	}

	IMenuStyle *style = menus->GetDefaultStyle();
	IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());

	menu->SetDefaultTitle(MENU_SKILL_TITLE);

	char skillname[64];
	unsigned int menustyle = ITEMDRAW_DEFAULT;

	for (int i = 0; i < MAX_SKILLS; i++)
	{
		sprintf(skillname, "%s (Level %d)", SkillNames[skills[i].iIndex], skills[i].iLevel);
		menustyle = ITEMDRAW_DEFAULT;

		if ((skills[i].iLevel >= 3) || (GetFreeSkills() == 0))
			menustyle = ITEMDRAW_DISABLED;

		if( i == 3 ) // ULTIMATE
		{
			if ((skills[i].iLevel >= 1) || (GetLevel() < 6) || (GetFreeSkills() == 0))
			{
				menustyle = ITEMDRAW_DISABLED;
			}
		}

		menu->AppendItem(SkillNames[skills[i].iIndex], ItemDrawInfo(skillname, menustyle));
	}
	menu->AppendItem(MENU_ITEM_RESET, ItemDrawInfo("Reset Skills"));
	menu->InsertItem(6, MENU_ITEM_RETURN, ItemDrawInfo(MENU_ITEM_RETURN));
	menu->SetMenuOptionFlags( menu->GetMenuOptionFlags() | MENUFLAG_BUTTON_EXIT );
	menu->Display(this->GetIndex(), MENU_TIME_FOREVER);
}
开发者ID:blaisebaileyfinnegan,项目名称:ZPS-RPG,代码行数:45,代码来源:rpgplayer.cpp

示例5: ClientPressedKey

void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
{
#if defined MENU_DEBUG
	g_Logger.LogMessage("[SM_MENU] ClientPressedKey() (client %d) (key_press %d)", client, key_press);
#endif
	CBaseMenuPlayer *player = GetMenuPlayer(client);

	/* First question: Are we in a menu? */
	if (!player->bInMenu)
	{
		return;
	}

	bool cancel = false;
	unsigned int item = 0;
	MenuCancelReason reason = MenuCancel_Exit;
	MenuEndReason end_reason = MenuEnd_Selected;
	menu_states_t &states = player->states;

	/* Save variables */
	IMenuHandler *mh = states.mh;
	IBaseMenu *menu = states.menu;

	unsigned int item_on_page = states.item_on_page;

	assert(mh != NULL);

	if (menu == NULL)
	{
		item = key_press;
	} else if (key_press < 1 || key_press > GetMaxPageItems()) {
		cancel = true;
	} else {
		ItemSelection type = states.slots[key_press].type;

		/* Check if we should play a sound about the type */
		if (g_Menus.MenuSoundsEnabled() && 
			(!menu || (menu->GetMenuOptionFlags() & MENUFLAG_NO_SOUND) != MENUFLAG_NO_SOUND))
		{
			CellRecipientFilter filter;
			cell_t clients[1];

			clients[0] = client;
			filter.Initialize(clients, 1);

			const char *sound = g_Menus.GetMenuSound(type);

			if (sound != NULL)
			{
				edict_t *pEdict = PEntityOfEntIndex(client);
				if (pEdict)
				{
					ICollideable *pCollideable = pEdict->GetCollideable();

					if (pCollideable)
					{
						const Vector & pos = pCollideable->GetCollisionOrigin();
						enginesound->EmitSound(filter, 
							client, 
							CHAN_AUTO, 
#if SOURCE_ENGINE >= SE_PORTAL2
							sound, 
							-1, 
#endif
							sound, 
							VOL_NORM, 
							ATTN_NORM, 
#if SOURCE_ENGINE >= SE_PORTAL2
							0, 
#endif
							0, 
							PITCH_NORM, 
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS \
	|| SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_TF2
							0,
#endif
							&pos);
					}
				}
			}
		}

		/* For navigational items, we're going to redisplay */
		if (type == ItemSel_Back)
		{
			if (!RedoClientMenu(client, ItemOrder_Descending))
			{
				cancel = true;
				reason = MenuCancel_NoDisplay;
				end_reason = MenuEnd_Cancelled;
			} else {
				return;
			}
		} else if (type == ItemSel_Next) {
			if (!RedoClientMenu(client, ItemOrder_Ascending))
			{
				cancel = true;						/* I like Saltines. */
				reason = MenuCancel_NoDisplay;
				end_reason = MenuEnd_Cancelled;
			} else {
//.........这里部分代码省略.........
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:101,代码来源:MenuStyle_Base.cpp

示例6: if

IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder order)
{
	IBaseMenu *menu = md.menu;

	if (!menu)
	{
		return NULL;
	}

	struct
	{
		unsigned int position;
		ItemDrawInfo draw;
	} drawItems[10];

	/* Figure out how many items to draw */
	IMenuStyle *style = menu->GetDrawStyle();
	unsigned int pgn = menu->GetPagination();
	unsigned int maxItems = style->GetMaxPageItems();
	bool exitButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXIT) == MENUFLAG_BUTTON_EXIT;
	bool novoteButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_NOVOTE) == MENUFLAG_BUTTON_NOVOTE;

	if (pgn != MENU_NO_PAGINATION)
	{
		maxItems = pgn;
	}
	else if (exitButton)
	{
		maxItems--;
	}

	if (novoteButton)
	{
		maxItems--;
	}

	/* This is very not allowed! */
	if (maxItems < 2)
	{
		return NULL;
	}

	unsigned int totalItems = menu->GetItemCount();
	unsigned int startItem = 0;

	/* For pagination, find the starting point. */
	if (pgn != MENU_NO_PAGINATION)
	{
		if (order == ItemOrder_Ascending)
		{
			startItem = md.lastItem;
			/* This shouldn't happen with well-coded menus.
			 * If the item is out of bounds, switch the order to
			 * Items_Descending and make us start from the top.
			 */
			if (startItem >= totalItems)
			{
				startItem = totalItems - 1;
				order = ItemOrder_Descending;
			}
		}
		else if (order == ItemOrder_Descending)
		{
			startItem = md.firstItem;
			/* This shouldn't happen with well-coded menus.
			 * If searching backwards doesn't give us enough room,
			 * start from the beginning and change to ascending.
			 */
			if (startItem <= maxItems)
			{
				startItem = 0;
				order = ItemOrder_Ascending;
			}
		}
	}

	/* Get our Display pointer and initialize some crap */
	IMenuPanel *panel = menu->CreatePanel();
	IMenuHandler *mh = md.mh;
	bool foundExtra = false;
	unsigned int extraItem = 0;

	if (panel == NULL)
	{
		return NULL;
	}

	/**
	 * We keep searching until:
	 * 1) There are no more items
	 * 2) We reach one OVER the maximum number of slot items
	 * 3) We have reached maxItems and pagination is MENU_NO_PAGINATION
	 */
	unsigned int i = startItem;
	unsigned int foundItems = 0;
	while (totalItems)
	{
		ItemDrawInfo &dr = drawItems[foundItems].draw;
		/* Is the item valid? */
		if (menu->GetItemInfo(i, &dr) != NULL)
//.........这里部分代码省略.........
开发者ID:pmrowla,项目名称:sourcemod-1.5,代码行数:101,代码来源:MenuManager.cpp


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