Event Reporting
Report custom events and scenes, and interact with the Feed system to subscribe, store, and retrieve feed data.
TT.ReportEvent(param)
Reports a custom event.
Signature
public static void ReportEvent(ReportEventParam param)Parameters
Field | Type | Description |
|
| Event name. |
|
| Event parameters. |
|
| Success callback. |
|
| Failure callback. |
|
| Completion callback. |
Example
using TTSDK.UNBridgeLib.LitJson;
var parameters = new JsonData();
parameters["level"] = 5;
TT.ReportEvent(new ReportEventParam
{
eventName = "level_complete",
@params = parameters,
success = () => Debug.Log("Event reported."),
fail = () => Debug.LogError("Event report failed."),
complete = () => Debug.Log("Event report completed.")
});TT.ReportScene(param, success, failed, complete)
Reports a scene event.
Signature
public static void ReportScene(
JsonData param,
Action<JsonData> success,
Action<int, string> failed,
Action complete)Example
var scene = new JsonData();
scene["scene"] = "level_complete";
TT.ReportScene(
scene,
success: result => Debug.Log(result.ToJson()),
failed: (code, message) => Debug.LogError($"{code}: {message}"),
complete: () => Debug.Log("Scene report completed.")
);TT.GetFeedManager()
Gets the Feed manager. Use the returned TTFeedManager for subsequent Feed calls.
Signature
public static TTFeedManager GetFeedManager()Return value
A TTFeedManager object used for subsequent Feed calls.
Example
TTFeedManager feedManager = TT.GetFeedManager();TTFeedManager.RequestFeedSubscribe(param, success, failed, complete)
Requests a Feed subscription.
Signature
public void RequestFeedSubscribe(
JsonData param,
Action<JsonData> success,
Action<int, string> failed,
Action complete)1.1.6-Beta exposes the parameter and success result as JsonData without a strongly typed C# model. Build and read the fields according to the Feed documentation.
Example
var param = new JsonData();
feedManager.RequestFeedSubscribe(
param,
success: result => Debug.Log(result.ToJson()),
failed: (code, message) => Debug.LogError($"{code}: {message}"),
complete: () => Debug.Log("Feed subscribe completed.")
);TTFeedManager.CheckFeedSubscribeStatus(param, success, failed, complete)
Checks the Feed subscription status.
Signature
public void CheckFeedSubscribeStatus(
JsonData param,
Action<JsonData> success,
Action<int, string> failed,
Action complete)1.1.6-Beta returns raw JsonData. Read the result fields according to the Feed documentation.
Example
feedManager.CheckFeedSubscribeStatus(
new JsonData(),
success: result => Debug.Log(result.ToJson()),
failed: (code, message) => Debug.LogError($"{code}: {message}"),
complete: () => { }
);TTFeedManager.StoreFeedData(param)
Stores feed data for a business scenario.
Signature
public void StoreFeedData(StoreFeedDataParam param)Parameters
Field | Type | Description |
|
| Feed business scenario. |
|
| Business content identifier. |
|
| Left value, operator, and right value of the business condition. |
|
| Business status. |
|
| Additional business data. |
|
| Success callback with a |
|
| Failure callback. |
|
| Completion callback. |
Example
feedManager.StoreFeedData(new StoreFeedDataParam
{
Scene = 1,
ContentID = "level_5",
LeftValue = "5",
Operator = ">=",
RightValue = "5",
Status = 1,
Extra = "{}",
Success = _ => Debug.Log("Feed data stored."),
Fail = error => Debug.LogError(error.ErrMsg),
Complete = () => { }
});TTFeedManager.GetFeedData(param)
Retrieves feed data for a business scenario.
Signature
public void GetFeedData(GetFeedDataParam param)Parameters and result
Field | Type | Description |
|
| Feed business scenario. |
|
| Business content identifier. |
|
| Success result containing |
|
| Failure callback. |
|
| Completion callback. |
Example
feedManager.GetFeedData(new GetFeedDataParam
{
Scene = 1,
ContentID = "level_5",
Success = result =>
Debug.Log($"Status: {result.Status}, Extra: {result.Extra}"),
Fail = error => Debug.LogError(error.ErrMsg),
Complete = () => { }
});TTFeedManager.OnFeedStatusChange(callback)
Registers a listener for feed status changes.
Signature
public void OnFeedStatusChange(OnFeedStatusChangeCallback callback)Type in the callback result is either FeedStatusEnum.FeedEnter or FeedStatusEnum.FeedExit.
Example
OnFeedStatusChangeCallback feedListener = result =>
Debug.Log($"Feed status: {result.Type}");
feedManager.OnFeedStatusChange(feedListener);TTFeedManager.OffFeedStatusChange(callback)
Removes a feed status change listener.
Signature
public void OffFeedStatusChange(OnFeedStatusChangeCallback callback)Example
feedManager.OffFeedStatusChange(feedListener);