Go To Console

TPMentor

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.
ShowLatestAdvice ShowLatestAdvice is a method for displaying the newest Advice to player.
ShowAdviceById ShowAdviceById is a method to show Advice to player.
AddAdviceClosedCount Check if the Advice has been opened by adding 1 to closed_count.

GetAdvicesAsync

public void GetAdvicesAsync(string player_uuid, Action<int> callback);

Description

Request the player’s Advice information asynchronously and save at the client-side DB. You can use it when loading game.

You need to wait at least TentuPlaySettings.advicesGetInterval before the next GetAdvicesAsync call. If not, you will see the following message in the Unity Editor Console in TentuPlay debug mode: TPDebug||GetAdvicesAsync started but too soon to send : advicesLastGetTs

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 ..

callback

1 if succeeded, -1 if failed.

SelectAdvicesInfo

public List<AdviceInfo> SelectAdvicesInfo(string player_uuid, [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

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.

ShowLatestAdvice

public int ShowLatestAdvice(GameObject tpAdviceControllerGameObject, string player_uuid, [int maximum_closed_count = 10000]);

Description

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

ShowLatestAdvice 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.

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.

ShowLatestAdvice 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.

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.