Cloud Goods - SocialPlay/CloudGoodsUnitySDK GitHub Wiki

Cloud Goods Class Script

CloudGoods class is the core class of the Cloud Goods SDK. This hold all of the service calls to the Cloud Goods server that are called to manage the persistent data in your game. It also hold all of the static data that the cloud goods systems might need to manage calls such as Application/Game ID, and the current logged in User Info.

Global Events/Callbacks

static public Action <string> onErrorEvent

An event that gets fired off when there is an error callback detected with one of the webservice calls. Returns string message summary of the related error

static public Action<UserResponse> OnUserLogin

An event that fires off when the user has successfully been authenticated and logged in by the server. Returns a UserResponse.

###static public event Action<string> OnLogout Gets fired off when user logs out. Returns string message of any errors.

###static public Action<UserResponse> OnUserRegister Gets fired off when user is confirmed to have registered to the server. Returns a UserResponse object.

###static public Action<UserResponse> OnForgotPassword Gets fired off when a User requests to retreive their password. Returns a UserResponse object.

###static public Action<UserResponse> OnVerificationSent Gets fired off when a user sends a re-verification message for registering user to the game. Returns a UserResponse

###static public Action<string> OnRegisteredUserToSession Gets fired off once the game has received a callback from the server that a user has registered to a game session. Returns a string representation of the SessionID

###static public Action<List<StoreItem>> OnStoreListLoaded Gets fired off when the webservice call returns with the list of store items for the App. Returns a list for StoreItem

###static public Action<List<ItemData>> OnItemsLoaded Gets fired off when the users items have been loaded from the server. Returns list of ItemData

###static public Action<int> OnStandardCurrency Returns the int amount of a users Standard currency

###static public Action<int> OnPremiumCurrency Returns the int amount of a users Premium currency

###static public Action<string> OnStandardCurrencyName Returns the string name of the worlds Standard currency

###static public Action<string> OnPremiumCurrencyName Returns the string name of the worlds Premiumcurrency

###static public Action On StandardCurrencyTexture Returns the texture image of the worlds StandardCurrency

###static public Action<Texture2D> On PremiumCurrencyTexture Returns the texture image of the worlds Premium Currency

Public Variables

static public string AppSecret

The key to the secure cloud goods calls like giving player credits, is set in the cloud goods settings window

static public string AppID

The ID of the application tied to this game. This is set in the cloud goods settings window.

static public GameObject DefaultItemDrop

Returns the Gameobject that will be instantiated when an item is dropped into the world from the item aquire system

static public GameObject DefaultUIItem

Returns the default GameObject that will be instantiated as a container item for the UnityUIItemContainer

static public bool isLogged

Shows if a user is logged in with cloud goods

static public CloudGoodsUser user

The current logged in user, has all of the user info.

Public Functions

Game Authentication Calls

static public void AuthorizeUser(CloudGoodsUser userInfo)

This function is called to attempt to authorize and log in a user to the application. Parameter userInfo is the CloudGoodsUser of the user attempting to log in.

ItemContainer Management Calls

static public void GenerateItemsAtLocation

This function generates random items from the game based on the parameters that are set in the call. This is used to generate drop items or giving players random items.

static public void GetItems

This function will retrieve the items of the currently logged in user.

static public void GetOwnerItems

This function will retrieve the items of a specific player

static public void GetOwnerItemById

This function will retrieve item information of a single item type from a given location.

static public void ConsumeItemById

This function will consume a certain amount from a specified item in a given location.

static public void HasItem

This function checks the local list of owners items and checks if the user has the item.

static public void GetItem (int id)

This function checks and retieves item information of an item in the local list of owner items, using the item ID as a look up.

static public void GetItem(string name)

This function checks and retieves item information of an item in the local list of owner items, using the item name as a look up.

static public void MoveItemStack

This function is used to move an item stack from one location to another location

static public void MoveItemStacks

This function is used to move multiple item stacks from one location to another location

static public void RemoveItemStack

This function is used to remove a all items in a single item stack from a given location

static public void UseItem

This function will deduct a single quantity from an item stack. Will be removed from location 0.

static public void RemoveItemStacks

Removes a list of item stacks from a user.

static public void GiveOwnerItems

Will generate a list of items for a user at location 0.

User Management

static public void GetUserFromWorld

Retrieves userInfo for a given user

static public void RegisterGameSession

Gets a sessionID from a server, usually after a user has logged in.

static public void GetAccessPinFromGuid

Gets a user Access pin login for an access pin style log in used in cross platform game login.

static public void Login

Logs a user into the developer application world. Receives a userResponse on success

static public void Register

Registers a new user to the developers application

static public void ForgotPassword

This function tells the server to send the user a password reset email

static public void ResendVerificationEmail

This function tells the server to send the user and email to re-verify their registration.

static public void Logout

Removes local cached info of a user

Store Calls

static public void ConsumePremiumCurrency

This function will consume a given amount of the currently logged in users premium currency

static public void GetFreeCurrencyBalance

Retrieves the current amount of free currency of the currently logged in user

static public void GetPremiumCurrencyBalance

Retrieves the current amount of premium currency of the currently logged in user

static public void GetWorldCurrencyInfo

Get the worlds currency info like name, and texture image.

static public void GetStoreItems

Retrieves a list of StoreItems for the given application

static public void GetStoreItem (int itemID)

Retrieves a storeItem from the local cached list of store items

static public void GetStoreItem (int itemID)

Retrieves a storeItem from the local cached list of store items using the itemID as the look up.

static public void GetStoreItem (string name)

Retrieves a storeItem from the local cached list of store items using the name as the look up.

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