question

MoonHeonYoung avatar image
MoonHeonYoung asked

how to make message box / inbox ??

Hello I want to implement two functions.

1. Mailbox system for mobile games

-Short message with item

-When you click the receive button, you will receive it in your inventory.

2. Function to send and receive messages between friends

Does the above function exist?

I need advice.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

Currently there is no mailbox system in PlayFab, if you would like to have this feature, you could refer to this feature request and vote for it: https://community.playfab.com/idea/196/205479628-Player-Messaging.html

However, there are workarounds. For your first case, you can do as follows:

  1. Create a container that contains items you would like players to receive.
  2. Use GrantItemsToUser API in your server or CloudScript, and specify the message in “Annotation” Parameter to grant the container with message to players.
  3. The players can use GetUserInventory API to get the information including the “Annotation” message of the item.
  4. When players click “Receive”, he opens the container using UnlockContainerInstance API and receive the items inside the container.

For your second case, you can implement as below:

  1. A player creates a SharedGroup using CreateSharedGroup API and adds his friends to the group using AddSharedGroupMembers API.
  2. Then one player can send “messages” using UpdateSharedGroupData API and the other can receive messages using GetSharedGroupData API.

If you have any further questions, please feel free to ask.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

MoonHeonYoung avatar image MoonHeonYoung commented ·

Thank you for answer.

and one more question!

Could i possibly figure out how to filter the ones obtained with getUserInventory??

Because I want only those named "mail" in front of the item to be visible in the mailbox

(in the client's ui)

And i want other items to be visible in the "normal" inventory.

In other words, I want to filter the results of getInventory to get only the items I want.

Thank you!

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ MoonHeonYoung commented ·

The API GetUserInventory does not have filter options, it returns all the items that the user possess. Nonetheless you can filter it in client side, you could write the filter logic in the successful callback of GetUserInventory.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.