初始化提交
This commit is contained in:
		
							
								
								
									
										67
									
								
								Source/BusyRabbit/Public/BusyActorManagerSubSystem.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Source/BusyRabbit/Public/BusyActorManagerSubSystem.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,67 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "Engine/Datatable.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "Subsystems/WorldSubsystem.h" | ||||
| #include "Level/BusyLevelItem.h" | ||||
| #include "BusyActorManagerSubSystem.generated.h" | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyLevelBaseConfig : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
| 	/* 第一个篝火的位置 */ | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "初始篝火位置") | ||||
| 	FVector2D FirstBonfirePosition; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "每次Tick的时间(MS)") | ||||
| 	int TickInterval; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "一个物品生成周期包含的Tick次数") | ||||
| 	int Period; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName ="关卡中存在的物品配置") | ||||
| 	TMap<int32, FBusyLevelItemGenerateConfig> LevelItemIds; | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyActorManagerSubSystem : public UWorldSubsystem, public ILuaOverriderInterface | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	// 初始化(关卡加载时调用) | ||||
| 	virtual void Initialize(FSubsystemCollectionBase& Collection) override; | ||||
|  | ||||
| 	virtual void OnWorldBeginPlay(UWorld& InWorld)override; | ||||
|  | ||||
| 	// 销毁(关卡卸载时调用) | ||||
| 	virtual void Deinitialize() override; | ||||
|  | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
|  | ||||
| public:  // 需要蓝图实现接口 | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveSubSystemInitialize(); | ||||
| 	 | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveWorldBeginPlay(); | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	bool GetLevelBaseConfig(FBusyLevelBaseConfig& config); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	UWorld* K2_GetWorld(); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	static UBusyActorManagerSubSystem* Get(UObject* WorldContextObject); | ||||
| }; | ||||
							
								
								
									
										29
									
								
								Source/BusyRabbit/Public/BusyBonfire.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Source/BusyRabbit/Public/BusyBonfire.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActor.h" | ||||
| #include "BusyBonfire.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyBonfire : public ALuaActor | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	ABusyBonfire(); | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UCapsuleComponent> CapsuleComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class USceneComponent> SceneComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UInventoryComponent> Inventory;  // <20>ֿ<EFBFBD> | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										21
									
								
								Source/BusyRabbit/Public/BusyCameraComponent.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Source/BusyRabbit/Public/BusyCameraComponent.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "Camera/CameraComponent.h" | ||||
| #include "BusyCameraComponent.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyCameraComponent : public UCameraComponent, public ILuaOverriderInterface | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	UBusyCameraComponent(); | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										26
									
								
								Source/BusyRabbit/Public/BusyCharacter.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								Source/BusyRabbit/Public/BusyCharacter.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
| #include "slua.h" | ||||
| #include "CoreMinimal.h" | ||||
| #include "PaperZDCharacter.h" | ||||
| #include "BusyCharacter.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyCharacter : public APaperZDCharacter, public ILuaOverriderInterface | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
| 	//UFUNCTION(BlueprintNativeEvent) | ||||
| 	//FString GetLuaFilePath()const; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	FString LuaFilePath; | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										36
									
								
								Source/BusyRabbit/Public/BusyDataAsset.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Source/BusyRabbit/Public/BusyDataAsset.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "Engine/DataAsset.h" | ||||
| #include "Blueprint/UserWidget.h" | ||||
| #include "BusyDataAsset.generated.h" | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyActorClassAsset: public UDataAsset | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(EditAnywhere, Category = "Blueprint Mapping") | ||||
| 	TMap<FString, TSubclassOf<AActor>> ClassPathConfig; | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyDataAsset : public UDataAsset | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(EditAnywhere, Category = "DataTable Mapping") | ||||
| 	TMap<FString, TObjectPtr<UDataTable>> DataTableMapping; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, Category = "Actor Class Mapping") | ||||
| 	TMap<FString, TSubclassOf<AActor>> ClassPathMapping; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, Category = "UI Class Mapping") | ||||
| 	TMap<FString, TSubclassOf<UUserWidget>> UIPathMapping; | ||||
| }; | ||||
							
								
								
									
										45
									
								
								Source/BusyRabbit/Public/BusyGameInstance.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								Source/BusyRabbit/Public/BusyGameInstance.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,45 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "slua.h" | ||||
| #include "CoreMinimal.h" | ||||
| #include "Engine/GameInstance.h" | ||||
| #include "BusyGameInstance.generated.h" | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyGameInstance : public UGameInstance | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UBusyGameInstance(); | ||||
|  | ||||
| public: | ||||
| 	DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBusyOnEndFrameDelegate); | ||||
|  | ||||
| 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: | ||||
| 	UPROPERTY(BlueprintAssignable) | ||||
| 	FBusyOnEndFrameDelegate OnEndFrameDelegate; | ||||
|  | ||||
| 	void OnEndFrame(); | ||||
|  | ||||
| protected:  // luaside | ||||
| 	NS_SLUA::LuaVar  LuaGameInstance; | ||||
| 	NS_SLUA::LuaVar  OnLuaEndFrame; | ||||
| }; | ||||
							
								
								
									
										17
									
								
								Source/BusyRabbit/Public/BusyGameMode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Source/BusyRabbit/Public/BusyGameMode.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaGameMode.h" | ||||
