Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
UCardWidget 클래스 참조

#include <CardWidget.h>

UCardWidget에 대한 상속 다이어그램 :
Inheritance graph
UCardWidget에 대한 협력 다이어그램:
Collaboration graph

Public 멤버 함수

void SetupCard (USituationBase *InSituation, UTexture2D *InIllustration)
 
USituationBaseGetSituation () const
 
FName GetSituationID () const
 
ESituationTag GetBroadcastTags () const
 
FORCEINLINE UTexture2D * GetIconTexture () const
 
- UUserWidgetBase(으)로부터 상속된 Public 멤버 함수
virtual void SetAbilitySystemComponent (AActor *InOwner)
 
virtual UAbilitySystemComponent * GetAbilitySystemComponent () const override
 
virtual void OnPushedToLayer ()
 
virtual void OnPoppedFromLayer ()
 
virtual void OnActivated ()
 
virtual void OnDeactivated ()
 
void Activate ()
 
void Deactivate ()
 
FORCEINLINE FGameplayTag GetLayerTag () const
 
FORCEINLINE void SetLayerTag (const FGameplayTag InTag)
 
FORCEINLINE bool IsPrimary () const
 
FORCEINLINE void SetPrimary (const bool InPrimary)
 
FORCEINLINE EWidgetState GetWidgetState () const
 
FORCEINLINE void SetWidgetState (const EWidgetState InState)
 
FORCEINLINE UWaitForWidgetActivationGetActivationHandle ()
 
FORCEINLINE bool HasAppearanceAnim () const
 
FORCEINLINE bool HasDisappearanceAnim () const
 

Public 속성

FOnSituationCardChosen OnCardChosen
 

Protected 멤버 함수

virtual void NativeConstruct () override
 
virtual void NativeTick (const FGeometry &MyGeometry, float InDeltaTime) override
 
virtual void NativeOnMouseEnter (const FGeometry &InGeometry, const FPointerEvent &InMouseEvent) override
 
virtual void NativeOnMouseLeave (const FPointerEvent &InMouseEvent) override
 
virtual FReply NativeOnMouseMove (const FGeometry &InGeometry, const FPointerEvent &InMouseEvent) override
 
virtual FReply NativeOnMouseButtonDown (const FGeometry &InGeometry, const FPointerEvent &InMouseEvent) override
 
virtual FReply NativeOnMouseButtonUp (const FGeometry &InGeometry, const FPointerEvent &InMouseEvent) override
 
void OnCardSetup ()
 
void HandleChooseClicked ()
 
void SetupCardTags ()
 
void UpdateCursorOffset (const FGeometry &InGeometry, const FPointerEvent &InMouseEvent)
 
void UpdateHoverTransform (float InDeltaTime)
 
- UUserWidgetBase(으)로부터 상속된 Protected 멤버 함수
virtual void OnWidgetActivated ()
 
virtual void OnWidgetDeactivated ()
 
void OnPushedToLayer_Internal ()
 
void OnPoppedFromLayer_Internal ()
 
void OnActivated_Internal ()
 
void OnDeactivated_Internal ()
 

Protected 속성

TObjectPtr< UImage > SituationIcon
 
TObjectPtr< UImage > SituationIllustration
 
TObjectPtr< UTextBlock > SituationNameText
 
TObjectPtr< UWrapBox > CardTags
 
TObjectPtr< UTextBlock > SituationDescriptionText
 
float HoverScale = 1.08f
 
float MaxTiltAngle = 6.0f
 
float MaxShearAngle = 4.0f
 
float IdleSwayAngle = 1.5f
 
float IdleSwaySpeed = 2.5f
 
float TransformInterpSpeed = 12.0f
 
TSubclassOf< UCardTagWidgetCardTagClass
 
TObjectPtr< USituationBaseSituation
 
TObjectPtr< UTexture2D > IconTexture
 
FVector2D CursorOffset = FVector2D::ZeroVector
 
FVector2D CurrentScale = FVector2D::UnitVector
 
