5#include "CoreMinimal.h"
6#include "Engine/GameViewportClient.h"
10#include "Blueprint/UserWidgetPool.h"
11#include "ProjectXGameViewportClient.generated.h"
27 virtual void Tick(
float DeltaTime)
override;
28 virtual void PostRender(UCanvas* Canvas)
override;
29 virtual void Init(
struct FWorldContext& WorldContext, UGameInstance* OwningGameInstance,
bool bCreateNewAudioDevice =
true)
override;
30 virtual void ClearFade();
31 virtual void Fade(
const float inFadeDuration,
const bool bInToBlack,
const float inFadeDelay = 0.0f,
const bool& bInForceFadeToBlack =
false);
32 void DrawScreenFade(UCanvas* Canvas);
33 bool IsFading()
const;
34 void ReinitializeViewportClientFade();
41 void OpenLandingScreen();
42 void DeferredOpenMapTimerComplete();
44 void CloseLandingScreen();
45 void DeferredOpenMap(
float Delay = -1.f);
46 void ClearMapTimers();
47 void NavigateBumperLeft();
48 void NavigateBumperRight();
50 UFUNCTION(BlueprintPure, Category = Bindings)
51 bool IsPlayerBindingNewButton()
const {
return bIsBinding; }
52 UFUNCTION(BlueprintCallable, Category = Bindings)
53 void SetPlayerBindingNewButton(const
bool bIsPlayerCurrentlyBinding) { bIsBinding = bIsPlayerCurrentlyBinding; }
56 void BottomFaceButton();
57 void RightFaceButton();
58 void LeftFaceButton();
59 void ToggleKickVoteMenu();
60 void ToggleMapVoteMenu();
61 void ShowScoreboard();
62 void HideScoreboard();
63 bool CanToggleChat()
const;
64 bool HasLegalPawn()
const;
65 void OpenPostGameScreen();
67 void CloseQuickChat();
68 void ToggleDeathWidget(
bool OpenWidget);
69 void ToggleHUD(
bool bToggle);
70 void RemoveHUDUserWidget(UUserWidget*
Widget);
71 void RemoveAllHUDUserWidgets();
72 virtual void ToggleSoftwareCursor(
const bool bToggle);
74 bool SetUserFocusOnFirstChild(UUserWidget*
Widget);
75 bool AreAnyActiveWidgetsDisablingInput()
const;
80 virtual void LevelTravel();
85 ToggleWidgetByClass(T::StaticClass());
90 UAdvancedUserWidget* GetWidgetByClass(TSubclassOf<UUserWidget> WidgetClass,
bool bReturnInheritedClasses =
false)
const;
91 void CloseAllWidgets(
const bool bClosedByAnotherWidget =
false);
94 UContextMenuWidget* CreateContextMenu(
const TArray<FContextMenuOption>& ContextMenuOptions,
const FText Title,
const bool bDismissable,
const UObject* ContextObject =
nullptr);
97 UUserWidget* GetHUDWidgetByClass(TSubclassOf<UUserWidget> WidgetClass)
const;
99 UAdvancedUserWidget* GetOrCreateViewportWidget(UClass* WidgetClass,
const int32 ZOrder,
const bool bDontCreateCopies =
false);
102 UFUNCTION(BlueprintCallable, Category =
"Display Meshes")
103 void ToggleDisplayMesh(
bool bToggled);
104 UFUNCTION(BlueprintCallable, Category = "Display Meshes")
105 AActor* const GetDisplayMesh() const;
106 UFUNCTION(BlueprintCallable, Category = "Display Meshes")
107 bool IsDisplayMeshVisible()
const {
return bShowingDisplayMesh; }
108 UFUNCTION(BlueprintCallable)
109 void KeysRebound() { OnViewportKeybindUpdatedEvent.Broadcast(); }
110 UFUNCTION(BlueprintCallable)
111 TSubclassOf<
UAdvancedUserWidget> GetHighestActiveWidget()
const {
return GetHighestPriorityActiveWidget() ? GetHighestPriorityActiveWidget()->GetClass() : NULL; }
112 UFUNCTION(BlueprintCallable)
113 UUserWidget* GetTooltipWidget();
115 UPROPERTY(BlueprintAssignable)
116 FWidgetChangedSignature OnHighestActiveWidgetChanged;
117 UPROPERTY(BlueprintAssignable)
118 FDisplayMeshVisibilityUpdatedSignature OnDisplayMeshVisibilityChangedEvent;
119 UPROPERTY(BlueprintAssignable, Category = "Gamepad Events")
120 FViewportGamePadStateChangeSignature OnGamepadStateChanged;
121 UPROPERTY(BlueprintAssignable, Category = "Gamepad Events")
122 FOnKeyBindingViewportUpdatedSignature OnViewportKeybindUpdatedEvent;
125 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject", DeterminesOutputType = "UserWidget"))
126 static UUserWidget* CreateUserWidgetFromPool(UObject* const WorldContextObject, TSubclassOf<UUserWidget> UserWidget);
127 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
128 static
void ReleaseUserWidgetFromPool(UObject* const WorldContextObject, UUserWidget* const UserWidget);
129 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
130 static
void BuildWidgetPoolForWidget(UObject* const WorldContextObject, TSubclassOf<UUserWidget> UserWidget, int32 PoolSize = 10);
133 UFUNCTION(BlueprintCallable, Category = Viewport, meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
135 UFUNCTION(BlueprintCallable, Category = Viewport, meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
137 UFUNCTION(BlueprintCallable, Category = Viewport, meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
139 UFUNCTION(BlueprintCallable, Category = Viewport, meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
140 static
bool IsAdvancedUserWidgetActiveByClass(const UObject* WorldContextObject, TSubclassOf<
UAdvancedUserWidget> AdvancedUserWidgetClass);
141 UFUNCTION(BlueprintCallable,BlueprintPure, Category = Viewport, meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
144 void SetPlayerInputLockingState();
145 bool IsUsingGamePad()
const {
return bIsUsingGamepad; };
149 virtual void BeginDestroy()
override;
150 virtual APlayerController* GetOwningPlayerController()
const;
151 virtual bool InputKey(
const FInputKeyEventArgs& EventArgs)
override;
152 virtual bool InputAxis(FViewport* InViewport, int32 ControllerId, FKey Key,
float Delta,
float DeltaTime, int32 NumSamples,
bool bGamepad)
override;
153 void SetUsingGamepad(
bool bToggle);
154 void LogFocusedWidget();
156 UPROPERTY(EditDefaultsOnly)
157 TSubclassOf<UUserWidget> TooltipWidgetClass = NULL;
166 int32 GetHighestPriorityWidgetStackIndex() const;
168 bool AreAnyActiveWidgetsBlockingNewWidgets(const TArray<
UAdvancedUserWidget*> Exceptions) const;
169 bool AreAnyActiveWidgetsBlockingLowerPriorityNewWidgets(const TArray<
UAdvancedUserWidget*> Exceptions, uint8 TestPriority) const;
172 void CloseHighestPriorityWidget();
173 UContextMenuWidget* CreateContextMenuWidget(UClass* WidgetClass, const TArray<
FContextMenuOption>& ContextMenuOptions, const FText Title, const FText Message, const
bool bDismissable = true, const UObject* ContextObject =
nullptr);
176 FTimerHandle MapOpenTimer;
178 bool bIsUsingGamepad = false;
179 float FocusIntervalCurrent;
180 int32 ActiveStackIndex;
182 uint32 bFadeToBlack : 1;
183 float FadeDelay = 0.0f;
184 float FadeStartTime = 0.0f;
185 float FadeDuration = 0.0f;
186 float CurrentAlpha = 0.0f;
187 bool bInitiating = true;
188 bool bGamePadInUse = false;
189 bool bShowingDisplayMesh = false;
190 bool bIsBinding = false;
193 UUserWidget* TooltipWidgetObject = NULL;
195 TWeakObjectPtr<AActor> InGameLoadoutDisplay =
nullptr;
198 static TMap<UWorld*, FUserWidgetPool> UserWidgetPool;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWidgetChangedSignature, TSubclassOf< UUserWidget >, WidgetClass)
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnKeyBindingViewportUpdatedSignature)
Definition: ProjectXHUD.h:20
Definition: ProjectXMapCamera.h:11
virtual void Tick(float DeltaTime) override
Definition: ProjectXMapCamera.cpp:85
Definition: ProjectXGameInstance.h:507
Definition: ProjectXGameViewportClient.h:23
void ToggleWidgetByClass()
Definition: ProjectXGameViewportClient.h:83