Space Plunder
Loading...
Searching...
No Matches
RadialWheelData.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameplayTagContainer.h"
8#include "UObject/Object.h"
9#include "Engine/DataTable.h"
10#include "RadialWheelData.generated.h"
11
12DECLARE_LOG_CATEGORY_EXTERN(LogBaseWidgets, Display, All);
13
14
15USTRUCT(BlueprintType)
16struct FNotificationData : public FTableRowBase
17{
18 GENERATED_BODY()
19
20 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
21 FUniqueID NotificationID;
22 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
23 // FString ID = "NotificationID";
24 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
25 // int32 IDNum = 0;
26 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
27 FString Title = "Player Added";
28 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
29 FString Description = "New Player Added To Game";
30 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
31 bool bUseSlot = false;
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
33 FGameplayTag SlotName;
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
35 bool bShowDescription = true;
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
38 bool bShowHint = true;
39 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
40 FString Hint = "Open Menu";
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
42 bool bUseCustomClass = false;
43
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
45 bool bUseCustomLife = false;
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
47 float LifeDuration = 3.0f;
48
49};
50
51
52
53// USTRUCT(BlueprintType)
54// struct FHUDLocation
55// {
56// GENERATED_BODY()
57//
58// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
59// FGameplayTag LocationName;
60//
61// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
62// TEnumAsByte<EHorizontalAlignment> HorizontalAlignment = HAlign_Fill;
63// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
64// TEnumAsByte<EVerticalAlignment> VerticalAlignment = VAlign_Fill;
65// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Appearance")
66// FMargin Padding = FMargin(0.0f,0.0f,0.0f,0.0f);
67// };
68
69
70USTRUCT(BlueprintType)
71struct FRadialSegmentData : public FTableRowBase
72{
73 GENERATED_BODY()
74
75 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Menu")
76 FGameplayTag GameplayTag;
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Menu")
78 FString Name = "Option 1";
79 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Menu")
80 FString Description = "Do Something..";
81 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Menu")
82 UTexture2D* Icon = nullptr;
83
84 bool IsValid() const
85 {
86 return Icon != nullptr;
87 }
89
90 explicit FRadialSegmentData(UTexture2D* SegmentIcon, FString SegmentName = "", FString SegmentDescription = "")
91 {
92 Icon = SegmentIcon;
93 Name = SegmentName;
94 Description = SegmentDescription;
95 };
96};
97
98USTRUCT(BlueprintType)
99struct FRadialMenuData : public FTableRowBase
100{
101 GENERATED_BODY()
102
103 //@ ID?
104
105 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
106 TArray<FRadialSegmentData> Selections;
107 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
108 bool bShowSegmentDescription = true;
109 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
110 bool bCenterDescription = true;
111
112 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Input")
113 bool bLeftJoystick = false;
114
115 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Colors")
116 bool bUseCustomColors = false;
117 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Colors", meta=(EditCondition="bUseCustomColors"))
118 FLinearColor OuterRingColor = FLinearColor(0.0f,0.25641f, 1.0f);
119 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Colors", meta=(EditCondition="bUseCustomColors"))
120 FLinearColor InnerRingColor = FLinearColor(0.369792f,0.369792f, 0.369792f);
121 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Colors", meta=(EditCondition="bUseCustomColors"))
122 FLinearColor RingMainColor = FLinearColor(1.0f,1.0f, 1.0f);
123 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Colors", meta=(EditCondition="bUseCustomColors"))
124 FLinearColor UnhighlightColor = FLinearColor(0.291667f, 0.291667f, 0.291667f);
125
126 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Size")
127 bool bUseCustomSize = false;
128 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Colors", meta=(EditCondition="bUseCustomSize"))
129 FVector2D MenuSize = FVector2D(512.0f, 512.0f);
130
131 bool IsEmpty() const
132 {
133 return Selections.IsEmpty();
134 }
135
137 {
138
139 }
140 explicit FRadialMenuData(const FName& GameplayTagCategory, const FString& DataTableLocation)
141 {
142 const UDataTable* RadialMenuDataTable = LoadObject<UDataTable>(nullptr, *DataTableLocation);
143 if (RadialMenuDataTable == nullptr)
144 {
145 UE_LOG(LogTemp, Error, TEXT("Failed to load Radial Menu DataTable"));
146 return;
147 }
148
149 TArray<FGameplayTag> GameplayTags = UBaseHelpersBPLib::GetAllTagsOfCategory(GameplayTagCategory);
150 // Iterate through the GameplayTags and find matching entries in the DataTable
151 for (const FGameplayTag& Tag : GameplayTags)
152 {
153 // Get just the last part of the GameplayTag (e.g., "Default" from "Character.Mode.Default")
154 FString LastTagPart;
155 Tag.GetTagName().ToString().Split(TEXT("."), nullptr, &LastTagPart, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
156 // FString TagName = Tag.ToString(); // Convert the GameplayTag to a string to search in the DataTable
157
158 // Try to find a matching row in the DataTable
159 FRadialSegmentData* Row = RadialMenuDataTable->FindRow<FRadialSegmentData>(FName(LastTagPart), TEXT("RadialMenu"));
160 if (Row != nullptr)
161 {
162 // Add the row to the Selections if it's not already added
163 if(!Selections.ContainsByPredicate([&](const FRadialSegmentData& ExistingRow)
164 {
165 return ExistingRow.Name == Row->Name; // Check if we already added a segment with the same name
166 }))
167 {
168 Selections.Add(*Row); // Add unique entry
169 }
170 }
171 }
172 UE_LOG(LogTemp, Warning, TEXT("Radial Menu created with %d options"), Selections.Num());
173 // for(auto Tag : GameplayTags)
174 // {
175 // UE_LOG(LogTemp, Warning, TEXT("Gameplay Tag: %s"), *Tag.ToString());
176 // }
177 // const TCHAR* LocationText = *DataTableLocation;
178 // const UDataTable* RadialMenuDataTable = LoadObject<UDataTable>(nullptr, LocationText);
179 // if(RadialMenuDataTable != nullptr)
180 // {
181 // TArray<FRadialSegmentData*> AllRows;
182 // RadialMenuDataTable->GetAllRows<FRadialSegmentData>(TEXT("RadialMenu"), AllRows);
183 // for (const FRadialSegmentData* Row : AllRows)
184 // {
185 // // Add each row as a segment in the radial menu
186 // Selections.Add(*Row);
187 // }
188 // UE_LOG(LogTemp, Warning, TEXT("Gameplay Tag: menu CREATED"));
189 // }
190 }
191};
192
193
197UCLASS()
198class BASEHELPERS_API URadialWheelData : public UObject
199{
200 GENERATED_BODY()
201};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
DECLARE_LOG_CATEGORY_EXTERN(LogBaseWidgets, Display, All)
static TArray< FGameplayTag > GetAllTagsOfCategory(const FName &Category)
Definition BaseHelpersBPLib.cpp:500
Definition RadialWheelData.h:199
Definition RadialWheelData.h:17
Definition RadialWheelData.h:100
FRadialMenuData()
Definition RadialWheelData.h:136
FRadialMenuData(const FName &GameplayTagCategory, const FString &DataTableLocation)
Definition RadialWheelData.h:140
Definition RadialWheelData.h:72
FRadialSegmentData()
Definition RadialWheelData.h:88
FRadialSegmentData(UTexture2D *SegmentIcon, FString SegmentName="", FString SegmentDescription="")
Definition RadialWheelData.h:90
Definition BaseData.h:253