1const string SLOT_LAYOUT_1x1 =
"{F437ACE2BD5F11E2}UI/layouts/Menus/Inventory/InventoryItemSlot.layout";
70 #ifdef DEBUG_INVENTORY20
110 m_workspaceWidget =
GetGame().GetWorkspace();
116 m_widget = m_workspaceWidget.CreateWidgets(
SetSlotSize(), wGrid );
117 m_widget.AddHandler(
this );
195 if (!BaseInventoryStorageComponent.Cast(
m_pItem) && !WeaponAttachmentsStorageComponent.Cast(
m_pItem))
199 m_pStorageUI.GetInventoryMenuHandler().RegisterUIStorage(
this);
212 if ( !pClothComponent )
215 return pClothComponent.GetAreaType();
268 m_ProgressBar.SetProgressRange(0, magComp.GetMaxAmmoCount());
275 Widget ammoType = m_widget.FindAnyWidget(
"AmmoTypeSize");
317 m_widget.SetEnabled(bVisible);
318 m_widget.SetVisible(bVisible);
346 ItemPreviewManagerEntity manager = world.GetItemPreviewManager();
353 previewEntity =
m_pItem.GetOwner();
354 m_wPreviewImage.SetVisible(
true);
358 manager.SetPreviewItem(renderPreview, previewEntity, null,
true);
377 m_wButton =
ButtonWidget.Cast( m_widget.FindAnyWidget(
"ItemButton" ) );
406 #ifdef DEBUG_INVENTORY20
409 array<string> dbgText =
new array<string>();
410 this.
ToString().Split(
"<", dbgText,
false );
411 m_wDbgClassText1 =
TextWidget.Cast( m_widget.FindAnyWidget(
"dbgTextClass1" ) );
412 m_wDbgClassText2 =
TextWidget.Cast( m_widget.FindAnyWidget(
"dbgTextClass2" ) );
413 m_wDbgClassText3 =
TextWidget.Cast( m_widget.FindAnyWidget(
"dbgTextClass3" ) );
414 m_wDbgClassText1.SetText( dbgText[0] );
415 m_wDbgClassText1.SetEnabled(
true );
416 m_wDbgClassText1.SetVisible(
true );
417 m_wDbgClassText2.SetText( dbgText[1] );
418 m_wDbgClassText2.SetEnabled(
true );
419 m_wDbgClassText2.SetVisible(
true );
420 m_pItem.ToString().Split(
"<", dbgText,
false );
421 if ( dbgText.Count() > 1 )
423 m_wDbgClassText3.SetText( dbgText[1] );
424 m_wDbgClassText3.SetEnabled(
true );
425 m_wDbgClassText3.SetVisible(
true );
434 m_wPreviewImage = null;
444 #ifdef DEBUG_INVENTORY20
445 m_wDbgClassText1 = null;
446 m_wDbgClassText2 = null;
447 m_wDbgClassText3 = null;
479 textQuickSlot.SetVisible( bVisible );
493 #ifdef DEBUG_INVENTORY20
495 BaseInventoryStorageComponent dbgStorage;
502 dbgStorageParentSlot =
m_pStorageUI.GetStorage().GetParentSlot();
505 PrintFormat(
"INV:OnSlotFocused | m_pStorageUI: %1 | Focused slotUI: %2 | Parent storage: %3 | from parent slot: %4",
m_pStorageUI,
this, dbgStorage, dbgStorageParentSlot );
578 m_widget.SetEnabled( enable );
596 m_widget.SetEnabled(
false );
603 m_widget.SetEnabled(
true );
611 m_widget.SetEnabled(
true );
644 return itemDetails.GetName();
658 if (inventoryItemDetails)
661 m_pStorageUI.ShowItemDetails(itemDetails.GetName(), itemDetails.GetDescription(),
m_Attributes.GetWeight().ToString());
674 protected void SetImage(
string resource,
string imageName )
676 if ( resource ==
string.Empty || imageName ==
string.Empty || m_wIcon == null )
679 m_wIcon.LoadImageFromSet( 0, resource, imageName );
681 m_wIcon.GetImageSize( 0, width, height );
682 m_wIcon.SetSize( 32, 32 );
692 if (!invMan || !invMan.CanMoveItem(
m_pItem.GetOwner()))
697 auto pStorage = pSlot.GetStorage();
700 if(!invMan.CanRemoveItemFromStorage(
m_pItem.GetOwner(), pStorage))
707 invMan.TryRemoveItemFromInventory(
m_pItem.GetOwner(), pStorage);
713 m_widget.RemoveHandler(
this );
714 m_widget.RemoveFromHierarchy();
739 if (SCR_GadgetComponent.Cast(item.
FindComponent(SCR_GadgetComponent)))
772 CharacterControllerComponent controller = character.GetCharacterController();
780 return storageManager.GetCharacterStorage();
828 if (dm && dm.IsDestroyed())
842 FactionAffiliationComponent vehicleFaction = FactionAffiliationComponent.Cast(vehicle.
FindComponent(FactionAffiliationComponent));
843 if (!vehicleFaction || !vehicleFaction.GetAffiliatedFaction())
846 FactionAffiliationComponent playerFaction = FactionAffiliationComponent.Cast(player.FindComponent(FactionAffiliationComponent));
847 if (!playerFaction || !playerFaction.GetAffiliatedFaction())
850 return (playerFaction.GetAffiliatedFaction() == vehicleFaction.GetAffiliatedFaction());
859 BaseInventoryStorageComponent pStorage =
GetAsStorage();
864 if ( pStorage.GetAttributes() && pStorage.GetAttributes().GetUIInfo() )
866 name = pStorage.GetAttributes().GetUIInfo().GetName();
869 float fOccupied = 0.0;
871 if ( pStorage.Type() == ClothNodeStorageComponent )
873 array<BaseInventoryStorageComponent> pOwnedStorages =
new array<BaseInventoryStorageComponent>();
874 pStorage.GetOwnedStorages( pOwnedStorages, 1,
false );
875 foreach ( BaseInventoryStorageComponent pSubStorage : pOwnedStorages )
878 fOccupied += pSubStorage.GetOccupiedSpace();
883 fOccupied = pStorage.GetOccupiedSpace();
885 float fCapacity = pStorage.GetMaxVolumeCapacity();
936 if (!weaponMuzzleComp)
940 int currentAmmoCount = weaponMuzzleComp.GetAmmoCount();
941 int maxAmmoCount = weaponMuzzleComp.GetMaxAmmoCount();
947 if (magazineCount > 0 && maxAmmoCount > 0)
949 else if (maxAmmoCount == 0)
975 m_pStorageUI.GetInventoryMenuHandler().UnregisterUIStorage(
this );
979 m_widget.RemoveHandler(
this );
980 m_widget.RemoveFromHierarchy();
986 ItemPreviewManagerEntity manager =
m_pStorageUI.GetInventoryMenuHandler().GetItemPreviewManager();
991 manager.SetPreviewItem(renderPreview, null);
1095 m_wIcon =
ImageWidget.Cast( m_widget.FindAnyWidget(
"icon" ) );
1098 m_wIcon.LoadImageTexture( 0, texture );
1099 m_wIcon.SetVisible(
true );
1113 return m_pItem.GetOwner().GetPrefabData().GetPrefabName();
1132 Widget incompatible = m_widget.FindAnyWidget(
"Incompatible");
1138 incompatible.SetVisible(
false);
1178 incompatible.SetVisible(
true);
1182 incompatible.SetVisible(!well.Type().IsInherited(muzzleWell.Type()));
1188 Widget incompatible = m_widget.FindAnyWidget(
"Incompatible");
1192 return !incompatible.IsVisible();
1213 super.HandlerDeattached(w);
ArmaReforgerScripted GetGame()
const float BUTTON_OPACITY_DISABLED
const float BUTTON_OPACITY_ENABLED
SCR_EAnalyticalItemSlotType
InputManager GetInputManager()
void SCR_FuelManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
const int CURRENT_AMMO_TEXT
const string SLOT_LAYOUT_1x1
const int CURRENT_AMMO_EMPTY
const float CURRENT_AMMO_OPACITY
const int CURRENT_AMMO_MAGAZINE
void SCR_UniversalInventoryStorageComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_VehicleDamageManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
proto external Managed FindComponent(typename typeName)
proto external IEntity GetParent()
ref SCR_MagazineIndicatorConfiguration m_MagIndicator
Replication item identifier.
bool UseItem(notnull IEntity item, ESlotFunction slotFunction=ESlotFunction.TYPE_GENERIC, SCR_EUseContext context=SCR_EUseContext.FROM_QUICKSLOT)
SCR_QuickslotBaseContainer GetContainerFromQuickslot(int index)
bool CanUseItem(notnull IEntity item, ESlotFunction slotFunction=ESlotFunction.TYPE_GENERIC)
bool SetAmmoType(InventoryItemComponent item)
BaseInventoryStorageComponent GetStorageComponent()
returns the storage component associated with this UI component
void SetSelected(bool select)
void SetSelectedQuickSlot(bool select)
void Destroy()
Removes just the UI slot.
override bool OnChange(Widget w, bool finished)
void SCR_InventorySlotUI(InventoryItemComponent pComponent=null, SCR_InventoryStorageBaseUI pStorageUI=null, bool bVisible=true, int iSlotIndex=-1, SCR_ItemAttributeCollection pAttributes=null)
SCR_CharacterInventoryStorageComponent GetCharacterStorage(IEntity entity)
ImageWidget m_wCurrentMagazineAmmoCount
ESlotFunction m_eSlotFunction
bool CanUseItem(IEntity player)
void IncreaseStackNumberWithRplId(RplId id)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
TextWidget m_wTextQuickSlot
InventoryItemComponent GetInventoryItemComponent()
ESlotFunction GetSlotedItemFunction()
What functionality the item in the slot has? ( weapon, magazine, health, consumable....
Widget m_wCurrentMagazine
override void HandlerAttached(Widget w)
void OverrideReferencedComponent(notnull InventoryItemComponent iic)
void UpdateVolumeBarValue()
ProgressBarWidget m_wVolumeBar
SCR_InventoryProgressBar m_ProgressBar
ref SCR_ItemAttributeCollection m_Attributes
void SetEnabledForMove(int iSelect)
void UpdateInventorySlot(InventoryItemComponent comp, int stackNumber)
void SetQuickSlotIndexVisible(TextWidget textQuickSlot, bool bVisible)
BaseInventoryStorageComponent GetAsStorage()
ResourceName GetItemResource()
bool ShouldVehicleSlotBeVisible(SCR_InventoryVehicleVisibilityAttribute attr)
void SetSlotBlocked(bool bBlocked)
should be the slot be blocked?
OverlayWidget m_wItemLockThrobber
void ~SCR_InventorySlotUI()
ECommonItemType GetCommonItemType()
void CheckCompatibility(SCR_InventorySlotUI slot)
SCR_InventoryStorageBaseUI GetStorageUI()
ProgressBarWidget m_wAmmoCount
InventoryItemComponent m_pItem
SCR_FuelManagerComponent m_FuelManager
void SetStackNumber(int i)
void UpdateWeaponAmmoCount()
override bool OnFocusLost(Widget w, int x, int y)
SCR_InventoryStorageManagerComponent GetInventoryManager()
void SetIcon(ResourceName texture)
void SetSlotSize(ESlotSize slotSize)
override void HandlerDeattached(Widget w)
void OnFuelAmountChanged(float newFuelValue)
void SetImage(string resource, string imageName)
TextWidget m_wMagazineNumber
SCR_InventoryStorageBaseUI m_pStorageUI
void UpdateReferencedComponent(InventoryItemComponent pComponent, SCR_ItemAttributeCollection attributes=null)
void SetItemFunctionality()
stores the type of the functionality of the item in the slot
void IncreaseStackNumber()
TextWidget m_wStackNumber
override bool OnMouseEnter(Widget w, int x, int y)
SCR_EAnalyticalItemSlotType GetAnalyticalItemSlotType()
void SetSlotVisible(bool bVisible)
should be the slot visible?
LoadoutAreaType GetLoadoutArea()
TextWidget m_wTextQuickSlotLarge
void OnOwnedSlotsUpdated()
override bool OnFocus(Widget w, int x, int y)
void SetEnabled(bool enable)
void UseItem(IEntity player, SCR_EUseContext context)
bool OnDrop(SCR_InventorySlotUI slot)
string GetInventoryItemName(InventoryItemComponent item)
Function to override to get custom inventory name.
string GetInventoryItemDescription(InventoryItemComponent item)
Function to override to get custom inventory description.
bool GetVisibleInVehicleOnly()
bool GetVisibleForVehicleFactionOnly()
static IEntity GetLocalControlledEntity()
SCR_QuickslotBaseContainer is intended to be used for quickslots, to allow quickslotting of non-item ...
void HandleVisualization(ImageWidget iconImage, RenderTargetWidget renderTarget, RichTextWidget text, TextWidget quickslotNumber)
UIInfo - allows to define UI elements.
enum EPhysicsLayerPresets Vehicle
SCR_EditableEntityComponent GetControlledEntity()
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute
proto external PlayerController GetPlayerController()
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
proto int ARGB(int a, int r, int g, int b)