Space Plunder
Loading...
Searching...
No Matches
UGameLogWidget Class Reference

#include <GameLogWidget.h>

Inheritance diagram for UGameLogWidget:
IWidgetLayout

Public Member Functions

 UGameLogWidget (const FObjectInitializer &ObjectInitializer)
 
virtual UWidget * NativeGetDesiredFocusTarget () const override
 
virtual UUserWidget * PushWidget (const TSoftClassPtr< UUserWidget > &WidgetClass) override
 
virtual void PopWidget () override
 
virtual void ClearStack () override
 
virtual UUserWidget * AddWidgetToLayer (const TSoftClassPtr< UUserWidget > &WidgetClass) override
 
virtual UUserWidget * GetContentFromLayer (const TSoftClassPtr< UUserWidget > &WidgetClass) override
 
virtual bool ToggleWidget (UUserWidget *Widget) override
 
virtual UUserWidget * AddWidgetToLayerWithSlot (const FGameplayTag &SlotTag, const TSoftClassPtr< UUserWidget > &WidgetClass) override
 

Protected Member Functions

virtual bool Initialize () override
 
virtual void NativeConstruct () override
 
virtual void NativePreConstruct () override
 
void GetSlots ()
 
class USlotWidgetFindSlotByTag (const FGameplayTag &SlotTag) const
 
virtual void NativeOnActivated () override
 
virtual void NativeOnDeactivated () override
 
virtual bool NativeOnHandleBackAction () override
 

Protected Attributes

bool bUseVerticalLayout = false
 
class UTabListWidgetTabList = nullptr
 
class UCommonActivatableWidgetSwitcher * Switcher = nullptr
 
TSubclassOf< class UCommonButtonBase > ButtonWidgetType
 
TArray< FName > TabNames
 
class USlotWidgetQuestPage = nullptr
 
class USlotWidgetCrewPage = nullptr
 
class USlotWidgetSkillsPage = nullptr
 
class USlotWidgetMapPage = nullptr
 
class USlotWidgetDebugPage = nullptr
 

Constructor & Destructor Documentation

◆ UGameLogWidget()

UGameLogWidget::UGameLogWidget ( const FObjectInitializer & ObjectInitializer)
explicit
12 :Super(ObjectInitializer)
13{
14
15}

Member Function Documentation

◆ AddWidgetToLayer()

UUserWidget * UGameLogWidget::AddWidgetToLayer ( const TSoftClassPtr< UUserWidget > & WidgetClass)
overridevirtual

Implements IWidgetLayout.

102{
103 UClass* LoadedClass = UKismetSystemLibrary::LoadClassAsset_Blocking(WidgetClass);
104 if(LoadedClass == nullptr || !LoadedClass->IsChildOf(UUserWidget::StaticClass())){return nullptr;}
105 const TSubclassOf<UUserWidget> LoadedWidgetClass = LoadedClass;
106 if(LoadedWidgetClass == nullptr){return nullptr;}
107 UUserWidget* CreatedWidget = CreateWidget(GetOwningPlayer(), LoadedWidgetClass);
108 // BackStack.Add(CreatedWidget);
109 // BackOverlay->AddChild(CreatedWidget);
110 // UOverlaySlot* OverlaySlot = Cast<UOverlaySlot>(CreatedWidget->Slot);
111 // if(OverlaySlot != nullptr)
112 // {
113 // OverlaySlot->SetHorizontalAlignment(HAlign_Fill);
114 // OverlaySlot->SetVerticalAlignment(VAlign_Fill);
115 // }
116 // else
117 // {
118 // UE_LOG(LogBaseWidgets, Warning, TEXT("Widget Slot Failed %s"), *WidgetClass->GetName());
119 // }
120 return CreatedWidget;
121}

◆ AddWidgetToLayerWithSlot()

UUserWidget * UGameLogWidget::AddWidgetToLayerWithSlot ( const FGameplayTag & SlotTag,
const TSoftClassPtr< UUserWidget > & WidgetClass )
overridevirtual

Implements IWidgetLayout.