| #include "BusyGameMode.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyGameMode : public ALuaGameMode | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										51
									
								
								Source/BusyRabbit/Public/BusyGamePlayLibrary.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								Source/BusyRabbit/Public/BusyGamePlayLibrary.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "slua.h" | ||||
| #include "Role/BusyRole.h" | ||||
| #include "Engine/World.h" | ||||
| #include "Level/BusyLevelItem.h" | ||||
| #include "Engine/DataTable.h" | ||||
| #include "BusyActorManagerSubSystem.h" | ||||
| #include "Kismet/BlueprintFunctionLibrary.h" | ||||
| #include "GameAsset/BusyItem.h" | ||||
| #include "BusyGamePlayLibrary.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyGamePlayLibrary : public UBlueprintFunctionLibrary | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	static UDataTable* GetGameDataTable(const FString& TableName); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	static UClass* GetGameClass(const FString& ClassName); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	static UClass* GetGameUIClass(const FString& ClassName); | ||||
|  | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	static UWorld* K2_GetWorld(UObject* obj); | ||||
|  | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	static bool GetLevelBaseConfig(const FName& RowName, FBusyLevelBaseConfig& RowData); | ||||
|  | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	static bool GetLevelItemConfig(const FName& RowName, FBusyLevelItemConfig& RowData); | ||||
|  | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	static bool GetRoleConfig(const FName& RowName, FBusyRoleConfig& RowData); | ||||
|  | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	static bool GetItemResourceConfig(const FName& RowName, FBusyLevelItemResourceConfig& RowData); | ||||
|  | ||||
| 	UFUNCTION(BlueprintPure) | ||||
| 	static bool GetLevelItemDescription(const FName& RowName, FBusyLevelItemDescription& RowData); | ||||
| }; | ||||
							
								
								
									
										17
									
								
								Source/BusyRabbit/Public/BusyGameState.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Source/BusyRabbit/Public/BusyGameState.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaGameState.h" | ||||
| #include "BusyGameState.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyGameState : public ALuaGameState | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										51
									
								
								Source/BusyRabbit/Public/BusyLevelLogicSubSystem.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								Source/BusyRabbit/Public/BusyLevelLogicSubSystem.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "Subsystems/WorldSubsystem.h" | ||||
| #include "BusyLevelLogicSubSystem.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyLevelLogicSubSystem : public UTickableWorldSubsystem, public ILuaOverriderInterface | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	UBusyLevelLogicSubSystem(); | ||||
| 	 | ||||
|  | ||||
|  | ||||
| public: | ||||
| 	virtual void Initialize(FSubsystemCollectionBase& Collection) override; | ||||
|  | ||||
| 	virtual void Tick(float DeltaTime) override; | ||||
|  | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
| 	// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ã<EFBFBD> | ||||
| 	virtual void OnWorldBeginPlay(UWorld& InWorld)override; | ||||
|  | ||||
| 	// <20><><EFBFBD>٣<EFBFBD><D9A3>ؿ<EFBFBD>ж<EFBFBD><D0B6>ʱ<EFBFBD><CAB1><EFBFBD>ã<EFBFBD> | ||||
| 	virtual void Deinitialize() override; | ||||
|  | ||||
| 	virtual TStatId GetStatId() const override; | ||||
|  | ||||
|  | ||||
|  | ||||
| public:  // <20><>Ҫ<EFBFBD><D2AA>ͼʵ<CDBC>ֽӿ<D6BD> | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveSubSystemInitialize(); | ||||
|  | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveWorldBeginPlay(); | ||||
|  | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveSubSystemTick(float DeltaTime); | ||||
|  | ||||
|  | ||||
| }; | ||||
							
								
								
									
										17
									
								
								Source/BusyRabbit/Public/BusyPlayerController.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Source/BusyRabbit/Public/BusyPlayerController.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaPlayerController.h" | ||||
| #include "BusyPlayerController.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyPlayerController : public ALuaPlayerController | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	virtual void BeginPlay()override; | ||||
| }; | ||||
							
								
								
									
										24
									
								
								Source/BusyRabbit/Public/BusyPlayerState.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Source/BusyRabbit/Public/BusyPlayerState.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaPlayerState.h" | ||||
| #include "BusyPlayerState.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyPlayerState : public ALuaPlayerState | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	ABusyPlayerState(); | ||||
| 	 | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UInventoryComponent> Inventory;  // <20>ֿ<EFBFBD> | ||||
| }; | ||||
							
								
								
									
										90
									
								
								Source/BusyRabbit/Public/Components/InventoryComponent.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								Source/BusyRabbit/Public/Components/InventoryComponent.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,90 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActorComponent.h" | ||||
