LIEventObserver
The LI PASS event callback LIEventObserver
is triggered after LI PASS initialization. The logic for this callback is handled by the game. For more information on the callback data structure, see LIBaseEventResult.
note
It is strongly recommended to incorporate the callback within the startup function of the game.
Function definition
// Add callbacks
public static void AddLIEventObserver(OnLIEventResultHandler<LIBaseEventResult> liEvent)
// Remove callbacks
public static void RemoveLIEventObserver(OnLIEventResultHandler<LIBaseEventResult> liEvent)
Code sample
// Add callbacks
LevelInfinite.AddLIEventObserver(OnLIBaseEventResult);
// Handle LIEventObserver callback result
private void OnLIBaseEventResult(LIBaseEventResult liRet)
{
Debug.Log("<color=#ff00ff>OnLIBaseEventResult. lIEventType : " + Enum.GetName(typeof(LIEventType), liRet.lIEventType) + ", extraJson:" + liRet.extraJson + "</color>");
ShowLogInNewLine("OnLIBaseEventResult. lIEventType : " + Enum.GetName(typeof(LIEventType), liRet.lIEventType) + ", extraJson:" + liRet.extraJson);
switch (liRet.lIEventType)
{
case LIEventType.DEFAULT:
break;
// LI PASS Init Finish
case LIEventType.GN_READY:
try
{
GNPanelReadyEventParam param = JsonUtility.FromJson<GNPanelReadyEventParam>(liRet.extraJson);
ShowLogInNewLine("<color=#ff0000>Version</color> : " + param.extraParams.asset_version + "\n Is_CDN_Asset:" + param.extraParams.is_cdn_asset.ToString());
}
catch (Exception e)
{
Debug.LogError("On LIEventType.INTL_READY Error. msg:" + e.ToString());
}
break;
// LI PASS Panel Open
case LIEventType.LIP_PANEL_OPEN:
try
{
GNPanelCreatedEventParam param = JsonUtility.FromJson<GNPanelCreatedEventParam>(liRet.extraJson);
ShowLogInNewLine("Open Panel from Module:" + param.module + "\n"+
"panelName:" + param.extraParams.panelName.ToString()+"\n"+
"extraJson:" + param.extraParams.extraJson.ToString()+"\n");
}
catch (Exception e)
{
Debug.LogError("On LIEventType.LIP_PANEL_OPEN Error. msg:" + e.ToString());
}
break;
// LI PASS Panel Close
case LIEventType.LIP_PANEL_CLOSE:
try
{
GNPanelCloseEventParam param = JsonUtility.FromJson<GNPanelCloseEventParam>(liRet.extraJson);
ShowLogInNewLine("CLOSE Panel from Module:" + param.module + "\n"+
"isPopPanel:" + param.isPopPanel.ToString() +"\n" +
"isInsertPanel:" + param.isInsertPanel.ToString() +"\n" +
"panelName:" + param.extraParams.panelName.ToString()+"\n"+
"isClosedManually:" + param.extraParams.isClosedManually.ToString()+"\n"+
"extraJson:" + param.extraParams.extraJson.ToString()+"\n");
ResetFocus();
Debug.LogError("reset focus");
}
catch (Exception e)
{
Debug.LogError("On LIEventType.LIP_PANEL_CLOSE " + liRet.lIEventType.ToString() + "Error. msg:" + e.ToString());
}
break;
// LI PASS Open Login Panel
case LIEventType.OPEN_LOGIN:
break;
// LI PASS Close Login Panel
case LIEventType.CLOSE_LOGIN:
break;
// LI PASS Open Account Center
case LIEventType.OPEN_ACCOUNT_CENTER:
break;
// LI PASS Close Account Center
case LIEventType.CLOSE_ACCOUNT_CENTER:
break;
// LI PASS Close Delete Account Panel
case LIEventType.CLOSE_DELETE_ACCOUNT:
break;
// LI PASS Close Parent Certificate Panel
case LIEventType.CLOSE_PARENT_CERTIFICATE:
break;
// LI PASS Close Parent Tip Panel
case LIEventType.CLOSE_PARENT_TIP:
break;
// LI PASS Close Parent Deny Panel
case LIEventType.CLOSE_PARENT_DENY:
try
{
GNPanelCloseEventParam param = JsonUtility.FromJson<GNPanelCloseEventParam>(liRet.extraJson);
ShowLogInNewLine("CLOSE Panel from Module:" + param.module + "\n"+
"isPopPanel:" + param.isPopPanel.ToString() +"\n" +
"isInsertPanel:" + param.isInsertPanel.ToString() +"\n" +
"panel_name:" + param.extraParams.panel_name.ToString()+"\n");
ResetFocus();
Debug.LogError("reset focus");
}
catch (Exception e)
{
Debug.LogError("On LIEventType.CLOSE Panel" + liRet.lIEventType.ToString() + "Error. msg:" + e.ToString());
}
break;
// LI PASS Delete Account Success, this LIEventType takes effect for LI PASS V1.14.00 and later version in Unity.
case LIEventType.DELETE_ACCOUNT_SUCCESS:
Debug.Log("LIEventType.DELETE_ACCOUNT_SUCCESS");
break;
// LI PASS Delete Account Parameters Missing, this LIEventType takes effect for LI PASS V1.14.00 and later version in Unity.
case LIEventType.DELETE_PARAMETERS_MISSING:
break;
// LI PASS Delete Account Failed, this LIEventType takes effect for LI PASS V1.14.00 and later version in Unity.
case LIEventType.DELETE_ACCOUNT_FAIL:
Debug.Log("LIEventType.DELETE_ACCOUNT_FAIL");
break;
// Authorization status of messaging for minors
case LIEventType.SOCIAL_FEATURE_APPROVE_STATUS:
try
{
LISocialFeatureApproveStatus param = JsonUtility.FromJson<LISocialFeatureApproveStatus>(liRet.extraJson);
ShowLogInNewLine("SOCIAL_FEATURE_APPROVE_STATUS, VoiceControlStatus:" + param.VoiceControlStatus + ", NeedVoiceControl:" + param.NeedVoiceControl + ", NeedVoiceVontrolIngame:" + param.NeedVoiceControlIngame + ", NeedVoiceControlParentCert:" + param.NeedVoiceControlParentCert);
}
catch (Exception e)
{
Debug.LogError("On LIEventType.SOCIAL_FEATURE_APPROVE_STATUS" + liRet.lIEventType.ToString() + "Error. msg:" + e.ToString());
}
break;
// Authorization result of messaging for minors
case LIEventType.SOCIAL_FEATURE_APPROVE_RESULT:
try
{
LISocialFeatureApproveResult param = JsonUtility.FromJson<LISocialFeatureApproveResult>(liRet.extraJson);
ShowLogInNewLine("SOCIAL_FEATURE_APPROVE_RESULT, VoiceControlStatus: " + param.VoiceControlStatus);
}
catch (Exception e)
{
Debug.LogError("On LIEventType.SOCIAL_FEATURE_APPROVE_RESULT" + liRet.lIEventType.ToString() + "Error. msg:" + e.ToString());
}
break;
// LI PASS Init Repeat
case LIEventType.GN_REPEAT:
break;
// LI PASS Closed
case LIEventType.GN_DISABLED:
break;
default:
break;
}
}
// Remove callbacks
LevelInfinite.RemoveLIEventObserver(OnLIBaseEventResult);