TPPersonalizedOffer
TPPersonalizedOffer
Class in TentuPlay.CRM / Implemented in:TentuPlay.CRM
Description
Class to show in-game offer messages.
GetOfferAsync | Request the player’s Offer information asynchronously and save at the client-side DB. |
---|---|
SelectOfferInfo | Request valid information of Offer in client-side DB sort from the most recent to oldest. |
ShowOffer | ShowOffer is a method for displaying a Offer to player. |
AddOfferClosedCount | Check if the Offer has been opened by adding 1 to closed_count. |
OfferOpened | Call when the player opens the Offer. |
GetOfferAsync
public void GetOfferAsync(string player_uuid, Action<int> callback);
Description
Request the player’s Offer information asynchronously and save at the client-side DB. You can use it when loading game.
You need to wait at least TentuPlaySettings.offersGetInterval
before the next GetOfferAsync call. If not, you will see the following message in the Unity Editor Console in TentuPlay debug mode: TPDebug||GetOffersAsync started but too soon to send : GetOffersAsyncTs
If GetOffersAsync has failed, you will see the following message in the Unity Editor Console in TentuPlay debug mode:
TPError||Error while getting offer: ERROR_MESSAGE
Parameter
player_uuid |
Player’s unique lD (Not a character's ID). e.g. Steam User ID, Google Play User ID .. |
---|---|
callback |
1 if succeeded, -1 if failed. |
SelectOfferInfo
public List<OfferInfo> SelectOfferInfo(string player_uuid, string language, [int maximum_closed_count = 10000]);
Description
Request valid information of Offer in client-side DB sort from the most recent to oldest.
Returns
OfferInfo: Information of Offer
public class OfferInfo
{
public int offer_id;
public int closed_count;
public string expires_in;
public string title;
}
If the call fails, null will be returned and you will see the following message in the Unity Editor Console in TentuPlay debug mode:
TPError||ERROR select from Offer: EXCEPTION_ERROR_MESSAGE
※ Note
Parameter
player_uuid |
Player’s unique lD (Not a character's ID). e.g. Steam User ID, Google Play User ID .. |
---|---|
language |
Language code you set up in personalized offer console. |
maximum_closed_count |
The maximum limit of closed_count for Advice. |
ShowOffer
public IEnumerator ShowOffer(GameObject tpPersonalizedOfferControllerGameObject, string player_uuid, string language, Action<int> callback, [maximum_closed_count = 10000], [int? offer_id = null]);
Description
ShowOffer is a method for displaying the Offer to player. If optional parameter offer_id is null, it shows the latest offer.
ShowOffer calls TentuPlayOffer.PlaceOffer, which shows TentuPlayOffer_landscape.prefab or TentuPlayOffer_portrait.prefab in Assets/TentuPlay/TPPersonalizedOfferTemplates/Resources dynamically. If there is nothing to offer for the player, no window will be shown. For more details, refer to TentuPlayOffer and you can modify the script.
※ Note
Parameter
tpPersonalizedOfferControllerGameObject |
Game object of TPOfferController |
---|---|
player_uuid |
Player’s unique lD (Not a character's ID). e.g. Steam User ID, Google Play User ID .. |
language |
Language code you set up in personalized offer console. |
callback |
1 if succeeded, -1 if failed. |
maximum_closed_count |
The maximum limit of closed_count for Advice. |
offer_id |
Unique ID assigned to the offer. |
AddOfferClosedCount
public int AddOfferClosedCount(int offer_id);
Description
Check if the Offer has been opened by adding 1 to closed_count. Since the method is called when Offer is closed, it is already called in TentuPlayOffer.cs.
It returns 1 for success and -1 for failure. When -1 is returned, you will see the following message in the Unity Editor Console in TentuPlay debug mode:
TPError||ERROR updating closed_count in offer: EXCEPTION_ERROR_MESSAGE
Parameter
offer_id |
Unique ID assigned to the offer. |
---|
OfferOpened
public void OfferOpened(int offer_id, Action<int> callback);
Description
Call when the player opens the Offer. It is necessary for the expiration date of the personalized offer promotion, and it is already called in TentuPlayOffer.cs.
Parameter
offer_id |
Unique ID assigned to the offer. |
---|---|
callback |
1 if succeeded, -1 if failed. |