| #include "InventoryComponent.generated.h" | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FInventoryGrid { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, DisplayName = "物品ID") | ||||
| 	int32 ItemID; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadWrite, DisplayName = "当前的数量") | ||||
| 	int32 CurrentCount; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadWrite, DisplayName = "最大堆叠限制") | ||||
| 	int32 MaxCount; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadWrite, DisplayName = "优先级") | ||||
| 	int32 Priority; | ||||
| }; | ||||
|  | ||||
|  | ||||
| DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventoryCapacityChanged); | ||||
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInventoryChanged, int32, ItemID); | ||||
| DECLARE_DYNAMIC_DELEGATE_TwoParams(FVisitInventoryGridDelegate, int32, Index, const FInventoryGrid&, Grid);  // 定义蓝图可用的遍历委托 | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UInventoryComponent : public ULuaActorComponent { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UInventoryComponent(); | ||||
|  | ||||
| public: // get | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	bool IsCanContain(int32 ItemID, int32 Count); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	bool IsEnough(int32 ItemID, int32 Count); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	FInventoryGrid GetGridWithIndex(int32 Index); | ||||
|  | ||||
| 	// 遍历所有库存格子 | ||||
| 	UFUNCTION(BlueprintCallable, Category = "Inventory") | ||||
| 	void ForEach(const FVisitInventoryGridDelegate& VisitDelegate); | ||||
|  | ||||
| public: // set | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	bool DepositItems(int32 ItemID, int32 ItemCnt); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	bool WithdrawItems(int32 ItemID, int32 ItemCnt); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	bool ConsumeItems(int32 Index, int32 ItemCnt); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetInventoryCapacity(int Capacity); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void ReSortAllItem(); | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintNativeEvent) | ||||
| 	void InitItemGrid(FInventoryGrid& Grid); | ||||
|  | ||||
| 	// 物品变动事件(添加/移除物品时触发) | ||||
| 	UPROPERTY(BlueprintAssignable, Category = "Inventory") | ||||
| 	FOnInventoryChanged OnInventoryChanged; | ||||
|  | ||||
| 	// 容量变化事件(设置新容量时触发) | ||||
| 	UPROPERTY(BlueprintAssignable, Category = "Inventory") | ||||
| 	FOnInventoryCapacityChanged OnInventoryCapacityChanged; | ||||
|  | ||||
| private: | ||||
| 	FInventoryGrid& GetOrCreateGrid(int32 ItemID); | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	int32 Capacity; | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	TArray<FInventoryGrid> InventoryList; | ||||
| }; | ||||
							
								
								
									
										25
									
								
								Source/BusyRabbit/Public/Core/BusyLuaActorComponent.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Source/BusyRabbit/Public/Core/BusyLuaActorComponent.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActorComponent.h" | ||||
| #include "BusyLuaActorComponent.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyLuaActorComponent : public ULuaActorComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public:  // <20><>д<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD> | ||||
| 	virtual void BeginPlay()override; | ||||
|  | ||||
| public:  // Lua<75><61>Ҫʵ<D2AA>ֵĺ<D6B5><C4BA><EFBFBD> | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveLuaBeginPlay(); | ||||
|  | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										15
									
								
								Source/BusyRabbit/Public/Core/BusyLuaUserWidget.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Source/BusyRabbit/Public/Core/BusyLuaUserWidget.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "BusyLuaUserWidget.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyLuaUserWidget : public ULuaUserWidget{ | ||||
| 	GENERATED_BODY() | ||||
| }; | ||||
							
								
								
									
										39
									
								
								Source/BusyRabbit/Public/Core/PW_Ability.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Source/BusyRabbit/Public/Core/PW_Ability.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "Abilities/GameplayAbility.h" | ||||
| #include "PW_Ability.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_Ability : public UGameplayAbility, public ILuaOverriderInterface{ | ||||
| 	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) | ||||
| 	void BP_ApplyCost(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo& ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo)const; | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName = "默认的Effect配置") | ||||
| 	TSubclassOf<UGameplayEffect> DefaultEffectConfig; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName = "技能的Effect配置") | ||||
| 	TMap<FGameplayTag, TSubclassOf<UGameplayEffect>> EffectConfigs; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName = "技能的Effect配置") | ||||
| 	TMap<FName, TSubclassOf<UGameplayEffect>> AbilityEffectConfigs; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) | ||||
| 	FString LuaFilePath; | ||||
| }; | ||||
							
								
								
									
										20
									
								
								Source/BusyRabbit/Public/Core/PW_AbilitySystemComponent.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Source/BusyRabbit/Public/Core/PW_AbilitySystemComponent.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "PW_AbilitySystemComponent.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_AbilitySystemComponent : public UAbilitySystemComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName = "技能的Effect配置") | ||||
| 	TMap<FName, TSubclassOf<UGameplayEffect>> AbilityEffectConfigs; | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										17
									
								
								Source/BusyRabbit/Public/Core/PW_ListViewEntry.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Source/BusyRabbit/Public/Core/PW_ListViewEntry.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "Blueprint/IUserObjectListEntry.h" | ||||
