国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當前位置: 首頁 > news >正文

武漢做網(wǎng)站制作google網(wǎng)頁版入口

武漢做網(wǎng)站制作,google網(wǎng)頁版入口,河南鄭州做網(wǎng)站漢獅,溫州網(wǎng)頁制作人才招聘目錄 游戲類 三種時間函數(shù)類型函數(shù)和提示類型 FName、FString、FText類型相互轉化 數(shù)組容器 鍵值容器 集合容器 基本類型打印 UPROPERTY宏 函數(shù) 枚舉 法1 法2 結構體 其他 藍圖生成時暴露 游戲類 1.創(chuàng)建所需項的類 2.創(chuàng)建游戲模式類,在該類上實現(xiàn)所需…

目錄

游戲類

三種時間函數(shù)類型函數(shù)和提示類型

FName、FString、FText類型相互轉化

數(shù)組容器

鍵值容器

集合容器

基本類型打印

UPROPERTY宏

函數(shù)

枚舉?

法1

?法2

?結構體

其他

藍圖生成時暴露


游戲類

1.創(chuàng)建所需項的類

2.創(chuàng)建游戲模式類,在該類上實現(xiàn)所需項,引入頭文件和構造函數(shù)時實例化


三種時間函數(shù)類型函數(shù)和提示類型


FName、FString、FText類型相互轉化

?FName用FName

FString用ToString()

FText用FText::FromString、FromName

//轉化
FString MyString = TEXT("I am String");
FName MyName = FName("I am Name");
FString x = TEXT("I am a FString");
FText MyText = FText::FromString(x);//FString-》FName
FName fName = FName(*MyString);//將string解引用為字符數(shù)組?
//FText->FName
fName = FName(*(MyText.ToString()));//FName->FString
FString fString = fName.ToString();
//FText->Fstring
fString = MyText.ToString();//FString-》FText
FText fText = FText::FromString(MyString);
//FName->FText
fText = FText::FromName(MyName);

數(shù)組容器

	TArray<int>arr;
//增arr.Add(10);arr.Add(25);arr.Add(40);arr.Add(60);arr.AddUnique(35);arr.AddUnique(40);printArr();//刪arr.Remove(10);//移除10元素arr.RemoveSingle(40);//移除第一個40arr.RemoveAt(1);//移除第一個arr.Empty();//移除所有元素arr.Reset();//全部為0printArr();//改arr.Insert(80, 0);//在index處插入,原元素后移int& b = arr[0];b = 24;printArr();//查arr.Contains(10);//是否包含arr.Find(24);//是否包含,是返回index,不是返回-1arr.FindLast(24);
void ASGameMode::printArr() {for (auto It= arr.CreateConstIterator();It;It++){UE_LOG(LogTemp,Warning,TEXT("%d"),*It);GEngine->AddOnScreenDebugMessage(-1, 5.F, FColor::Blue, FString::Printf (TEXT("%d"),*It));}
}

鍵值容器

TMap<int, int>map;
	map.Emplace(0, 1);map.Emplace(1, 3);map.Emplace(2, 5);//刪map.Remove(1);//按Key刪除map.Empty();//查找map.Contains(2);//按key查找int* isFind= map.Find(5);//找5,返回指針const int*isFindKey= map.FindKey(2);//值找鍵//獲取查找TArray<int>arrkey;TArray<int>arrayVal;map.GenerateKeyArray(arrkey);map.GenerateValueArray(arrayVal);
void ASGameMode::printmap()
{for (auto& TestMap:map) {GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT("key:%d,Value:%d"), TestMap.Key,TestMap.Value));UE_LOG(LogTemp,Display,TEXT("key:%d,Value:%d"), TestMap.Key, TestMap.Value);}
}

集合容器

