83 lines
2.1 KiB
C++
83 lines
2.1 KiB
C++
// 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<int32> RemovedIndices, int32 FinalSize);
|
|
|
|
|
|
void PostReplicatedAdd(const TArrayView<int32> AddedIndices, int32 FinalSize);
|
|
|
|
void PostReplicatedChange(const TArrayView<int32> ChangedIndices, int32 FinalSize);
|
|
//~End of FFastArraySerializer contract
|
|
|
|
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
|
|
{
|
|
return FastArrayDeltaSerialize<FGCS_BulletEntry, FGCS_BulletContainer>(Entries, DeltaParms, *this);
|
|
}
|
|
|
|
|
|
int32 IndexOfById(const FGuid& Id) const;
|
|
|
|
UPROPERTY(VisibleAnywhere, Category="BulletSystem", meta=(ShowOnlyInnerProperties, DisplayName="Bullets"))
|
|
TArray<FGCS_BulletEntry> Entries;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<UGCS_BulletSystemComponent> OwningComponent;
|
|
};
|
|
|
|
template <>
|
|
struct TStructOpsTypeTraits<FGCS_BulletContainer> : TStructOpsTypeTraitsBase2<FGCS_BulletContainer>
|
|
{
|
|
enum { WithNetDeltaSerializer = true };
|
|
};
|