| #include "PW_ListViewEntry.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_ListViewEntry : public ULuaUserWidget, public IUserObjectListEntry{ | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										23
									
								
								Source/BusyRabbit/Public/Core/PW_Object.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Source/BusyRabbit/Public/Core/PW_Object.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| // 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; | ||||
| }; | ||||
							
								
								
									
										24
									
								
								Source/BusyRabbit/Public/Core/PW_TimerModule.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Source/BusyRabbit/Public/Core/PW_TimerModule.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| // 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; | ||||
| }; | ||||
							
								
								
									
										55
									
								
								Source/BusyRabbit/Public/Core/PW_UserWidget.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								Source/BusyRabbit/Public/Core/PW_UserWidget.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "PW_UserWidget.generated.h" | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| enum class EWidgetLayoutType: uint8 { | ||||
| 	MainLayer, | ||||
| 	PopupLayer, | ||||
| 	FloatLayer, | ||||
| 	TopLayer, | ||||
| 	LayerTypeMax | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_SimpleWidget : public ULuaUserWidget | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPW_SimpleWidget(); | ||||
| 	virtual bool Initialize() override; | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	bool bVisible; | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetVisible(bool Visible); | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_UserWidget : public UPW_SimpleWidget | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, DisplayName="是否全局唯一") | ||||
| 	bool bSingletonInstance; | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) | ||||
| 	EWidgetLayoutType LayoutType; | ||||
| }; | ||||
							
								
								
									
										155
									
								
								Source/BusyRabbit/Public/Core/UI/PW_TableSwitcher.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										155
									
								
								Source/BusyRabbit/Public/Core/UI/PW_TableSwitcher.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,155 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaUserWidget.h" | ||||
| #include "Blueprint/UserWidget.h" | ||||
| #include "Core/PW_UserWidget.h" | ||||
| #include "PW_TableSwitcher.generated.h" | ||||
|  | ||||
| DECLARE_MULTICAST_DELEGATE_OneParam (FTableSwitcherWidgetClicked, class UPW_TableSwitcherWidget*) | ||||
| DECLARE_MULTICAST_DELEGATE_TwoParams(FTableSwitcherWidgetHoverChange, class UPW_TableSwitcherWidget*, bool) | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FTableSwitcherInfo { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	UPROPERTY(EditAnyWhere, DisplayName="是否延迟加载") | ||||
| 	bool bIsLazyCreate; | ||||
|  | ||||
| 	UPROPERTY(EditAnyWhere, DisplayName = "是否复用面板") | ||||
| 	bool bIsReusePanel; | ||||
|  | ||||
| 	UPROPERTY(EditAnyWhere, DisplayName = "复用的切换页的名称", meta = (EditCondition = "bIsReusePanel")) | ||||
| 	FName ReusePanelName; | ||||
|  | ||||
| 	UPROPERTY(EditAnyWhere, DisplayName = "切换页签的类配置") | ||||
| 	TSubclassOf <class UPW_TableSwitcherWidget > SwitcherWidget; | ||||
|  | ||||
| 	UPROPERTY(EditAnyWhere, DisplayName = "切换页签的的显示名称") | ||||
| 	FText TableSwitcherName; | ||||
|  | ||||
| 	UPROPERTY(EditAnyWhere, DisplayName = "切换页的类配置") | ||||
| 	TSubclassOf <class UPW_TableSwitcherPage> PageWidget; | ||||
| }; | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_TableSwitcherWidget: public ULuaUserWidget{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	FName GetSwitcherName() { return SwitcherName; } | ||||
|  | ||||
| public: | ||||
| 	void SetHoveredState(bool bIsHover); | ||||
| 	void SetSelectedState(bool bIsSelect); | ||||
| 	void SetSwitcherTitle(const FText& Text); | ||||
|  | ||||
| 	void SetSwitcherName(const FName& SwitcherWidgetName) { SwitcherName = SwitcherWidgetName; } | ||||
|  | ||||
| public: | ||||
| 	virtual void NativeOnInitialized()override; | ||||
| 	virtual void NativeConstruct()override; | ||||
| 	virtual void NativeDestruct()override; | ||||
|  | ||||
| protected: | ||||
| 	UFUNCTION() | ||||
| 	void OnWidgetClicked(); | ||||
| 	UFUNCTION() | ||||
| 	void OnWidgetHovered(); | ||||
| 	UFUNCTION() | ||||
| 	void OnWidgetUnHovered(); | ||||
|  | ||||
| protected: | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void OnWidgetStateChange(bool bIsWidgetHovered, bool bIsWidgetSelected); | ||||
|  | ||||
| public: | ||||
| 	// 必须绑定的控件 | ||||
| 	UPROPERTY(BlueprintReadOnly, meta = (BindWidget)) | ||||
| 	TObjectPtr<class UButton> BtnMain; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadOnly, meta = (BindWidget)) | ||||
| 	TObjectPtr<class UTextBlock> SwitcherTitle; | ||||
|  | ||||
|  | ||||
| 	FTableSwitcherWidgetClicked OnTableWidgetClicked; | ||||
| 	FTableSwitcherWidgetHoverChange OnHoverStateChange; | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	bool bIsHovered; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	bool bIsSelected; | ||||
|  | ||||
| 	FName SwitcherName; | ||||
|  | ||||
| }; | ||||
|  | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_TableSwitcherPage : public UPW_SimpleWidget { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPW_TableSwitcherPage() :bIsShowing(false) {} | ||||
| public: | ||||
| 	void SwitchIn(const FName& SwitcherName); | ||||
| 	void SwitchOut(const FName& SwitcherName); | ||||
|  | ||||
| protected: | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void OnSwitchIn(const FName& SwitcherName); | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void OnSwitchOut(const FName& SwitcherName); | ||||
| protected: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	bool bIsShowing; | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_TableSwitcher : public UUserWidget | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	virtual void NativePreConstruct()override; | ||||
|  | ||||
| 	virtual void NativeOnInitialized()override; | ||||
|  | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetSelectedSwitcher(const FName& SwitcherName); | ||||
|  | ||||
|  | ||||
| public: | ||||
| 	void RebuildSwitcher(const TMap<FName, FTableSwitcherInfo>& infos); | ||||
|  | ||||
| 	void RefreshSwitcher(); | ||||
|  | ||||
| protected: | ||||
| 	UPW_TableSwitcherPage* GetOrCreateSwitcherPage(const FName& SwitcherName); | ||||
|  | ||||
| public: | ||||
| 	// 必须绑定的控件 | ||||
| 	UPROPERTY(BlueprintReadOnly, meta = (BindWidget, DisplayName = "盛放标签的容器")) | ||||
| 	TObjectPtr<class UHorizontalBox> SwitcherBar; | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadOnly, meta = (BindWidget, DisplayName = "盛放页签的容器")) | ||||
| 	TObjectPtr<class UOverlay> PanelOverlay; | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditAnyWhere, BlueprintReadOnly, DisplayName="控件切换器配置") | ||||
| 	TMap<FName, FTableSwitcherInfo> SwicthersInfo; | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY() | ||||
| 	TMap<FName, TWeakObjectPtr<UPW_TableSwitcherPage>> SwitcherPages; | ||||
| 	UPROPERTY() | ||||
| 	TMap<FName, TWeakObjectPtr<UPW_TableSwitcherWidget>> SwitcherWidgets; | ||||
| }; | ||||
							
								
								
									
										61
									
								
								Source/BusyRabbit/Public/GameAsset/BusyItem.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Source/BusyRabbit/Public/GameAsset/BusyItem.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | ||||
