TentuPlay

Documentation

SDK Version:
Language:

TPMentor

Class in TentuPlay.CRM / Implemented in:TentuPlay.CRM

Description

Class to show in-game messages.

Methods

GetAdvicesAsync Request the player’s Advice information asynchronously and save at the client-side DB.
SelectAdvicesInfo Request valid information of Advice in client-side DB sort from the most recent to oldest.
ShowAdviceById ShowAdviceById is a method to show Advice to player.
ShowAdvices ShowAdvices is a method for displaying the newest Advice to player.
AddAdviceClosedCount Check if the Advice has been opened by adding 1 to closed_count.

Property

GetAdvicesAsyncResult Show status of GetAdvicesAsync with GetAdvicesAsync’s callback property

GetAdvicesAsync

public void GetAdvicesAsync(string player_uuid);

Description

Request the player’s Advice information asynchronously and save at the client-side DB. You can use it when loading game. You can get the status of GetAdvicesAsync from property of GetAdvicesAsyncResult.

You need to wait at least 600 seconds before the next GetAdvicesAsync call. If not, you will see the following message in the Unity Editor Console in TentuPlay debug mode:

If GetAdvicesAsync has failed, you will see the following message in the Unity Editor Console in TentuPlay debug mode: TPError||Error while getting advice: ERROR_MESSAGE

Parameter

player_uuid

Player’s unique lD (Not a character's ID).

e.g. Steam User ID, Google Play User ID ..

SelectAdvicesInfo

public List<AdviceInfo> SelectAdvicesInfo(int maximum_closed_count = 10000);

Description

Request valid information of Advice in client-side DB sort from the most recent to oldest.

Returns

AdviceInfo: Information of Advice

public class AdviceInfo
{
    public int advice_id;
    public int closed_count;
    public string valid_until;
}
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 Advice : EXCEPTION_ERROR_MESSAGE

Parameter

maximum_closed_count

The maximum limit of closed_count for Advice.

ShowAdviceById

public int ShowAdviceById(GameObject tpAdviceControllerGameObject, string player_uuid, int advice_id);

Description

ShowAdviceById is a method to show Advice to player.

After requesting SelectAdvicesInfo, get advice_id and show the Advice for the advice_id.

ShowAdvices and ShowAdvicesById call PlaceAdvice that fits the player’s persona among TPAdviceWindowUI{Persona}Controller. Then, call the persona’s prefab dynamically among the prefabs in TPAdviceTemplates/Resources and show them on screen. If there is no analysis result of the player, no window will appear. For more details, refer to TPAdviceWindowUI{Persona}Controller and you can modify the script.

It returns 1 for success and -1 for failure. If there is no Advice to show, it returns 0.

Parameter

tpAdviceControllerGameObject

Game object of TPAdviceController

player_uuid

Player’s unique lD (Not a character's ID).

e.g. Steam User ID, Google Play User ID ..

advice_id

Unique ID assigned to the advice. It can be obtained from AdviceInfo.advice_id.

ShowAdvices

public int ShowAdvices(GameObject tpAdviceControllerGameObject, string player_uuid, int maximum_closed_count = 10000);

Description

ShowAdvices is a method for displaying the newest Advice to player. To show the most recent Advice, you can call ShowAdvices which replaces calling both SelectAdvicesInfo and ShowAdviceById.

ShowAdvices and ShowAdviceById call PlaceAdvice that fit the player’s persona among TPAdviceWindowUI{Persona}Controller. Then, call the persona’s prefab dynamically among the prefabs in TPAdviceTemplates/Resources and show. If there is no analysis result for the player, no window will be shown. For more details, refer to TPAdviceWindowUI{Persona}Controller and you can modify the script.

It returns 1 for success and -1 for failure. If there is no Advice to show, it returns 0.

Parameter

tpAdviceControllerGameObject

Game object of TPAdviceController

player_uuid

Player’s unique lD (Not a character's ID).

e.g. Steam User ID, Google Play User ID ..

maximum_closed_count

The maximum limit of closed_count for Advice.

AddAdviceClosedCount

public int AddAdviceClosedCount(int advice_id);

Description

Check if the Advice has been opened by adding 1 to closed_count. Since the method is called when Advice is closed, it is located in TPAdviceWindowUI{Persona}Controller.

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 advice : EXCEPTION_ERROR_MESSAGE

Parameter

advice_id

Unique ID assigned to the advice.

GetAdvicesAsyncResult

public Result GetAdvicesAsyncResult;

Description

Show status of GetAdvicesAsync with GetAdvicesAsync’s callback property

public enum Result
{
    None, // GetAdviceAsync is processing
    Failed, // GetAdviceAsync failed
    Success // GetAdviceAsync succeed
}