Skip to main content

Callback of the Notification Module (NoticeResultObserver)

[MSDK & Player Network SDK] Register a callback for the notice module. The game needs to register a callback for processing.For more information about the callback data structure, see GUANoticeResult.

note

It is strongly recommended that games register in the application startup function.

Function Definition

List of methods used to handle callback events

Callback EventCommon[Player Network SDK only][MSD only]
NoticeResultEventsLoad notice information (LoadNoticeData)*-
event OnResultHandler<GUANoticeRet> NoticeResultEvents;

Code Example

// Add the callback
UnionAdapterAPI.GetNoticeService().NoticeResultEvents += OnNoticeResultEvent;

// Remove the callback
UnionAdapterAPI.GetNoticeService().NoticeResultEvents -= OnNoticeResultEvent;

// NoticeResultEvents callback handling
private void OnNoticeResultEvent(GUANoticeRet noticeRet)
{
Debug.Log("OnNoticeResultEvent");
string methodTag = "";
if (noticeRet.MethodId == (int)GUAMethodID.GUA_NOTICE_REQUEST_DATA)
{
methodTag = "RequestNoticeData";
}

Debug.Log(methodTag + noticeRet.ToString());
NoticeSample noticeWindow = m_sample as NoticeSample;
if (noticeWindow != null)
{
noticeWindow.SetNoticeResult(noticeRet);
}
}