refactor: prefixo ZMMO -> Zeus em classes/módulos C++ do cliente
- Renomeia ~50 classes UCLASS/USTRUCT/UENUM/UINTERFACE pra Zeus* (AZeusGameMode, AZeusCharacter, UZeusGameInstance, IZeusEntityInterface, UZeusWorldSubsystem, FZeusEntitySnapshot, etc.) - Encurta AZMMOPlayerCharacter -> AZeusCharacter - Renomeia módulos satélite ZMMOAttributes -> ZeusAttributes e ZMMOJobs -> ZeusJobs (pasta + .Build.cs + .uproject) - Mantém módulo principal ZMMO (renomeia depois quando jogo ganhar nome) - DefaultEngine.ini: ActiveClassRedirects ZMMOX -> ZeusX (preserva BPs/assets) - DefaultGame.ini: sections atualizadas pra ZeusThemeSubsystem/ZeusPlayerState - Category="ZMMO|..." -> "Zeus|..." em UPROPERTYs - Preserva LogZMMO, ZMMO_API, /Script/ZMMO., /Game/ZMMO/, classes Target Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
55
Source/ZeusAttributes/Private/ZeusAttributeComponent.cpp
Normal file
55
Source/ZeusAttributes/Private/ZeusAttributeComponent.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "ZeusAttributeComponent.h"
|
||||
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "ZeusNetworkSubsystem.h"
|
||||
|
||||
UZeusAttributeComponent::UZeusAttributeComponent()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = false;
|
||||
}
|
||||
|
||||
void UZeusAttributeComponent::ApplySnapshot(const FZeusAttributesSnapshot& InSnapshot)
|
||||
{
|
||||
const int32 OldHp = Current.Hp;
|
||||
const int32 OldSp = Current.Sp;
|
||||
Current = InSnapshot;
|
||||
OnAttributesChanged.Broadcast(Current);
|
||||
if (OldHp != Current.Hp || OldSp != Current.Sp)
|
||||
{
|
||||
OnHpSpChanged.Broadcast(Current.Hp, Current.Sp);
|
||||
}
|
||||
}
|
||||
|
||||
void UZeusAttributeComponent::ApplyHpSpUpdate(int32 NewHp, int32 NewSp)
|
||||
{
|
||||
if (Current.Hp == NewHp && Current.Sp == NewSp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Current.Hp = NewHp;
|
||||
Current.Sp = NewSp;
|
||||
OnHpSpChanged.Broadcast(Current.Hp, Current.Sp);
|
||||
}
|
||||
|
||||
void UZeusAttributeComponent::NotifyLevelUp(int32 NewBaseLevel, int32 StatusPointDelta)
|
||||
{
|
||||
// O snapshot subsequente vai trazer todos os outros campos atualizados —
|
||||
// aqui apenas dispara o delegate para efeitos visuais imediatos.
|
||||
OnLevelUp.Broadcast(NewBaseLevel, StatusPointDelta);
|
||||
}
|
||||
|
||||
void UZeusAttributeComponent::NotifyStatAllocReply(bool bAccepted, int32 Reason)
|
||||
{
|
||||
OnStatAllocReply.Broadcast(bAccepted, Reason);
|
||||
}
|
||||
|
||||
void UZeusAttributeComponent::RequestStatAlloc(int32 StatId, int32 Amount)
|
||||
{
|
||||
UWorld* World = GetWorld();
|
||||
if (!World) { return; }
|
||||
UGameInstance* GI = World->GetGameInstance();
|
||||
if (!GI) { return; }
|
||||
UZeusNetworkSubsystem* Net = GI->GetSubsystem<UZeusNetworkSubsystem>();
|
||||
if (!Net) { return; }
|
||||
Net->SendStatAlloc(StatId, Amount);
|
||||
}
|
||||
Reference in New Issue
Block a user