125{
126 UClass* LoadedClass = UKismetSystemLibrary::LoadClassAsset_Blocking(WidgetClass);
127 if(LoadedClass == nullptr || !LoadedClass->IsChildOf(UUserWidget::StaticClass())){return nullptr;}
128 const TSubclassOf<UUserWidget> LoadedWidgetClass = LoadedClass;
129 if(LoadedWidgetClass == nullptr){return nullptr;}
130 UUserWidget* CreatedWidget = CreateWidget(GetOwningPlayer(), LoadedWidgetClass);
131 if(CreatedWidget == nullptr){UE_LOG(LogTemp, Error, TEXT("UGameLogWidget::AddWidgetToLayerWithSlot Created Widget FAILED "))return nullptr;}
132 const USlotWidget* SlotWidget = FindSlotByTag(SlotTag);
133 if(SlotWidget == nullptr){UE_LOG(LogTemp, Error, TEXT("UGameLogWidget::AddWidgetToLayerWithSlot Slot %s Doesn't Exist on %s"), *SlotTag.ToString(), *GetName())return nullptr;}
134 SlotWidget->AddWidgetToSlot(CreatedWidget, false);
135 UE_LOG(LogTemp, Warning, TEXT("UGameLogWidget::AddWidgetToLayerWithSlot WIDGET %s ADDED TO SLOT %s in GAMELOG"), *CreatedWidget->GetName(), *SlotTag.GetTagName().ToString())
136 return CreatedWidget;
137}
Definition GameLogWidget.h:15
virtual UUserWidget * AddWidgetToLayerWithSlot(const FGameplayTag &SlotTag, const TSoftClassPtr< UUserWidget > &WidgetClass) override
Definition GameLogWidget.cpp:123
class USlotWidget * FindSlotByTag(const FGameplayTag &SlotTag) const
Definition GameLogWidget.cpp:139
Definition SlotWidget.h:16

◆ ClearStack()

void UGameLogWidget::ClearStack ( )
overridevirtual

Implements IWidgetLayout.

98{
99}

◆ FindSlotByTag()

USlotWidget * UGameLogWidget::FindSlotByTag ( const FGameplayTag & SlotTag) const
protected
140{
141 for(int32 i = 0; i < Switcher->GetChildrenCount(); ++i)
142 {
143 if(Switcher->GetChildAt(i) == nullptr){continue;}
144 USlotWidget* SlotWidget = Cast<USlotWidget>(Switcher->GetChildAt(i));
145 if(SlotWidget == nullptr){continue;}
146 if(SlotTag == SlotWidget->SlotTag)
147 {
148 return SlotWidget;
149 }
150 }
151 return nullptr;
152}
class UCommonActivatableWidgetSwitcher * Switcher
Definition GameLogWidget.h:61
FGameplayTag SlotTag
Definition SlotWidget.h:22

◆ GetContentFromLayer()

UUserWidget * UGameLogWidget::GetContentFromLayer ( const TSoftClassPtr< UUserWidget > & WidgetClass)
overridevirtual

Get the Widget that was already created by class

Implements IWidgetLayout.

157{
158 UClass* LoadedClass = UKismetSystemLibrary::LoadClassAsset_Blocking(WidgetClass);
159 if(LoadedClass == nullptr || !LoadedClass->IsChildOf(UUserWidget::StaticClass())){return nullptr;}
160 const TSubclassOf<UUserWidget> LoadedWidgetClass = LoadedClass;
161 if(LoadedWidgetClass == nullptr){return nullptr;}
162 // for(const auto Widget : BackStack)
163 // {
164 // if(Widget == nullptr){continue;}
165 // if(Widget->GetClass() == LoadedWidgetClass)
166 // {
167 // return Widget;
168 // }
169 // }
170 return nullptr;
171}

◆ GetSlots()

void UGameLogWidget::GetSlots ( )
protected
211{
212 // if(SlotsOverlay == nullptr){return;}
213 // for(const auto Widget : SlotsOverlay->GetAllChildren())
214 // {
215 // USlotWidget* SlotWidget = Cast<USlotWidget>(Widget);
216 // if(SlotWidget == nullptr){continue;}
217 // HUDSlots.Add(SlotWidget->SlotTag, SlotWidget);
218 // }
219}