FVector2D CurrentShear = FVector2D::ZeroVector
 
float CurrentAngle = 0.0f
 
float SwayTime = 0.0f
 
uint8 bHovered: 1 = false
 
- UUserWidgetBase(으)로부터 상속된 Protected 속성
EWidgetState WidgetState
 
TObjectPtr< UAbilitySystemComponent > ASC
 
FGameplayTag LayerTag
 
bool bPrimary = false
 
TObjectPtr< UWidgetAnimation > AppearanceAnim
 
TObjectPtr< UWidgetAnimation > DisappearanceAnim
 

상세한 설명

레벨업 선택창의 카드 한 장.

표 행을 복사해 들고 있지 않고 상황 인스턴스를 그대로 가리킨다. 이름 / 설명뿐 아니라 버프 수치와 방송 태그까지 카드가 직접 물어볼 수 있게 하기 위함이다.

멤버 함수 문서화

◆ GetBroadcastTags()

ESituationTag UCardWidget::GetBroadcastTags ( ) const
203{
204 return Situation ? Situation->GetSituationTags() : ESituationTag::None;
205}
TObjectPtr< USituationBase > Situation
Definition CardWidget.h:130

◆ GetIconTexture()

FORCEINLINE UTexture2D * UCardWidget::GetIconTexture ( ) const
inline
50 {
51 return IconTexture;
52 }
TObjectPtr< UTexture2D > IconTexture
Definition CardWidget.h:134
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetSituation()

USituationBase * UCardWidget::GetSituation ( ) const
191{
192 return Situation;
193}

◆ GetSituationID()

FName UCardWidget::GetSituationID ( ) const
197{
198 return Situation ? Situation->GetSituationID() : NAME_None;
199}
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ HandleChooseClicked()

void UCardWidget::HandleChooseClicked ( )
protected
237{
238 OnCardChosen.Broadcast(this);
239}
FOnSituationCardChosen OnCardChosen
Definition CardWidget.h:81
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ NativeConstruct()

void UCardWidget::NativeConstruct ( )
overrideprotectedvirtual
21{
22 Super::NativeConstruct();
23
24 // 카드 세 장이 같은 위상으로 흔들리면 한 덩어리처럼 보인다. 시작 위상을 흩어 둔다.
25 SwayTime = FMath::FRandRange(0.0f, 2.0f * PI);
26
27 // 회전과 확대는 카드 중앙을 기준으로 돌아야 한다.
28 SetRenderTransformPivot(FVector2D(0.5f, 0.5f));
29}
float SwayTime
Definition CardWidget.h:146

◆ NativeOnMouseButtonDown()

FReply UCardWidget::NativeOnMouseButtonDown ( const FGeometry &  InGeometry,
const FPointerEvent &  InMouseEvent 
)
overrideprotectedvirtual
69{
70 // 좌클릭만 선택으로 본다. 나머지 버튼은 상위 위젯이 처리하게 넘긴다.
71 if (InMouseEvent.GetEffectingButton() != EKeys::LeftMouseButton)
72 {
73 return Super::NativeOnMouseButtonDown(InGeometry, InMouseEvent);
74 }
75
76 // 선택은 뗄 때 확정한다. 여기서는 클릭이 뒤로 새지 않게 잡아만 둔다.
77 return FReply::Handled();
78}

◆ NativeOnMouseButtonUp()

FReply UCardWidget::NativeOnMouseButtonUp ( const FGeometry &  InGeometry,
const FPointerEvent &  InMouseEvent 
)
overrideprotectedvirtual
82{
83 if (InMouseEvent.GetEffectingButton() != EKeys::LeftMouseButton)
84 {
85 return Super::NativeOnMouseButtonUp(InGeometry, InMouseEvent);
86 }
87
88 // 이 이벤트는 커서가 카드 위에 있을 때만 온다. 눌렀다가 밖에서 떼면 선택되지 않는다.
90 return FReply::Handled();
91}
void HandleChooseClicked()
Definition CardWidget.cpp:236
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ NativeOnMouseEnter()