| #pragma once | ||||
| #include "CoreMinimal.h" | ||||
| #include "BusyItem.generated.h" | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyLevelCollectionDropRate { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "掉落数量") | ||||
| 	int Count; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "掉落概率") | ||||
| 	float Rate; | ||||
| }; | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyLevelCollectionDropConfig { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "掉落物ID") | ||||
| 	FName ItemID; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "掉落物概率") | ||||
| 	TArray<FBusyLevelCollectionDropRate> configs; | ||||
| }; | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyLevelItemConfig : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "道具备注") | ||||
| 	FString Comment; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "采集需要花费的饥饿值") | ||||
| 	int PickHungerCost; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "采集需要花费的时间,(单位MS)") | ||||
| 	int PickTimeCost; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "物品标签列表") | ||||
| 	FGameplayTagContainer TypeTagContainer; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "采集后能带来的效果") | ||||
| 	TMap<FGameplayTag, float> GameplayEffects; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "采集后的掉落物配置") | ||||
| 	TArray<FBusyLevelCollectionDropConfig> DropConfigs; | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| USTRUCT() | ||||
| struct FBusyLevelItemDescription : public FTableRowBase {  // 物品描述表头 | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "道具名称") | ||||
| 	FName Name; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "道具描述") | ||||
| 	FText Desc; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "物品UI图标资源") | ||||
| 	TSoftObjectPtr<UObject> IconResource; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "物品关卡内资源") | ||||
| 	TSoftObjectPtr<UPaperFlipbook> LevelResource; | ||||
| }; | ||||
|  | ||||
|  | ||||
							
								
								
									
										17
									
								
								Source/BusyRabbit/Public/Gas/BusyAbilitySystemComponent.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Source/BusyRabbit/Public/Gas/BusyAbilitySystemComponent.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "BusyAbilitySystemComponent.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyAbilitySystemComponent : public UAbilitySystemComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| 	 | ||||
| }; | ||||
							
								
								
									
										65
									
								
								Source/BusyRabbit/Public/Gas/BusyAttributeSet.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								Source/BusyRabbit/Public/Gas/BusyAttributeSet.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,65 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "AttributeSet.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "BusyAttributeSet.generated.h" | ||||