◆ Initialize()

bool UGameLogWidget::Initialize ( )
overrideprotectedvirtual
18{
19 const bool Success = Super::Initialize();
20 if(!Success) return false;
21 if (!ensure(TabList != nullptr)) return false;
22 if (!ensure(Switcher != nullptr)) return false;
23 if (!ensure(QuestPage != nullptr)) return false;
24 if (!ensure(CrewPage != nullptr)) return false;
25 if (!ensure(SkillsPage != nullptr)) return false;
26 if (!ensure(MapPage != nullptr)) return false;
27 if (!ensure(DebugPage != nullptr)) return false;
28 QuestPage->DisplayName = "Missions";
29 CrewPage->DisplayName = "Crew";
30 SkillsPage->DisplayName = "Skills";
31 MapPage->DisplayName = "Map";
32 DebugPage->DisplayName = "Debug";
33
34 // Add all the Pages to A List for GameplayTags
35 TabList->SetLinkedSwitcher(Switcher);
36
37 if (!ensure(ButtonWidgetType != nullptr))
38 {
39 UE_LOG(LogTemp, Error, TEXT("ButtonWidgetType is not valid!"));
40 return false;
41 }
42
43 for(int32 i = 0; i < Switcher->GetAllChildren().Num(); ++i)
44 {
45 UWidget* ChildWidget = Switcher->GetChildAt(i);
46 if (ChildWidget == nullptr){continue;}
47 FName TabName = FName("Tab: " + FString::FromInt(i));
48 const USlotWidget* SlotWidget = Cast<USlotWidget>(Switcher->GetAllChildren()[i]);
49 if(SlotWidget != nullptr)
50 {
51 TabName = SlotWidget->DisplayName;
52 }
53 TabList->RegisterTab(TabName, ButtonWidgetType, ChildWidget, i);
54 }
55 bIsBackHandler = true;
56 return true;
57}
class USlotWidget * SkillsPage
Definition GameLogWidget.h:74
TSubclassOf< class UCommonButtonBase > ButtonWidgetType
Definition GameLogWidget.h:64
class USlotWidget * QuestPage
Definition GameLogWidget.h:70
class USlotWidget * DebugPage
Definition GameLogWidget.h:78
class UTabListWidget * TabList
Definition GameLogWidget.h:59
class USlotWidget * CrewPage
Definition GameLogWidget.h:72
class USlotWidget * MapPage
Definition GameLogWidget.h:76
FName DisplayName
Definition SlotWidget.h:24

◆ NativeConstruct()

void UGameLogWidget::NativeConstruct ( )
overrideprotectedvirtual
199{
200 Super::NativeConstruct();
201 GetSlots();
202}
void GetSlots()
Definition GameLogWidget.cpp:210

◆ NativeGetDesiredFocusTarget()

UWidget * UGameLogWidget::NativeGetDesiredFocusTarget ( ) const
overridevirtual
61{
62 if(TabList != nullptr)
63 {
64 return TabList->GetTabButtonBaseByID(TabList->GetActiveTab());
65 }
66 return Super::NativeGetDesiredFocusTarget();
67}

◆ NativeOnActivated()

void UGameLogWidget::NativeOnActivated ( )
overrideprotectedvirtual
222{
223 Super::NativeOnActivated();
224}

◆ NativeOnDeactivated()

void UGameLogWidget::NativeOnDeactivated ( )
overrideprotectedvirtual
227{
228 Super::NativeOnDeactivated();
229}

◆ NativeOnHandleBackAction()

bool UGameLogWidget::NativeOnHandleBackAction ( )
overrideprotectedvirtual
232{
233 if(GetOwningPlayer() == nullptr){return false;}
234 IPlayerControllerInterface* PlayerController = Cast<IPlayerControllerInterface>(GetOwningPlayer());
235 if(PlayerController != nullptr)
236 {
237 PlayerController->ToggleGameLog();
238 }
239 return Super::NativeOnHandleBackAction();
240}
Definition PlayerControllerInterface.h:21
virtual void ToggleGameLog()=0

◆ NativePreConstruct()

