Ucc_v.2.2.7 Integration Uis_v.1.1.1

Hi,
Errors messages report:

-In "ItemViewSlotsContainerItemActionBindingBase.cs"
At line 204 ("protected virtual void InvokeActionInternal(int itemSlotIndex, int itemActionIndex)")
I'm think if you add:
"if (itemAction == null)
return;"
This would avoid the error when you press an empty hotbar key.

-And when you drop an item assigned at hotbar, I think you are missing delete them in hotbar and there make an error if you press the assigned key.

But you've made a lot of progress, I'll finally be able to use it, if I find other errors or anything else I'll let you know.
Thanks for this nice pair of Ucc and Uis scripts.
?
 
Last edited:
Thank you for reporting this bug, I've actually already fixed it,excatly how you mentioned, it will be part of the v1.1.2 update which should come out either this week or the next.

I'm glad you're enjoying UIS and UCC :)
 
Cool ?

In "ItemHotbar.cs" I've modified this:
/// <summary>
/// Assign an item to a slot.
/// </summary>
/// <param name="itemInfo">The item.</param>
/// <param name="slot">The item slot.</param>
public virtual void AssignItemToSlot(ItemInfo itemInfo, int slot)
{
UnassignItemToSlot(itemInfo);
m_ItemViewSlotsContainer.AddItem(itemInfo, slot);
}

/// <summary>
/// Unassign an item to a slot.
/// </summary>
/// <param name="itemInfo">The item.</param>
public virtual void UnassignItemToSlot(ItemInfo itemInfo)
{
int slot;

while ((slot = m_ItemViewSlotsContainer.GetItemIndex(itemInfo)) != -1)
{
m_ItemViewSlotsContainer.RemoveItem(itemInfo, slot);
}
}

/// <summary>
/// UnAssign an item to a slot.
/// </summary>
/// <param name="itemInfo">The item.</param>
/// <param name="slot">The item slot.</param>
public virtual void UnAssignItemToSlot(ItemInfo itemInfo, int slot)
{
if (slot == m_ItemViewSlotsContainer.GetItemIndex(itemInfo))
{
UnassignItemToSlot(itemInfo);
}
else
{
AssignItemToSlot(itemInfo, slot);
}
}

This allowed me to create :
"UnAssignHotbarItemAction.cs" I've just copying "AssignHotbarItemAction.cs" and changing:
/// <summary>
/// Invoke action after waiting for index slot.
/// </summary>
/// <param name="itemInfo">The item.</param>
/// <param name="itemUser">The item user (can be null).</param>
/// <param name="awaitedValue">The index slot.</param>
protected override void InvokeWithAwaitedValue(ItemInfo itemInfo, ItemUser itemUser, int awaitedValue)
{
m_ItemHotbar.UnAssignItemToSlot(itemInfo, awaitedValue);
}

Finally for fixed error when drop item in hotbar i've modified "CharacterQuantityDropItemAction.cs":
/// <summary>
/// Invoke with the action with the awaited value.
/// </summary>
/// <param name="itemInfo">The itemInfo.</param>
/// <param name="itemUser">The item user.</param>
/// <param name="awaitedValue">The value that was waited for.</param>
protected override void InvokeWithAwaitedValue(ItemInfo itemInfo, ItemUser itemUser, int awaitedValue)
{
if (awaitedValue <= 0) { return; }

itemInfo = (awaitedValue, itemInfo);

foreach (ItemHotbar itemHotbar in Resources.FindObjectsOfTypeAll(typeof(ItemHotbar)))
{
if (itemHotbar.ItemUser == itemUser)
{
itemHotbar.UnassignItemToSlot(itemInfo);
}
}

EventHandler.ExecuteEvent<ItemInfo>(itemInfo.Inventory.gameObject, "OnItemActionDrop", itemInfo);
}

It's not the best solution but that work lol
If it can inspire you ;)

Tomorrow I go to see for Rewired, UMA and/or an Localization Integration.
 
Interesting, those all look like good solutions to me, I might look into something similar.

Just one note I don't think you should be using this:
foreach (ItemHotbar itemHotbar in Resources.FindObjectsOfTypeAll(typeof(ItemHotbar)))

Instead I would find the PanelManager -> Item Hotbar Panel -> Item Hotbar. I believe it will be more efficient. If for some reason you have multiple Item Hotbars in the game then I would cache them all the first time you search such that you do not have to call Resources each time you drop an item.

On my side I will look as to why the hotbar does not update correctly when dropping the item.

I'm actually refactoring the Item Hotbar class due to other problems so I'm glad you found this issue now.
I'll add instructions in the release notes as to how to update the hotbar to make it work correctly.
I think we will release the next update later this week or early next week
 
I like your inventory but I'm still having trouble using it...

Another thing that caught my attention is that as soon as you have a weapon in the inventory it can be placed in the holster, on my integration of InventoryPro and Rucksack I make the weapons appear only when they are equipped and I use ItemAbilities to switch between them.

But the magic system associated with the Hotbar is great!

Finally how can you create an inventory with ItemSlotCollection? Or just limit the number of slots and/or the weight...

Keep it that way, you're doing a great job! ?
 
The way the integration works right now is that it spawns all the items that equippable on the character, then the character actually switches the equipped item by moving & activating/deactivating the equippable items.

We will look into improving this in the future such that users can have more control over the bridge between UCC and UIS.

As for limiting the items that can be added you may use a GroupItemRestrictionObject or if you wish to have more control you may use your own component with the IItemRestriction interface. This allows you to control if items can be added/removed to/from the inventory. You can learn more about it here:

Of course you can create your very own custom Item Collection if you wish to have total control over your items.

(There is currently a bug that happens when switching the ItemCollection of the character when bound to the UCC/UIS bridge component, you may ingore it, it will be fixed in the next update)
 
I will return to my Mirror and Rucksack integrations for Ucc.
Currently I've copied and translated PUN to Mirror,
But if I redo everything on a client-server architecture, I could sell it?
Sorry I know this is not the appropriate topic but I will create the appropriate topic when I'm ready, if you permit me to do that...
:unsure:
 
You can sell it if it's an independent asset which does not contain any of our source code (Similar to our PUN add-on of UCC)
Just give us a heads up to know about your progress and any hurdles you come up with :)
 
Top