LI PASS 事件回调信息(LIEventObserver)
LI PASS 事件的回调,游戏需要处理回调逻辑。当 LI PASS 初始化完成时,将触发回调。更多回调数据结构的信息,请参见 LIBaseEventResult。
注意
强烈建议游戏在应用启动函数中进行注册。
函数定义
static FLIEventDelegate& GetEventDelegate();
代码示例
// 添加回调
FDelegateHandle LIEventObserver;
LIEventObserver = ULevelInfiniteAPI::GetEventDelegate().AddUObject(this, &ULevelInfiniteWindow::OnLIEvent_Callback);
// 处理 LIEventObserver 的回调结果
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, ¶m, 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, ¶m, 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, ¶m, 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, ¶m, 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, ¶m, 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, ¶m, 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);
}
// 移除回调
ULevelInfiniteAPI::GetEventDelegate().Remove(LIEventObserver);