void UCardWidget::NativeOnMouseEnter ( const FGeometry &  InGeometry,
const FPointerEvent &  InMouseEvent 
)
overrideprotectedvirtual
41{
42 Super::NativeOnMouseEnter(InGeometry, InMouseEvent);
43
44 bHovered = true;
45 UpdateCursorOffset(InGeometry, InMouseEvent);
46}
uint8 bHovered
Definition CardWidget.h:148
void UpdateCursorOffset(const FGeometry &InGeometry, const FPointerEvent &InMouseEvent)
Definition CardWidget.cpp:94
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ NativeOnMouseLeave()

void UCardWidget::NativeOnMouseLeave ( const FPointerEvent &  InMouseEvent)
overrideprotectedvirtual
50{
51 Super::NativeOnMouseLeave(InMouseEvent);
52
53 // 목표값만 되돌린다. 실제 복귀는 Tick 의 보간이 맡아 뚝 끊기지 않는다.
54 bHovered = false;
55 CursorOffset = FVector2D::ZeroVector;
56}
FVector2D CursorOffset
Definition CardWidget.h:138

◆ NativeOnMouseMove()

FReply UCardWidget::NativeOnMouseMove ( const FGeometry &  InGeometry,
const FPointerEvent &  InMouseEvent 
)
overrideprotectedvirtual
60{
61 UpdateCursorOffset(InGeometry, InMouseEvent);
62
63 // 이동 자체는 소비하지 않는다. 상위 위젯의 처리를 막지 않기 위함.
64 return Super::NativeOnMouseMove(InGeometry, InMouseEvent);
65}
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ NativeTick()

void UCardWidget::NativeTick ( const FGeometry &  MyGeometry,
float  InDeltaTime 
)
overrideprotectedvirtual
33{
34 Super::NativeTick(MyGeometry, InDeltaTime);
35
36 UpdateHoverTransform(InDeltaTime);
37}
void UpdateHoverTransform(float InDeltaTime)
Definition CardWidget.cpp:111
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ OnCardSetup()

void UCardWidget::OnCardSetup ( )
protected
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ SetupCard()

void UCardWidget::SetupCard ( USituationBase InSituation,
UTexture2D *  InIllustration 
)
146{
147 Situation = InSituation;
148
149 if (Situation == nullptr)
150 {
151 LOG_WARNING(LogCK, "상황이 비어 있어 카드를 채울 수 없습니다.");
152 return;
153 }
154
155 const FDT_SituationTable& SituationData = Situation->GetSituationData();
156
157 // UserWidget 기본값은 SelfHitTestInvisible 이라 그대로는 마우스 이벤트가 카드까지 오지 않는다.
158 // 뒤에 불리는 OnCardSetup 에서 BP 가 다시 바꿀 수 있다.
159 SetVisibility(ESlateVisibility::Visible);
160
161 if (SituationIcon)
162 {
163 IconTexture = InSituation->GetSituationIcon();
164 ensureAlwaysMsgf(IconTexture, TEXT("%s이 정상적으로 가져와지지 않았습니다. "), NAMEOF_VAR(IconTexture));
165 SituationIcon->SetBrushFromTexture(IconTexture);
166 }
167
169 {
170 SituationIllustration->SetBrushFromTexture(InIllustration);
171 SituationIllustration->SetVisibility(ESlateVisibility::HitTestInvisible);
172 }
173
175 {
176 SituationNameText->SetText(SituationData.Name);
177 }
178
180 {
181 // {{name1}} / {{value1}} 치환자를 현재 무기 기준 수치로 채운다.
182 SituationDescriptionText->SetText(Situation->BuildBuffDescription(GetOwningPlayer()));
183 }
184
186 OnCardSetup();
187}
#define NAMEOF_VAR(Expr)
Definition CK_UE.h:34
#define LOG_WARNING(Category, Format,...)
Definition CK_UE.h:39
TObjectPtr< UTextBlock > SituationNameText
Definition CardWidget.h:91
TObjectPtr< UImage > SituationIcon
Definition CardWidget.h:85
void OnCardSetup()
void SetupCardTags()
Definition CardWidget.cpp:208
TObjectPtr< UImage > SituationIllustration
Definition CardWidget.h:88
TObjectPtr< UTextBlock > SituationDescriptionText
Definition CardWidget.h:97
FORCEINLINE UTexture2D * GetSituationIcon() const
Definition SituationBase.h:104
Definition DT_SituationTable.h:20
FText Name
Definition DT_SituationTable.h:35
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ SetupCardTags()

