移除slua插件,升级UE5.6 #11
This commit is contained in:
		| @ -9,7 +9,7 @@ public class BusyRabbitTarget : TargetRules | ||||
| 	{ | ||||
| 		Type = TargetType.Game; | ||||
| 		DefaultBuildSettings = BuildSettingsVersion.V5; | ||||
| 		IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_4; | ||||
| 		IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_6; | ||||
| 		ExtraModuleNames.Add("BusyRabbit"); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -4,76 +4,12 @@ | ||||
| #include "BusyGameInstance.h" | ||||
| #include "Misc/FileHelper.h" | ||||
| #include "Misc/CoreDelegates.h" | ||||
| #include "LuaCppBinding.h" | ||||
| #include "GameplayTagsManager.h" | ||||
|  | ||||
| extern void RegisterDataTableExtension(); | ||||
|  | ||||
|  | ||||
| static uint8* ReadFile(IPlatformFile& PlatformFile, FString path, uint32& len) { | ||||
| 	IFileHandle* FileHandle = PlatformFile.OpenRead(*path); | ||||
| 	if (FileHandle) { | ||||
| 		len = (uint32)FileHandle->Size(); | ||||
| 		uint8* buf = new uint8[len]; | ||||
| 		FileHandle->Read(buf, len); | ||||
| 		delete FileHandle; | ||||
| 		return buf; | ||||
| 	} | ||||
| 	return nullptr; | ||||
| } | ||||
|  | ||||
| static int32 PrintLog(NS_SLUA::lua_State* L) | ||||
| { | ||||
| 	FString str; | ||||
| 	size_t len; | ||||
| 	const char* s = luaL_tolstring(L, 1, &len); | ||||
| 	if (s) str += UTF8_TO_TCHAR(s); | ||||
| 	NS_SLUA::Log::Log("PrintLog %s", TCHAR_TO_UTF8(*str)); | ||||
| 	return 0; | ||||
| UBusyGameInstance::UBusyGameInstance(){ | ||||
| } | ||||
|  | ||||
|  | ||||
| UBusyGameInstance::UBusyGameInstance(): state(nullptr){ | ||||
| 	CreateLuaState(); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UBusyGameInstance::CreateLuaState() { | ||||
| 	NS_SLUA::LuaState::onInitEvent.AddUObject(this, &UBusyGameInstance::LuaStateInitCallback); | ||||
|  | ||||
| 	CloseLuaState(); | ||||
| 	state = new NS_SLUA::LuaState("SLuaMainState", this); | ||||
| 	state->setLoadFileDelegate([](const char* fn, FString& filepath)->TArray<uint8> { | ||||
|  | ||||
| 		IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); | ||||
| 		FString path = FPaths::ProjectContentDir(); | ||||
| 		FString filename = UTF8_TO_TCHAR(fn); | ||||
| 		path /= "Lua"; | ||||
| 		path /= filename.Replace(TEXT("."), TEXT("/")); | ||||
|  | ||||
| 		TArray<uint8> Content; | ||||
| 		TArray<FString> luaExts = { UTF8_TO_TCHAR(".lua"), UTF8_TO_TCHAR(".luac") }; | ||||
| 		for (auto& it : luaExts) { | ||||
| 			auto fullPath = path + *it; | ||||
|  | ||||
| 			FFileHelper::LoadFileToArray(Content, *fullPath); | ||||
| 			if (Content.Num() > 0) { | ||||
| 				filepath = fullPath; | ||||
| 				return MoveTemp(Content); | ||||
| 			} | ||||
| 		} | ||||
| 		return MoveTemp(Content); | ||||
| 	}); | ||||
| 	state->init(); | ||||
| } | ||||
|  | ||||
| void UBusyGameInstance::CloseLuaState() { | ||||
| 	if (state) { | ||||
| 		state->close(); | ||||
| 		delete state; | ||||
| 		state = nullptr; | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| void UBusyGameInstance::Init(){ | ||||
| @ -83,23 +19,10 @@ void UBusyGameInstance::Init(){ | ||||
|  | ||||
|  | ||||
| void UBusyGameInstance::Shutdown() { | ||||
| 	CloseLuaState(); | ||||
| 	FCoreDelegates::OnEndFrame.RemoveAll(this); | ||||
| 	Super::Shutdown(); | ||||
| } | ||||
|  | ||||
| void UBusyGameInstance::LuaStateInitCallback(NS_SLUA::lua_State* L) { | ||||
| 	using namespace slua; | ||||
| 	lua_pushcfunction(L, PrintLog); | ||||
| 	lua_setglobal(L, "PrintLog"); | ||||
|  | ||||
| 	LuaGameInstance = state->doFile("GameInstance"); | ||||
| 	LuaGameInstance.getFromTable("OnEndFrame", OnLuaEndFrame); | ||||
|  | ||||
| 	// 注册拓展 | ||||
| 	RegisterDataTableExtension(); | ||||
| } | ||||
|  | ||||
| void UBusyGameInstance::OnEndFrame(){ | ||||
| 	OnLuaEndFrame.call(); | ||||
| void UBusyGameInstance::OnEndFrame() | ||||
| { | ||||
| } | ||||
|  | ||||
| @ -4,7 +4,6 @@ | ||||
| #include "Math/UnrealMathUtility.h" | ||||
|  | ||||
| UInventoryComponent::UInventoryComponent() : Capacity(20) { | ||||
| 	LuaFilePath = TEXT("GamePlay.Components.InventoryComponent"); | ||||
| } | ||||
|  | ||||
| bool UInventoryComponent::DepositItems(int32 ItemID, int32 ItemCnt) { | ||||
| @ -27,7 +26,7 @@ bool UInventoryComponent::DepositItems(int32 ItemID, int32 ItemCnt) { | ||||
| 		RemainItemCnt -= AddCount; | ||||
| 	} | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>䶯<EFBFBD>¼<EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>䶯<EFBFBD>¼<EFBFBD> | ||||
| 	OnInventoryChanged.Broadcast(ItemID); | ||||
| 	return true; | ||||
| } | ||||
| @ -42,7 +41,7 @@ bool UInventoryComponent::WithdrawItems(int32 ItemID, int32 ItemCnt) { | ||||
| 	} | ||||
|  | ||||
| 	int32 RemainToWithdraw = ItemCnt; | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><EFBFBD><EFBFBD>⣩ | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><E4BBAF><EFBFBD>⣩ | ||||
| 	for (int32 i = InventoryList.Num() - 1; i >= 0 && RemainToWithdraw > 0; --i) { | ||||
| 		FInventoryGrid& Grid = InventoryList[i]; | ||||
| 		if (Grid.ItemID == ItemID) { | ||||
| @ -52,7 +51,7 @@ bool UInventoryComponent::WithdrawItems(int32 ItemID, int32 ItemCnt) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>䶯<EFBFBD>¼<EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>䶯<EFBFBD>¼<EFBFBD> | ||||
| 	OnInventoryChanged.Broadcast(ItemID); | ||||
| 	return true; | ||||
| } | ||||
| @ -73,15 +72,15 @@ bool UInventoryComponent::ConsumeItems(int32 Index, int32 ItemCnt) { | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| 	// <20>ȿ۳<C8BF>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ʒ | ||||
| 	// <20>ȿ۳<C8BF>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ʒ | ||||
| 	int32 RemoveFromSpecified = FMath::Min(ItemCnt, SpecifiedGrid.CurrentCount); | ||||
| 	SpecifiedGrid.CurrentCount -= RemoveFromSpecified; | ||||
| 	int32 RemainToConsume = ItemCnt - RemoveFromSpecified; | ||||
|  | ||||
| 	// <20>ٿ۳<D9BF><DBB3><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ʒ | ||||
| 	// <20>ٿ۳<D9BF><DBB3><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ʒ | ||||
| 	if (RemainToConsume > 0) { | ||||
| 		for (int32 i = InventoryList.Num() - 1; i >= 0 && RemainToConsume > 0; --i) { | ||||
| 			if (i == Index) continue; // <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB> | ||||
| 			if (i == Index) continue; // <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB> | ||||
|  | ||||
| 			FInventoryGrid& Grid = InventoryList[i]; | ||||
| 			if (Grid.ItemID == ItemID) { | ||||
| @ -92,7 +91,7 @@ bool UInventoryComponent::ConsumeItems(int32 Index, int32 ItemCnt) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>䶯<EFBFBD>¼<EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>䶯<EFBFBD>¼<EFBFBD> | ||||
| 	OnInventoryChanged.Broadcast(ItemID); | ||||
| 	return true; | ||||
| } | ||||
| @ -101,22 +100,22 @@ void UInventoryComponent::SetInventoryCapacity(int MaxCapacity) { | ||||
| 	int32 NewCapacity = FMath::Max(0, MaxCapacity); | ||||
| 	if (Capacity != NewCapacity) { | ||||
| 		Capacity = NewCapacity; | ||||
| 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD>¼<EFBFBD> | ||||
| 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD>¼<EFBFBD> | ||||
| 		OnInventoryCapacityChanged.Broadcast(); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void UInventoryComponent::ReSortAllItem() { | ||||
| 	// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA>ĸ<EFBFBD><C4B8><EFBFBD> | ||||
| 	// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA>ĸ<EFBFBD><C4B8><EFBFBD> | ||||
| 	for (int32 i = InventoryList.Num() - 1; i >= 0; --i) { | ||||
| 		if (InventoryList[i].CurrentCount <= 0) { | ||||
| 			InventoryList.RemoveAt(i); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	InventoryList.Sort([](const FInventoryGrid& A, const FInventoryGrid& B) { | ||||
| 		return A.Priority > B.Priority; // <20><><EFBFBD>ȼ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ | ||||
| 		return A.Priority > B.Priority; // <20><><EFBFBD>ȼ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ǰ | ||||
| 		}); | ||||
| } | ||||
|  | ||||
| @ -127,7 +126,7 @@ bool UInventoryComponent::IsCanContain(int32 ItemID, int32 Count) { | ||||
| 	int32 ExistingSpace = 0; | ||||
| 	int32 ExistingGrids = 0; | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пռ<D0BF> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пռ<D0BF> | ||||
| 	for (const FInventoryGrid& Grid : InventoryList) { | ||||
| 		if (Grid.ItemID == ItemID) { | ||||
| 			ExistingSpace += (Grid.MaxCount - Grid.CurrentCount); | ||||
| @ -143,13 +142,13 @@ bool UInventoryComponent::IsCanContain(int32 ItemID, int32 Count) { | ||||
|  | ||||
| 	int32 NeededSpace = Count - ExistingSpace; | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8>ӿ<EFBFBD><D3BF>ÿռ<C3BF> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8>ӿ<EFBFBD><D3BF>ÿռ<C3BF> | ||||
| 	int32 AvailableGridSlots = Capacity - InventoryList.Num() + EmptySlotCount; | ||||
| 	if (AvailableGridSlots <= 0) { | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| 	// <20><>ȡ<EFBFBD><C8A1>ƷĬ<C6B7>϶ѵ<CFB6><D1B5><EFBFBD>С | ||||
| 	// <20><>ȡ<EFBFBD><C8A1>ƷĬ<C6B7>϶ѵ<CFB6><D1B5><EFBFBD>С | ||||
| 	FInventoryGrid TempGrid; | ||||
| 	TempGrid.ItemID = ItemID; | ||||
| 	InitItemGrid(TempGrid); | ||||
| @ -176,13 +175,13 @@ FInventoryGrid UInventoryComponent::GetGridWithIndex(int32 Index) { | ||||
|  | ||||
| void UInventoryComponent::InitItemGrid_Implementation(FInventoryGrid& Grid) { | ||||
| 	Grid.CurrentCount = 0; | ||||
| 	Grid.MaxCount = 20;		// Ĭ<>϶ѵ<CFB6><D1B5><EFBFBD>С | ||||
| 	Grid.Priority = 1;		// Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD> | ||||
| 	Grid.MaxCount = 20;		// Ĭ<>϶ѵ<CFB6><D1B5><EFBFBD>С | ||||
| 	Grid.Priority = 1;		// Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD> | ||||
| } | ||||
|  | ||||
| void UInventoryComponent::ForEach(const FVisitInventoryGridDelegate& VisitDelegate) { | ||||
| 	for (int32 i = 0; i < InventoryList.Num(); ++i) { | ||||
| 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>CurrentCount <= 0<><30> | ||||
| 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>CurrentCount <= 0<><30> | ||||
| 		if (InventoryList[i].CurrentCount > 0) { | ||||
| 			VisitDelegate.ExecuteIfBound(i, InventoryList[i]); | ||||
| 		} | ||||
| @ -190,7 +189,7 @@ void UInventoryComponent::ForEach(const FVisitInventoryGridDelegate& VisitDelega | ||||
| } | ||||
|  | ||||
| FInventoryGrid& UInventoryComponent::GetOrCreateGrid(int32 ItemID) { | ||||
| 	// <20><><EFBFBD>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD> | ||||
| 	// <20><><EFBFBD>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD> | ||||
| 	for (FInventoryGrid& Grid : InventoryList) { | ||||
| 		if (Grid.ItemID == 0 || Grid.CurrentCount == 0) { | ||||
| 			Grid.ItemID = ItemID; | ||||
| @ -202,9 +201,9 @@ FInventoryGrid& UInventoryComponent::GetOrCreateGrid(int32 ItemID) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	if (InventoryList.Num() >= Capacity) { | ||||
| 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>账<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飩 | ||||
| 		// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>账<EFBFBD><E8B4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飩 | ||||
| 		static FInventoryGrid DummyGrid; | ||||
| 		DummyGrid = FInventoryGrid(); | ||||
| 		InitItemGrid(DummyGrid); | ||||
| @ -212,12 +211,12 @@ FInventoryGrid& UInventoryComponent::GetOrCreateGrid(int32 ItemID) { | ||||
| 		return DummyGrid; | ||||
| 	} | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD> | ||||
| 	FInventoryGrid NewGrid; | ||||
| 	NewGrid.ItemID = ItemID; | ||||
| 	InitItemGrid(NewGrid); | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD>뵽<EFBFBD><EBB5BD>ȷλ<C8B7><CEBB> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD>뵽<EFBFBD><EBB5BD>ȷλ<C8B7><CEBB> | ||||
| 	int32 InsertIndex = 0; | ||||
| 	for (; InsertIndex < InventoryList.Num(); InsertIndex++) { | ||||
| 		if (NewGrid.Priority > InventoryList[InsertIndex].Priority) { | ||||
|  | ||||
| @ -4,13 +4,8 @@ | ||||
| #include "Core/PW_Ability.h" | ||||
|  | ||||
| UPW_Ability::UPW_Ability(){ | ||||
| 	bHasBlueprintActivateFromEvent = true; | ||||
| } | ||||
|  | ||||
| FString UPW_Ability::GetLuaFilePath_Implementation() const{ | ||||
| 	return LuaFilePath; | ||||
| 	 | ||||
| } | ||||
|  | ||||
| void UPW_Ability::ApplyCost( | ||||
| 		const FGameplayAbilitySpecHandle Handle, | ||||
|  | ||||
| @ -1,17 +0,0 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
|  | ||||
| #include "Core/PW_Object.h" | ||||
|  | ||||
| UPW_Object::UPW_Object(){ | ||||
| 	//FString Left, Right; | ||||
| 	//if (this->GetName().Split(TEXT("_"), &Left, &Right)) { | ||||
| 	//	LuaFilePath = Left; | ||||
| 	//}else { | ||||
| 	//	LuaFilePath = this->GetName(); | ||||
| 	//} | ||||
| } | ||||
|  | ||||
| FString UPW_Object::GetLuaFilePath_Implementation() const{ | ||||
| 	return LuaFilePath; | ||||
| } | ||||
| @ -1,33 +0,0 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
|  | ||||
| #include "Core/PW_TimerModule.h" | ||||
|  | ||||
| //int UPW_TimerModule::SetTimer(slua::LuaVar cb){ | ||||
| //    UWorld* World = GetWorld(); | ||||
| //    if (!World) { | ||||
| //        return -1; | ||||
| //    } | ||||
| //    FTimerManager &TimerManager = World->GetTimerManager(); | ||||
| // | ||||
| //    //// <20><><EFBFBD><EFBFBD>ί<EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD>Lambda | ||||
| //    //FTimerDelegate Delegate = FTimerDelegate::CreateLambda( | ||||
| //    //    [this](int32 index) { | ||||
| //    //        UE_LOG(LogTemp, Warning, TEXT("%s"), *Message); | ||||
| //    //    } | ||||
| //    //); | ||||
| // | ||||
| // | ||||
| // | ||||
| //    //// <20><><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD> | ||||
| //    //TimerManager.SetTimer( | ||||
| //    //    TimerHandle, | ||||
| //    //    Delegate, | ||||
| //    //    2.0f, | ||||
| //    //    false, | ||||
| //    //    "Hello from Timer!" // <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>ί<EFBFBD>д<EFBFBD><D0B4><EFBFBD> | ||||
| //    //); | ||||
| // | ||||
| //    //TimerManager.SetTimer() | ||||
| //    //return 0; | ||||
| //} | ||||
| @ -3,130 +3,129 @@ | ||||
|  | ||||
| #include "Core/PW_UserWidget.h" | ||||
| #include "Core/UI/PW_UIHud.h" | ||||
| #include "slua.h" | ||||
| #include "EnhancedInput/Public/EnhancedInputSubsystems.h" | ||||
| #include "EnhancedInput/Public/EnhancedInputComponent.h" | ||||
|  | ||||
| UPW_SimpleWidget::UPW_SimpleWidget():bVisible(true){ | ||||
| 	bVisible = true; | ||||
| 	SetVisibility(ESlateVisibility::SelfHitTestInvisible); | ||||
| } | ||||
|  | ||||
| bool UPW_SimpleWidget::Initialize(){ | ||||
| 	return UUserWidget::Initialize(); | ||||
| } | ||||
|  | ||||
| void UPW_SimpleWidget::SetVisible(bool InVisible){ | ||||
| 	if (bVisible == InVisible) { return; } | ||||
| 	bVisible = InVisible; | ||||
| 	if (bVisible) { | ||||
| 		SetVisibility(ESlateVisibility::SelfHitTestInvisible); | ||||
| 	} | ||||
| 	else { | ||||
| 		SetVisibility(ESlateVisibility::Collapsed); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void UPW_SimpleWidget::BP_SetVisible(bool InVisible){ | ||||
| 	SetVisible(InVisible); | ||||
| } | ||||
|  | ||||
| FLuaWidgetEventHandle UPW_SimpleWidget::BP_BindLuaEvent(const FName& EventName, const FLuaBPVar& InLuaFunction){ | ||||
| 	FLuaWidgetEventHandle Handle; | ||||
| 	if (!InLuaFunction.value.isFunction()) { | ||||
| 		return Handle; | ||||
| 	} | ||||
| 	TMap<int32, slua::LuaVar>& FunctionPool = LuaFuncMappings.FindOrAdd(EventName); | ||||
| 	HandleIndex += 1; | ||||
| 	FunctionPool.Add(HandleIndex, InLuaFunction.value); | ||||
| 	Handle.EventName = EventName; | ||||
| 	Handle.HandleIndex = HandleIndex; | ||||
| 	return Handle; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UPW_SimpleWidget::BP_UnBindLuaEvent(const FLuaWidgetEventHandle &InHandle){ | ||||
| 	TMap<int32, slua::LuaVar>* FunctionPool = LuaFuncMappings.Find(InHandle.EventName); | ||||
| 	if (FunctionPool == nullptr) { | ||||
| 		return; | ||||
| 	} | ||||
| 	FunctionPool->Remove(InHandle.HandleIndex); | ||||
| } | ||||
|  | ||||
| void UPW_SimpleWidget::BP_EmitLuaEvent(const FName& EventName, const FLuaBPVar& InLuaArgs){ | ||||
| 	TMap<int32, slua::LuaVar>* FunctionPool = LuaFuncMappings.Find(EventName); | ||||
| 	if (FunctionPool == nullptr) { | ||||
| 		return; | ||||
| 	} | ||||
| 	for (auto &Pair : *FunctionPool) { | ||||
| 		slua::LuaVar& Callback = Pair.Value; | ||||
| 		if (!Callback.isFunction()) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		Callback.call(InLuaArgs.value); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void UPW_SimpleWidget::BP_BindLuaEnhancedInput(UInputAction* Action, FLuaBPVar Callback) { | ||||
| 	UEnhancedInputComponent* EnhancedInput; | ||||
| 	if (!Action) return; | ||||
|  | ||||
| 	EnhancedInput = CastChecked<UEnhancedInputComponent>(GetOwningPlayer()->InputComponent); | ||||
| 	if (!EnhancedInput) return; | ||||
|  | ||||
| 	EnhancedInput->BindActionInstanceLambda(Action, ETriggerEvent::Triggered, [Callback](const FInputActionInstance& ActionInstance) { | ||||
| 		slua::LuaVar LuaCallback = Callback.value; | ||||
| 		if (!LuaCallback.isFunction()) return; | ||||
| 		LuaCallback.call(); | ||||
| 	}); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| void UPW_UserWidget::BP_Close(){ | ||||
| 	APW_UIHud* Hud = Cast<APW_UIHud>(GetPlayerContext().GetHUD()); | ||||
| 	if (!Hud) return; | ||||
| 	Hud->PopWidget(this); | ||||
| } | ||||
|  | ||||
| void UPW_UserWidget::SetVisible(bool InVisible){ | ||||
| 	bVisible = InVisible; | ||||
| 	_RefreshVisible(); | ||||
| } | ||||
|  | ||||
| void UPW_UserWidget::FrameWorkSetVisible(bool InVisible){ | ||||
| 	bFrameWorkVisible = InVisible; | ||||
| 	_RefreshVisible(); | ||||
| } | ||||
|  | ||||
| void UPW_UserWidget::_UpdateInputState(bool bNeedRegister) { | ||||
| 	APlayerController* PC; | ||||
| 	UEnhancedInputLocalPlayerSubsystem* Subsystem; | ||||
|  | ||||
| 	if (!InputMappingContext) return; | ||||
|  | ||||
| 	PC = GetOwningPlayer(); | ||||
| 	if (!PC) return; | ||||
|  | ||||
| 	Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer()); | ||||
| 	if (!Subsystem) return; | ||||
|  | ||||
| 	if (bNeedRegister) { | ||||
| 		Subsystem->AddMappingContext(InputMappingContext, 0); | ||||
| 	} | ||||
| 	else { | ||||
| 		Subsystem->RemoveMappingContext(InputMappingContext); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void UPW_UserWidget::_RefreshVisible(){ | ||||
| 	bool bFinalVisible = bFrameWorkVisible && bVisible; | ||||
| 	if (bFinalVisible) { | ||||
| 		SetVisibility(ESlateVisibility::SelfHitTestInvisible); | ||||
| 	} | ||||
| 	else { | ||||
| 		SetVisibility(ESlateVisibility::Collapsed); | ||||
| 	} | ||||
| 	_UpdateInputState(bFinalVisible); | ||||
| } | ||||
| // UPW_SimpleWidget::UPW_SimpleWidget():bVisible(true){ | ||||
| // 	bVisible = true; | ||||
| // 	SetVisibility(ESlateVisibility::SelfHitTestInvisible); | ||||
| // } | ||||
| // | ||||
| // bool UPW_SimpleWidget::Initialize(){ | ||||
| // 	return UUserWidget::Initialize(); | ||||
| // } | ||||
| // | ||||
| // void UPW_SimpleWidget::SetVisible(bool InVisible){ | ||||
| // 	if (bVisible == InVisible) { return; } | ||||
| // 	bVisible = InVisible; | ||||
| // 	if (bVisible) { | ||||
| // 		SetVisibility(ESlateVisibility::SelfHitTestInvisible); | ||||
| // 	} | ||||
| // 	else { | ||||
| // 		SetVisibility(ESlateVisibility::Collapsed); | ||||
| // 	} | ||||
| // } | ||||
| // | ||||
| // void UPW_SimpleWidget::BP_SetVisible(bool InVisible){ | ||||
| // 	SetVisible(InVisible); | ||||
| // } | ||||
| // | ||||
| // FLuaWidgetEventHandle UPW_SimpleWidget::BP_BindLuaEvent(const FName& EventName, const FLuaBPVar& InLuaFunction){ | ||||
| // 	FLuaWidgetEventHandle Handle; | ||||
| // 	if (!InLuaFunction.value.isFunction()) { | ||||
| // 		return Handle; | ||||
| // 	} | ||||
| // 	TMap<int32, slua::LuaVar>& FunctionPool = LuaFuncMappings.FindOrAdd(EventName); | ||||
| // 	HandleIndex += 1; | ||||
| // 	FunctionPool.Add(HandleIndex, InLuaFunction.value); | ||||
| // 	Handle.EventName = EventName; | ||||
| // 	Handle.HandleIndex = HandleIndex; | ||||
| // 	return Handle; | ||||
| // } | ||||
| // | ||||
| // | ||||
| // void UPW_SimpleWidget::BP_UnBindLuaEvent(const FLuaWidgetEventHandle &InHandle){ | ||||
| // 	TMap<int32, slua::LuaVar>* FunctionPool = LuaFuncMappings.Find(InHandle.EventName); | ||||
| // 	if (FunctionPool == nullptr) { | ||||
| // 		return; | ||||
| // 	} | ||||
| // 	FunctionPool->Remove(InHandle.HandleIndex); | ||||
| // } | ||||
| // | ||||
| // void UPW_SimpleWidget::BP_EmitLuaEvent(const FName& EventName, const FLuaBPVar& InLuaArgs){ | ||||
| // 	TMap<int32, slua::LuaVar>* FunctionPool = LuaFuncMappings.Find(EventName); | ||||
| // 	if (FunctionPool == nullptr) { | ||||
| // 		return; | ||||
| // 	} | ||||
| // 	for (auto &Pair : *FunctionPool) { | ||||
| // 		slua::LuaVar& Callback = Pair.Value; | ||||
| // 		if (!Callback.isFunction()) { | ||||
| // 			continue; | ||||
| // 		} | ||||
| // 		Callback.call(InLuaArgs.value); | ||||
| // 	} | ||||
| // } | ||||
| // | ||||
| // void UPW_SimpleWidget::BP_BindLuaEnhancedInput(UInputAction* Action, FLuaBPVar Callback) { | ||||
| // 	UEnhancedInputComponent* EnhancedInput; | ||||
| // 	if (!Action) return; | ||||
| // | ||||
| // 	EnhancedInput = CastChecked<UEnhancedInputComponent>(GetOwningPlayer()->InputComponent); | ||||
| // 	if (!EnhancedInput) return; | ||||
| // | ||||
| // 	EnhancedInput->BindActionInstanceLambda(Action, ETriggerEvent::Triggered, [Callback](const FInputActionInstance& ActionInstance) { | ||||
| // 		slua::LuaVar LuaCallback = Callback.value; | ||||
| // 		if (!LuaCallback.isFunction()) return; | ||||
| // 		LuaCallback.call(); | ||||
| // 	}); | ||||
| // } | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // void UPW_UserWidget::BP_Close(){ | ||||
| // 	APW_UIHud* Hud = Cast<APW_UIHud>(GetPlayerContext().GetHUD()); | ||||
| // 	if (!Hud) return; | ||||
| // 	Hud->PopWidget(this); | ||||
| // } | ||||
| // | ||||
| // void UPW_UserWidget::SetVisible(bool InVisible){ | ||||
| // 	bVisible = InVisible; | ||||
| // 	_RefreshVisible(); | ||||
| // } | ||||
| // | ||||
| // void UPW_UserWidget::FrameWorkSetVisible(bool InVisible){ | ||||
| // 	bFrameWorkVisible = InVisible; | ||||
| // 	_RefreshVisible(); | ||||
| // } | ||||
| // | ||||
| // void UPW_UserWidget::_UpdateInputState(bool bNeedRegister) { | ||||
| // 	APlayerController* PC; | ||||
| // 	UEnhancedInputLocalPlayerSubsystem* Subsystem; | ||||
| // | ||||
| // 	if (!InputMappingContext) return; | ||||
| // | ||||
| // 	PC = GetOwningPlayer(); | ||||
| // 	if (!PC) return; | ||||
| // | ||||
| // 	Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer()); | ||||
| // 	if (!Subsystem) return; | ||||
| // | ||||
| // 	if (bNeedRegister) { | ||||
| // 		Subsystem->AddMappingContext(InputMappingContext, 0); | ||||
| // 	} | ||||
| // 	else { | ||||
| // 		Subsystem->RemoveMappingContext(InputMappingContext); | ||||
| // 	} | ||||
| // } | ||||
| // | ||||
| // void UPW_UserWidget::_RefreshVisible(){ | ||||
| // 	bool bFinalVisible = bFrameWorkVisible && bVisible; | ||||
| // 	if (bFinalVisible) { | ||||
| // 		SetVisibility(ESlateVisibility::SelfHitTestInvisible); | ||||
| // 	} | ||||
| // 	else { | ||||
| // 		SetVisibility(ESlateVisibility::Collapsed); | ||||
| // 	} | ||||
| // 	_UpdateInputState(bFinalVisible); | ||||
| // } | ||||
|  | ||||
| @ -2,9 +2,6 @@ | ||||
| #include "Core/PW_UserWidget.h" | ||||
| #include "Core/UI/PW_UILayer.h" | ||||
|  | ||||
| FString APW_UIHud::GetLuaFilePath_Implementation() const { | ||||
| 	return LuaFilePath; | ||||
| } | ||||
|  | ||||
| void APW_UIHud::BeginPlay() { | ||||
| 	ensureMsgf(LayerClass, TEXT("LayerClass not be nullptr")); | ||||
|  | ||||
| @ -8,82 +8,83 @@ | ||||
|  | ||||
|  | ||||
| bool UPW_UILayer::PushWidget(UPW_UserWidget* WidgetInst){ | ||||
| 	UOverlay* Overlay; | ||||
| 	UOverlaySlot* OverlaySlot; | ||||
|  | ||||
| 	Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType); | ||||
| 	if (!Overlay) return false; | ||||
|  | ||||
| 	Overlay->AddChild(WidgetInst); | ||||
| 	OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot); | ||||
| 	if (!OverlaySlot) return false; | ||||
|  | ||||
| 	OverlaySlot->SetVerticalAlignment(EVerticalAlignment::VAlign_Fill); | ||||
| 	OverlaySlot->SetHorizontalAlignment(EHorizontalAlignment::HAlign_Fill); | ||||
|  | ||||
| 	// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㼶<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>push<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>widget | ||||
| 	auto AllOverlayChildren = Overlay->GetAllChildren(); | ||||
| 	for (int i = 0; i < AllOverlayChildren.Num() - 1; ++i) { | ||||
| 		UPW_UserWidget* Child = Cast<UPW_UserWidget>(AllOverlayChildren[i]); | ||||
| 		if (!Child) continue; | ||||
| 		Child->FrameWorkSetVisible(false); | ||||
| 	} | ||||
|  | ||||
| 	WidgetInst->FrameWorkSetVisible(true); | ||||
| 	// UOverlay* Overlay; | ||||
| 	// UOverlaySlot* OverlaySlot; | ||||
| 	// | ||||
| 	// Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType); | ||||
| 	// if (!Overlay) return false; | ||||
| 	// | ||||
| 	// Overlay->AddChild(WidgetInst); | ||||
| 	// OverlaySlot = Cast<UOverlaySlot>(WidgetInst->Slot); | ||||
| 	// if (!OverlaySlot) return false; | ||||
| 	// | ||||
| 	// OverlaySlot->SetVerticalAlignment(EVerticalAlignment::VAlign_Fill); | ||||
| 	// OverlaySlot->SetHorizontalAlignment(EHorizontalAlignment::HAlign_Fill); | ||||
| 	// | ||||
| 	// // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㼶<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>push<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>widget | ||||
| 	// auto AllOverlayChildren = Overlay->GetAllChildren(); | ||||
| 	// for (int i = 0; i < AllOverlayChildren.Num() - 1; ++i) { | ||||
| 	// 	UPW_UserWidget* Child = Cast<UPW_UserWidget>(AllOverlayChildren[i]); | ||||
| 	// 	if (!Child) continue; | ||||
| 	// 	Child->FrameWorkSetVisible(false); | ||||
| 	// } | ||||
| 	// | ||||
| 	// WidgetInst->FrameWorkSetVisible(true); | ||||
| 	return true; | ||||
| } | ||||
|  | ||||
| void UPW_UILayer::PopWidget(const UPW_UserWidget* WidgetInst){ | ||||
| 	UOverlay* Overlay; | ||||
| 	bool bNeedRemove; | ||||
| 	int32 i, OverlayWidgetCount; | ||||
| 	UPW_UserWidget* Child, * NeedShowWidget; | ||||
| 	TArray<UWidget*> AllOverlayChildren; | ||||
| 	TArray<UPW_UserWidget*> NeedRemoveWidgets; | ||||
|  | ||||
| 	bNeedRemove = true; | ||||
| 	NeedShowWidget = nullptr; | ||||
| 	 | ||||
| 	Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType); | ||||
| 	if (!Overlay) return; | ||||
|  | ||||
| 	AllOverlayChildren = Overlay->GetAllChildren(); | ||||
| 	OverlayWidgetCount = AllOverlayChildren.Num(); | ||||
|  | ||||
| 	for (i = OverlayWidgetCount - 1; i >= 0; --i) { | ||||
| 		Child = Cast<UPW_UserWidget>(AllOverlayChildren[i]); | ||||
| 		if (!Child) continue; | ||||
| 		if(bNeedRemove){ | ||||
| 			NeedRemoveWidgets.Add(Child); | ||||
| 		} | ||||
| 		else if(Child->bVisible) { | ||||
| 			NeedShowWidget = Child; | ||||
| 			break; | ||||
| 		} | ||||
| 		if (Child == WidgetInst) { | ||||
| 			bNeedRemove = false; | ||||
| 		} | ||||
| 	} | ||||
| 	for (i = 0; i < NeedRemoveWidgets.Num(); ++i) { | ||||
| 		NeedRemoveWidgets[i]->FrameWorkSetVisible(false); | ||||
| 		NeedRemoveWidgets[i]->RemoveFromParent(); | ||||
| 	} | ||||
| 	if (NeedShowWidget) { | ||||
| 		NeedShowWidget->FrameWorkSetVisible(true); | ||||
| 	} | ||||
| 	// UOverlay* Overlay; | ||||
| 	// bool bNeedRemove; | ||||
| 	// int32 i, OverlayWidgetCount; | ||||
| 	// UPW_UserWidget* Child, * NeedShowWidget; | ||||
| 	// TArray<UWidget*> AllOverlayChildren; | ||||
| 	// TArray<UPW_UserWidget*> NeedRemoveWidgets; | ||||
| 	// | ||||
| 	// bNeedRemove = true; | ||||
| 	// NeedShowWidget = nullptr; | ||||
| 	// | ||||
| 	// Overlay = _GetOverlayByLayerType(WidgetInst->LayoutType); | ||||
| 	// if (!Overlay) return; | ||||
| 	// | ||||
| 	// AllOverlayChildren = Overlay->GetAllChildren(); | ||||
| 	// OverlayWidgetCount = AllOverlayChildren.Num(); | ||||
| 	// | ||||
| 	// for (i = OverlayWidgetCount - 1; i >= 0; --i) { | ||||
| 	// 	Child = Cast<UPW_UserWidget>(AllOverlayChildren[i]); | ||||
| 	// 	if (!Child) continue; | ||||
| 	// 	if(bNeedRemove){ | ||||
| 	// 		NeedRemoveWidgets.Add(Child); | ||||
| 	// 	} | ||||
| 	// 	else if(Child->bVisible) { | ||||
| 	// 		NeedShowWidget = Child; | ||||
| 	// 		break; | ||||
| 	// 	} | ||||
| 	// 	if (Child == WidgetInst) { | ||||
| 	// 		bNeedRemove = false; | ||||
| 	// 	} | ||||
| 	// } | ||||
| 	// for (i = 0; i < NeedRemoveWidgets.Num(); ++i) { | ||||
| 	// 	NeedRemoveWidgets[i]->FrameWorkSetVisible(false); | ||||
| 	// 	NeedRemoveWidgets[i]->RemoveFromParent(); | ||||
| 	// } | ||||
| 	// if (NeedShowWidget) { | ||||
| 	// 	NeedShowWidget->FrameWorkSetVisible(true); | ||||
| 	// } | ||||
| } | ||||
|  | ||||
| UOverlay* UPW_UILayer::_GetOverlayByLayerType(EWidgetLayoutType InLayoutType){ | ||||
| 	switch (LayoutType) { | ||||
| 	case EWidgetLayoutType::MainLayer:  | ||||
| 		return MainLayer; | ||||
| 	case EWidgetLayoutType::PopupLayer: | ||||
| 		return PopupLayer; | ||||
| 	case EWidgetLayoutType::FloatLayer: | ||||
| 		return FloatLayer; | ||||
| 	case EWidgetLayoutType::TopLayer: | ||||
| 		return TopLayer; | ||||
| 	default: | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	// switch (LayoutType) { | ||||
| 	// case EWidgetLayoutType::MainLayer:  | ||||
| 	// 	return MainLayer; | ||||
| 	// case EWidgetLayoutType::PopupLayer: | ||||
| 	// 	return PopupLayer; | ||||
| 	// case EWidgetLayoutType::FloatLayer: | ||||
| 	// 	return FloatLayer; | ||||
| 	// case EWidgetLayoutType::TopLayer: | ||||
| 	// 	return TopLayer; | ||||
| 	// default: | ||||
| 	// 	return nullptr; | ||||
| 	// } | ||||
| 	return nullptr; | ||||
| } | ||||
|  | ||||
| @ -1,9 +0,0 @@ | ||||
| #include "LuaCppBinding.h" | ||||
|  | ||||
| using slua::lua_State, slua::LuaObject, slua::LuaStruct; | ||||
|  | ||||
|  | ||||
| extern void RegisterAbilitySystemComponentExtension() { | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -1,25 +0,0 @@ | ||||
| #include "LuaCppBinding.h" | ||||
| using namespace slua; | ||||
|  | ||||
|  | ||||
| static int LuaBinding_FindRow(lua_State* L) { | ||||
| 	UDataTable* DataTable = LuaObject::checkUD<UDataTable>(L, 1); | ||||
| 	FName RowName = LuaObject::checkValue<FName>(L, 2); | ||||
|  | ||||
| 	FTableRowBase* TableRow = DataTable->FindRow<FTableRowBase>(RowName, TEXT("")); | ||||
| 	 | ||||
| 	const UScriptStruct* rowStruct = DataTable->GetRowStruct(); | ||||
| 	 | ||||
| 	LuaStruct* luaStruct = new LuaStruct(); | ||||
| 	luaStruct->Init((uint8*)TableRow, rowStruct->GetStructureSize(), (UScriptStruct*)rowStruct, true); | ||||
|  | ||||
| 	LuaObject::addLink(L, TableRow); | ||||
| 	 | ||||
| 	//auto ret = LuaObject::push(L, luaStruct); | ||||
| 	return LuaObject::pushReference<LuaStruct*>(L, luaStruct, TableRow); | ||||
| } | ||||
|  | ||||
|  | ||||
| extern void RegisterDataTableExtension() { | ||||
| 	REG_EXTENSION_METHOD_IMP(UDataTable, "FindRow", { return LuaBinding_FindRow(L); }); | ||||
| } | ||||
| @ -9,7 +9,7 @@ static FString GetPropertyNameInOwner(UObject *Attr){ | ||||
| 	UObject* Outer = Attr->GetOuter(); | ||||
| 	if (!Outer) return FString(); | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	// <20><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	FProperty* Property = nullptr; | ||||
| 	for (TFieldIterator<FProperty> PropIt(Outer->GetClass()); PropIt; ++PropIt){ | ||||
| 		Property = *PropIt; | ||||
| @ -26,53 +26,12 @@ static FString GetPropertyNameInOwner(UObject *Attr){ | ||||
| 	return FString(); | ||||
| } | ||||
|  | ||||
| static void CopyAttributeToTable(UObject* Attribute, slua::LuaVar& LuaTable) { | ||||
| 	FProperty* Property = nullptr; | ||||
| 	FGameplayAttributeData* Data = nullptr; | ||||
| 	UClass* AttributeClass = Attribute->GetClass(); | ||||
|  | ||||
| 	for (TFieldIterator<FProperty> PropIt(AttributeClass); PropIt; ++PropIt) { | ||||
| 		Property = *PropIt; | ||||
| 		if (Property->GetOwnerClass() != AttributeClass) continue;  // ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰ<EFBFBD>ࣨ<EFBFBD><E0A3A8><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8>ࣩ | ||||
|  | ||||
| 		FStructProperty* StructProperty = CastField<FStructProperty>(Property); | ||||
| 		if (!StructProperty || StructProperty->Struct != FGameplayAttributeData::StaticStruct()) continue; | ||||
|  | ||||
| 		Data = StructProperty->ContainerPtrToValuePtr<FGameplayAttributeData>(Attribute); | ||||
| 		if (!Data) continue; | ||||
| 		LuaTable.setToTable(Property->GetName(),Data->GetBaseValue()); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| bool UPW_AttributeSet::RegisterCustomAttribute(){ | ||||
| 	ILuaOverriderInterface* Owner = Cast<ILuaOverriderInterface>(GetOwningActor()); | ||||
| 	if (!Owner) return false; | ||||
|  | ||||
| 	// <20><>ȡActor<6F><72>Lua<75><61><EFBFBD><EFBFBD> | ||||
| 	slua::LuaVar SelfTable = Owner->GetSelfTable(); | ||||
|  | ||||
| 	// <20><>ȡ LuaState | ||||
| 	slua::lua_State * RawState = SelfTable.getState(); | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD> Reactive ģ<><C4A3> | ||||
| 	slua::LuaVar moduleTable = slua::LuaState::get(RawState)->requireModule("Core.Reactive"); | ||||
|  | ||||
| 	// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ReactiveProperty <20><><EFBFBD><EFBFBD> | ||||
| 	LuaSideData = moduleTable.callField("ReactiveProperty"); | ||||
|  | ||||
| 	// <20><>Attribute<74><65><EFBFBD><EFBFBD><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Lua Reactive Property | ||||
| 	CopyAttributeToTable(this, LuaSideData); | ||||
|  | ||||
| 	// <20><><EFBFBD><EFBFBD>Lua Reactive Property | ||||
| 	auto name = GetPropertyNameInOwner(this); | ||||
| 	Owner->GetSelfTable().setToTable<FString, slua::LuaVar>( | ||||
| 		TEXT("Lua") + name, LuaSideData, true | ||||
| 	); | ||||
| 	return true; | ||||
| } | ||||
|  | ||||
| void UPW_AttributeSet::PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue){ | ||||
| 	FString AttributeName = Attribute.GetName(); | ||||
| 	LuaSideData.setToTable(AttributeName, NewValue); | ||||
| 	OnAttributeChanged.Broadcast(AttributeName, OldValue, NewValue); | ||||
| } | ||||
|  | ||||
| @ -4,12 +4,6 @@ | ||||
|  | ||||
| UBusyGameAbility::UBusyGameAbility() | ||||
| { | ||||
| 	bHasBlueprintActivateFromEvent = true; | ||||
| } | ||||
|  | ||||
| FString UBusyGameAbility::GetLuaFilePath_Implementation()const | ||||
| { | ||||
| 	return LuaFilePath; | ||||
| } | ||||
|  | ||||
| bool UBusyGameAbility::GetAbilityEffectSpecHandle(const FName& EffectName, const UAbilitySystemComponent* Asc, const int32 Level, | ||||
|  | ||||
| @ -2,9 +2,3 @@ | ||||
|  | ||||
|  | ||||
| #include "Hud/BusyGameHud.h" | ||||
|  | ||||
|  | ||||
|  | ||||
| FString ABusyGameHud::GetLuaFilePath_Implementation() const{ | ||||
| 	return LuaFilePath; | ||||
| } | ||||
| @ -1,6 +1 @@ | ||||
| #include "Level/Actor/Components/BusyAbilitySystemComponent.h" | ||||
|  | ||||
| FString UBusyAbilitySystemComponent::GetLuaFilePath_Implementation() const | ||||
| { | ||||
| 	return LuaFilePath; | ||||
| } | ||||
|  | ||||
| @ -3,7 +3,6 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "Camera/CameraComponent.h" | ||||
| #include "BusyCameraComponent.generated.h" | ||||
|  | ||||
| @ -11,7 +10,7 @@ | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyCameraComponent : public UCameraComponent, public ILuaOverriderInterface | ||||
| class BUSYRABBIT_API UBusyCameraComponent : public UCameraComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
|  | ||||
| @ -2,7 +2,6 @@ | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "slua.h" | ||||
| #include "CoreMinimal.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "BusyGameInstance.generated.h" | ||||
| @ -24,13 +23,6 @@ public: | ||||
| public: | ||||
| 	virtual void Init()override; | ||||
| 	virtual void Shutdown() override; | ||||
| public: | ||||
| 	void CreateLuaState(); | ||||
| 	void CloseLuaState(); | ||||
| 	void LuaStateInitCallback(NS_SLUA::lua_State* L); | ||||
|  | ||||
| public: | ||||
| 	NS_SLUA::LuaState* state; | ||||
|  | ||||
|  | ||||
| protected: | ||||
| @ -38,8 +30,5 @@ protected: | ||||
| 	FBusyOnEndFrameDelegate OnEndFrameDelegate; | ||||
|  | ||||
| 	void OnEndFrame(); | ||||
|  | ||||
| protected:  // luaside | ||||
| 	NS_SLUA::LuaVar  LuaGameInstance; | ||||
| 	NS_SLUA::LuaVar  OnLuaEndFrame; | ||||
| 	 | ||||
| }; | ||||
|  | ||||
| @ -3,14 +3,14 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaGameMode.h" | ||||
| #include "Runtime/Engine/Classes/GameFramework/GameMode.h" | ||||
| #include "BusyGameMode.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyGameMode : public ALuaGameMode | ||||
| class BUSYRABBIT_API ABusyGameMode : public AGameMode | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
|  | ||||
| @ -3,14 +3,14 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaGameState.h" | ||||
| #include "Runtime/Engine/Classes/GameFramework/GameState.h" | ||||
| #include "BusyGameState.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyGameState : public ALuaGameState | ||||
| class BUSYRABBIT_API ABusyGameState : public AGameState | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
|  | ||||
| @ -3,14 +3,13 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaPlayerController.h" | ||||
| #include "BusyPlayerController.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyPlayerController : public ALuaPlayerController | ||||
| class BUSYRABBIT_API ABusyPlayerController : public APlayerController | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	virtual void BeginPlay()override; | ||||
|  | ||||
| @ -3,14 +3,14 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaPlayerState.h" | ||||
| #include "Runtime/Engine/Classes/GameFramework/PlayerState.h" | ||||
| #include "BusyPlayerState.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyPlayerState : public ALuaPlayerState | ||||
| class BUSYRABBIT_API ABusyPlayerState : public APlayerState | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| @ -20,5 +20,5 @@ public: | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UInventoryComponent> Inventory;  // <20>ֿ<EFBFBD> | ||||
| 	TObjectPtr<class UInventoryComponent> Inventory;  // <20>ֿ<EFBFBD> | ||||
| }; | ||||
|  | ||||
| @ -3,7 +3,6 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActorComponent.h" | ||||
| #include "InventoryComponent.generated.h" | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| @ -30,7 +29,7 @@ DECLARE_DYNAMIC_DELEGATE_TwoParams(FVisitInventoryGridDelegate, int32, Index, co | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UInventoryComponent : public ULuaActorComponent { | ||||
| class BUSYRABBIT_API UInventoryComponent : public UActorComponent { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UInventoryComponent(); | ||||
|  | ||||
| @ -3,21 +3,20 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActorComponent.h" | ||||
| #include "BusyLuaActorComponent.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyLuaActorComponent : public ULuaActorComponent | ||||
| class BUSYRABBIT_API UBusyLuaActorComponent : public UActorComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public:  // <20><>д<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD> | ||||
| public:  // <20><>д<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD> | ||||
| 	virtual void BeginPlay()override; | ||||
|  | ||||
| public:  // Lua<75><61>Ҫʵ<D2AA>ֵĺ<D6B5><C4BA><EFBFBD> | ||||
| public:  // Lua<75><61>Ҫʵ<D2AA>ֵĺ<D6B5><C4BA><EFBFBD> | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveLuaBeginPlay(); | ||||
|  | ||||
|  | ||||
| @ -3,13 +3,13 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "Runtime/UMG/Public/Blueprint/UserWidget.h" | ||||
| #include "BusyLuaUserWidget.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyLuaUserWidget : public ULuaUserWidget{ | ||||
| class BUSYRABBIT_API UBusyLuaUserWidget : public UUserWidget{ | ||||
| 	GENERATED_BODY() | ||||
| }; | ||||
|  | ||||
| @ -3,7 +3,6 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "Abilities/GameplayAbility.h" | ||||
| #include "PW_Ability.generated.h" | ||||
|  | ||||
| @ -11,14 +10,12 @@ | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_Ability : public UGameplayAbility, public ILuaOverriderInterface{ | ||||
| class BUSYRABBIT_API UPW_Ability : public UGameplayAbility{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPW_Ability(); | ||||
|  | ||||
| public: | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
| 	virtual void ApplyCost(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo) const override; | ||||
|  | ||||
| 	UFUNCTION(BlueprintNativeEvent) | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "Runtime/UMG/Public/Blueprint/UserWidget.h" | ||||
| #include "Blueprint/IUserObjectListEntry.h" | ||||
| #include "PW_ListViewEntry.generated.h" | ||||
|  | ||||
| @ -11,7 +11,7 @@ | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_ListViewEntry : public ULuaUserWidget, public IUserObjectListEntry{ | ||||
| class BUSYRABBIT_API UPW_ListViewEntry : public UUserWidget, public IUserObjectListEntry{ | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
| }; | ||||
|  | ||||
| @ -1,23 +0,0 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "UObject/NoExportTypes.h" | ||||
| #include "PW_Object.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_Object : public UObject, public ILuaOverriderInterface{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPW_Object(); | ||||
| public: | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
| protected: | ||||
| 	FString LuaFilePath; | ||||
| }; | ||||
| @ -1,24 +0,0 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "slua.h" | ||||
| #include "CoreMinimal.h" | ||||
| #include "Engine/TimerHandle.h" | ||||
| #include "UObject/NoExportTypes.h" | ||||
| #include "PW_TimerModule.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_TimerModule : public UObject | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	//UFUNCTION(BlueprintCallable) | ||||
| 	//int SetTimer(slua::LuaVar cb); | ||||
|  | ||||
| protected: | ||||
| 	TArray<FTimerHandle> Timers; | ||||
| }; | ||||
| @ -3,8 +3,7 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "LuaBlueprintLibrary.h" | ||||
| #include "Runtime/UMG/Public/Blueprint/UserWidget.h" | ||||
| #include "PW_UserWidget.generated.h" | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| @ -29,40 +28,40 @@ struct FLuaWidgetEventHandle { | ||||
|  * | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_SimpleWidget : public ULuaUserWidget | ||||
| class BUSYRABBIT_API UPW_SimpleWidget : public UUserWidget | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPW_SimpleWidget(); | ||||
| 	virtual bool Initialize() override; | ||||
|  | ||||
| public: | ||||
| 	virtual void SetVisible(bool InVisible); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void BP_SetVisible(bool InVisible); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	FLuaWidgetEventHandle BP_BindLuaEvent(const FName& EventName, const FLuaBPVar& InLuaFunction); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void BP_UnBindLuaEvent(const FLuaWidgetEventHandle& InHandle); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void BP_EmitLuaEvent(const FName& EventName, const FLuaBPVar& InLuaArgs); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void BP_BindLuaEnhancedInput(class UInputAction* Action, FLuaBPVar Callback); | ||||
|  | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	bool bVisible; | ||||
|  | ||||
|  | ||||
| protected: // lua相关 | ||||
| 	int32 HandleIndex = 0; | ||||
| 	TMap<FName, TMap<int32, slua::LuaVar>> LuaFuncMappings; | ||||
| // 	UPW_SimpleWidget(); | ||||
| // 	virtual bool Initialize() override; | ||||
| // | ||||
| // public: | ||||
| // 	virtual void SetVisible(bool InVisible); | ||||
| // | ||||
| // 	UFUNCTION(BlueprintCallable) | ||||
| // 	void BP_SetVisible(bool InVisible); | ||||
| // | ||||
| // 	UFUNCTION(BlueprintCallable) | ||||
| // 	FLuaWidgetEventHandle BP_BindLuaEvent(const FName& EventName, const FLuaBPVar& InLuaFunction); | ||||
| // | ||||
| // 	UFUNCTION(BlueprintCallable) | ||||
| // 	void BP_UnBindLuaEvent(const FLuaWidgetEventHandle& InHandle); | ||||
| // | ||||
| // 	UFUNCTION(BlueprintCallable) | ||||
| // 	void BP_EmitLuaEvent(const FName& EventName, const FLuaBPVar& InLuaArgs); | ||||
| // | ||||
| // 	UFUNCTION(BlueprintCallable) | ||||
| // 	void BP_BindLuaEnhancedInput(class UInputAction* Action, FLuaBPVar Callback); | ||||
| // | ||||
| // | ||||
| // public: | ||||
| // 	UPROPERTY(BlueprintReadOnly) | ||||
| // 	bool bVisible; | ||||
| // | ||||
| // | ||||
| // protected: // lua相关 | ||||
| // 	int32 HandleIndex = 0; | ||||
| // 	TMap<FName, TMap<int32, slua::LuaVar>> LuaFuncMappings; | ||||
| }; | ||||
|  | ||||
|  | ||||
| @ -74,32 +73,32 @@ UCLASS() | ||||
| class BUSYRABBIT_API UPW_UserWidget : public UPW_SimpleWidget{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName="是否全局唯一") | ||||
| 	bool bSingletonInstance; | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) | ||||
| 	EWidgetLayoutType LayoutType; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, Category = "Input") | ||||
| 	TObjectPtr<class UInputMappingContext> InputMappingContext; | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void BP_Close(); | ||||
|  | ||||
| public: | ||||
| 	virtual void SetVisible(bool InVisible)override; | ||||
|  | ||||
| public: | ||||
| 	void FrameWorkSetVisible(bool InVisible); | ||||
|  | ||||
| protected: | ||||
| 	void _UpdateInputState(bool bNeedRegister); | ||||
|  | ||||
| 	void _RefreshVisible(); | ||||
|  | ||||
| protected: | ||||
| 	bool bFrameWorkVisible;  // 框架控制的显隐,高优先级 | ||||
| // 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName="是否全局唯一") | ||||
| // 	bool bSingletonInstance; | ||||
| // | ||||
| // public: | ||||
| // 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) | ||||
| // 	EWidgetLayoutType LayoutType; | ||||
| // | ||||
| // 	UPROPERTY(EditDefaultsOnly, Category = "Input") | ||||
| // 	TObjectPtr<class UInputMappingContext> InputMappingContext; | ||||
| // | ||||
| // public: | ||||
| // 	UFUNCTION(BlueprintCallable) | ||||
| // 	void BP_Close(); | ||||
| // | ||||
| // public: | ||||
| // 	virtual void SetVisible(bool InVisible)override; | ||||
| // | ||||
| // public: | ||||
| // 	void FrameWorkSetVisible(bool InVisible); | ||||
| // | ||||
| // protected: | ||||
| // 	void _UpdateInputState(bool bNeedRegister); | ||||
| // | ||||
| // 	void _RefreshVisible(); | ||||
| // | ||||
| // protected: | ||||
| // 	bool bFrameWorkVisible;  // 框架控制的显隐,高优先级 | ||||
|  | ||||
| }; | ||||
|  | ||||
| @ -3,7 +3,6 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "Blueprint/UserWidget.h" | ||||
| #include "Core/PW_UserWidget.h" | ||||
| #include "PW_TableSwitcher.generated.h" | ||||
| @ -36,7 +35,7 @@ struct FTableSwitcherInfo { | ||||
| }; | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_TableSwitcherWidget: public ULuaUserWidget{ | ||||
| class BUSYRABBIT_API UPW_TableSwitcherWidget: public UUserWidget{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	FName GetSwitcherName() { return SwitcherName; } | ||||
|  | ||||
| @ -1,18 +1,15 @@ | ||||
| #pragma once | ||||
| #include "CoreMinimal.h" | ||||
| #include "GameFramework/HUD.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "PW_UIHud.generated.h" | ||||
|  | ||||
| class UPW_UILayer; | ||||
| class UPW_UserWidget; | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API APW_UIHud : public AHUD, public ILuaOverriderInterface { | ||||
| class BUSYRABBIT_API APW_UIHud : public AHUD{ | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
| 	virtual void BeginPlay()override; | ||||
|  | ||||
| public: | ||||
|  | ||||
| @ -5,7 +5,6 @@ | ||||
| #include "CoreMinimal.h" | ||||
| #include "AttributeSet.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "BusyAttributeSet.generated.h" | ||||
|  | ||||
|  | ||||
| @ -33,7 +32,6 @@ public: | ||||
| 	FPW_OnAttributeChanged OnAttributeChanged; | ||||
|  | ||||
| protected: | ||||
| 	slua::LuaVar LuaSideData; | ||||
| }; | ||||
|  | ||||
| UCLASS() | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| #pragma once | ||||
| #include "slua.h" | ||||
| #include "Data/Ability/BusyAbilityDataAssetBase.h" | ||||
| #include "Abilities/GameplayAbility.h" | ||||
| #include "BusyGameAbility.generated.h" | ||||
| @ -7,16 +6,13 @@ | ||||
|  | ||||
|  | ||||
| UCLASS(Blueprintable, BlueprintType) | ||||
| class UBusyGameAbility : public UGameplayAbility, public ILuaOverriderInterface | ||||
| class UBusyGameAbility : public UGameplayAbility | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| 	UBusyGameAbility(); | ||||
| 	 | ||||
| 	virtual FString GetLuaFilePath_Implementation()const override; | ||||
|  | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	bool GetAbilityEffectSpecHandle(const FName& EffectName, const UAbilitySystemComponent* Asc, const int32 Level, FGameplayEffectSpecHandle& Handle)const; | ||||
|  | ||||
| @ -4,20 +4,15 @@ | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "GameFramework/HUD.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "BusyGameHud.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyGameHud : public AHUD, public ILuaOverriderInterface{ | ||||
| class BUSYRABBIT_API ABusyGameHud : public AHUD{ | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
| public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	FString LuaFilePath; | ||||
| 	UPROPERTY(EditAnywhere, Category = "UI Class Mapping") | ||||
| 	TMap<FName, TSubclassOf<UUserWidget>> UIClassMapping; | ||||
| }; | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| #pragma once | ||||
| #include "LuaPawn.h" | ||||
| #include "Level/Actor/Components/BusyPawnMovement.h" | ||||
| #include "Level/Actor/Components/BusyAbilitySystemComponent.h" | ||||
| #include "BusyPawnBase.generated.h" | ||||
| @ -53,7 +52,7 @@ public: | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class ABusyPawnBase : public ALuaPawn, public IBusyMovable | ||||
| class ABusyPawnBase : public APawn, public IBusyMovable | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| #pragma once | ||||
| #include "LuaActor.h" | ||||
| #include "BusyStaticResource.generated.h" | ||||
|  | ||||
| class USpineSkeletonRendererComponent; | ||||
| @ -7,7 +6,7 @@ class USpineSkeletonAnimationComponent; | ||||
|  | ||||
|  | ||||
| UCLASS(Blueprintable, BlueprintType) | ||||
| class ABusyStaticResource:public ALuaActor | ||||
| class ABusyStaticResource:public AActor | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| @ -1,17 +1,10 @@ | ||||
| #pragma once | ||||
| #include "slua.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "BusyAbilitySystemComponent.generated.h" | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class UBusyAbilitySystemComponent : public UAbilitySystemComponent, public ILuaOverriderInterface | ||||
| class UBusyAbilitySystemComponent : public UAbilitySystemComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
|  | ||||
| protected: | ||||
| 	FString LuaFilePath; | ||||
| }; | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| #pragma once | ||||
| #include "LuaActorComponent.h" | ||||
| #include "BusyPawnMovement.generated.h" | ||||
|  | ||||
| UINTERFACE(MinimalAPI, Blueprintable) | ||||
| @ -36,7 +35,7 @@ enum class EBusyMoveState: uint8 | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class UBusyPawnMovement : public ULuaActorComponent | ||||
| class UBusyPawnMovement : public UActorComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "LuaPlayerController.h" | ||||
| #include "GameplayTagContainer.h" | ||||
| #include "InputAction.h" | ||||
| #include "LevelPlayerController.generated.h" | ||||
| @ -49,7 +48,7 @@ struct FBusySkillActionConfig | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class ALevelPlayerController : public ALuaPlayerController | ||||
| class ALevelPlayerController : public APlayerController | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| #pragma once | ||||
|  | ||||
| #include "LuaPlayerState.h" | ||||
| #include "Runtime/Engine/Classes/GameFramework/PlayerState.h" | ||||
| #include "LevelPlayerState.generated.h" | ||||
|  | ||||
| class ABusyPlayerRole; | ||||
| @ -9,7 +9,7 @@ class ABusyPlayerRole; | ||||
| DECLARE_LOG_CATEGORY_EXTERN(LogLevelPlayerState, Log, All); | ||||
|  | ||||
| UCLASS() | ||||
| class ALevelPlayerState : public ALuaPlayerState | ||||
| class ALevelPlayerState : public APlayerState | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| #pragma once | ||||
| #include "Engine/DataTable.h" | ||||
| #include "LuaActor.h" | ||||
| #include "Level/Map/Components/TerrainLayerComponent.h" | ||||
| #include "Level/Map/Components/StaticResourceLayerComponent.h" | ||||
| #include "GameMapActor.generated.h" | ||||
| @ -31,7 +30,7 @@ public: | ||||
|  | ||||
|  | ||||
| UCLASS(Blueprintable, Blueprintable) | ||||
| class AGameMapActor : public ALuaActor, public IGameMapInterface | ||||
| class AGameMapActor : public AActor, public IGameMapInterface | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
|  | ||||
| @ -9,7 +9,7 @@ public class BusyRabbitEditorTarget : TargetRules | ||||
| 	{ | ||||
| 		Type = TargetType.Editor; | ||||
| 		DefaultBuildSettings = BuildSettingsVersion.V5; | ||||
| 		IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_4; | ||||
| 		IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_6; | ||||
| 		ExtraModuleNames.Add("BusyRabbit"); | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user