TSet<FString>FruitSet;
//增
FruitSet.Add(TEXT("Apple"));
FruitSet.Add(TEXT("Orange"));
FruitSet.Add(TEXT("Banana"));
FruitSet.Emplace("Purple");//比add好,在插入集合時,避免創(chuàng)建臨時文件
PrintFruit();
TSet<FString> TestSet2;
TestSet2.Emplace(TEXT("aaa"));
TestSet2.Emplace(TEXT("bbb"));
TestSet2.Emplace(TEXT("ccc"));
FruitSet.Append(TestSet2);
PrintFruit();
FruitSet.Remove(TEXT("aaa"));
FruitSet.Reset();
FruitSet.Empty();
PrintFruit();
int32 len=FruitSet.Num();
bool isFind=FruitSet.Contains(TEXT("bbb"));
FString* isFind2=FruitSet.Find(TEXT("ccc"));TArray<FString> FruitArr = FruitSet.Array();TSet<FString>TS2 = { TEXT("a"),TEXT("aa") ,TEXT("aaa") ,TEXT("aaaa") };
//長度排序
TS2.Sort([](FString A, FString B){return A.Len() > B.Len(); });
void ASGameMode::PrintFruit()
{for (auto& TestSet : FruitSet) {GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT("%s"),* TestSet));UE_LOG(LogTemp, Display, TEXT("%s"), *TestSet);}
}

TSet<FString>MySet;
MySet.Add(TEXT("abc"));
FSetElementId index = MySet.Add(TEXT("bbc"));
MySet[index] = TEXT("abd");//預留內(nèi)存
TSet<FString> NewSet2;
NewSet2.Reserve(10);for (int32 i=0;i<10;i++)
{NewSet2.Add(FString::Printf(TEXT("No:%d"), i));
}
for (int32 i=0;i<10;i+=2)
{NewSet2.Remove(FSetElementId::FromInteger(i));
}
NewSet2.Shrink();//刪除末端空白元素
NewSet2.Compact();//刪除空白元素

基本類型打印

	int32 myInt = 10;float myFloat = 5.f;bool myBool = true;char myChar = 'c';FString myString = TEXT("xxx");FVector myVector = FVector(1,1,1);UE_LOG(LogTemp,Display,TEXT("%d,%f,%d,%c,%s,%s"), myInt, myFloat, myBool, myChar, *myString, *myVector.ToString());

UPROPERTY宏

	//在哪些地方可見
UPROPERTY(VisibleAnywhere)int32 Int32_VisibleAnywhere;
UPROPERTY(VisibleDefaultsOnly)int32 Int32_VisibleDefaultsOnly;
UPROPERTY(VisibleInstanceOnly)int32 Int32_VisibleInstanceOnly;//在哪些地方可編輯
UPROPERTY(EditDefaultsOnly)FVector V3_EditDefaultsOnly;
UPROPERTY(EditAnywhere)FVector V3_EditAnywhere;
UPROPERTY(EditInstanceOnly)FVector V3_EditInstanceOnly;//在藍圖中可get和getset
UPROPERTY(EditAnywhere,BlueprintReadOnly)int32 int32_EditAnywhere_BlueprintReadOnly;
UPROPERTY(EditAnywhere,BlueprintReadWrite)int32 int32_EditAnywhere_BlueprintReadWrite;//目錄
UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyIntValue")int32 valueB1;//子目錄
UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyIntValue|MySubIntValue")int32 ValueB2;//起別名
UPROPERTY(EditAnywhere,BlueprintReadWrite,meta=(DisplayName="displayName"))int32 ValueB3;//條件控制編輯,上者影響下者是否能修改
UPROPERTY(EditAnywhere,BlueprintReadWrite,meta=(DisplayName="Controller"))bool isController;
UPROPERTY(EditAnywhere,BlueprintReadOnly,meta=(EditCondition="isController"))float ValueB4;//變量提示
UPROPERTY(EditAnywhere,BlueprintReadOnly,meta=(ToolTip="isControllerTrue"))
bool isTrue;

函數(shù)

//暴露在藍圖,可調(diào)用
UFUNCTION(BlueprintCallable,category="MyFunction")
void PrintF1();
//純虛函數(shù),僅返回值
UFUNCTION(BlueprintCallable,BlueprintPure,category="MyFunction")
bool PrintF2();//不能定義(CPP不實現(xiàn)),只能重載
//無返回值的是事件、有返回值的是函數(shù)
UFUNCTION(BlueprintImplementableEvent)
void Test1();
UFUNCTION(BlueprintImplementableEvent)
int Test2();
UFUNCTION(BlueprintImplementableEvent)
void Test3(const FString &MyString);
UFUNCTION(BlueprintImplementableEvent)
int Test4(const FString& MyString);//在C++中聲明藍圖重載或不重載
//有連線-用連線的方法(重載),否則用CPP寫好的方法(不重載)
UFUNCTION(BlueprintNativeEvent)void TestA();
UFUNCTION(BlueprintNativeEvent)int TestB();
UFUNCTION(BlueprintNativeEvent)void TestC(const FString& MyString);
UFUNCTION(BlueprintNativeEvent)
int TestD(const FString& MyString);//起別名
UFUNCTION(BlueprintCallable,Category="MyFunction",meta=(Display="MyPrintTest"))void Printtest();

