A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
WidgetController.h
Go to the documentation of this file.
1// Copyright(c) Pixo Group. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "UIData.h"
7#include "Components/ArrowComponent.h"
8#include "Components/TimelineComponent.h"
9#include "GameFramework/Actor.h"
10#include "WidgetController.generated.h"
11
12class UTimelineComponent;
14class UBoxComponent;
15
20UCLASS()
21class PIXOCORE_API AWidgetController : public AActor
22{
23 GENERATED_BODY()
24
25protected:
27
28 virtual void Tick(float DeltaTime) override;
29 virtual void BeginPlay() override;
30
31public:
32 UFUNCTION(BlueprintCallable, Category = "WidgetController")
33 void InitWidget(UBasicWidgetInfo* WidgetInfo);
34 UFUNCTION(BlueprintCallable, Category = "WidgetController")
35 void CloseWidget();
36 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "WidgetController")
37 bool IsWidgetInited();
38
39 UFUNCTION(BlueprintCallable, Category = "WidgetController")
40 FVector GetWidgetLocation() { return FinalLocation; };
41
42protected:
43 void InternalCloseWidget();
44
45 UFUNCTION(BlueprintCallable, Category = "Widget")
46 void OpenWidgetAnim();
47
48 UFUNCTION(BlueprintCallable, Category = "Widget")
49 void CloseWidgetAnim();
50
51 UFUNCTION(BlueprintCallable, Category = "Widget")
52 void StartLookAt();
53
54 UFUNCTION(BlueprintCallable, Category = "Widget")
55 void StopLookAt();
56
57 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Widget")
58 bool CanRotate();
59
60 UFUNCTION(BlueprintCallable, Category = "Widget")
61 void ActivateCurrentWidget();
62
63 UFUNCTION(BlueprintCallable, Category = "Widget")
64 void DeactivateCurrentWidget();
65
66 virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
67
68private:
69 UFUNCTION()
70 void HandleTimeLineFloat(float Value);
71 UFUNCTION()
72 void HandleTimelineFinished();
73
74 UFUNCTION()
75 void BeginOverlap(
76 UPrimitiveComponent* OverlappedComponent,
77 AActor* OtherActor,
78 UPrimitiveComponent* OtherComp,
79 int32 OtherBodyIndex,
80 bool bFromSweep,
81 const FHitResult& SweepResult);
82
83 UFUNCTION()
84 void EndOverlap(
85 UPrimitiveComponent* OverlappedComponent,
86 AActor* OtherActor,
87 UPrimitiveComponent* OtherComp,
88 int32 OtherBodyIndex);
89
90 void InitWidgetLocally(UBasicWidgetInfo* WidgetInfo);
91 //void InitWidgetOnRemoteClient(UBasicWidgetInfo* WidgetInfo);
92 void InitBasicWidget(UBasicWidget* BasicWidget, UBasicWidgetInfo* WidgetInfo);
93
94 UFUNCTION()
95 void TouchBeginOverlap(
96 UPrimitiveComponent* OverlappedComponent,
97 AActor* OtherActor,
98 UPrimitiveComponent* OtherComp,
99 int32 OtherBodyIndex,
100 bool bFromSweep,
101 const FHitResult& SweepResult);
102
103 UFUNCTION()
104 void TouchEndOverlap(
105 UPrimitiveComponent* OverlappedComponent,
106 AActor* OtherActor,
107 UPrimitiveComponent* OtherComp,
108 int32 OtherBodyIndex);
109
110public:
111 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
112 UBoxComponent* BoxForSpawn;
113
114 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
115 UBoxComponent* BoxForRotate;
116
117 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
118 USceneComponent* WidgetScene;
119
120 UPROPERTY(VisibleAnywhere, Replicated, BlueprintReadWrite, Category = "Components")
121 UWidgetComponent* WidgetComponent;
122
123 UPROPERTY(VisibleAnywhere, Replicated, BlueprintReadWrite, Category = "Components")
124 UTimelineComponent* OpenCloseTimeline;
125
126 UPROPERTY(VisibleAnywhere, Replicated, BlueprintReadWrite, Category = "Components")
127 UBoxComponent* BoxForTouch;
128
129 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
130 UArrowComponent* ArrowDirection;
131
132protected:
133 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Meta = (ExposeOnSpawn = true), Category = "Widget")
134 FVector FinalLocation;
135 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Meta = (ExposeOnSpawn = true), Category = "Widget")
136 FVector StartLocation;
137
138 UPROPERTY(BlueprintReadOnly, Replicated, Meta = (ExposeOnSpawn = true), Category = "Widget")
139 FRotator StartRotation;
140 UPROPERTY(BlueprintReadOnly, Replicated, Meta = (ExposeOnSpawn = true), Category = "Widget")
141 FRotator FinalRotation;
142
143 UPROPERTY(EditDefaultsOnly, Category = "Widget")
144 UCurveFloat* OpenCloseFloatCurve;
145
146 FOnTimelineFloat TimelinePostUpdate;
147 FOnTimelineEvent TimelineFinished;
148
149 UPROPERTY(EditAnywhere, BlueprintReadWrite)
150 USoundBase* OpenSound;
151 UPROPERTY(EditAnywhere, BlueprintReadWrite)
152 USoundBase* CloseSound;
153
154private:
155 bool bStartLookAtAllowed = false;
156 bool bRotateAllowed = true;
157 bool bSoundAllowed = true;
158
159 UPROPERTY()
160 bool bFinalLocationPendingChange = false;
161
162 UPROPERTY()
163 TArray<UPrimitiveComponent*> OverlapArray;
164
165 UPROPERTY()
166 UBasicWidget* CurrentWidget = nullptr;
167 //UPROPERTY() TMap<FGuid, FServerHandlerCacheModel> HandlerCache;
168
169 TDoubleLinkedList<UBasicWidget*> WidgetQueue;
170 UPROPERTY()
171 TArray<UBasicWidgetInfo*> WidgetCache;
AActor class representing a widget controller that manages widget functionality.
FRotator FinalRotation
UPROPERTY(BlueprintReadOnly, Replicated, Meta = (ExposeOnSpawn = true), Category = "Widget")
TDoubleLinkedList< UBasicWidget * > WidgetQueue
FVector StartLocation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Meta = (ExposeOnSpawn = true),...
FVector FinalLocation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Meta = (ExposeOnSpawn = true),...
FOnTimelineEvent TimelineFinished
This delegate will be fired when the timeline reaches the end.
TArray< UBasicWidgetInfo * > WidgetCache
UPROPERTY()
TArray< UPrimitiveComponent * > OverlapArray
UPROPERTY()
UWidgetComponent * WidgetComponent
UPROPERTY(VisibleAnywhere, Replicated, BlueprintReadWrite, Category = "Components")
UBoxComponent * BoxForRotate
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
UArrowComponent * ArrowDirection
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
USoundBase * OpenSound
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FOnTimelineFloat TimelinePostUpdate
This delegate will be fired to be informed when the timeline has a new update.
FVector GetWidgetLocation()
UFUNCTION(BlueprintCallable, Category = "WidgetController")
FRotator StartRotation
UPROPERTY(BlueprintReadOnly, Replicated, Meta = (ExposeOnSpawn = true), Category = "Widget")
UTimelineComponent * OpenCloseTimeline
UPROPERTY(VisibleAnywhere, Replicated, BlueprintReadWrite, Category = "Components")
UBoxComponent * BoxForSpawn
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
UCurveFloat * OpenCloseFloatCurve
UPROPERTY(EditDefaultsOnly, Category = "Widget")
USoundBase * CloseSound
UPROPERTY(EditAnywhere, BlueprintReadWrite)
USceneComponent * WidgetScene
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Components")
UBoxComponent * BoxForTouch
UPROPERTY(VisibleAnywhere, Replicated, BlueprintReadWrite, Category = "Components")
Base class for user widgets in the PixoCore module.
Definition BasicWidget.h:24
UDataAsset class representing basic widget information.
Definition UIData.h:56