Space Plunder
Loading...
Searching...
No Matches
WheelMenu.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 "Blueprint/UserWidget.h"
9#include "WheelMenu.generated.h"
10
11class UWheelSegment;
15UCLASS()
16class BASEHELPERS_API UWheelMenu : public UUserWidget, public IRadialMenu
17{
18 GENERATED_BODY()
19
20public:
21 explicit UWheelMenu(const FObjectInitializer& ObjectInitializer);
22
23 //~~ Radial Menu Interface ~~//
24 virtual void SetWheelData(const FRadialMenuData& Data) override;
25 virtual bool GetCurrentIndex(int32& Value) const override;
26 virtual void StartUpdateInput() override;
27 virtual void CenterMousePosition() override;
28 //~~ Radial Menu Interface ~~//
29
30 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
31 FVector2D GetJoystickDirection(const bool bLeft) const;
32
33
34
35
36 //@ TODO
37 // By name? or Index
38 // void RemoveItem();
39
40protected:
41
42 virtual bool Initialize() override;
43 virtual void NativePreConstruct() override;
44 virtual void NativeConstruct() override;
45
46 virtual void UpdateInput();
47 void SetIndex(const int32 Value);
48 FVector2D FixInputRotation(const FVector2D& Input) const;
49 void SetInDeadZone(const bool bValue);
50 FVector2D GetScreenCenter() const;
51
52
53 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
54 float GetSectionDegreeSize() const;
55 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
56 float GetSectionDegreeSizeUp() const;
57 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
58 FVector GetSegmentDirection(const int32 SegmentIndex) const;
59
60 UFUNCTION(BlueprintCallable, Category="Radial Wheel", meta=(BlueprintPure=false))
61 void UpdateChildPositions() const;
62 UFUNCTION(BlueprintCallable, Category="Radial Wheel", meta=(BlueprintPure=false))
63 void SetBackgroundRotation() const;
64
65 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
66 void UpdateDirectionWithMouseCursor();
67 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
68 void UpdateDirectionWithJoystick();
69
70 UFUNCTION(BlueprintCallable, Category="Radial Wheel")
71 void SetInputDirection(const FVector2D Direction);
72
73
74 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget), Category="Radial Wheel|Widgets")
75 class UOverlay* RootOverlay = nullptr;
76 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget), Category="Radial Wheel|Widgets")
77 class UImage* RadialBackground = nullptr;
78 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget), Category="Radial Wheel|Widgets")
79 class UImage* RadialDebug = nullptr;
80 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget), Category="Radial Wheel|Widgets")
81 class UTextBlock* TitleTextBlock = nullptr;
82 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget), Category="Radial Wheel|Widgets")
83 class UTextBlock* DescriptionTextBlock = nullptr;
84 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (BindWidget), Category="Radial Wheel|Widgets")
85 class USizeBox* SizeBox = nullptr;
86
87 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
88 float UpdateSpeed = 1.0f;
89 // UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
90 // int32 MaxSegments = 2;
91
92 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Debug")
93 bool bNormalize = false;
94
98 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
99 float ItemOffsetRadius = 180.0f;
101 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Wheel|General")
102 bool bAutoRotateForUp = true;
103 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Wheel|General")
104 bool bUseCustomInput = false;
105 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Wheel|General")
106 float MouseDeadZone = 0.2f;
108 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Wheel|General")
109 float JoystickDeadZone = 0.3f;
110
111 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material")
112 UMaterialInterface* MaterialBase = nullptr;
113 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
114 FName MaterialParamSegments = FName("Segments");
115 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
116 FName MaterialParamIndex = FName("Index");
117 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
118 FName MaterialParamDeadZone = FName("Deadzone");
119 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
120 FName MaterialParamRadialTexture = FName("RadialTexture");
121 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material")
122 bool bUseCustomTexture = false;
123 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material")
124 UTexture2D* RadialTexture = nullptr;
125 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material")
126 bool bUseCustomColors = false;
127
128 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
129 FName MaterialParamOuterRingColor = FName("OuterRingColor");
130 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
131 FName MaterialParamInnerRingColor = FName("InnerRingColor");
132 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
133 FName MaterialParamRingMainColor = FName("RingMainColor");
134 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Names")
135 FName MaterialParamUnhighlightColor = FName("UnhighlightColor");
136 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Colors")
137 FLinearColor OuterRingColorDefault = FLinearColor(0.0f,0.25641f, 1.0f);
138 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Colors")
139 FLinearColor InnerRingColorDefault = FLinearColor(0.369792f,0.369792f, 0.369792f);
140 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Colors")
141 FLinearColor RingMainColorDefault = FLinearColor(1.0f,1.0f, 1.0f);
142 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Colors")
143 FLinearColor UnhighlightColorDefault = FLinearColor(0.291667f, 0.291667f, 0.291667f);
144 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material|Colors")
145 FVector2D MenuSizeDefault = FVector2D(512.0f, 512.0f);
146
147
148
149 //@ Do i Need?
150 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Wheel|General")
151 bool bUseDeadZoneEvents = false;
152
153
155 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
156 float IndexRaw = 0.0f;
158 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
159 int32 Index = -1;
160 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
161 int32 Segments = 2;
162 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
163 bool bInDeadZone = false;
164 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|General")
165 FVector2D CurrentInput = FVector2D::ZeroVector;
166 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material")
167 UMaterialInstanceDynamic* DynamicMaterial = nullptr;
168 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Radial Wheel|Material")
170
171private:
172 virtual bool GetCurrentSegmentData(FRadialSegmentData& Data) const;
173
174 void SetDescriptionText(const FRadialSegmentData& SegmentData) const;
175 void SetCancelText() const;
176 void ClearDescriptionText() const;
177
178 void SetColors(const FLinearColor& OuterRing, const FLinearColor& InnerRing, const FLinearColor& RingMain, const FLinearColor& UnHighlight);
179 void SetColorsToDefault();
180
181 void SetMenuSize() const;
182
183 void CreateMaterial();
184 void UpdateMaterials() const;
185 void UpdateMaterialVisuals() const;
186
187 void SetMaterialSegments() const;
188
189
190 void Setup();
191 void SetSegmentData(const TArray<FRadialSegmentData>& Selections, const bool bShowDescription) const;
192
193
194 FTimerHandle UpdateSpeedTimer;
195
196 UPROPERTY(EditAnywhere, Category="Radial Wheel|General")
197 TSubclassOf<UUserWidget> RadialSegmentClass;
198
199 UPROPERTY(VisibleAnywhere, Category="Radial Wheel|Material|Colors")
200 FLinearColor OuterRingColor = FLinearColor(0.0f,0.25641f, 1.0f);
201 UPROPERTY(VisibleAnywhere, Category="Radial Wheel|Material|Colors")
202 FLinearColor InnerRingColor = FLinearColor(0.369792f,0.369792f, 0.369792f);
203 UPROPERTY(VisibleAnywhere, Category="Radial Wheel|Material|Colors")
204 FLinearColor RingMainColor = FLinearColor(1.0f,1.0f, 1.0f);
205 UPROPERTY(VisibleAnywhere, Category="Radial Wheel|Material|Colors")
206 FLinearColor UnhighlightColor = FLinearColor(0.291667f, 0.291667f, 0.291667f);
207
208};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition RadialMenu.h:21
Definition WheelMenu.h:17
Definition WheelSegment.h:15
class UTextBlock * DescriptionTextBlock
Definition WheelSegment.h:45
int32 Index
Definition WheelSegment.h:51
virtual void NativePreConstruct() override
Definition WheelSegment.cpp:23
void SetIndex(const int32 Value)
Definition WheelSegment.h:25
virtual bool Initialize() override
Definition WheelSegment.cpp:11
bool bShowDescription
Definition WheelSegment.h:55
void SetSegmentData(const FRadialSegmentData &Data)
Definition WheelSegment.cpp:34
FRadialSegmentData SegmentData
Definition WheelSegment.h:58
virtual void NativeConstruct() override
Definition WheelSegment.cpp:28
class UTextBlock * TitleTextBlock
Definition WheelSegment.h:43
Definition RadialWheelData.h:100
Definition RadialWheelData.h:72