Keewano Unity SDK
Loading...
Searching...
No Matches
In-Game Balance

Defining an "Item"

Keewano tracks game balance by defining the concept of an "item". An item is any countable element that can be given or taken within the game. Examples include:

  • Virtual currencies (e.g., gold coins)
  • Unique elements (e.g., a sword)
  • Game actions (e.g., number of moves)

It is important to note that these items are distinct from in-app purchases, which involve real money transactions.

Items Reset

To set or reset a specific item for the user, use KeewanoSDK.ReportItemsReset.

KeewanoSDK.ReportItemsReset is designed to both initialize items with default values and override existing values. This function is typically used during initial setup or in response to a support command to ensure the user's items are accurate and up-to-date.

Items Exchange

To track game balance, rewards, or lost items, use the KeewanoSDK.ReportItemsExchange. For example, a player spends 5 gold coins and a healing potion to get 1 vial of eternal life. Passing null as the to parameter means that the user lost the items (e.g., a broken sword or payment to pass a bridge), while passing null to the from parameter means the user gets a reward, such as collecting an item on the road or level win rewards.

Examples

Player Spends 5 Gold Coins and a Healing Potion to Get 1 Vial of Eternal Life

Keewano.Item[] fromItems = { new Keewano.Item("Gold Coin", 5), new Keewano.Item("Healing Potion") };
Keewano.Item[] toItems = { new Keewano.Item("Vial of Eternal Life") };
KeewanoSDK.ReportItemsExchange("Magic Store", fromItems, toItems);
Definition KeewanoSDK.cs:18
static void ReportItemsExchange(string exchangeLocation, Item[] from, Item[] to)
Reports an item exchange event using item arrays.
Definition KeewanoSDK.cs:333
Definition KBatch.cs:6
Represents a game item with a unique identifier and a quantity.
Definition KeewanoItems.cs:8

Player Loses a Broken Sword (One-Sided Transaction)

Keewano.Item[] lostItems = { new Keewano.Item("Broken Sword") };
KeewanoSDK.ReportItemsExchange("Tavern", lostItems, null);

Player Receives a Reward (One-Sided Transaction)

Keewano.Item[] rewardItems = { new Keewano.Item("Diamond", 3), new Keewano.Item("Health Potion", 2) };
KeewanoSDK.ReportItemsExchange("Wizard's Gift", null, rewardItems);

Match3 Level Scenario

When the player enters a Match3 level, they lose 1 attempt and 1 bomb booster, their moves are reset to 5, they perform 3 moves (each reducing the moves count by 1), and finally win 50 gold coins and a rainbow booster.

// Step 1: Upon entering the level, deduct 1 attempt and 1 bomb booster
Keewano.Item[] initialLoss = { new Keewano.Item("Attempt", 1),
new Keewano.Item("Bomb Booster", 1) };
KeewanoSDK.ReportItemsExchange("Match3 Level Entry", initialLoss, null);
// Step 2: Reset moves to 5 at the start of the level
Keewano.Item[] movesReset = { new Keewano.Item("Moves", 5) };
KeewanoSDK.ReportItemsReset("Match3 Level Start", movesReset);
// Step 3: Player makes 3 moves, each costing 1 move
Keewano.Item[] moveCost = { new Keewano.Item("Moves", 1) };
KeewanoSDK.ReportItemsExchange("Match3 Move", moveCost, null);
KeewanoSDK.ReportItemsExchange("Match3 Move", moveCost, null);
KeewanoSDK.ReportItemsExchange("Match3 Move", moveCost, null);
// Step 4: Upon winning, reward the player with 50 gold coins and 1 rainbow booster
Keewano.Item[] winReward = { new Keewano.Item("Gold Coin", 50),
new Keewano.Item("Rainbow Booster") };
KeewanoSDK.ReportItemsExchange("Match3 Win", null, winReward);
static void ReportItemsReset(string location, Item[] items)
Resets the user's items at a specified location.
Definition KeewanoSDK.cs:406

User Balance Fix Reset by Support Team

In this scenario, the support team issues a command to fix a user's balance, resetting it to a predefined default state.

Keewano.Item[] balanceFix = { new Keewano.Item("Gold Coin", 100),
new Keewano.Item("Healing Potion", 2),
new Keewano.Item("Attempt", 3) };
KeewanoSDK.ReportItemsReset("Support Balance Reset", balanceFix);