//------------------------------------------------------------------------ int CScriptBind_UIAction::HideElement( IFunctionHandler *pH, const char * elementName, int instanceID ) { IUIElement* pElement = GetElement( elementName, instanceID ); if ( pElement ) { if ( instanceID < 0 ) { IUIElementIteratorPtr elements = pElement->GetInstances(); while ( IUIElement* pInstance = elements->Next() ) pInstance->SetVisible( false ); } else { pElement->SetVisible( false ); } return pH->EndFunction( true ); } UIACTION_WARNING( "LUA: UIElement %s does not exist", elementName ); return pH->EndFunction( false ); }
void CHUDInventory::ShowInventory() { IUIElement* pElement = gEnv->pFlashUI->GetUIElement("Inventory"); if(pElement) { if(!Inv_loaded) { pElement->Reload(); pElement->GetFlashPlayer()->SetVisible(true); pElement->SetVisible(true); CActor *pActor = static_cast<CActor *>(gEnv->pGame->GetIGameFramework()->GetClientActor()); IInventory *pInventory = pActor->GetInventory(); g_pGame->Actions().FilterNoMouse()->Enable(true); for (int i = 0; i < pInventory->GetCount(); i++) { EntityId ide = pInventory->GetItem(i); EntityId slotID = pActor->GetInventory()->FindItem(ide); CItem *curItem = static_cast<CItem*>(gEnv->pGame->GetIGameFramework()->GetIItemSystem()->GetItem(ide)); IItem *pItem = static_cast<IItem*>(gEnv->pGame->GetIGameFramework()->GetIItemSystem()->GetItem(ide)); CItem::SInventotyInfo info = curItem->GetInventoryInfo(); //int slotID; EntityId itemID = pItem->GetEntityId(); itemsSaved = false; for(int i = 0; i<inventoryItems.size(); i++) { if(inventoryItems[i].itemID == itemID) { //CryLog("Items finded in saved items"); slotID = inventoryItems[i].slotID; itemsSaved = true; break; } } if(!itemsSaved) slotID--; SFlashVarValue args[8] = {slotID, info.iconName.c_str(), itemID, info.itemName.c_str(), info.itemDescription.c_str(), 0, info.canStack, info.canQuick}; if(info.itemClass) { pElement->GetFlashPlayer()->Invoke("addInventoryItem", args, 8); if(!itemsSaved) { SInventoryItem inventoryItem; inventoryItem.itemName = info.itemName.c_str(); inventoryItem.itemID = itemID; inventoryItem.slotID = slotID++; inventoryItem.itemAmmount = 0; inventoryItem.canStack = info.canStack; inventoryItems.push_back(inventoryItem); } } } pElement->GetFlashPlayer()->SetFSCommandHandler(this); Inv_loaded = true; } else { g_pGame->Actions().FilterNoMouse()->Enable(false); pElement->SetVisible(false); pElement->GetFlashPlayer()->SetVisible(false); pElement->GetFlashPlayer()->SetFSCommandHandler(NULL); Inv_loaded = false; } } else CryLog("CHUDInventory::Error open inventory!"); }