这些核心代理会在引擎主框架的不同时机被触发广播。
比如,FCoreDelegates::OnBeginFrame.Broadcast()就是在LaunchEngineLoop.cpp的FEngineLoop::Tick()里调用的。

   1 // Copyright Epic Games, Inc. All Rights Reserved.
   2 
   3 #pragma once
   4 
   5 #include "CoreTypes.h"
   6 #include "Containers/Array.h"
   7 #include "Containers/UnrealString.h"
   8 #include "Containers/Map.h"
   9 #include "Delegates/Delegate.h"
  10 #include "Math/IntVector.h"
  11 #include "Misc/AES.h"
  12 #include "GenericPlatform/GenericPlatformFile.h"
  13 
  14 class AActor;
  15 class Error;
  16 class IPakFile;
  17 
  18 // delegates for hotfixes
  19 namespace EHotfixDelegates
  20 {
  21         enum Type
  22         {
  23                 Test,
  24         };
  25 }
  26 
  27 
  28 // this is an example of a hotfix arg and return value structure. Once we have other examples, it can be deleted.
  29 struct FTestHotFixPayload
  30 {
  31         FString Message;
  32         bool ValueToReturn;
  33         bool Result;
  34 };
  35 
  36 // Parameters passed to CrashOverrideParamsChanged used to customize crash report client behavior/appearance. If the corresponding bool is not true, this value will not be stored.
  37 struct FCrashOverrideParameters
  38 {
  39         UE_DEPRECATED(4.21, "CrashReportClientMessageText should now be set through the CrashReportClientRichText property in the [CrashContextProperties] section of DefaultEngine.ini.")
  40         FString CrashReportClientMessageText;
  41         /** Appended to the end of GameName (which is retreived from FApp::GetGameName). */
  42         FString GameNameSuffix;
  43         /** Default this to true for backward compatibility before these bools were added. */
  44         bool bSetCrashReportClientMessageText = true;
  45         bool bSetGameNameSuffix = false;
  46         TOptional<bool> SendUnattendedBugReports;
  47         TOptional<bool> SendUsageData;
  48 
  49         CORE_API ~FCrashOverrideParameters();
  50 };
  51 
  52 class CORE_API FCoreDelegates
  53 {
  54 public:
  55         //hot fix delegate
  56         DECLARE_DELEGATE_TwoParams(FHotFixDelegate, void *, int32);
  57 
  58         // Callback for object property modifications
  59         DECLARE_MULTICAST_DELEGATE_OneParam(FOnActorLabelChanged, AActor*);
  60 
  61         // delegate type for prompting the pak system to mount all pak files, which haven't already been mounted, from all default locations
  62         DECLARE_DELEGATE_RetVal_OneParam(int32, FOnMountAllPakFiles, const TArray<FString>&);
  63 
  64         // deprecated delegate type for prompting the pak system to mount a new pak
  65         DECLARE_DELEGATE_RetVal_ThreeParams(bool, FOnMountPak, const FString&, int32, IPlatformFile::FDirectoryVisitor*);
  66 
  67         // delegate type for prompting the pak system to mount a new pak
  68         DECLARE_DELEGATE_RetVal_TwoParams(IPakFile*, FMountPak, const FString&, int32);
  69 
  70         // delegate type for prompting the pak system to unmount a pak
  71         DECLARE_DELEGATE_RetVal_OneParam(bool, FOnUnmountPak, const FString&);
  72 
  73         // delegate type for prompting the pak system to optimize memory for mounted paks
  74         DECLARE_DELEGATE(FOnOptimizeMemoryUsageForMountedPaks);
  75 
  76         // deprecated delegate for handling when a new pak file is successfully mounted passes in the name of the mounted pak file
  77         DECLARE_MULTICAST_DELEGATE_OneParam(FPakFileMountedDelegate, const TCHAR*);
  78 
  79         // deprecated delegate for handling when a new pak file is successfully mounted passes in the name of the pak file and its chunk ID (or INDEX_NONE)
  80         DECLARE_MULTICAST_DELEGATE_TwoParams(FOnPakFileMounted, const TCHAR*, const int32);
  81 
  82         // delegate for handling when a new pak file is successfully mounted
  83         DECLARE_MULTICAST_DELEGATE_OneParam(FOnPakFileMounted2, const IPakFile&);
  84 
  85         // delegate to let other systems no that no paks were mounted, in case something wants to handle that case
  86         DECLARE_MULTICAST_DELEGATE(FNoPakFilesMountedDelegate);
  87 
  88         /** delegate type for opening a modal message box ( Params: EAppMsgType::Type MessageType, const FText& Text, const FText& Title ) */
  89         DECLARE_DELEGATE_RetVal_ThreeParams(EAppReturnType::Type, FOnModalMessageBox, EAppMsgType::Type, const FText&, const FText&);
  90 
  91         // Callback for handling an ensure
  92         DECLARE_MULTICAST_DELEGATE(FOnHandleSystemEnsure);
  93 
  94         // Callback for handling an error
  95         DECLARE_MULTICAST_DELEGATE(FOnHandleSystemError);
  96 
  97         typedef TSharedPtr<class IMovieStreamer, ESPMode::ThreadSafe> FMovieStreamerPtr;
  98     // Delegate used to register a movie streamer with any movie player modules that bind to this delegate
  99     DECLARE_MULTICAST_DELEGATE_OneParam(FRegisterMovieStreamerDelegate, FMovieStreamerPtr);
 100 
 101     // Delegate used to un-register a movie streamer with any movie player modules that bind to this delegate
 102     DECLARE_MULTICAST_DELEGATE_OneParam(FUnRegisterMovieStreamerDelegate, FMovieStreamerPtr);
 103 
 104         // Callback for handling user login/logout.  first int is UserID, second int is UserIndex
 105         DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnUserLoginChangedEvent, bool, int32, int32);
 106 
 107         // Callback for handling safe frame area size changes
 108         DECLARE_MULTICAST_DELEGATE(FOnSafeFrameChangedEvent);
 109 
 110         // Callback for handling accepting invitations - generally for engine code
 111         DECLARE_MULTICAST_DELEGATE_TwoParams(FOnInviteAccepted, const FString&, const FString&);
 112 
 113         UE_DEPRECATED(4.26, "FCoreDelegates::FRegisterEncryptionKeyDelegate is deprecated; use FRegisterEncryptionKeyMulticastDelegate instead")
 114         DECLARE_DELEGATE_TwoParams(FRegisterEncryptionKeyDelegate, const FGuid&, const FAES::FAESKey&);
 115 
 116         // Callback for registering a new encryption key
 117         DECLARE_MULTICAST_DELEGATE_TwoParams(FRegisterEncryptionKeyMulticastDelegate, const FGuid&, const FAES::FAESKey&);
 118 
 119         // Callback for accessing pak encryption key, if it exists
 120         DECLARE_DELEGATE_OneParam(FPakEncryptionKeyDelegate, uint8[32]);
 121 
 122         // Callback for gathering pak signing keys, if they exist
 123         DECLARE_DELEGATE_TwoParams(FPakSigningKeysDelegate, TArray<uint8>&, TArray<uint8>&);
 124 
 125         // Callback for handling the Controller connection / disconnection
 126         // first param is true for a connection, false for a disconnection.
 127         // second param is UserID, third is UserIndex / ControllerId.
 128         DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnUserControllerConnectionChange, bool, FPlatformUserId, int32);
 129 
 130         // Callback for handling a Controller pairing change
 131         // first param is controller index
 132         // second param is NewUserPlatformId, third is OldUserPlatformId.
 133         DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnUserControllerPairingChange, int32 /*ControllerIndex*/, FPlatformUserId /*NewUserPlatformId*/, FPlatformUserId /*OldUserPlatformId*/);
 134 
 135         // Callback for platform handling when flushing async loads.
 136         DECLARE_MULTICAST_DELEGATE(FOnAsyncLoadingFlush);
 137         static FOnAsyncLoadingFlush OnAsyncLoadingFlush;
 138 
 139         // Callback for a game thread interruption point when a async load flushing. Used to updating UI during long loads.
 140         DECLARE_MULTICAST_DELEGATE(FOnAsyncLoadingFlushUpdate);
 141         static FOnAsyncLoadingFlushUpdate OnAsyncLoadingFlushUpdate;
 142 
 143         // Callback on the game thread when an async load is started. This goes off before the packages has finished loading
 144         DECLARE_MULTICAST_DELEGATE_OneParam(FOnAsyncLoadPackage, const FString&);
 145         static FOnAsyncLoadPackage OnAsyncLoadPackage;
 146 
 147         DECLARE_MULTICAST_DELEGATE_OneParam(FOnSyncLoadPackage, const FString&);
 148         static FOnSyncLoadPackage OnSyncLoadPackage;
 149 
 150         // get a hotfix delegate
 151         static FHotFixDelegate& GetHotfixDelegate(EHotfixDelegates::Type HotFix);
 152 
 153         // Callback when a user logs in/out of the platform.
 154         static FOnUserLoginChangedEvent OnUserLoginChangedEvent;
 155 
 156         // Callback when controllers disconnected / reconnected
 157         static FOnUserControllerConnectionChange OnControllerConnectionChange;
 158 
 159         // Callback when a single controller pairing changes
 160         static FOnUserControllerPairingChange OnControllerPairingChange;
 161 
 162         // Callback when a user changes the safe frame size
 163         static FOnSafeFrameChangedEvent OnSafeFrameChangedEvent;
 164 
 165         // Callback for mounting all the pak files in default locations
 166         static FOnMountAllPakFiles OnMountAllPakFiles;
 167 
 168         // Callback to prompt the pak system to mount a pak file
 169         static FMountPak MountPak;
 170 
 171         UE_DEPRECATED(4.26, "OnMountPak is deprecated; use MountPak instead.")
 172         static FOnMountPak OnMountPak;
 173 
 174         // Callback to prompt the pak system to unmount a pak file.
 175         static FOnUnmountPak OnUnmountPak;
 176 
 177         // Callback to optimize memeory for currently mounted paks
 178         static FOnOptimizeMemoryUsageForMountedPaks OnOptimizeMemoryUsageForMountedPaks;
 179 
 180         // After a pakfile is mounted this is called
 181         static FOnPakFileMounted2 OnPakFileMounted2;
 182 
 183         UE_DEPRECATED(4.26, "FCoreDelegates::OnPakFileMounted is deprecated; use OnPakFileMounted2 instead")
 184         static FOnPakFileMounted OnPakFileMounted;
 185 
 186         UE_DEPRECATED(4.25, "FCoreDelegates::PakFileMountedCallback is deprecated. Use FCoreDelegates::OnPakFileMounted2 instead.")
 187         static FPakFileMountedDelegate PakFileMountedCallback;
 188 
 189         // After a file is added this is called
 190         DECLARE_MULTICAST_DELEGATE_OneParam(FNewFileAddedDelegate, const FString&);
 191         static FNewFileAddedDelegate NewFileAddedDelegate;
 192 
 193         // After an attempt to mount all pak files, but none wre found, this is called
 194         static FNoPakFilesMountedDelegate NoPakFilesMountedDelegate;
 195 
 196         // When a file is opened for read from a pak file
 197         DECLARE_MULTICAST_DELEGATE_TwoParams(FOnFileOpenedForReadFromPakFile, const TCHAR* /*PakFile*/, const TCHAR* /*FileName*/);
 198         static FOnFileOpenedForReadFromPakFile OnFileOpenedForReadFromPakFile;
 199 
 200     // Delegate used to register a movie streamer with any movie player modules that bind to this delegate
 201     // Designed to be called when a platform specific movie streamer plugin starts up so that it doesn't need to implement a register for all movie player plugins
 202     static FRegisterMovieStreamerDelegate RegisterMovieStreamerDelegate;
 203     // Delegate used to un-register a movie streamer with any movie player modules that bind to this delegate
 204     // Designed to be called when a platform specific movie streamer plugin shuts down so that it doesn't need to implement a register for all movie player plugins
 205     static FUnRegisterMovieStreamerDelegate UnRegisterMovieStreamerDelegate;
 206 
 207         // Callback when an ensure has occurred
 208         static FOnHandleSystemEnsure OnHandleSystemEnsure;
 209 
 210         // Callback when an error (crash) has occurred
 211         static FOnHandleSystemError OnHandleSystemError;
 212 
 213         // Called when an actor label is changed
 214         static FOnActorLabelChanged OnActorLabelChanged;
 215 
 216         UE_DEPRECATED(4.26, "FCoreDelegates::GetRegisterEncryptionKeyDelegate is deprecated; use GetRegisterEncryptionKeyMulticastDelegate instead")
 217         PRAGMA_DISABLE_DEPRECATION_WARNINGS // Don't warn about FRegisterEncryptionKeyDelegate
 218         static FRegisterEncryptionKeyDelegate& GetRegisterEncryptionKeyDelegate();
 219         PRAGMA_ENABLE_DEPRECATION_WARNINGS
 220         static FRegisterEncryptionKeyMulticastDelegate& GetRegisterEncryptionKeyMulticastDelegate();
 221         static FPakEncryptionKeyDelegate& GetPakEncryptionKeyDelegate();
 222         static FPakSigningKeysDelegate& GetPakSigningKeysDelegate();
 223 
 224         
 225 
 226 #if WITH_EDITOR
 227         // Called before the editor displays a modal window, allowing other windows the opportunity to disable themselves to avoid reentrant calls
 228         static FSimpleMulticastDelegate PreModal;
 229 
 230         // Called after the editor dismisses a modal window, allowing other windows the opportunity to disable themselves to avoid reentrant calls
 231         static FSimpleMulticastDelegate PostModal;
 232     
 233     // Called before the editor displays a Slate (non-platform) modal window, allowing other windows the opportunity to disable themselves to avoid reentrant calls
 234     static FSimpleMulticastDelegate PreSlateModal;
 235     
 236     // Called after the editor dismisses a Slate (non-platform) modal window, allowing other windows the opportunity to disable themselves to avoid reentrant calls
 237     static FSimpleMulticastDelegate PostSlateModal;
 238     
 239 #endif  //WITH_EDITOR
 240         
 241         // Called when an error occurred.
 242         static FSimpleMulticastDelegate OnShutdownAfterError;
 243 
 244         // Called when appInit is called, very early in startup
 245         static FSimpleMulticastDelegate OnInit;
 246 
 247         // Called at the end of UEngine::Init, right before loading PostEngineInit modules for both normal execution and commandlets
 248         static FSimpleMulticastDelegate OnPostEngineInit;
 249 
 250         // Called at the very end of engine initialization, right before the engine starts ticking. This is not called for commandlets
 251         static FSimpleMulticastDelegate OnFEngineLoopInitComplete;
 252 
 253         // Called when the application is about to exit.
 254         static FSimpleMulticastDelegate OnExit;
 255 
 256         // Called when before the application is exiting.
 257         static FSimpleMulticastDelegate OnPreExit;
 258 
 259         // Called before the engine exits. Separate from OnPreExit as OnEnginePreExit occurs before shutting down any core modules.
 260         static FSimpleMulticastDelegate OnEnginePreExit;
 261 
 262         /** Delegate for gathering up additional localization paths that are unknown to the UE4 core (such as plugins) */
 263         DECLARE_MULTICAST_DELEGATE_OneParam(FGatherAdditionalLocResPathsDelegate, TArray<FString>&);
 264         static FGatherAdditionalLocResPathsDelegate GatherAdditionalLocResPathsCallback;
 265 
 266         /** Color picker color has changed, please refresh as needed*/
 267         static FSimpleMulticastDelegate ColorPickerChanged;
 268 
 269         /** requests to open a message box */
 270         static FOnModalMessageBox ModalErrorMessage;
 271 
 272         /** Called when the user accepts an invitation to the current game */
 273         static FOnInviteAccepted OnInviteAccepted;
 274 
 275         // Called at the beginning of a frame
 276         static FSimpleMulticastDelegate OnBeginFrame;
 277 
 278         // Called at the moment of sampling the input (currently on the gamethread)
 279         static FSimpleMulticastDelegate OnSamplingInput;
 280 
 281         // Called at the end of a frame
 282         static FSimpleMulticastDelegate OnEndFrame;
 283 
 284         // Called at the beginning of a frame on the renderthread
 285         static FSimpleMulticastDelegate OnBeginFrameRT;
 286 
 287         // Called at the end of a frame on the renderthread
 288         static FSimpleMulticastDelegate OnEndFrameRT;
 289 
 290 
 291         DECLARE_MULTICAST_DELEGATE_ThreeParams(FWorldOriginOffset, class UWorld*, FIntVector, FIntVector);
 292         /** called before world origin shifting */
 293         static FWorldOriginOffset PreWorldOriginOffset;
 294         /** called after world origin shifting */
 295         static FWorldOriginOffset PostWorldOriginOffset;
 296 
 297         /** called when the main loop would otherwise starve. */
 298         DECLARE_DELEGATE(FStarvedGameLoop);
 299         static FStarvedGameLoop StarvedGameLoop;
 300 
 301         // IOS-style temperature updates, allowing game to scale down to let temp drop (to avoid thermal throttling on mobile, for instance) */
 302         // There is a parellel enum in ApplicationLifecycleComponent
 303         enum class ETemperatureSeverity : uint8
 304         {
 305                 Unknown,
 306                 Good,
 307                 Bad,
 308                 Serious,
 309                 Critical,
 310 
 311                 NumSeverities,
 312         };
 313         DECLARE_MULTICAST_DELEGATE_OneParam(FOnTemperatureChange, ETemperatureSeverity);
 314         static FOnTemperatureChange OnTemperatureChange;
 315 
 316         /** Called when the OS goes into low power mode */
 317         DECLARE_MULTICAST_DELEGATE_OneParam(FOnLowPowerMode, bool);
 318         static FOnLowPowerMode OnLowPowerMode;
 319 
 320 
 321 
 322         DECLARE_MULTICAST_DELEGATE_TwoParams(FCountPreLoadConfigFileRespondersDelegate, const TCHAR* /*IniFilename*/, int32& /*ResponderCount*/);
 323         DECLARE_MULTICAST_DELEGATE_TwoParams(FPreLoadConfigFileDelegate, const TCHAR* /*IniFilename*/, FString& /*LoadedContents*/);
 324         DECLARE_MULTICAST_DELEGATE_ThreeParams(FPreSaveConfigFileDelegate, const TCHAR* /*IniFilename*/, const FString& /*ContentsToSave*/, int32& /*SavedCount*/);
 325         static FCountPreLoadConfigFileRespondersDelegate CountPreLoadConfigFileRespondersDelegate;
 326         static FPreLoadConfigFileDelegate PreLoadConfigFileDelegate;
 327         static FPreSaveConfigFileDelegate PreSaveConfigFileDelegate;
 328 
 329         DECLARE_MULTICAST_DELEGATE_OneParam(FOnFConfigFileCreated, const FConfigFile *);
 330         DECLARE_MULTICAST_DELEGATE_OneParam(FOnFConfigFileDeleted, const FConfigFile *);
 331         static FOnFConfigFileCreated OnFConfigCreated;
 332         static FOnFConfigFileDeleted OnFConfigDeleted;
 333 
 334         DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnConfigValueRead, const TCHAR* /*IniFilename*/, const TCHAR* /*SectionName*/, const TCHAR* /*Key*/);
 335         static FOnConfigValueRead OnConfigValueRead;
 336 
 337         DECLARE_MULTICAST_DELEGATE_TwoParams(FOnConfigSectionRead, const TCHAR* /*IniFilename*/, const TCHAR* /*SectionName*/);
 338         static FOnConfigSectionRead OnConfigSectionRead;
 339         static FOnConfigSectionRead OnConfigSectionNameRead;
 340 
 341         DECLARE_MULTICAST_DELEGATE_FourParams(FOnApplyCVarFromIni, const TCHAR* /*SectionName*/, const TCHAR* /*IniFilename*/, uint32 /*SetBy*/, bool /*bAllowCheating*/);
 342         static FOnApplyCVarFromIni OnApplyCVarFromIni;
 343 
 344         DECLARE_MULTICAST_DELEGATE_TwoParams(FOnSystemResolutionChanged, uint32 /*ResX*/, uint32 /*ResY*/);
 345         static FOnSystemResolutionChanged OnSystemResolutionChanged;
 346 
 347 #if WITH_EDITOR
 348         // called when a target platform changes it's return value of supported formats.  This is so anything caching those results can reset (like cached shaders for cooking)
 349         DECLARE_MULTICAST_DELEGATE_OneParam(FOnTargetPlatformChangedSupportedFormats, const ITargetPlatform*); 
 350         static FOnTargetPlatformChangedSupportedFormats OnTargetPlatformChangedSupportedFormats;
 351 
 352         // Called when a feature level is disabled by the user.
 353         DECLARE_MULTICAST_DELEGATE_TwoParams(FOnFeatureLevelDisabled, int, const FName&);
 354         static FOnFeatureLevelDisabled OnFeatureLevelDisabled;
 355 #endif
 356 
 357         /** IOS-style application lifecycle delegates */
 358         DECLARE_MULTICAST_DELEGATE(FApplicationLifetimeDelegate);
 359 
 360         // This is called when the application is about to be deactivated (e.g., due to a phone call or SMS or the sleep button).
 361         // The game should be paused if possible, etc...
 362         static FApplicationLifetimeDelegate ApplicationWillDeactivateDelegate;
 363 
 364         // Called when the application has been reactivated (reverse any processing done in the Deactivate delegate)
 365         static FApplicationLifetimeDelegate ApplicationHasReactivatedDelegate;
 366 
 367         // This is called when the application is being backgrounded (e.g., due to switching
 368         // to another app or closing it via the home button)
 369         // The game should release shared resources, save state, etc..., since it can be
 370         // terminated from the background state without any further warning.
 371         static FApplicationLifetimeDelegate ApplicationWillEnterBackgroundDelegate; // for instance, hitting the home button
 372 
 373         // Called when the application is returning to the foreground (reverse any processing done in the EnterBackground delegate)
 374         static FApplicationLifetimeDelegate ApplicationHasEnteredForegroundDelegate;
 375 
 376         // This *may* be called when the application is getting terminated by the OS.
 377         // There is no guarantee that this will ever be called on a mobile device,
 378         // save state when ApplicationWillEnterBackgroundDelegate is called instead.
 379         static FApplicationLifetimeDelegate ApplicationWillTerminateDelegate;
 380 
 381         // Called when in the background, if the OS is giving CPU time to the device. It is very likely
 382         // this will never be called due to mobile OS backgrounded CPU restrictions. But if, for instance,
 383         // VOIP is active on iOS, the will be getting called
 384         DECLARE_MULTICAST_DELEGATE_OneParam(FBackgroundTickDelegate, float /*DeltaTime*/);
 385         static FBackgroundTickDelegate MobileBackgroundTickDelegate;
 386 
 387         // Called when the OS needs control of the music (parameter is true) or when the OS returns
 388         // control of the music to the application (parameter is false). This can happen due to a
 389         // phone call or timer or other OS-level event. This is currently triggered only on iOS
 390         // devices.
 391         DECLARE_MULTICAST_DELEGATE_OneParam(FUserMusicInterruptDelegate, bool);
 392         static FUserMusicInterruptDelegate UserMusicInterruptDelegate;
 393         
 394         // [iOS only] Called when the mute switch is detected as changed or when the
 395         // volume changes. Parameter 1 is the mute switch state (true is muted, false is
 396         // unmuted). Parameter 2 is the volume as an integer from 0 to 100.
 397         DECLARE_MULTICAST_DELEGATE_TwoParams(FAudioMuteDelegate, bool, int);
 398         static FAudioMuteDelegate AudioMuteDelegate;
 399         
 400         // [iOS only] Called when the audio device changes
 401         // For instance, when the headphones are plugged in or removed
 402         DECLARE_MULTICAST_DELEGATE_OneParam(FAudioRouteChangedDelegate, bool);
 403         static FAudioRouteChangedDelegate AudioRouteChangedDelegate;
 404 
 405         // Generally, events triggering UserMusicInterruptDelegate or AudioMuteDelegate happen only
 406         // when a change occurs. When a system comes online needing the current audio state but the
 407         // event has already been broadcast, calling ApplicationRequestAudioState will force the
 408         // UserMusicInterruptDelegate and AudioMuteDelegate to be called again if the low-level
 409         // application layer supports it. Currently, this is available only on iOS.
 410         DECLARE_MULTICAST_DELEGATE(FApplicationRequestAudioState);
 411         static FApplicationRequestAudioState ApplicationRequestAudioState;
 412         
 413         // Called when the OS is running low on resources and asks the application to free up any cached resources, drop graphics quality etc.
 414         static FApplicationLifetimeDelegate ApplicationShouldUnloadResourcesDelegate;
 415 
 416         DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationStartupArgumentsDelegate, const TArray<FString>&);
 417 
 418         // Called with arguments passed to the application on statup, perhaps meta data passed on by another application which launched this one.
 419         static FApplicationStartupArgumentsDelegate ApplicationReceivedStartupArgumentsDelegate;
 420 
 421         /** IOS-style push notification delegates */
 422         DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationRegisteredForRemoteNotificationsDelegate, TArray<uint8>);
 423         DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationRegisteredForUserNotificationsDelegate, int);
 424         DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationFailedToRegisterForRemoteNotificationsDelegate, FString);
 425         DECLARE_MULTICAST_DELEGATE_TwoParams(FApplicationReceivedRemoteNotificationDelegate, FString, int);
 426         DECLARE_MULTICAST_DELEGATE_ThreeParams(FApplicationReceivedLocalNotificationDelegate, FString, int, int);
 427     DECLARE_MULTICAST_DELEGATE(FApplicationPerformFetchDelegate);
 428     DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationBackgroundSessionEventDelegate, FString);
 429 
 430         // called when the user grants permission to register for remote notifications
 431         static FApplicationRegisteredForRemoteNotificationsDelegate ApplicationRegisteredForRemoteNotificationsDelegate;
 432 
 433         // called when the user grants permission to register for notifications
 434         static FApplicationRegisteredForUserNotificationsDelegate ApplicationRegisteredForUserNotificationsDelegate;
 435 
 436         // called when the application fails to register for remote notifications
 437         static FApplicationFailedToRegisterForRemoteNotificationsDelegate ApplicationFailedToRegisterForRemoteNotificationsDelegate;
 438 
 439         // called when the application receives a remote notification
 440         static FApplicationReceivedRemoteNotificationDelegate ApplicationReceivedRemoteNotificationDelegate;
 441 
 442         // called when the application receives a local notification
 443         static FApplicationReceivedLocalNotificationDelegate ApplicationReceivedLocalNotificationDelegate;
 444 
 445     // called when the application receives notice to perform a background fetch
 446     static FApplicationPerformFetchDelegate ApplicationPerformFetchDelegate;
 447 
 448     // called when the application receives notice that a background download has completed
 449     static FApplicationBackgroundSessionEventDelegate ApplicationBackgroundSessionEventDelegate;
 450 
 451         /** Sent when a device screen orientation changes */
 452         DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationReceivedOnScreenOrientationChangedNotificationDelegate, int32);
 453         static FApplicationReceivedOnScreenOrientationChangedNotificationDelegate ApplicationReceivedScreenOrientationChangedNotificationDelegate;
 454 
 455         /** Checks to see if the stat is already enabled */
 456         DECLARE_MULTICAST_DELEGATE_ThreeParams(FStatCheckEnabled, const TCHAR*, bool&, bool&);
 457         static FStatCheckEnabled StatCheckEnabled;
 458 
 459         /** Sent after each stat is enabled */
 460         DECLARE_MULTICAST_DELEGATE_OneParam(FStatEnabled, const TCHAR*);
 461         static FStatEnabled StatEnabled;
 462 
 463         /** Sent after each stat is disabled */
 464         DECLARE_MULTICAST_DELEGATE_OneParam(FStatDisabled, const TCHAR*);
 465         static FStatDisabled StatDisabled;
 466 
 467         /** Sent when all stats need to be disabled */
 468         DECLARE_MULTICAST_DELEGATE_OneParam(FStatDisableAll, const bool);
 469         static FStatDisableAll StatDisableAll;
 470 
 471         // Called when an application is notified that the application license info has been updated.
 472         // The new license data should be polled and steps taken based on the results (i.e. halt application if license is no longer valid).
 473         DECLARE_MULTICAST_DELEGATE(FApplicationLicenseChange);
 474         static FApplicationLicenseChange ApplicationLicenseChange;
 475 
 476         /** Sent when the platform changed its laptop mode (for convertible laptops).*/
 477         DECLARE_MULTICAST_DELEGATE_OneParam(FPlatformChangedLaptopMode, EConvertibleLaptopMode);
 478         static FPlatformChangedLaptopMode PlatformChangedLaptopMode;
 479 
 480         /** Sent when the platform needs the user to fix headset tracking on startup (PS4 Morpheus only) */
 481         DECLARE_MULTICAST_DELEGATE(FVRHeadsetTrackingInitializingAndNeedsHMDToBeTrackedDelegate);
 482         static FVRHeadsetTrackingInitializingAndNeedsHMDToBeTrackedDelegate VRHeadsetTrackingInitializingAndNeedsHMDToBeTrackedDelegate;
 483 
 484         /** Sent when the platform finds that needed headset tracking on startup has completed (PS4 Morpheus only) */
 485         DECLARE_MULTICAST_DELEGATE(FVRHeadsetTrackingInitializedDelegate);
 486         static FVRHeadsetTrackingInitializedDelegate VRHeadsetTrackingInitializedDelegate;
 487 
 488         /** Sent when the platform requests a low-level VR recentering */
 489         DECLARE_MULTICAST_DELEGATE(FVRHeadsetRecenter);
 490         static FVRHeadsetRecenter VRHeadsetRecenter;
 491 
 492         /** Sent when connection to VR HMD is lost */
 493         DECLARE_MULTICAST_DELEGATE(FVRHeadsetLost);
 494         static FVRHeadsetLost VRHeadsetLost;
 495 
 496         /** Sent when connection to VR HMD is restored */
 497         DECLARE_MULTICAST_DELEGATE(FVRHeadsetReconnected);
 498         static FVRHeadsetReconnected VRHeadsetReconnected;
 499 
 500         /** Sent when connection to VR HMD connection is refused by the player */
 501         DECLARE_MULTICAST_DELEGATE(FVRHeadsetConnectCanceled);
 502         static FVRHeadsetConnectCanceled VRHeadsetConnectCanceled;
 503 
 504         /** Sent when the VR HMD detects that it has been put on by the player. */
 505         DECLARE_MULTICAST_DELEGATE(FVRHeadsetPutOnHead);
 506         static FVRHeadsetPutOnHead VRHeadsetPutOnHead;
 507 
 508         /** Sent when the VR HMD detects that it has been taken off by the player. */
 509         DECLARE_MULTICAST_DELEGATE(FVRHeadsetRemovedFromHead);
 510         static FVRHeadsetRemovedFromHead VRHeadsetRemovedFromHead;
 511 
 512         /** Sent when a 3DOF VR controller is recentered */
 513         DECLARE_MULTICAST_DELEGATE(FVRControllerRecentered);
 514         static FVRControllerRecentered VRControllerRecentered;
 515 
 516         /** Sent when application code changes the user activity hint string for analytics, crash reports, etc */
 517         DECLARE_MULTICAST_DELEGATE_OneParam(FOnUserActivityStringChanged, const FString&);
 518         static FOnUserActivityStringChanged UserActivityStringChanged;
 519 
 520         /** Sent when application code changes the currently active game session. The exact semantics of this will vary between games but it is useful for analytics, crash reports, etc  */
 521         DECLARE_MULTICAST_DELEGATE_OneParam(FOnGameSessionIDChange, const FString&);
 522         static FOnGameSessionIDChange GameSessionIDChanged;
 523 
 524         /** Sent when application code changes game state. The exact semantics of this will vary between games but it is useful for analytics, crash reports, etc  */
 525         DECLARE_MULTICAST_DELEGATE_OneParam(FOnGameStateClassChange, const FString&);
 526         static FOnGameStateClassChange GameStateClassChanged;
 527 
 528         /** Sent by application code to set params that customize crash reporting behavior. */
 529         DECLARE_MULTICAST_DELEGATE_OneParam(FOnCrashOverrideParamsChanged, const FCrashOverrideParameters&);
 530         static FOnCrashOverrideParamsChanged CrashOverrideParamsChanged;
 531         
 532         /** Sent by engine code when the "vanilla" status of the engine changes */
 533         DECLARE_MULTICAST_DELEGATE_OneParam(FOnIsVanillaProductChanged, bool);
 534         static FOnIsVanillaProductChanged IsVanillaProductChanged;
 535 
 536         // Callback for platform specific very early init code.
 537         DECLARE_MULTICAST_DELEGATE(FOnPreMainInit);
 538         static FOnPreMainInit& GetPreMainInitDelegate();
 539         
 540         /** Sent when GConfig is finished initializing */
 541         DECLARE_MULTICAST_DELEGATE(FConfigReadyForUse);
 542         static FConfigReadyForUse ConfigReadyForUse;
 543 
 544         /** Callback for notifications regarding changes of the rendering thread. */
 545         DECLARE_MULTICAST_DELEGATE(FRenderingThreadChanged)
 546 
 547         /** Sent just after the rendering thread has been created. */
 548         static FRenderingThreadChanged PostRenderingThreadCreated;
 549         /* Sent just before the rendering thread is destroyed. */
 550         static FRenderingThreadChanged PreRenderingThreadDestroyed;
 551 
 552         // Callback to allow custom resolution of package names. Arguments are InRequestedName, OutResolvedName.
 553         // Should return True of resolution occured.
 554         DECLARE_DELEGATE_RetVal_TwoParams(bool, FResolvePackageNameDelegate, const FString&, FString&);
 555         static TArray<FResolvePackageNameDelegate> PackageNameResolvers;
 556 
 557         // Called to request that systems free whatever memory they are able to. Called early in LoadMap.
 558         // Caller is responsible for flushing rendering etc. See UEngine::TrimMemory
 559         static FSimpleMulticastDelegate& GetMemoryTrimDelegate();
 560 
 561         // Called when OOM event occurs, after backup memory has been freed, so there's some hope of being effective
 562         static FSimpleMulticastDelegate& GetOutOfMemoryDelegate();
 563 
 564         enum class EOnScreenMessageSeverity : uint8
 565         {
 566                 Info,
 567                 Warning,
 568                 Error,
 569         };
 570         typedef TMultiMap<EOnScreenMessageSeverity, FText> FSeverityMessageMap;
 571 
 572         // Called when displaying on screen messages (like the "Lighting needs to be rebuilt"), to let other systems add any messages as needed
 573         // Sample Usage:
 574         // void GetMyOnScreenMessages(FCoreDelegates::FSeverityMessageMap& OutMessages)
 575         // {
 576         //              OutMessages.Add(FCoreDelegates::EOnScreenMessageSeverity::Info, FText::Format(LOCTEXT("MyMessage", "My Status: {0}"), SomeStatus));
 577         // }
 578         DECLARE_MULTICAST_DELEGATE_OneParam(FGetOnScreenMessagesDelegate, FSeverityMessageMap&);
 579         static FGetOnScreenMessagesDelegate OnGetOnScreenMessages;
 580 
 581         DECLARE_DELEGATE_RetVal(bool, FIsLoadingMovieCurrentlyPlaying)
 582         static FIsLoadingMovieCurrentlyPlaying IsLoadingMovieCurrentlyPlaying;
 583 
 584         // Callback to allow user code to prevent url from being launched from FPlatformProcess::LaunchURL. Used to apply http whitelist
 585         // Return true for to launch the url
 586         DECLARE_DELEGATE_RetVal_OneParam(bool, FShouldLaunchUrl, const TCHAR* /* URL */);
 587         static FShouldLaunchUrl ShouldLaunchUrl;
 588 
 589         /** Sent when GC finish destroy takes more time than expected */
 590         DECLARE_MULTICAST_DELEGATE_OneParam(FOnGCFinishDestroyTimeExtended, const FString&);
 591         static FOnGCFinishDestroyTimeExtended OnGCFinishDestroyTimeExtended;
 592 
 593         /** Called when the application's network initializes or shutdowns on platforms where the network stack is not always available */
 594         DECLARE_MULTICAST_DELEGATE_OneParam(FApplicationNetworkInitializationChanged, bool /*bIsNetworkInitialized*/);
 595         static FApplicationNetworkInitializationChanged ApplicationNetworkInitializationChanged;
 596 
 597         // Callback to let code read or write specialized binary data that is generated at Stage time, for optimizing data right before 
 598         // final game data is being written to disk
 599         // The TMap is a map of an identifier for owner of the data, and a boolean where true means the data is being generated (ie editor), and false 
 600         // means the data is for use (ie runtime game)
 601         struct FExtraBinaryConfigData
 602         {
 603                 // the data that will be saved/loaded quickly
 604                 TMap<FString, TArray<uint8>> Data;
 605 
 606                 // Ini config data (not necessarily GConfig)
 607                 class FConfigCacheIni& Config;
 608 
 609                 // if true, the callback should fill out Data/Config
 610                 bool bIsGenerating;
 611 
 612                 FExtraBinaryConfigData(class FConfigCacheIni& InConfig, bool InIsGenerating)
 613                         : Config(InConfig)
 614                         , bIsGenerating(InIsGenerating)
 615                 {
 616                 }
 617         };
 618         DECLARE_MULTICAST_DELEGATE_OneParam(FAccesExtraBinaryConfigData, FExtraBinaryConfigData&);
 619         static FAccesExtraBinaryConfigData AccessExtraBinaryConfigData;
 620 
 621         /** Called when the verbosity of a log category is changed */
 622         DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnLogVerbosityChanged, const FLogCategoryName& /* CategoryName */, ELogVerbosity::Type /* OldVerbosity */, ELogVerbosity::Type /* NewVerbosity */);
 623         static FOnLogVerbosityChanged OnLogVerbosityChanged;
 624 
 625 private:
 626 
 627         // Callbacks for hotfixes
 628         static TArray<FHotFixDelegate> HotFixDelegates;
 629 
 630         // This class is only for namespace use
 631         FCoreDelegates() {}
 632 };

UE4/UE4.27-Source/Engine\Source\Runtime\Core\Public\Misc\CoreDelegates.h (last edited 2021-11-02 04:47:03 by zbjxb)