new parallax, cpp lvl manager, tagged trigger etc
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "cppFuncLib.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FcppFuncLibModule"
|
||||
|
||||
void FcppFuncLibModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
|
||||
}
|
||||
|
||||
void FcppFuncLibModule::ShutdownModule()
|
||||
{
|
||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
||||
// we call this function before unloading the module.
|
||||
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FcppFuncLibModule, cppFuncLib)
|
||||
@@ -0,0 +1,110 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "cppFuncLibBPLibrary.h"
|
||||
#include "cppFuncLib.h"
|
||||
|
||||
UcppFuncLibBPLibrary::UcppFuncLibBPLibrary(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*for working tarray::Contains*/
|
||||
|
||||
//bool operator==(const Fcppcoords& c1, const Fcppcoords& c2) {
|
||||
// return c1.flat == c2.flat &&
|
||||
// c1.floor == c2.floor &&
|
||||
// c1.house == c2.house &&
|
||||
// c1.section == c2.section &&
|
||||
// c1.type == c2.type &&
|
||||
// c1.zone == c2.zone;
|
||||
//}
|
||||
|
||||
|
||||
TArray<FString> UcppFuncLibBPLibrary::cppUniversalParser(FString string, TArray<FString> keys, FString delimiter, bool caseSensitive)
|
||||
{
|
||||
TArray<FString> arr;
|
||||
TArray<FString> out;
|
||||
out.SetNum(keys.Num());
|
||||
|
||||
string.ParseIntoArray(arr, *delimiter, false);
|
||||
for (const auto& str : arr) {
|
||||
int n = 0;
|
||||
for (const auto& str1 : keys) {
|
||||
if (str1.IsEmpty()) continue;
|
||||
FString left_;
|
||||
FString right_;
|
||||
if (str.Split(str1, &left_, &right_, caseSensitive ? ESearchCase::CaseSensitive : ESearchCase::IgnoreCase)) {
|
||||
|
||||
if (out[n].IsEmpty()) out[n] = right_;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
FString UcppFuncLibBPLibrary::cppIntToStrPad(int32 int_, int32 minDigits)
|
||||
{
|
||||
FString temp = FString::FromInt(int_);
|
||||
for (int32 i = temp.Len(); i < minDigits; i++) {
|
||||
temp = FString("0") + temp;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
TSoftObjectPtr<UTexture2D> UcppFuncLibBPLibrary::castSoftTex2D(TSoftObjectPtr<UObject> ptr)
|
||||
{
|
||||
return TSoftObjectPtr<UTexture2D>(ptr.ToSoftObjectPath());//somewhy cant construct from another <T> and cant cast
|
||||
}
|
||||
|
||||
void UcppFuncLibBPLibrary::getMinMaxInRange(TArray<int32> array_, int32 min, int32 max, int32& minId, int32& maxId)
|
||||
{
|
||||
if (min > max) return;
|
||||
int32 minv = array_[min];
|
||||
int32 maxv = minv;
|
||||
|
||||
int32 mini = min;
|
||||
int32 maxi = mini;
|
||||
for (int32 i = 0; i < array_.Num(); i++) {
|
||||
if ((min <= i) && (i <= max)) {
|
||||
if (array_[i] < minv) {
|
||||
minv = array_[i];
|
||||
mini = i;
|
||||
}
|
||||
else if (array_[i] > maxv) {
|
||||
maxv = array_[i];
|
||||
maxi = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
minId = mini;
|
||||
maxId = maxi;
|
||||
return;
|
||||
}
|
||||
|
||||
void UcppFuncLibBPLibrary::getMinMaxInRangeF(TArray<float> array_, int32 min, int32 max, int32& minId, int32& maxId)
|
||||
{
|
||||
if (min > max) return;
|
||||
int32 minv = array_[min];
|
||||
int32 maxv = minv;
|
||||
|
||||
int32 mini = min;
|
||||
int32 maxi = mini;
|
||||
for (int32 i = 0; i < array_.Num(); i++) {
|
||||
if ((min <= i) && (i <= max)) {
|
||||
if (array_[i] < minv) {
|
||||
minv = array_[i];
|
||||
mini = i;
|
||||
}
|
||||
else if (array_[i] > maxv) {
|
||||
maxv = array_[i];
|
||||
maxi = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
minId = mini;
|
||||
maxId = maxi;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user