void UGameLogWidget::NativePreConstruct ( )
overrideprotectedvirtual
205{
206 Super::NativePreConstruct();
207 GetSlots();
208}

◆ PopWidget()

void UGameLogWidget::PopWidget ( )
overridevirtual

Implements IWidgetLayout.

85{
86 // UUserWidget* TopWidget = GetTopWidget();
87 // if(TopWidget == nullptr){UE_LOG(LogBaseWidgets,Error, TEXT("Top Widget Invalid ULayerWidget::PopWidget"));return;}
88 // TopWidget->RemoveFromParent();
89 // Stack.Remove(TopWidget);
90 // Border->ClearChildren();
91 // TopWidget = GetTopWidget();
92 // if(TopWidget == nullptr){UE_LOG(LogBaseWidgets,Error, TEXT("2nd Top Widget Invalid ULayerWidget::PopWidget"));return;}
93 // TopWidget->SetVisibility(ESlateVisibility::HitTestInvisible);
94 // Border->AddChild(TopWidget);
95}

◆ PushWidget()

UUserWidget * UGameLogWidget::PushWidget ( const TSoftClassPtr< UUserWidget > & WidgetClass)
overridevirtual

Implements IWidgetLayout.

70{
71 UClass* LoadedClass = UKismetSystemLibrary::LoadClassAsset_Blocking(WidgetClass);
72 if(LoadedClass == nullptr || !LoadedClass->IsChildOf(UUserWidget::StaticClass())){return nullptr;}
73 const TSubclassOf<UUserWidget> LoadedWidgetClass = LoadedClass;
74 if(LoadedWidgetClass == nullptr){return nullptr;}
75 UUserWidget* CreatedWidget = CreateWidget(GetOwningPlayer(), LoadedWidgetClass);
76 // CollapseTopWidget();
77 // Border->ClearChildren();
78 // Stack.Add(CreatedWidget);
79 // Border->AddChild(CreatedWidget);
80 // ShowTopWidget();
81 return CreatedWidget;
82}

◆ ToggleWidget()

bool UGameLogWidget::ToggleWidget ( UUserWidget * Widget)
overridevirtual

Implements IWidgetLayout.

174{
175 if(Widget == nullptr){UE_LOG(LogTemp, Error, TEXT("ULayerWidget::ToggleWidget Widget null"));return false;}
176 // if(Stack.Contains(Widget) == false)
177 // {
178 // UE_LOG(LogBaseWidgets, Error, TEXT("ULayerWidget::ToggleWidget %s Doesn't Exist On Layer"), *Widget->GetName())return false;
179 // }
180 // // if(Widget->IsVisible())
181 // // {
182 // // Widget->
183 // // }
184 // if(Switcher == nullptr || EmptyOverlay == nullptr){return false;}
185 // if(Switcher->GetActiveWidget() == Widget)
186 // {
187 // Switcher->SetActiveWidget(EmptyOverlay);
188 // }
189 // else
190 // {
191 // Switcher->SetActiveWidget(Widget);
192 // }
193 return true;
194}

Member Data Documentation

◆ bUseVerticalLayout

bool UGameLogWidget::bUseVerticalLayout = false
protected

◆ ButtonWidgetType

TSubclassOf<class UCommonButtonBase> UGameLogWidget::ButtonWidgetType
protected

◆ CrewPage

class USlotWidget* UGameLogWidget::CrewPage = nullptr
protected

◆ DebugPage

class USlotWidget* UGameLogWidget::DebugPage = nullptr
protected

◆ MapPage

class USlotWidget* UGameLogWidget::MapPage = nullptr
protected

◆ QuestPage

class USlotWidget* UGameLogWidget::QuestPage = nullptr
protected

◆ SkillsPage

class USlotWidget* UGameLogWidget::SkillsPage = nullptr
protected

◆ Switcher

class UCommonActivatableWidgetSwitcher* UGameLogWidget::Switcher = nullptr
protected

◆ TabList

class UTabListWidget* UGameLogWidget::TabList = nullptr
protected

◆ TabNames

TArray<FName> UGameLogWidget::TabNames
protected

The documentation for this class was generated from the following files: