// Copyright 2025 https://yuewu.dev/en All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "GameplayTagContainer.h" #include "GCS_BulletStructLibrary.h" #include "Net/Serialization/FastArraySerializer.h" #include "UObject/Object.h" #include "GCS_BulletContainer.generated.h" struct FGCS_BulletContainer; class UGCS_BulletSystemComponent; /** * Structure representing an equipment entry in the container. * 表示容器中装备条目的结构体。 * @note WIP */ USTRUCT(BlueprintType) struct GENERICCOMBATSYSTEM_API FGCS_BulletEntry : public FFastArraySerializerItem { GENERATED_BODY() friend FGCS_BulletContainer; //The request id of this entry. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS") FGuid Id; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GCS") FGCS_BulletSpawnParameters SpawnParameters; }; /** * Container for a list of applied equipment. * 存储已应用装备列表的容器。 */ USTRUCT() struct GENERICCOMBATSYSTEM_API FGCS_BulletContainer : public FFastArraySerializer { GENERATED_BODY() FGCS_BulletContainer() : OwningComponent(nullptr) { } FGCS_BulletContainer(UGCS_BulletSystemComponent* InComponent) : OwningComponent(InComponent) { } void PreReplicatedRemove(const TArrayView RemovedIndices, int32 FinalSize); void PostReplicatedAdd(const TArrayView AddedIndices, int32 FinalSize); void PostReplicatedChange(const TArrayView ChangedIndices, int32 FinalSize); //~End of FFastArraySerializer contract bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms) { return FastArrayDeltaSerialize(Entries, DeltaParms, *this); } int32 IndexOfById(const FGuid& Id) const; UPROPERTY(VisibleAnywhere, Category="BulletSystem", meta=(ShowOnlyInnerProperties, DisplayName="Bullets")) TArray Entries; UPROPERTY() TObjectPtr OwningComponent; }; template <> struct TStructOpsTypeTraits : TStructOpsTypeTraitsBase2 { enum { WithNetDeltaSerializer = true }; };