KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UCommonFunctionLibrary 클래스 참조

#include <UCommonFunctionLibrary.h>

+ UCommonFunctionLibrary에 대한 상속 다이어그램 :
+ UCommonFunctionLibrary에 대한 협력 다이어그램:

정적 Public 멤버 함수

static FString GererateMD5 (const FString &InText)
 
static float GetDistance (AActor *A, AActor *B)
 두 액터 사이의 거리를 계산한다.
 
static int64 GetNowTimestamp ()
 현재 시간을 Unix Timestamp(초)로 반환한다.
 
static class UMaterialInstanceDynamic * GetOrCreateMID (class UPrimitiveComponent *Target, int32 ElementIndex, FName OptionalName=NAME_None)
 머티리얼 인스턴스 다이내믹을 얻거나 새로 생성한다.
 
static int32 GetRandomIndex (const TArray< int32 > &TargetArray, bool &bIsValid)
 정수 배열에서 랜덤 인덱스를 선택한다.
 
static UAnimMontage * GetRandomMontage (const TArray< UAnimMontage * > &Montages)
 몽타주 배열에서 랜덤 항목을 반환한다.
 
static bool InBounds (const int32 Index, const int32 Count)
 주어진 인덱스가 배열 범위 안에 있는지 확인한다.
 
static bool IsValidKoreanWord (const FString &Word)
 한국어 단어 검증 (한글만 포함되어 있는지 확인)
 
static void PlayLocationSound (const AActor *Actor, USoundBase *Sound, const float RetriggerDelay)
 지정된 위치에서 사운드를 재생한다.
 
static FString RemoveLineBreaks (const FString &InText)
 줄바꿈 문자들을 모두 공백으로 치환한 문자열을 반환
 
static void SetCollisionDebugVisible (UPrimitiveComponent *Target, bool bVisible)
 

상세한 설명

UCommonFunctionLibrary.h 파일의 11 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ GererateMD5()

FString UCommonFunctionLibrary::GererateMD5 ( const FString &  InText)
static

UCommonFunctionLibrary.cpp 파일의 56 번째 라인에서 정의되었습니다.

57{
58 FTCHARToUTF8 UTF8Text(*InText);
59
60 uint8 Digest[16];
61 FMD5 Md5;
62 Md5.Update((uint8*)UTF8Text.Get(), UTF8Text.Length());
63 Md5.Final(Digest);
64
65 FString HashString;
66 for (uint8 B : Digest)
67 HashString += FString::Printf(TEXT("%02x"), B);
68 return HashString;
69}

다음에 의해서 참조됨 : UVoiceCacheManager::GenerateCacheFileName(), APopupTesterActor::GererateMD5().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetDistance()

float UCommonFunctionLibrary::GetDistance ( AActor *  A,
AActor *  B 
)
static

두 액터 사이의 거리를 계산한다.

UCommonFunctionLibrary.cpp 파일의 153 번째 라인에서 정의되었습니다.

154{
155 if ( !IsValid(A) || !IsValid(B) )
156 return 0;
157
158 return UKismetMathLibrary::Vector_Distance( A->GetActorLocation(), B->GetActorLocation() );
159}

◆ GetNowTimestamp()

int64 UCommonFunctionLibrary::GetNowTimestamp ( )
static

현재 시간을 Unix Timestamp(초)로 반환한다.

UCommonFunctionLibrary.cpp 파일의 97 번째 라인에서 정의되었습니다.

98{
99 const auto DataTime = FDateTime::UtcNow();
100 return DataTime.ToUnixTimestamp();
101}

◆ GetOrCreateMID()

UMaterialInstanceDynamic * UCommonFunctionLibrary::GetOrCreateMID ( class UPrimitiveComponent *  Target,
int32  ElementIndex,
FName  OptionalName = NAME_None 
)
static

머티리얼 인스턴스 다이내믹을 얻거나 새로 생성한다.

UCommonFunctionLibrary.cpp 파일의 103 번째 라인에서 정의되었습니다.

105{
106 if (!Target)
107 return nullptr;
108
109 const int32 Num = Target->GetNumMaterials();
110 if (ElementIndex < 0 || ElementIndex >= Num)
111 return nullptr;
112
113 UMaterialInterface* CurMat = Target->GetMaterial(ElementIndex);
114 if (!CurMat)
115 return nullptr;
116
117 if (UMaterialInstanceDynamic* AsMID = Cast<UMaterialInstanceDynamic>(CurMat))
118 return AsMID;
119
120 UMaterialInstanceDynamic* NewMID = UMaterialInstanceDynamic::Create(CurMat, Target, OptionalName);
121 if (NewMID)
122 Target->SetMaterial(ElementIndex, NewMID);
123
124 return NewMID;
125}

◆ GetRandomIndex()

int32 UCommonFunctionLibrary::GetRandomIndex ( const TArray< int32 > &  TargetArray,
bool &  bIsValid 
)
static