void UCardWidget::SetupCardTags ( )
protected
209{
210 if (CardTags == nullptr)
211 {
212 return;
213 }
214
215 // 카드는 재사용될 수 있으므로 이전 태그를 먼저 걷어낸다.
216 CardTags->ClearChildren();
217
218 if (CardTagClass == nullptr)
219 {
220 LOG_WARNING(LogCK, "%s 가 비어 있어 카드 태그를 만들 수 없습니다.", NAMEOF_VAR(CardTagClass));
221 return;
222 }
223
224 TArray<ESituationTag> Tags;
225 BroadcastTag::Split(Situation->GetSituationTags(), Tags);
226
227 for (const ESituationTag Tag : Tags)
228 {
229 UCardTagWidget* TagWidget = CreateWidget<UCardTagWidget>(GetOwningPlayer(), CardTagClass);
230 TagWidget->SetupTag(Tag);
231 CardTags->AddChild(TagWidget);
232 }
233}
ESituationTag
Definition SituationTag.h:17
Definition CardTagWidget.h:16
void SetupTag(ESituationTag InTag)
Definition CardTagWidget.cpp:9
TSubclassOf< UCardTagWidget > CardTagClass
Definition CardWidget.h:125
TObjectPtr< UWrapBox > CardTags
Definition CardWidget.h:94
CK_UE_API void Split(ESituationTag Tags, TArray< ESituationTag > &OutTags)
Definition SituationTag.cpp:54
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ UpdateCursorOffset()

void UCardWidget::UpdateCursorOffset ( const FGeometry &  InGeometry,
const FPointerEvent &  InMouseEvent 
)
protected
95{
96 const FVector2D LocalSize = InGeometry.GetLocalSize();
97
98 if (LocalSize.X <= 0.0 || LocalSize.Y <= 0.0)
99 {
100 return;
101 }
102
103 const FVector2D LocalPosition = InGeometry.AbsoluteToLocal(InMouseEvent.GetScreenSpacePosition());
104
105 // 카드 중심을 0 으로 두고 -1 ~ 1 로 정규화한다. 카드 크기가 달라도 기울기가 같아진다.
106 CursorOffset.X = FMath::Clamp(LocalPosition.X / LocalSize.X * 2.0 - 1.0, -1.0, 1.0);
107 CursorOffset.Y = FMath::Clamp(LocalPosition.Y / LocalSize.Y * 2.0 - 1.0, -1.0, 1.0);
108}
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ UpdateHoverTransform()

