Skip to main content

LIEventObserver

If you were looking for the method for use with Unity, see LIEventObserver for Unity SDK.

LI PASS event callback, callback logic needs to be handled by the game. The callback is triggered after initializing LI PASS. For more information on the callback data structure, see LIBaseEventResult.

note

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

Function definition

static FLIEventDelegate& GetEventDelegate();

Code sample

// Add callbacks
FDelegateHandle LIEventObserver;
LIEventObserver = ULevelInfiniteAPI::GetEventDelegate().AddUObject(this, &ULevelInfiniteWindow::OnLIEvent_Callback);
// Handle LIEventObserver callback result
void ULevelInfiniteWindow::OnLIEvent_Callback(FLIBaseEvent Event)
{
AppendResultText(ULISubSystem::FormatJsonINTLResult(Event));
FString logStr;
switch(Event.EventType){
// LI PASS Closed
case ELIEventType::GN_DISABLED:
{
logStr = TEXT("LI closed by CND");
break;
}
// LI PASS Panel Open
case ELIEventType::LIP_PANEL_OPEN:
{
FGNPanelOpenEventParam param;
FJsonObjectConverter::JsonObjectStringToUStruct(Event.ExtraJson, &param, 0, 0);
logStr = FString::Printf(TEXT("LIP_PANEL_OPEN: %s panel open, extraJson = %s"), *param.panelName,*param.extraJson);
break;
}
// LI PASS Panel Close
case ELIEventType::LIP_PANEL_CLOSE:
{
FGNPanelCloseEventParam param;
FJsonObjectConverter::JsonObjectStringToUStruct(Event.ExtraJson, &param, 0, 0);
logStr = FString::Printf(TEXT("LIP_PANEL_CLOSE: %s panel close: isClosedManually= %s, extraJson = %s"), *param.panelName,(param.isClosedManually ? TEXT("true") : TEXT("false")),*param.extraJson);
break;
}
// LI PASS Open Login Panel
case ELIEventType::LOGIN_PANEL_OPEN:
{
logStr = TEXT("Login panel open");
break;
}
// LI PASS Close Login Panel
case ELIEventType::LOGIN_PANEL_CLOSE:
{
logStr = TEXT("Login panel close");
break;
}
// LI PASS Open Account Center
case ELIEventType::ACCOUNT_CENTER_OPEN:
{
logStr = TEXT("Account center open");
break;
}
// LI PASS Close Account Center
case ELIEventType::ACCOUNT_CENTER_CLOSE:
{
logStr = TEXT("Account center close");
break;
}
// LI PASS Save Protocol Version
case ELIEventType::SET_PROVISION:
{
logStr = FString::Printf(TEXT("LI set provision: %s"), *Event.ExtraJson);
break;
}
// LI PASS Real Name Compliance Success
case ELIEventType::COMPLIANCE_AGE_SUCESS:
{
logStr = TEXT("LI age and region compliance success");
break;
}
// LI PASS Minor Compliance Success
case ELIEventType::COMPLIANCE_MINOR_SUCESS:
{
logStr = TEXT("LI minor compliance success");
break;
}
// LI PASS Close Parent Tip Panel
case ELIEventType::CLOSE_PARENT_TIP_PANEL:
{
logStr = TEXT("LI close parent tip panel");
break;
}
// LI PASS Close Parent Deny Panel
case ELIEventType::CLOSE_PARENT_DENY_PANEL:
{
logStr = TEXT("LI close parent deny tip panel");
break;
}
// LI PASS Close Parent Certificate Panel
case ELIEventType::CLOSE_PARENT_CERTIFICATE_PANEL:
{
logStr = TEXT("LI close parent certificate panel");
break;
}
// LI PASS Close Delete Account Panel
case ELIEventType::CLOSE_DELETE_ACCOUNT_PANEL:
{
logStr = TEXT("LI close delete account panel");
break;
}
// Console platform ingame link successfully
case ELIEventType::CONSOLE_INGAME_BIND_COMPLETE:
{
FLIPBindCompleteEventParam param;
FJsonObjectConverter::JsonObjectStringToUStruct(Event.ExtraJson, &param, 0, 0);
logStr = FString::Printf(TEXT("console bind account complete, sucess: %d, msg: %s"), param.sucess, *param.msg);
if(TextBlock_ConsoleBindAccountEmail) {
TextBlock_ConsoleBindAccountEmail->SetText(FText::FromString(param.email));
}
// If console platform logs in successfully, the focus needs to be set.
#if INTL_OS_XBOXONE || INTL_OS_XSX || INTL_OS_PS5 || INTL_OS_WINDOWS
FocusSampleUI();
#endif
break;
}
// LI PASS Delete Account Success, this LIEventType takes effect for LI PASS V1.13.00 and later version in Unreal.
case ELIEventType::DELETE_ACCOUNT_SUCCESS:
{
logStr = TEXT("LI PASS account delete success");
break;
}
// LI PASS Delete Account Failed, this LIEventType takes effect for LI PASS V1.13.00 and later version in Unreal.
case ELIEventType::DELETE_ACCOUNT_FAIL:
{
logStr = TEXT("LI PASS account delete fail");
break;
}
// LI PASS Delete Account Parameters Missing, this LIEventType takes effect for LI PASS V1.13.00 and later version in Unreal.
case ELIEventType::DELETE_PARAMETERS_MISSING:
{
logStr = TEXT("Missing parameters to delete LI PASS account");
break;
}
// Authorization status of messaging for minors
case ELIEventType::SOCIAL_FEATURE_APPROVE_STATUS:
{
FLIPSocialFeatureApproveStatus param;
FJsonObjectConverter::JsonObjectStringToUStruct(Event.ExtraJson, &param, 0, 0);
logStr = FString::Printf(TEXT("SOCIAL_FEATURE_APPROVE_STATUS, VoiceControlStatus: %d, NeedVoiceControl: %d, NeedVoiceControlIngame: %d, NeedVoiceControlParentCert: %d"), param.VoiceControlStatus, param.NeedVoiceControl, param.NeedVoiceControlIngame, param.NeedVoiceControlParentCert);
break;
}
// Authorization result of messaging for minors
case ELIEventType::SOCIAL_FEATURE_APPROVE_RESULT:
{
FLIPSocialFeatureApproveResult param;
FJsonObjectConverter::JsonObjectStringToUStruct(Event.ExtraJson, &param, 0, 0);
logStr = FString::Printf(TEXT("SOCIAL_FEATURE_APPROVE_RESULT, VoiceControlStatus: %d"), param.VoiceControlStatus);
break;
}
// LI PASS Init Repeat
case ELIEventType::INTL_REPEAT:
{
logStr = TEXT("LI init repeat");
break;
}
// LI PASS Init Finish
case ELIEventType::GN_READY:
{
FGNPanelReadyEventParam param;
FJsonObjectConverter::JsonObjectStringToUStruct(Event.ExtraJson, &param, 0, 0);
logStr = FString::Printf(TEXT("LI activity assets ready, is_cdn_asset:%d, asset_version:%s"), param.extraParams.is_cdn_asset, *param.extraParams.asset_version);
break;
}
}

if (GEngine && !logStr.IsEmpty())
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, *logStr);
}
UE_LOG(LogTemp, Warning, TEXT("ULevelInfiniteWindow OnLIEvent_Callback:%s"), *logStr);
}
// Remove callbacks
ULevelInfiniteAPI::GetEventDelegate().Remove(LIEventObserver);