|  | ||||
|  | ||||
| #define MY_ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \ | ||||
| 	GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \ | ||||
| 	GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \ | ||||
| 	GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \ | ||||
| 	GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName) | ||||
|  | ||||
| DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FPW_OnAttributeChanged, FString, Name, float, OldValue, float, NewValue); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UPW_AttributeSet: public UAttributeSet{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	virtual bool RegisterCustomAttribute(); | ||||
| 	virtual void PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue)override; | ||||
|  | ||||
| public: | ||||
| 	FPW_OnAttributeChanged OnAttributeChanged; | ||||
|  | ||||
| protected: | ||||
| 	slua::LuaVar LuaSideData; | ||||
| }; | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyRoleAttributeSet : public UPW_AttributeSet { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes") | ||||
| 	FGameplayAttributeData Health; | ||||
| 	MY_ATTRIBUTE_ACCESSORS(UBusyRoleAttributeSet, Health); | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes") | ||||
| 	FGameplayAttributeData Hunger; | ||||
| 	MY_ATTRIBUTE_ACCESSORS(UBusyRoleAttributeSet, Hunger); | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes") | ||||
| 	FGameplayAttributeData MoveSpeed; | ||||
| 	MY_ATTRIBUTE_ACCESSORS(UBusyRoleAttributeSet, MoveSpeed); | ||||
|  | ||||
| }; | ||||
|  | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyLevelItemAttributeSet : public UPW_AttributeSet { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes") | ||||
| 	FGameplayAttributeData Health; | ||||
| 	MY_ATTRIBUTE_ACCESSORS(UBusyRoleAttributeSet, Health); | ||||
|  | ||||
| }; | ||||
							
								
								
									
										28
									
								
								Source/BusyRabbit/Public/Hud/BusyGameHud.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Source/BusyRabbit/Public/Hud/BusyGameHud.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "GameFramework/HUD.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "BusyGameHud.generated.h" | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyGameHud : public AHUD, public ILuaOverriderInterface{ | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	virtual FString GetLuaFilePath_Implementation() const override; | ||||
|  | ||||
| public: | ||||
| 	//UFUNCTION(BlueprintCallable) | ||||
| 	//void PushWidget(const FName& WidgetName); | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	FString LuaFilePath; | ||||
| 	UPROPERTY(EditAnywhere, Category = "UI Class Mapping") | ||||
| 	TMap<FName, TSubclassOf<UUserWidget>> UIClassMapping; | ||||
| }; | ||||
							
								
								
									
										109
									
								
								Source/BusyRabbit/Public/Level/BusyLevelItem.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								Source/BusyRabbit/Public/Level/BusyLevelItem.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,109 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActor.h" | ||||
| #include "Engine/Datatable.h" | ||||
| #include "PaperFlipbookComponent.h" | ||||
| #include "Gas/BusyAttributeSet.h" | ||||
| #include "GameplayTagContainer.h" | ||||
| #include "GameAsset/BusyItem.h" | ||||
| #include "BusyLevelItem.generated.h" | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| enum class EBusyItemEffectType: uint8 { | ||||
| 	Health = 0, | ||||
| 	Hunger = 1, | ||||
| 	Speed = 2, | ||||
| }; | ||||
|  | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| enum class EBusyLevelItemType : uint8 { | ||||
| 	None = 0, | ||||
| 	Collection = 1, | ||||
| 	Building = 2, | ||||
| 	Reward= 3, | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyLevelItemResourceConfig : public FTableRowBase {  // 物品资源表 | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "物品图标资源") | ||||
| 	TObjectPtr<UTexture2D> IconResource; | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "物品静态资源") | ||||
| 	TObjectPtr<UPaperFlipbook> StaticResource; | ||||
| }; | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyLevelItemGenerateConfig { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "每个周期生成物品的数量") | ||||
| 	int CountOfPeriod; | ||||
| }; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyLevelItem : public ALuaActor | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	ABusyLevelItem(); | ||||
|  | ||||
| public: | ||||
| 	virtual void OnConstruction(const FTransform& Transform) override; | ||||
|  | ||||
| 	virtual void BeginPlay() override; | ||||
|  | ||||
| protected: | ||||
| 	void InitCapsule(); | ||||
| 	void InitSprite(); | ||||
| 	void InitPickBar(); | ||||
|  | ||||
| 	void SetItemDisplay(const FName &ItemID); | ||||
|  | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UCapsuleComponent> CapsuleComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class USceneComponent> SceneComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UPaperFlipbookComponent> Sprite; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UBusyAbilitySystemComponent> AbilityComponent;	// 技能组件 | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UWidgetComponent> PickBar; | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditAnyWhere, BlueprintReadOnly) | ||||
| 	FName CurrentItemID; | ||||
|  | ||||
| public:  // 提供给蓝图的接口 | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetLevelItemID(const FName& ItemID); | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	FBusyLevelItemConfig LevelItemConfig; | ||||
|  | ||||
| 	UPROPERTY() | ||||
| 	TObjectPtr<UBusyLevelItemAttributeSet> LevelItemAttribute; | ||||
|  | ||||
| public:  // 需要蓝图实现的函数 | ||||
| 	// LevelItem被设置时的回调 | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveLevelItemSetted(const FBusyLevelItemConfig& Config); | ||||
| }; | ||||
							
								
								
									
										57
									
								
								Source/BusyRabbit/Public/Level/LevelItemReward.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								Source/BusyRabbit/Public/Level/LevelItemReward.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,57 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActor.h" | ||||