정수 배열에서 랜덤 인덱스를 선택한다.

UCommonFunctionLibrary.cpp 파일의 76 번째 라인에서 정의되었습니다.

77{
78 if (TargetArray.Num() == 0)
79 {
80 bIsValid = false;
81 return INDEX_NONE;
82 }
83 bIsValid = true;
84 return TargetArray[FMath::RandRange(0, TargetArray.Num() - 1)];
85}

◆ GetRandomMontage()

UAnimMontage * UCommonFunctionLibrary::GetRandomMontage ( const TArray< UAnimMontage * > &  Montages)
static

몽타주 배열에서 랜덤 항목을 반환한다.

UCommonFunctionLibrary.cpp 파일의 87 번째 라인에서 정의되었습니다.

88{
89 const int32 Num = Montages.Num();
90 if (Num <= 0)
91 return nullptr;
92
93 const int32 Idx = FMath::RandRange(0, Num - 1);
94 return Montages[Idx];
95}

◆ InBounds()

bool UCommonFunctionLibrary::InBounds ( const int32  Index,
const int32  Count 
)
static

주어진 인덱스가 배열 범위 안에 있는지 확인한다.

UCommonFunctionLibrary.cpp 파일의 71 번째 라인에서 정의되었습니다.

72{
73 return (Index >= 0) && (Index < Count);
74}

◆ IsValidKoreanWord()

bool UCommonFunctionLibrary::IsValidKoreanWord ( const FString &  Word)
static

한국어 단어 검증 (한글만 포함되어 있는지 확인)

UCommonFunctionLibrary.cpp 파일의 179 번째 라인에서 정의되었습니다.

180{
181 if (Word.IsEmpty())
182 return false;
183
184 // 한글 유니코드 범위 체크
185 // - 완성형 한글: AC00-D7A3 (가-힣)
186 // - 한글 자음/모음: 1100-11FF, 3130-318F
187 for (const TCHAR& Char : Word)
188 {
189 // 완성형 한글 (가-힣)
190 if (Char >= 0xAC00 && Char <= 0xD7A3)
191 continue;
192
193 // 한글 자음/모음
194 if ((Char >= 0x1100 && Char <= 0x11FF) || (Char >= 0x3130 && Char <= 0x318F))
195 continue;
196
197 // 공백 허용
198 if (Char == TEXT(' '))
199 continue;
200
201 // 한글이 아닌 문자 발견
202 return false;
203 }
204
205 return true;
206}

다음에 의해서 참조됨 : UChatInputBox::OnDailyAnswerReceived(), ADailyKiosk::OnResponseDailyQuestion().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ PlayLocationSound()

void UCommonFunctionLibrary::PlayLocationSound ( const AActor *  Actor,
USoundBase *  Sound,
const float  RetriggerDelay 
)
static

지정된 위치에서 사운드를 재생한다.

UCommonFunctionLibrary.cpp 파일의 127 번째 라인에서 정의되었습니다.

128{
129 if (!IsValid(Actor) || !Sound)
130 return;
131
132 if (auto World = Actor->GetWorld())
133 {
134 if ( RetriggerDelay > 0.0f)
135 {
136 TWeakObjectPtr<const AActor> WeakActor = Actor;
137 FTimerHandle TimerHandle;
138 World->GetTimerManager().SetTimer(TimerHandle, [WeakActor, Sound]()
139 {
140 if (WeakActor.IsValid())
141 {
142 UGameplayStatics::PlaySoundAtLocation(WeakActor.Get(), Sound, WeakActor->GetActorLocation());
143 }
144 }, RetriggerDelay, false);
145 }
146 else
147 {
148 UGameplayStatics::PlaySoundAtLocation(Actor, Sound, Actor->GetActorLocation());
149 }
150 }
151}

◆ RemoveLineBreaks()

FString UCommonFunctionLibrary::RemoveLineBreaks ( const FString &  InText)
static

줄바꿈 문자들을 모두 공백으로 치환한 문자열을 반환

UCommonFunctionLibrary.cpp 파일의 161 번째 라인에서 정의되었습니다.

162{
163 FString CleanedText = InText;
164 CleanedText.ReplaceInline(TEXT("\r\n"), TEXT(""));
165 CleanedText.ReplaceInline(TEXT("\r"), TEXT(""));
166 CleanedText.ReplaceInline(TEXT("\n"), TEXT(""));
167 return CleanedText;
168}

◆ SetCollisionDebugVisible()

void UCommonFunctionLibrary::SetCollisionDebugVisible ( UPrimitiveComponent *  Target,
bool  bVisible 
)
static

UCommonFunctionLibrary.cpp 파일의 170 번째 라인에서 정의되었습니다.

171{
172 if (!Target)
173 return;
174
175 Target->SetHiddenInGame(!bVisible);
176 Target->SetVisibility(bVisible);
177}

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