重載不重載那個要加_implementation


void AMyPawn::TestA_Implementation()
{
}void AMyPawn::TestB_Implementation()
{
}void AMyPawn::TestC_Implementation(const FString& MyString)
{UE_LOG(LogTemp, Display, TEXT("%s"), *MyString);
}void AMyPawn::TestD_Implementation(const FString& MyString)
{
}

枚舉?

位置同UCLASS

法1

UENUM(BlueprintType)
namespace MyEnumType 
{enum MyCustomEnum {type1,type2,type3};
}
	UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyEnum")TEnumAsByte<MyEnumType::MyCustomEnum> MyCustomEnumInst;

?法2


UENUM(BlueprintType)
enum class MyCustomEnum2 :uint8
{a UMETA(DisplayName="type1"),b UMETA(DisplayName="type2"),c UMETA(DisplayName="type3")
};
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyCustomStruct")MyCustomEnum2 myCustomStruct;

??

?結構體

//命名必須以F開頭
USTRUCT(BlueprintType)//作為藍圖類型,可被藍圖調(diào)用
struct FMyStruct
{GENERATED_USTRUCT_BODY()UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyTestStruct")int32 Health;UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyTestStruct")FString MyName;
};
	//結構體UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyCustomStruct")FMyStruct myCustomStruct;

其他

藍圖生成時暴露

	//藍圖生成時暴露UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="MyExposeOnSpawn",meta=(ExposeOnSpawn="ExposeOnSpawnValue"))float Health;

http://m.aloenet.com.cn/news/29587.html

相關文章:

  • 深圳的網(wǎng)站建設公司官網(wǎng)seo公司推薦
  • 做信息網(wǎng)站能掙錢嗎360投放廣告怎么收費
  • wordpress手機版美女東莞seo外包公司
  • 襄陽市做網(wǎng)站 優(yōu)幫云長尾詞挖掘工具
  • 佛山網(wǎng)站建設模板建站b2b電子商務平臺網(wǎng)站
  • 做財經(jīng)直播網(wǎng)站商業(yè)軟文案例
  • 購物網(wǎng)站的英文app推廣接單渠道
  • 自己建個網(wǎng)站做優(yōu)化百度云盤資源搜索
  • 電子商城網(wǎng)站開發(fā)品牌推廣的三個階段
  • 網(wǎng)站開發(fā)及維護合同網(wǎng)站免費制作
  • 女生學電子商務專業(yè)好嗎seo推廣排名公司
  • 西安做行業(yè)平臺網(wǎng)站的公司重慶百度快照優(yōu)化
  • wordpress 目錄安全seo教學培訓
  • 北海教網(wǎng)站建設全網(wǎng)營銷整合營銷
  • 免費空間網(wǎng)站怎么做出來的上海關鍵詞自動排名
  • wordpress 已登錄用戶登錄seo是指搜索引擎優(yōu)化
  • 甘肅最新消息今天seo優(yōu)化顧問
  • 設計案例分享網(wǎng)站搜索引擎優(yōu)化包括哪些內(nèi)容
  • h5移動端網(wǎng)站開發(fā)最有效的宣傳方式
  • 新開傳奇網(wǎng)站999新服網(wǎng)百度正版下載恢復百度
  • 美國做ppt的網(wǎng)站百度競價排名榜
  • 貴州專業(yè)網(wǎng)站建設公司哪家好湖南seo優(yōu)化哪家好
  • 新疆建網(wǎng)站程序站外推廣
  • 正規(guī)網(wǎng)店代運營公司seo每日
  • 豆瓣網(wǎng)站模板滕州今日頭條新聞
  • 自己的電腦做網(wǎng)站服務器seo的五個步驟
  • 找人做網(wǎng)站協(xié)議網(wǎng)站在線優(yōu)化檢測
  • 專業(yè)網(wǎng)站優(yōu)化外包百度seo推廣計劃類型包括
  • 怎么學做淘寶電商網(wǎng)站嗎關鍵詞搜索排行榜
  • html5 公眾號 網(wǎng)站開發(fā)百度seo優(yōu)化價格