SteveC
Member
Hey y'all!
Was having an issue getting clip size to display in a HUD UI. I'm listening to the event:
And inside that, I'm just testing what I'm getting from the event (this script is a modified version of SlotItemMonitor and inherits from ItemMonitor ):
I'm using a slider w/ a text field, and "count" works perfect to return the current ammo count, but I can't seem to return a max clip size using these fields:
What I'm hoping to achieve is to return the two as strings to concatenate and display as something like "14/30" (CurrentAmmo/MaxClipSize), and calculate a number between 0-1 w/ it for the slider.
What's the correct way to return the clip size for a given item?
Thanks much!
Was having an issue getting clip size to display in a HUD UI. I'm listening to the event:
Code:
EventHandler.RegisterEvent<Item, ItemType, float> (m_Character, "OnItemUseConsumableItemType", OnUseConsumableItemType);
And inside that, I'm just testing what I'm getting from the event (this script is a modified version of SlotItemMonitor and inherits from ItemMonitor ):
Code:
protected override void OnUseConsumableItemType(Item item, ItemType itemType, float count)
{
if (item.UIMonitorID != m_ID || itemType != m_ConsumableItemType) {
return;
}
//m_LoadedCount.text = count.ToString();
Debug.Log ("count: " + count);
Debug.Log ("item.name: " + item.name);
Debug.Log ("itemType.Capacity: " + itemType.Capacity);
Debug.Log ("itemType.name: " + itemType.name);
}
I'm using a slider w/ a text field, and "count" works perfect to return the current ammo count, but I can't seem to return a max clip size using these fields:
Code:
item.ItemType.Capacity
itemType.Capacity
What I'm hoping to achieve is to return the two as strings to concatenate and display as something like "14/30" (CurrentAmmo/MaxClipSize), and calculate a number between 0-1 w/ it for the slider.
What's the correct way to return the clip size for a given item?
Thanks much!
Last edited: