第一次提交

This commit is contained in:
不明不惑
2026-03-03 01:23:02 +08:00
commit 3e434877e8
1053 changed files with 102411 additions and 0 deletions

View File

@@ -0,0 +1,221 @@
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GMS_SettingStructLibrary.h"
#include "UObject/Object.h"
#include "Engine/DataAsset.h"
#include "Runtime/Launch/Resources/Version.h"
#if ENGINE_MINOR_VERSION < 5
#include "InstancedStruct.h"
#else
#include "StructUtils/InstancedStruct.h"
#endif
#include "Utility/GMS_Tags.h"
#include "GMS_SettingObjectLibrary.generated.h"
#pragma region CommonSettings
class UGMS_AnimLayer;
class UGMS_AnimLayerSetting;
/**
* Defines multiple movement set settings for a character.
* 定义角色的多个运动集设置。
*/
UCLASS(BlueprintType, Const)
class GENERICMOVEMENTSYSTEM_API UGMS_MovementDefinition : public UDataAsset
{
GENERATED_BODY()
public:
/**
* Map of gameplay tags to movement set settings.
* 游戏标签到运动集设置的映射。
*/
UPROPERTY(EditAnywhere, Category="GMS", meta=(ForceInlineRow))
TMap<FGameplayTag, FGMS_MovementSetSetting> MovementSets;
#if WITH_EDITOR
/**
* Called before saving the asset in the editor.
* 在编辑器中保存资产前调用。
* @param SaveContext The save context. 保存上下文。
*/
virtual void PreSave(FObjectPreSaveContext SaveContext) override;
/**
* Validates data in the editor.
* 在编辑器中验证数据。
* @param Context The validation context. 验证上下文。
* @return The validation result. 验证结果。
*/
virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override;
#endif
};
/**
* Stores animation graph-specific settings, one per unique skeleton.
* 存储动画图特定的设置,每个唯一骨架一个。
*/
UCLASS()
class GENERICMOVEMENTSYSTEM_API UGMS_AnimGraphSetting : public UDataAsset
{
GENERATED_BODY()
public:
/**
* Maps animation layer settings to their corresponding animation layer implementations.
* 将动画层设置映射到对应的动画层实现。
* @note Add custom animation layer settings/implementations to this mapping. 将自定义动画层设置/实现添加到此映射。
*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Settings")
TMap<TSubclassOf<UGMS_AnimLayerSetting>, TSubclassOf<UGMS_AnimLayer>> AnimLayerSettingToInstanceMapping;
/**
* Settings for orientation warping.
* 朝向扭曲的设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Settings")
FGMS_OrientationWarpingSettings OrientationWarping;
};
#pragma endregion
#pragma region ControlSettings
/**
* Default Movement control settings.
* 默认运动控制设置。
*/
UCLASS(BlueprintType, Blueprintable, Const, DisplayName="GMS Movement Control Setting")
class GENERICMOVEMENTSYSTEM_API UGMS_MovementControlSetting_Default : public UDataAsset
{
GENERATED_BODY()
public:
/**
* Matches a speed to a movement state tag based on a threshold.
* 根据阈值将速度匹配到运动状态标签。
* @param Speed The current speed. 当前速度。
* @param Threshold The speed threshold. 速度阈值。
* @return The matching gameplay tag. 匹配的游戏标签。
*/
FGameplayTag MatchStateTagBySpeed(float Speed, float Threshold) const;
/**
* Gets a movement state setting by index.
* 通过索引获取运动状态设置。
* @param Index The index of the state. 状态索引。
* @param OutSetting The output movement state setting. 输出的运动状态设置。
* @return True if found. 如果找到返回true。
*/
bool GetStateByIndex(const int32& Index, FGMS_MovementStateSetting& OutSetting) const;
/**
* Gets a movement state setting by speed level.
* 通过速度级别获取运动状态设置。
* @param Level The speed level. 速度级别。
* @param OutSetting The output movement state setting. 输出的运动状态设置。
* @return True if found. 如果找到返回true。
*/
bool GetStateBySpeedLevel(const int32& Level, FGMS_MovementStateSetting& OutSetting) const;
/**
* Gets a movement state setting by tag.
* 通过标签获取运动状态设置。
* @param Tag The gameplay tag. 游戏标签。
* @param OutSetting The output movement state setting. 输出的运动状态设置。
* @return True if found. 如果找到返回true。
*/
bool GetStateByTag(const FGameplayTag& Tag, FGMS_MovementStateSetting& OutSetting) const;
const FGMS_MovementStateSetting* GetMovementStateSetting(const FGameplayTag& Tag) const;
const FGMS_MovementStateSetting* GetMovementStateSetting(const FGameplayTag& Tag, bool bHasFallback) const;
/**
* Speed threshold for determining movement.
* 确定移动的速度阈值。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Control", Meta = (ClampMin = 0, ForceUnits = "cm/s"))
float MovingSpeedThreshold{50.0f};
/**
* Array of movement states, sorted by speed.
* 按速度排序的运动状态数组。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Control", meta=(TitleProperty="EditorFriendlyName"))
TArray<FGMS_MovementStateSetting> MovementStates;
/**
* Setting for velocity based rotation mode.
* 基于速率的旋转模式设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="RotationControl", meta=(ExcludeBaseStruct))
TInstancedStruct<FGMS_VelocityDirectionSetting_Base> VelocityDirectionSetting;
/**
* Setting for view based rotation mode.
* 基于视角的旋转模式设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="RotationControl")
TInstancedStruct<FGMS_ViewDirectionSetting_Base> ViewDirectionSetting;
/**
* Rotation mode when in air.
* 空中时的旋转模式。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="RotationControl")
EGMS_InAirRotationMode InAirRotationMode{EGMS_InAirRotationMode::KeepRelativeRotation};
/**
* Interpolation speed for in-air rotation.
* 空中旋转的插值速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="RotationControl", meta=(ClampMin=0))
float InAirRotationInterpolationSpeed = 5.0f;
/**
* Maps speed levels to movement state indices.
* 将速度级别映射到运动状态索引。
*/
UPROPERTY(EditAnywhere, Category="Advanced", meta=(EditCondition=false, ForceInlineRow))
TMap<int32, int32> SpeedLevelToArrayIndex;
#if WITH_EDITORONLY_DATA
float MigrateRotationInterpolationSpeed(float Old);
/**
* Called before saving the asset in the editor.
* 在编辑器中保存资产前调用。
* @param SaveContext The save context. 保存上下文。
*/
virtual void PreSave(FObjectPreSaveContext SaveContext) override;
/**
* Validates data in the editor.
* 在编辑器中验证数据。
* @param Context The validation context. 验证上下文。
* @return The validation result. 验证结果。
*/
virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override;
#endif
};
#pragma endregion
#pragma region AnimSettings
/**
* Base class for custom movement set user settings.
* 自定义运动集用户设置的基类。
* @note Subclass to add custom settings without modifying movement set settings. 子类化以添加自定义设置,而无需修改运动集设置。
*/
UCLASS(BlueprintType, Blueprintable, Abstract, Const, EditInlineNew, DefaultToInstanced)
class GENERICMOVEMENTSYSTEM_API UGMS_MovementSetUserSetting : public UObject
{
GENERATED_BODY()
};
#pragma endregion