| #include "Engine/Datatable.h" | ||||
| #include "GameplayTagContainer.h" | ||||
| #include "Core/BusyLuaActorComponent.h" | ||||
| #include "LevelItemReward.generated.h" | ||||
|  | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FLevelItemRewardConfig : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "道具备注") | ||||
| 	FString Comment; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "物品标签列表") | ||||
| 	FGameplayTagContainer TypeTagContainer; | ||||
| 	 | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "使用后能带来的效果") | ||||
| 	TMap<FGameplayTag, float> GameplayEffects; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ALevelItemReward : public ALuaActor | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	ALevelItemReward(); | ||||
|  | ||||
| public: | ||||
| 	virtual void OnConstruction(const FTransform& Transform) override; | ||||
|  | ||||
|  | ||||
| protected: | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UCapsuleComponent> CapsuleComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class USceneComponent> SceneComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UPaperFlipbookComponent> Sprite; | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetRewardID(const FName& CurrentRewardID); | ||||
|  | ||||
| public: | ||||
| 	UPROPERTY(EditAnyWhere, BlueprintReadOnly) | ||||
| 	FName RewardID; | ||||
| }; | ||||
							
								
								
									
										148
									
								
								Source/BusyRabbit/Public/Role/BusyRole.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										148
									
								
								Source/BusyRabbit/Public/Role/BusyRole.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,148 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "slua.h" | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaPawn.h" | ||||
| #include "Engine/Datatable.h" | ||||
| #include "Gas/BusyAttributeSet.h" | ||||
| #include "AbilitySystemComponent.h" | ||||
| #include "BusyRole.generated.h" | ||||
|  | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| enum class EBusyRoleState : uint8{ | ||||
| 	BonfireIdle,	// 篝火旁闲置 | ||||
| 	Searching,		// 外出搜索物品 | ||||
| 	Picking,		// 正在与物品交互 | ||||
| 	PickFinished,	// 与物品交互完毕 | ||||
| 	BackBonfire,	// 返回篝火  | ||||
| }; | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyRoleConfig : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色的生命值") | ||||
| 	int32 Health; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色的饥饿值") | ||||
| 	int32 Hunger; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色饥饿值消耗速度") | ||||
| 	int HungerConsumeSpeed; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色生命值消耗速度") | ||||
| 	int HealthConsumeSpeed; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色的采集效率") | ||||
| 	int PickEffect; | ||||
| 	 | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色的移动速度") | ||||
| 	int MoveSpeed; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色的技能列表") | ||||
| 	TArray<TSubclassOf<UGameplayAbility>> DefaultAbilities; | ||||
| }; | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyRoleResourceConfig : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "角色头像图标") | ||||
| 	int32 Health; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API ABusyRole : public ALuaPawn{ | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	ABusyRole(); | ||||
| 	virtual void BeginPlay()override; | ||||
| 	virtual void Tick(float InDeltaSeconds)override; | ||||
|  | ||||
|  | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class USceneComponent> SceneComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class USpringArmComponent> SpringArmComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UCapsuleComponent> CapsuleComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UBusyCameraComponent> CameraComp; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UPaperFlipbookComponent> Sprite; | ||||
| 	 | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UBusyRoleMovement> Movement;  // 移动组件 | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UPW_AbilitySystemComponent> RoleAbility;	// 技能组件 | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) | ||||
| 	TObjectPtr<class UInventoryComponent> Inventory;  // 仓库组件 | ||||
|  | ||||
| 	UPROPERTY(BlueprintReadWrite) | ||||
| 	TObjectPtr<class URoleAnimation> RoleAnimation; | ||||
|  | ||||
| public:  // 蓝图接口 | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetRole(const FName& Name); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void TryActiveAbility(const FName& TagName, const FGameplayEventData& EventData); | ||||
|  | ||||
| public: | ||||
| 	// 输入相关 | ||||
| 	UPROPERTY(EditDefaultsOnly, Category = "Input") | ||||
| 	TObjectPtr<class UInputMappingContext> InputMapping; | ||||
|  | ||||
| 	UPROPERTY(EditDefaultsOnly, Category = "Input") | ||||
| 	TObjectPtr<class UInputAction> TouchAction; | ||||
|  | ||||
| 	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)override; | ||||
|  | ||||
| protected: | ||||
| 	void InitCapsule(); | ||||
|  | ||||
| public: // 蓝图实现 | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void OnTouch(const FInputActionValue& Value) const; | ||||
|  | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void OnOverlapBegin( | ||||
| 		UPrimitiveComponent* OverlappedComp, | ||||
| 		AActor* OtherActor, | ||||
| 		UPrimitiveComponent* OtherComp, | ||||
| 		int32 OtherBodyIndex, | ||||
| 		bool bFromSweep, | ||||
| 		const FHitResult& SweepResult | ||||
| 	); | ||||
|  | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveSetRole(const FBusyRoleConfig& RoleTableConfig); | ||||
|  | ||||
| protected: | ||||
| 	FTimerHandle TimerHandle; | ||||
|  | ||||
| public:  // 角色属性 | ||||
| 	UPROPERTY(BlueprintReadOnly) | ||||
| 	FName RoleName; | ||||
| 	UPROPERTY(BlueprintReadOnly, Category = "Value") | ||||
| 	FBusyRoleConfig RoleConfig; | ||||
|  | ||||
| private: | ||||
| 	UPROPERTY() | ||||
| 	TObjectPtr<UBusyRoleAttributeSet> RoleAttribute; | ||||
|  | ||||
| public:  // 不暴露给蓝图的属性 | ||||
|  | ||||
| }; | ||||
							
								
								
									
										40
									
								
								Source/BusyRabbit/Public/Role/BusyRoleMovement.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Source/BusyRabbit/Public/Role/BusyRoleMovement.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaOverriderInterface.h" | ||||
