本文整理汇总了C++中IBaseMenu::InsertItem方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseMenu::InsertItem方法的具体用法?C++ IBaseMenu::InsertItem怎么用?C++ IBaseMenu::InsertItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseMenu
的用法示例。
在下文中一共展示了IBaseMenu::InsertItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowClassMenu
void CRPGPlayer::ShowClassMenu( int team )
{
IMenuStyle *style = menus->GetDefaultStyle();
IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());
menu->SetDefaultTitle(MENU_CLASS_TITLE);
switch (team)
{
case TEAM_SURVIVORS:
for (int i = 0; i < NUM_HUMAN_CLASSES; i++)
{
menu->AppendItem(HumanClasses[i], ItemDrawInfo(HumanClasses[i]));
}
break;
case TEAM_UNDEAD:
for (int i = 0; i < NUM_ZOMBIE_CLASSES; i++)
{
menu->AppendItem(ZombieClasses[i], ItemDrawInfo(ZombieClasses[i]));
}
break;
}
menu->InsertItem(MENU_CHOICE_RETURN, MENU_ITEM_RETURN, ItemDrawInfo(MENU_ITEM_RETURN));
menu->Display(this->GetIndex(), MENU_TIME_FOREVER );
}
示例2: 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);
}
示例3: InsertMenuItem
static cell_t InsertMenuItem(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);
}
char *info;
ItemDrawInfo dr;
pContext->LocalToString(params[3], &info);
pContext->LocalToString(params[4], (char **)&dr.display);
dr.style = params[5];
return menu->InsertItem(params[2], info, dr) ? 1 : 0;
}