Skip to main content

NoticeResultObserver

If you were looking for the method for use with Unreal Engine, see NoticeResultObserver for Unreal Engine SDK.

Register the callback of the Player Network SDK notice module, the game needs to process the callback function. For more information on the callback data structure, see NoticeResult.

note

It is strongly recommended to perform registration in the startup function of the game application.

Function definition

// Add the INTLNoticeResult callback to process callback
public static void AddNoticeResultObserver(OnINTLResultHandler<INTLNoticeResult> callback);
// Remove the INTLNoticeResult callback
public static void RemoveNoticeResultObserver(OnINTLResultHandler<INTLNoticeResult> callback);

Code sample

// Add callbacks
public void AddNoticeObserver()
{
INTLAPI.AddNoticeResultObserver(OnNoticeResultEvent);
}

// Remove callbacks
public void RemoveNoticeObserver()
{
INTLAPI.RemoveNoticeResultObserver(OnNoticeResultEvent);
}

// Process the INTLNoticeResult callback
public void OnNoticeResultEvent(INTLNoticeResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
string methodTag = "";
if (noticeRet.MethodId == (int)INTLMethodID.INTL_NOTICE_REQUEST_DATA)
{
methodTag = "RequestNoticeData";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(noticeRet));
}