Files
PHY/Plugins/GIS/Source/GenericInventorySystem/Private/Exchange/GIS_CurrencyContainer.cpp
2026-03-03 01:23:02 +08:00

47 lines
1.2 KiB
C++

// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#include "GIS_CurrencyContainer.h"
#include "GIS_CurrencySystemComponent.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(GIS_CurrencyContainer)
void FGIS_CurrencyContainer::PreReplicatedRemove(const TArrayView<int32> RemovedIndices, int32 FinalSize)
{
for (int32 Index : RemovedIndices)
{
FGIS_CurrencyEntry& Entry = Entries[Index];
if (OwningComponent)
{
OwningComponent->OnCurrencyEntryRemoved(Entry, Index);
}
Entry.PrevAmount = 0;
}
}
void FGIS_CurrencyContainer::PostReplicatedAdd(const TArrayView<int32> AddedIndices, int32 FinalSize)
{
for (int32 Index : AddedIndices)
{
FGIS_CurrencyEntry& Entry = Entries[Index];
if (OwningComponent)
{
OwningComponent->OnCurrencyEntryAdded(Entry, Index);
}
Entry.PrevAmount = Entry.Amount;
}
}
void FGIS_CurrencyContainer::PostReplicatedChange(const TArrayView<int32> ChangedIndices, int32 FinalSize)
{
for (int32 Index : ChangedIndices)
{
FGIS_CurrencyEntry& Entry = Entries[Index];
if (OwningComponent)
{
OwningComponent->OnCurrencyEntryUpdated(Entry, Index, Entry.PrevAmount, Entry.Amount);
}
Entry.PrevAmount = Entry.Amount;
}
}