Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Player.SInventory Class Reference
Inheritance diagram for SineSpace.Scripting.Player.SInventory:
ScriptClass< T > ScriptClassWrapper< T >

Public Member Functions

override void Initialise (SScript runtime, object wrapper)
 
void Authorize (Closure onAuthorized=null, Closure onRejected=null)
 Requests access to inventory functions, must be called prior to attempting to access inventory. As soon as the player has accepted the request, the Authorized attribute will be 'true'. More...
 
void Authorize (Action onAuthorized=null, Action onRejected=null)
 Requests access to inventory functions, must be called prior to attempting to access inventory. As soon as the player has accepted the request, the Authorized attribute will be 'true'. More...
 
int CountCopiesOfItem (int itemID)
 Checks if the user owns a specified item More...
 
void AddToHotbar (int index, int itemID)
 Adds the first found instance of itemID to the players first free hotbar entry More...
 
void RemoveFromHotbar (int index)
 Adds the first found instance of itemID to the players first free hotbar entry More...
 
void RequestRefresh ()
 Requests a refresh of the users inventory (can occur max once per 120 seconds). Requires authorization. More...
 
- Public Member Functions inherited from ScriptClass< T >
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 

Properties

bool Authorized [get]
 
SInventoryItem[] Items [get]
 Returns the users current loaded inventory More...
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive. More...
 
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass< T >
void Initialise (SScript runtime)
 

Member Function Documentation

◆ AddToHotbar()

void SineSpace.Scripting.Player.SInventory.AddToHotbar ( int  index,
int  itemID 
)

Adds the first found instance of itemID to the players first free hotbar entry

◆ Authorize() [1/2]

void SineSpace.Scripting.Player.SInventory.Authorize ( Action  onAuthorized = null,
Action  onRejected = null 
)

Requests access to inventory functions, must be called prior to attempting to access inventory. As soon as the player has accepted the request, the Authorized attribute will be 'true'.

Parameters
onAuthorizedThe onAuthorized c# action.
onRejectedThe onRejected c# action.

◆ Authorize() [2/2]

void SineSpace.Scripting.Player.SInventory.Authorize ( Closure  onAuthorized = null,
Closure  onRejected = null 
)

Requests access to inventory functions, must be called prior to attempting to access inventory. As soon as the player has accepted the request, the Authorized attribute will be 'true'.

Parameters
onAuthorizedThe onAuthorized lua callback.
onRejectedThe onRejected lua callback.

◆ CountCopiesOfItem()

int SineSpace.Scripting.Player.SInventory.CountCopiesOfItem ( int  itemID)

Checks if the user owns a specified item

Parameters
itemID
Returns
-1 if still loading inventory, number of items otherwise

◆ Initialise()

override void SineSpace.Scripting.Player.SInventory.Initialise ( SScript  runtime,
object  wrapper 
)
virtual

Implements ScriptClass< T >.

◆ RemoveFromHotbar()

void SineSpace.Scripting.Player.SInventory.RemoveFromHotbar ( int  index)

Adds the first found instance of itemID to the players first free hotbar entry

◆ RequestRefresh()

void SineSpace.Scripting.Player.SInventory.RequestRefresh ( )

Requests a refresh of the users inventory (can occur max once per 120 seconds). Requires authorization.

Property Documentation

◆ Authorized

bool SineSpace.Scripting.Player.SInventory.Authorized
get

◆ Items

SInventoryItem [] SineSpace.Scripting.Player.SInventory.Items
get

Returns the users current loaded inventory