CutoutInfoObserver [Player Network SDK Only]
Register the callback of the asynchronous notched display information acquisition interface, the game needs to process the callback function. For more information on the callback data structure, see GUACutoutInfoResult.
note
It is strongly recommended to perform registration in the startup function of the game application.[Player Network SDK Only].
Function Definition
- Unity
- Unreal Engine
The list of methods used to process the callback events.
Callback Event | Common | [Player Network SDK Only] | [MSDK Only] |
---|---|---|---|
CutoutResultEvents | - | LoadCutoutData | - |
event OnResultHandler<GUACutoutInfo> CutoutResultEvents;
The list of methods used to process the callback events.
Callback Event | Common | [Player Network SDK Only] | [MSDK Only] |
---|---|---|---|
OnCutoutInfoResultNotify | - | LoadCutoutData | - |
class GUA_EXTERN GUACutoutInfoObserver
{
public:
virtual void OnCutoutInfoResultNotify(const GUACutoutResult &result) {};
virtual ~GUACutoutInfoObserver() {};
};
Code Sample
- Unity
- Unreal Engine
UnionAdapterAPI.GetToolsService().CutoutResultEvents += OnCutoutResultEvents;
UnionAdapterAPI.GetToolsService().CutoutResultEvents -= OnCutoutResultEvents;
#if UNITY_ANDROID
private void OnCutoutResultEvents(GUACutoutInfo result)
{
Debug.Log("Cutout info:" + result.ToString());
}
#endif
// 1. Define an observer class that inherits from GUA_NAMESPACE::GUACutoutInfoObserver at the engine level.
// 2. Implement a callback interface with the same method name such as OnCutoutInfoResultNotify
class FGUACutoutInfoObserver : public GUA_NAMESPACE::GUACutoutInfoObserver {
public:
static FGUACutoutInfoObserver Instance;
void OnCutoutInfoResultNotify(const GUA_NAMESPACE::GUACutoutResult &ret)
{
}
};
FGUACutoutInfoObserver FGUACutoutInfoObserver::Instance;
//Configure the callback
GUA_NAMESPACE::GUAToolsService::SetCutoutObserver(&FGUACutoutInfoObserver::Instance);