useritemmanager - TogetherGames/Public-Unity-CSharp GitHub Wiki

UserItemManager

together.UserItemManager

Overview

The UserItemManager is used for fetching and finding items that exist for the current user.


Members

List<UserItem> UserItems

Stores all the UserItems contained in the Manager.


Methods


Add()

Adds a UserItem to the internally managed list without persistence.

Note
This method is deprecated

Returns void
Syntax
UserItemManager.Add( userItem )
Parameters

UserItem userItem

Instance of a UserItem to add internally

--------------------------------------------------------------------------------

FindByUserItemID()

Finds the UserItem with the specified UserItemID if it exists, otherwise returns null.

Returns UserItem
Syntax
UserItemManager.FindByUserItemID( userItemID )
Parameters

long userItemID

The ID of the UserItem to find

--------------------------------------------------------------------------------

GetCount()

Gets the number of UserItems currently managed internally.

Returns int
Syntax
UserItemManager.GetCount(  )

Get()

Gets the UserItem at the specified index if it exists, otherwise returns null.

Returns UserItem
Syntax
UserItemManager.Get( index )
Parameters

int index

The index of the UserItem to find

--------------------------------------------------------------------------------

IndexOf()

Returns the index of the specified UserItem if it exists, otherwise returns -1.

Returns int
Syntax
UserItemManager.IndexOf( userItem )
Parameters

UserItem userItem

Instance of the UserItem to find the index of

--------------------------------------------------------------------------------

IndexOfByUserItemID()

Returns the index of the UserItem with the specified UserItemID if it exists, otherwise returns -1.

Returns int
Syntax
UserItemManager.IndexOfByUserItemID( userItemID )
Parameters

long userItemID

The ID of the UserItem to find the index of

--------------------------------------------------------------------------------

Remove()

Removes a UserItem from the internally managed list. This does not delete the user item from the user's account persistently.

Note
This method is deprecated

Returns void
Syntax
UserItemManager.Remove( index )
Parameters

int index

The index of the UserItem to remove internally

--------------------------------------------------------------------------------

PopulateFrom()

Does a one for one copy of the user items contained in the passed manager to this manager.

Note
This method is deprecated

Returns void
Syntax
UserItemManager.PopulateFrom( manager )
Parameters

UserItemManager manager

The manager to copy from

--------------------------------------------------------------------------------

Award()

Awards a UserItem. Upon success, this automatically updates the internal list.

Returns void
Syntax
UserItemManager.Award( itemID, roomID, userItemProperties, callbackFunc )
Parameters

long itemID

The ID of the Item to award.

[long](#) roomID

The ID of the Room the UserItem is being awarded in.

[PropertyCollection](./propertycollection) userItemProperties

The properties to assign to the UserItem. Pass null to assign no properties.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Create()

Creates a UserItem. Upon success, this automatically updates the internal list.

Returns void
Syntax
UserItemManager.Create( itemID, roomID, userItemProperties, callbackFunc )
Parameters

long itemID

The ID of the Item to create a UserItem from.

[long](#) roomID

The ID of the Room the UserItem is being awarded in.

[PropertyCollection](./propertycollection) userItemProperties

The properties to assign to the UserItem. Pass null to assign no properties.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Delete()

Deletes a UserItem. Upon success, this automatically updates the internal list.

Returns void
Syntax
UserItemManager.Delete( userItemID, callbackFunc )
Parameters

long userItemID

The ID of the UserItem to delete.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

GetAll()

Gets all UserItems assigned to the User. Upon success, this automatically updates the internal list.

Returns void
Syntax
UserItemManager.GetAll( callbackFunc )
Parameters

OnCompleteHandler callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Purchase()

Purchases a UserItem. Upon success, this automatically updates the internal list.

Returns void
Syntax
UserItemManager.Purchase( itemID, roomID, userItemProperties, callbackFunc )
Parameters

long itemID

The ID of the Item to purchase.

[long](#) roomID

The ID of the Room the UserItem is being awarded in.

[PropertyCollection](./propertycollection) userItemProperties

The properties to assign to the UserItem. Pass null to assign no properties.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------

Sell()

Sells a UserItem. Upon success, this automatically updates the internal list.

Returns void
Syntax
UserItemManager.Sell( userItemID, callbackFunc )
Parameters

long userItemID

The ID of the UserItem to sell.

[OnCompleteHandler](./oncompletehandler) callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------
⚠️ **GitHub.com Fallback** ⚠️