void UCardWidget::UpdateHoverTransform ( float  InDeltaTime)
protected
112{
113 const bool bAtRest = CurrentScale.Equals(FVector2D::UnitVector, 0.001) && CurrentShear.IsNearlyZero(0.001) && FMath::IsNearlyZero(CurrentAngle, 0.01f);
114
115 // 커서도 없고 이미 원래 크기로 돌아왔으면 손대지 않는다. 매 프레임 변형을 다시 넣으면 카드가 계속 다시 그려진다.
116 if (bHovered == false && bAtRest)
117 {
118 return;
119 }
120
121 SwayTime += InDeltaTime;
122
123 // 커서가 멈춰 있어도 좌우로 천천히 흔들려, 카드가 멈춰 죽어 보이지 않게 한다.
124 const float Sway = bHovered ? FMath::Sin(SwayTime * IdleSwaySpeed) * IdleSwayAngle : 0.0f;
125
126 const FVector2D TargetScale = bHovered ? FVector2D(HoverScale, HoverScale) : FVector2D::UnitVector;
127 const float TargetAngle = bHovered ? static_cast<float>(CursorOffset.X * MaxTiltAngle) + Sway : 0.0f;
128
129 // 세로 오프셋은 회전이 아니라 기울임으로 준다. 2D 위젯이 앞뒤로 눕는 것처럼 보이게 하는 부분.
130 const FVector2D TargetShear = bHovered ? FVector2D(-CursorOffset.Y * MaxShearAngle, 0.0f) : FVector2D::ZeroVector;
131
132 CurrentScale = FMath::Vector2DInterpTo(CurrentScale, TargetScale, InDeltaTime, TransformInterpSpeed);
133 CurrentShear = FMath::Vector2DInterpTo(CurrentShear, TargetShear, InDeltaTime, TransformInterpSpeed);
134 CurrentAngle = FMath::FInterpTo(CurrentAngle, TargetAngle, InDeltaTime, TransformInterpSpeed);
135
136 FWidgetTransform CardTransform;
137 CardTransform.Scale = CurrentScale;
138 CardTransform.Shear = CurrentShear;
139 CardTransform.Angle = CurrentAngle;
140
141 SetRenderTransform(CardTransform);
142}
float IdleSwaySpeed
Definition CardWidget.h:117
float TransformInterpSpeed
Definition CardWidget.h:121
FVector2D CurrentScale
Definition CardWidget.h:141
float MaxTiltAngle
Definition CardWidget.h:106
float IdleSwayAngle
Definition CardWidget.h:114
float MaxShearAngle
Definition CardWidget.h:110
float HoverScale
Definition CardWidget.h:102
FVector2D CurrentShear
Definition CardWidget.h:142
float CurrentAngle
Definition CardWidget.h:143
이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ bHovered

uint8 UCardWidget::bHovered
protected

◆ CardTagClass

TSubclassOf<UCardTagWidget> UCardWidget::CardTagClass
protected

◆ CardTags

TObjectPtr<UWrapBox> UCardWidget::CardTags
protected

◆ CurrentAngle

float UCardWidget::CurrentAngle = 0.0f
protected

◆ CurrentScale

FVector2D UCardWidget::CurrentScale = FVector2D::UnitVector
protected

◆ CurrentShear

FVector2D UCardWidget::CurrentShear = FVector2D::ZeroVector
protected

◆ CursorOffset

FVector2D UCardWidget::CursorOffset = FVector2D::ZeroVector
protected

◆ HoverScale

float UCardWidget::HoverScale = 1.08f
protected

◆ IconTexture

TObjectPtr<UTexture2D> UCardWidget::IconTexture
protected

◆ IdleSwayAngle

float UCardWidget::IdleSwayAngle = 1.5f
protected

◆ IdleSwaySpeed

float UCardWidget::IdleSwaySpeed = 2.5f
protected

◆ MaxShearAngle

float UCardWidget::MaxShearAngle = 4.0f
protected

◆ MaxTiltAngle

float UCardWidget::MaxTiltAngle = 6.0f
protected

◆ OnCardChosen

FOnSituationCardChosen UCardWidget::OnCardChosen

◆ Situation

TObjectPtr<USituationBase> UCardWidget::Situation
protected

◆ SituationDescriptionText

TObjectPtr<UTextBlock> UCardWidget::SituationDescriptionText
protected

◆ SituationIcon

TObjectPtr<UImage> UCardWidget::SituationIcon
protected

◆ SituationIllustration

TObjectPtr<UImage> UCardWidget::SituationIllustration
protected

◆ SituationNameText

TObjectPtr<UTextBlock> UCardWidget::SituationNameText
protected

◆ SwayTime

float UCardWidget::SwayTime = 0.0f
protected

◆ TransformInterpSpeed

float UCardWidget::TransformInterpSpeed = 12.0f
protected

이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: