// Copyright Epic Games, Inc. All Rights Reserved. #include "LyraVerbMessageReplication.h" #include "GameFramework/GameplayMessageSubsystem.h" #include "Messages/LyraVerbMessage.h" #include "Misc/AssertionMacros.h" ////////////////////////////////////////////////////////////////////// // FLyraVerbMessageReplicationEntry FString FLyraVerbMessageReplicationEntry::GetDebugString() const { return Message.ToString(); } ////////////////////////////////////////////////////////////////////// // FLyraVerbMessageReplication void FLyraVerbMessageReplication::AddMessage(const FLyraVerbMessage& Message) { FLyraVerbMessageReplicationEntry& NewStack = CurrentMessages.Emplace_GetRef(Message); MarkItemDirty(NewStack); } void FLyraVerbMessageReplication::PreReplicatedRemove(const TArrayView RemovedIndices, int32 FinalSize) { // for (int32 Index : RemovedIndices) // { // const FGameplayTag Tag = CurrentMessages[Index].Tag; // TagToCountMap.Remove(Tag); // } } void FLyraVerbMessageReplication::PostReplicatedAdd(const TArrayView AddedIndices, int32 FinalSize) { for (int32 Index : AddedIndices) { const FLyraVerbMessageReplicationEntry& Entry = CurrentMessages[Index]; RebroadcastMessage(Entry.Message); } } void FLyraVerbMessageReplication::PostReplicatedChange(const TArrayView ChangedIndices, int32 FinalSize) { for (int32 Index : ChangedIndices) { const FLyraVerbMessageReplicationEntry& Entry = CurrentMessages[Index]; RebroadcastMessage(Entry.Message); } } void FLyraVerbMessageReplication::RebroadcastMessage(const FLyraVerbMessage& Message) { check(Owner); UGameplayMessageSubsystem& MessageSystem = UGameplayMessageSubsystem::Get(Owner); MessageSystem.BroadcastMessage(Message.Verb, Message); }