| #include "LuaActorComponent.h" | ||||
| #include "GameFramework/MovementComponent.h" | ||||
| #include "BusyRoleMovement.generated.h" | ||||
|  | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| enum class ERoleMoveDirection: uint8 { | ||||
| 	Move_Right,		// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD> | ||||
| 	Move_Left,		// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD> | ||||
| 	Move_All_Cnt	// ö<><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API UBusyRoleMovement : public ULuaActorComponent | ||||
| 	//class BUSYRABBIT_API UBusyRoleMovement : public UObject, public ILuaOverriderInterface | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| public: | ||||
| 	UBusyRoleMovement(); | ||||
| public: | ||||
| 	virtual void BeginPlay()override; | ||||
|  | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveComponentTick(float DeltaTime); | ||||
|  | ||||
| 	UFUNCTION(BlueprintImplementableEvent) | ||||
| 	void ReceiveComponentBeginPlay(); | ||||
|  | ||||
| 	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)override; | ||||
| }; | ||||
							
								
								
									
										77
									
								
								Source/BusyRabbit/Public/Role/RoleAnimation.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								Source/BusyRabbit/Public/Role/RoleAnimation.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,77 @@ | ||||
| // Fill out your copyright notice in the Description page of Project Settings. | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include "CoreMinimal.h" | ||||
| #include "LuaActorComponent.h" | ||||
| #include "Engine/Datatable.h" | ||||
| #include "PaperFlipbookComponent.h" | ||||
| #include "BusyRoleMovement.h" | ||||
| #include "../Core/BusyLuaActorComponent.h" | ||||
| #include "RoleAnimation.generated.h" | ||||
|  | ||||
| DECLARE_LOG_CATEGORY_EXTERN(LogRoleAnimation, Log, All); | ||||
|  | ||||
| UENUM(BlueprintType) | ||||
| enum class EBusyAnimationPhase : uint8{ | ||||
| 	PrepareCast,	// 动作前摇阶段 | ||||
| 	Casting,		// 动作释放阶段 | ||||
| 	PostCast,		// 动作后摇阶段 | ||||
| }; | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyAnimationPhaseData : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "各个阶段的动作") | ||||
| 	TMap<EBusyAnimationPhase, UPaperFlipbook*> PhaseAnimation; | ||||
| }; | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyRolePickingAnimationData : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "各个方向的采集动作") | ||||
| 	TMap<ERoleMoveDirection, FBusyAnimationPhaseData> DirectionAnimations; | ||||
| }; | ||||
|  | ||||
| USTRUCT(BlueprintType) | ||||
| struct FBusyRoleAnimationData : public FTableRowBase { | ||||
| 	GENERATED_BODY() | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "移动时的动作") | ||||
| 	TMap<ERoleMoveDirection, UPaperFlipbook*> MoveAnimations; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "静止时的动作") | ||||
| 	TMap<ERoleMoveDirection, UPaperFlipbook*> IdleAnimations; | ||||
|  | ||||
| 	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "采集物品时的动作") | ||||
| 	TMap<FName, FBusyRolePickingAnimationData> PickingAnimations; | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  */ | ||||
| UCLASS() | ||||
| class BUSYRABBIT_API URoleAnimation : public UBusyLuaActorComponent | ||||
| { | ||||
| 	GENERATED_BODY() | ||||
| public: | ||||
| 	URoleAnimation(); | ||||
|  | ||||
| public: | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetMoveAnimation(ERoleMoveDirection direction); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void SetIdleAnimation(ERoleMoveDirection direction); | ||||
|  | ||||
| 	UFUNCTION(BlueprintCallable) | ||||
| 	void PlayPickAnimation(const FName& ItemName, ERoleMoveDirection Direction, EBusyAnimationPhase Phase, float PlayRate); | ||||
|  | ||||
| protected: | ||||
| 	bool GetOwnerRoleInfo(UPaperFlipbookComponent* &Sprite, FBusyRoleAnimationData* &AnimationData); | ||||
|  | ||||
| 	// 设置表格里面的动作 | ||||
| 	void SetRoleAnimation(UPaperFlipbookComponent* Sprite, UPaperFlipbook** Anim); | ||||
| 	 | ||||
| 	void PlayAnimationOnce(UPaperFlipbookComponent* Sprite, UPaperFlipbook** Anim, float PlayRate); | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user