public class SwarmActiveUser extends SwarmUser
Modifier and Type | Class and Description |
---|---|
static class |
SwarmActiveUser.FriendRequestCB |
static class |
SwarmActiveUser.GotCloudDataCB |
static class |
SwarmActiveUser.GotFriendsCB |
static class |
SwarmActiveUser.GotInventoryCB |
static class |
SwarmActiveUser.GotItemQuantityCB |
static class |
SwarmActiveUser.GotUserCoinsCB |
static class |
SwarmActiveUser.SaveCloudDataCB |
SwarmUser.GotUserCB, SwarmUser.GotUserStatusCB
Modifier and Type | Field and Description |
---|---|
int |
numNewMessages
The number of new, unread messages.
|
Constructor and Description |
---|
SwarmActiveUser(SwarmUser other) |
Modifier and Type | Method and Description |
---|---|
void |
acceptFriendRequest(int id,
SwarmActiveUser.FriendRequestCB cb)
Accept the friend request from another user.
|
void |
addFriend(int id,
SwarmActiveUser.FriendRequestCB cb)
Send a friend request to another user.
|
void |
consumeItem(int itemId)
Consume the specified item in the user's inventory.
|
void |
deleteFriend(int id,
SwarmActiveUser.FriendRequestCB cb)
Remove a friend from this user's friends list.
|
void |
getCloudData(java.lang.String key,
SwarmActiveUser.GotCloudDataCB cb)
Retrieve the user's data from the cloud via a key-value pair.
|
void |
getCoins(SwarmActiveUser.GotUserCoinsCB cb)
Get this user's current Swarm Coin balance.
|
void |
getFriendRequests(SwarmActiveUser.GotFriendsCB cb)
Get the list of all pending friend requests.
|
void |
getFriends(SwarmActiveUser.GotFriendsCB cb)
Get the list of all friends and all pending friend requests.
|
void |
getInventory(SwarmActiveUser.GotInventoryCB cb)
Get the user's SwarmUserInventory
|
void |
getItemQuantity(int itemId,
SwarmActiveUser.GotItemQuantityCB cb)
Check to see if the user's inventory contains the item and get the quantity of the item specified by the itemId.
|
boolean |
isGuestAccount()
Checks if the user is using a guest account.
|
boolean |
isOfflineGuest()
Checks if the user is using a guest account that is offline.
|
void |
saveCloudData(java.lang.String key,
java.lang.String data)
Save the user's data to the cloud via a key-value pair.
|
void |
saveCloudData(java.lang.String key,
java.lang.String data,
SwarmActiveUser.SaveCloudDataCB cb)
Deprecated.
|
void |
submitPendingCloudData()
Data being sent to the cloud is batched (up to a 5 second delay) for efficiency purposes
This method allows you to force any pending data to be immediately sent.
|
void |
upgradeGuest()
Displays a screen to the user that allows the user to upgrade from a guest account
to a full named account with username, password, and email address.
|
getOnlineStatus, getUser, getUser
public SwarmActiveUser(SwarmUser other)
public boolean isGuestAccount()
public boolean isOfflineGuest()
public void upgradeGuest()
public void saveCloudData(java.lang.String key, java.lang.String data)
key
- The key for the data.data
- The data to be saved.public void submitPendingCloudData()
@Deprecated public void saveCloudData(java.lang.String key, java.lang.String data, SwarmActiveUser.SaveCloudDataCB cb)
key
- The key for the data.data
- The data to be saved.cb
- An optional callback that can be used to confirm the data was successfully saved.public void getCloudData(java.lang.String key, SwarmActiveUser.GotCloudDataCB cb)
key
- The key for the data.cb
- The GotCloudDataCB callback returns the String data for the key. If the request is unsuccessful, then the callback returns null.public void getCoins(SwarmActiveUser.GotUserCoinsCB cb)
cb
- When successful, the GotUserCoinsCB callback returns this SwarmUser's current Swarm Coin balance and returns 0 on failure.public void acceptFriendRequest(int id, SwarmActiveUser.FriendRequestCB cb)
id
- The SwarmUser id of the other user (the one who sent the friend request).cb
- The FriendRequest callback returns true on success, false on failure.public void addFriend(int id, SwarmActiveUser.FriendRequestCB cb)
id
- The SwarmUser id of the other user (the one that this user is sending the friend request to).cb
- The FriendRequest callback returns true on success, false on failure.public void deleteFriend(int id, SwarmActiveUser.FriendRequestCB cb)
id
- The SwarmUser id of the user to be removed from this user's friends list.cb
- The FriendRequest callback returns true on success, false on failure.public void getFriends(SwarmActiveUser.GotFriendsCB cb)
cb
- The GotFriendsCB callback returns Listpublic void getFriendRequests(SwarmActiveUser.GotFriendsCB cb)
cb
- The GotFriendsCB callback returns Listpublic void getInventory(SwarmActiveUser.GotInventoryCB cb)
cb
- The GotInventoryCB callback returns the user's SwarmUserInventory on success, null on failure.public void getItemQuantity(int itemId, SwarmActiveUser.GotItemQuantityCB cb)
itemId
- The StoreItem ID number of the item to check. StoreItem ID numbers are shown in your online Swarm Admin Panel.cb
- The GotItemQuantity callback that contains the quantity of the item in the user's inventory. Will contain 0
if the user does not have the specified item in his/her inventorypublic void consumeItem(int itemId)
itemId
- The StoreItem ID number of the item to consume. StoreItem ID numbers are shown in your online Swarm Admin Panel.