Compare commits
12 Commits
feat/ui-sy
...
9422522d6d
| Author | SHA1 | Date | |
|---|---|---|---|
| 9422522d6d | |||
| c3b32bc1a1 | |||
| cda5fea776 | |||
| 16de963301 | |||
| 8d73cc9df8 | |||
| d5402216a2 | |||
| ff75ad92eb | |||
| 98dce2f855 | |||
| 94442feca5 | |||
| 6a6a28a086 | |||
| bd1dab25ca | |||
| 477574f842 |
@@ -2,9 +2,9 @@
|
||||
GameDefaultMap=/Game/ZMMO/Maps/FrontEnd/L_FrontEnd.L_FrontEnd
|
||||
EditorStartupMap=/Game/ZMMO/Maps/FrontEnd/L_FrontEnd.L_FrontEnd
|
||||
; GameMode/PlayerController/PlayerCharacter agora moram em C++ (Game/Modes/Entity/Controller).
|
||||
; O motor pode spawnar AZMMOGameMode directamente; um BP filho continua opcional.
|
||||
GlobalDefaultGameMode=/Script/ZMMO.ZMMOGameMode
|
||||
GameInstanceClass=/Script/ZMMO.ZMMOGameInstance
|
||||
; O motor pode spawnar AZeusGameMode directamente; um BP filho continua opcional.
|
||||
GlobalDefaultGameMode=/Script/ZMMO.ZeusGameMode
|
||||
GameInstanceClass=/Script/ZMMO.ZeusGameInstance
|
||||
|
||||
[/Script/Engine.RendererSettings]
|
||||
r.ReflectionMethod=1
|
||||
@@ -80,12 +80,30 @@ GameViewportClientClassName=/Script/CommonUI.CommonGameViewportClient
|
||||
+ActiveGameNameRedirects=(OldGameName="TP_ThirdPerson",NewGameName="/Script/ZMMO")
|
||||
+ActiveGameNameRedirects=(OldGameName="/Script/TP_ThirdPerson",NewGameName="/Script/ZMMO")
|
||||
; Redirects do template antigo para a nova arquitectura (Game/Modes/Entity/Controller).
|
||||
; ZMMOCharacter foi reescrito como ZMMOPlayerCharacter (ACharacter local com CMC livre).
|
||||
+ActiveClassRedirects=(OldClassName="TP_ThirdPersonPlayerController",NewClassName="ZMMOPlayerController")
|
||||
+ActiveClassRedirects=(OldClassName="TP_ThirdPersonGameMode",NewClassName="ZMMOGameMode")
|
||||
+ActiveClassRedirects=(OldClassName="TP_ThirdPersonCharacter",NewClassName="ZMMOPlayerCharacter")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOCharacter",NewClassName="ZMMOPlayerCharacter")
|
||||
|
||||
; Pipeline: TP_ThirdPerson* -> ZMMO* (legado) -> Zeus* (atual). Os redirects de
|
||||
; ZMMO*->Zeus* preservam asset/BP refs criadas durante o periodo ZMMO* (Batches 1-3).
|
||||
+ActiveClassRedirects=(OldClassName="TP_ThirdPersonPlayerController",NewClassName="ZeusPlayerController")
|
||||
+ActiveClassRedirects=(OldClassName="TP_ThirdPersonGameMode",NewClassName="ZeusGameMode")
|
||||
+ActiveClassRedirects=(OldClassName="TP_ThirdPersonCharacter",NewClassName="ZeusCharacter")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOCharacter",NewClassName="ZeusCharacter")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOPlayerCharacter",NewClassName="ZeusCharacter")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOPlayerController",NewClassName="ZeusPlayerController")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOFrontEndPlayerController",NewClassName="ZeusFrontEndPlayerController")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOGameMode",NewClassName="ZeusGameMode")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOFrontEndGameMode",NewClassName="ZeusFrontEndGameMode")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOGameInstance",NewClassName="ZeusGameInstance")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOHUD",NewClassName="ZeusHUD")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOPlayerState",NewClassName="ZeusPlayerState")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOEntity",NewClassName="ZeusEntity")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOPlayerProxy",NewClassName="ZeusPlayerProxy")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOProxyMovementComponent",NewClassName="ZeusProxyMovementComponent")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOWorldSubsystem",NewClassName="ZeusWorldSubsystem")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOThemeDataAsset",NewClassName="ZeusThemeDataAsset")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOThemeSubsystem",NewClassName="ZeusThemeSubsystem")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOLoginSaveGame",NewClassName="ZeusLoginSaveGame")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOHudWidget",NewClassName="ZeusHudWidget")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOHudPlayerVitalsWidget",NewClassName="ZeusHudPlayerVitalsWidget")
|
||||
+ActiveClassRedirects=(OldClassName="ZMMOLoadingProfilesDataAsset",NewClassName="ZeusLoadingProfilesDataAsset")
|
||||
[CoreRedirects]
|
||||
; Migração v1→v2 do FUIStylePanel: TMap<EUIPanelTexture,...> (Enum) → TMap<FName,...>.
|
||||
; Os campos *_DEPRECATED preservam a leitura do asset antigo; PostSerialize copia
|
||||
@@ -95,6 +113,27 @@ GameViewportClientClassName=/Script/CommonUI.CommonGameViewportClient
|
||||
+PropertyRedirects=(OldName="/Script/ZMMO.UIStylePanel.PanelOutline",NewName="/Script/ZMMO.UIStylePanel.PanelOutline_DEPRECATED")
|
||||
+PropertyRedirects=(OldName="/Script/ZMMO.UIStylePanel.PanelOutlineEffect",NewName="/Script/ZMMO.UIStylePanel.PanelOutlineEffect_DEPRECATED")
|
||||
|
||||
; --- M7: Modulo cliente "ZMMOJobs" foi renomeado pra "ZeusJobs" + classe
|
||||
; UZMMOJobDataAsset -> UZeusJobDataAsset. Os 7 DA_Job_* em /Game/ZMMO/Data/Jobs/
|
||||
; foram salvos apontando pra /Script/ZMMOJobs.ZMMOJobDataAsset (modulo + classe
|
||||
; antigos). ActiveClassRedirects so' troca o NOME da classe, nao o package;
|
||||
; precisamos de CoreRedirects com path completo + PackageRedirect.
|
||||
+PackageRedirects=(OldName="/Script/ZMMOJobs",NewName="/Script/ZeusJobs")
|
||||
+ClassRedirects=(OldName="/Script/ZMMOJobs.ZMMOJobDataAsset",NewName="/Script/ZeusJobs.ZeusJobDataAsset")
|
||||
|
||||
; --- M7: USTRUCTs renomeadas (mesmo modulo ZMMO). DTs salvos com Row Structure
|
||||
; apontando pro nome antigo (ZMMOMapDef, ZMMOLoadingTipRow). USTRUCT usa
|
||||
; +StructRedirects (nao +ClassRedirects).
|
||||
+StructRedirects=(OldName="/Script/ZMMO.ZMMOMapDef",NewName="/Script/ZMMO.ZeusMapDef")
|
||||
+StructRedirects=(OldName="/Script/ZMMO.ZMMOLoadingTipRow",NewName="/Script/ZMMO.ZeusLoadingTipRow")
|
||||
; DA_LoadingProfiles salvo com TMap<EZMMOLoadingContext, FZMMOLoadingProfile>;
|
||||
; FZMMOLoadingProfile contem TArray<FZMMOLoadingStepDef>. Precisa de 3 redirects
|
||||
; (1 enum + 2 struct) pra carregar sem warnings nem perda de dados.
|
||||
+EnumRedirects=(OldName="/Script/ZMMO.EZMMOLoadingContext",NewName="/Script/ZMMO.EZeusLoadingContext")
|
||||
+EnumRedirects=(OldName="/Script/ZMMO.EZMMOLoadingStepStatus",NewName="/Script/ZMMO.EZeusLoadingStepStatus")
|
||||
+StructRedirects=(OldName="/Script/ZMMO.ZMMOLoadingProfile",NewName="/Script/ZMMO.ZeusLoadingProfile")
|
||||
+StructRedirects=(OldName="/Script/ZMMO.ZMMOLoadingStepDef",NewName="/Script/ZMMO.ZeusLoadingStepDef")
|
||||
|
||||
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
|
||||
bEnablePlugin=True
|
||||
bAllowNetworkConnection=True
|
||||
|
||||
@@ -3,10 +3,10 @@ ProjectID=FC3E256F43B2AFD43009F4949B0814BE
|
||||
ProjectName=Third Person Game Template
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; ZMMO Theme subsystem (see Source/ZMMO/Game/UI/ZMMOThemeSubsystem.h and
|
||||
; ZMMO Theme subsystem (see Source/ZMMO/Game/UI/ZeusThemeSubsystem.h and
|
||||
; ARQUITETURA.md §1.10 / §4.7).
|
||||
;
|
||||
; - DefaultThemeAsset is the fallback theme (must define every EZMMOThemeKey).
|
||||
; - DefaultThemeAsset is the fallback theme (must define every EZeusThemeKey).
|
||||
; - ThemeRegistry maps ThemeId -> seasonal DA_Theme_* asset.
|
||||
; - CalendarTable points to DT_ThemeCalendar (FThemeCalendarRow rows).
|
||||
; - UIStyleTable points to DT_UI_Styles (FUIStyleRow rows): tokens de estilo
|
||||
@@ -18,7 +18,7 @@ ProjectName=Third Person Game Template
|
||||
; assets are actually created in the editor.
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
[/Script/ZMMO.ZMMOThemeSubsystem]
|
||||
[/Script/ZMMO.ZeusThemeSubsystem]
|
||||
;DefaultThemeAsset=/Game/ZMMO/UI/Themes/DA_Theme_Default.DA_Theme_Default
|
||||
;+ThemeRegistry=(("Christmas", "/Game/ZMMO/UI/Themes/DA_Theme_Christmas.DA_Theme_Christmas"))
|
||||
;+ThemeRegistry=(("Halloween", "/Game/ZMMO/UI/Themes/DA_Theme_Halloween.DA_Theme_Halloween"))
|
||||
@@ -33,20 +33,20 @@ ScreenSetAsset=/Game/ZMMO/UI/FrontEnd/DA_FrontEndScreenSet.DA_FrontEndScreenSet
|
||||
|
||||
; Fase 4 — char spawn DB-driven. DT_Maps espelha o `maps_config.json` do
|
||||
; server (Server/ZeusServerEngine/Config/DataTables/maps_config.json) — o
|
||||
; cliente resolve `mapId -> ClientLevel/spawns` via FZMMOMapDef rows.
|
||||
; cliente resolve `mapId -> ClientLevel/spawns` via FZeusMapDef rows.
|
||||
MapsTableAsset=/Game/ZMMO/Data/World/DT_Maps.DT_Maps
|
||||
|
||||
; Loading dinâmico (etapas + dicas). DA_LoadingProfiles tem 1 perfil por
|
||||
; contexto (EZMMOLoadingContext); DT_LoadingTips rotaciona durante o load.
|
||||
; contexto (EZeusLoadingContext); DT_LoadingTips rotaciona durante o load.
|
||||
; Cliente local marca etapas via eventos (sem opcode novo).
|
||||
LoadingProfilesAsset=/Game/ZMMO/Data/UI/Loading/DA_LoadingProfiles.DA_LoadingProfiles
|
||||
LoadingTipsAsset=/Game/ZMMO/Data/UI/Loading/DT_LoadingTips.DT_LoadingTips
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; UI in-game (PR 19+). Espelho do front-end pattern:
|
||||
; - ScreenSetAsset mapeia EZMMOInGameUIState -> WBP (Playing -> WBP_HUD,
|
||||
; - ScreenSetAsset mapeia EZeusInGameUIState -> WBP (Playing -> WBP_HUD,
|
||||
; StatusWindow -> WBP_StatusWindow, etc.)
|
||||
; - Subsystem orquestra: AZMMOHUD::BeginPlay chama StartInGame que vai pra
|
||||
; - Subsystem orquestra: AZeusHUD::BeginPlay chama StartInGame que vai pra
|
||||
; Playing.
|
||||
; Asset criado via MCP em /Game/ZMMO/UI/InGame/DA_InGameScreenSet.
|
||||
; -----------------------------------------------------------------------------
|
||||
@@ -56,16 +56,27 @@ ScreenSetAsset=/Game/ZMMO/UI/InGame/DA_InGameScreenSet.DA_InGameScreenSet
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; PlayerState Component Registry (PR 19+). Cada módulo MMO registra seus
|
||||
; UActorComponent aqui. O AZMMOPlayerState lê esta lista no construtor e
|
||||
; UActorComponent aqui. O AZeusPlayerState lê esta lista no construtor e
|
||||
; instancia cada classe como subobject — pattern Open-Closed: adicionar
|
||||
; Inventory/Skills/Guild = mais uma linha aqui, sem editar AZMMOPlayerState.
|
||||
; Inventory/Skills/Guild = mais uma linha aqui, sem editar AZeusPlayerState.
|
||||
;
|
||||
; Convenção: usa o path /Script/<Module>.<ClassName> (sem o "U" do prefixo
|
||||
; C++; UClass resolve pelo nome curto).
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
[/Script/ZMMO.ZMMOPlayerState]
|
||||
+ComponentClasses=/Script/ZMMOAttributes.ZMMOAttributeComponent
|
||||
[/Script/ZMMO.ZeusPlayerState]
|
||||
; UZeusGASComponent (plugin ZeusGAS) — dono unico dos atributos do char (M7).
|
||||
; Owns UZeusAbilitySystemComponent + UZeusAttributeSet (26 atributos
|
||||
; espelhados do server CharAttributeSet). Bridge via UZeusGASNetworkHandler
|
||||
; (UWorldSubsystem) subscribe nos delegates do UZeusNetworkSubsystem.
|
||||
+ComponentClasses=/Script/ZeusGAS.ZeusGASComponent
|
||||
|
||||
; === GAS Cue paths (Batch 2.5 — S_ABILITY_CUE multicast cosmetico) ===
|
||||
; UGameplayCueManager scaneia esses paths no boot pra mapear FGameplayTag
|
||||
; -> AGameplayCueNotify_Actor BP. UZeusGASComponent::DispatchAbilityCue chama
|
||||
; ASC->ExecuteGameplayCueLocal(CueTag, params) -> manager resolve pelo path.
|
||||
[/Script/GameplayAbilities.AbilitySystemGlobals]
|
||||
+GameplayCueNotifyPaths="/Game/ZMMO/GAS/Cues"
|
||||
|
||||
[/Script/Engine.AssetManagerSettings]
|
||||
-PrimaryAssetTypesToScan=(PrimaryAssetType="Map",AssetBaseClass=/Script/Engine.World,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game/Maps")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown))
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Input/Actions/IA_Dash.uasset
Normal file
BIN
Content/Input/Actions/IA_Dash.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/ZMMO/Core/Player/BP_PlayerState.uasset
Normal file
BIN
Content/ZMMO/Core/Player/BP_PlayerState.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/Data/Abilities/DT_Abilities.uasset
Normal file
BIN
Content/ZMMO/Data/Abilities/DT_Abilities.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/ZMMO/GAS/Abilities/BP_GA_Dash.uasset
Normal file
BIN
Content/ZMMO/GAS/Abilities/BP_GA_Dash.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/GAS/Cues/GC_Dash.uasset
Normal file
BIN
Content/ZMMO/GAS/Cues/GC_Dash.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/Sounds/Abilities/SA_Dash.uasset
Normal file
BIN
Content/ZMMO/Sounds/Abilities/SA_Dash.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/Sounds/Abilities/SC_Dash.uasset
Normal file
BIN
Content/ZMMO/Sounds/Abilities/SC_Dash.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/Sounds/Abilities/SW_Dash_Source.uasset
Normal file
BIN
Content/ZMMO/Sounds/Abilities/SW_Dash_Source.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/Sounds/Abilities/SW_Dash_Source.wav
Normal file
BIN
Content/ZMMO/Sounds/Abilities/SW_Dash_Source.wav
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/ZMMO/VFX/Abilities/Dash/NS_Dash_Burst.uasset
Normal file
BIN
Content/ZMMO/VFX/Abilities/Dash/NS_Dash_Burst.uasset
Normal file
Binary file not shown.
BIN
Content/ZMMO/VFX/Abilities/Dash/T_DashShard_Source.png
Normal file
BIN
Content/ZMMO/VFX/Abilities/Dash/T_DashShard_Source.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,17 +10,17 @@
|
||||
*
|
||||
* Fluxo: Boot → Connecting → Login → ServerSelect → Lobby → EnteringWorld
|
||||
* → InWorld. O Lobby é o hub principal logado; suas páginas internas são
|
||||
* EZMMOLobbyPage (não são estados de topo — ver ARQUITETURA.md §4.8).
|
||||
* EZeusLobbyPage (não são estados de topo — ver ARQUITETURA.md §4.8).
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOFrontEndState : uint8
|
||||
enum class EZeusFrontEndState : uint8
|
||||
{
|
||||
None,
|
||||
Boot, // splash inicial enquanto subsistemas sobem
|
||||
Connecting, // conectando ao servidor Zeus (UDP)
|
||||
Login, // autenticação
|
||||
ServerSelect, // escolha de servidor/realm
|
||||
Lobby, // hub principal logado (host das EZMMOLobbyPage)
|
||||
Lobby, // hub principal logado (host das EZeusLobbyPage)
|
||||
EnteringWorld, // loading/handoff: OpenLevel do mapa de mundo
|
||||
InWorld // no mundo (HUD de gameplay assume)
|
||||
};
|
||||
@@ -30,7 +30,7 @@ enum class EZMMOFrontEndState : uint8
|
||||
* de Lobby ("Switch principal"), não pelo fluxo de topo.
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOLobbyPage : uint8
|
||||
enum class EZeusLobbyPage : uint8
|
||||
{
|
||||
None,
|
||||
CharacterSelect,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Estados da UI in-game. Dirigidos pelo UUIInGameFlowSubsystem; cada estado
|
||||
* resolve uma tela (UCommonActivatableWidget) via DA_InGameScreenSet.
|
||||
*
|
||||
* Espelha simetricamente EZMMOFrontEndState (Data/UI/FrontEndTypes.h):
|
||||
* Espelha simetricamente EZeusFrontEndState (Data/UI/FrontEndTypes.h):
|
||||
* - Front-end usa estados pra Login/ServerSelect/Lobby (UI.Layer.Menu)
|
||||
* - In-game usa estados pra HUD/Status/Inventory/Skills (UI.Layer.Game + GameMenu)
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* Layer.GameMenu por cima dele.
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOInGameUIState : uint8
|
||||
enum class EZeusInGameUIState : uint8
|
||||
{
|
||||
None, ///< Antes do player local spawnar; UI in-game inativa.
|
||||
Playing, ///< HUD principal visivel (HP/SP/level/etc).
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
/**
|
||||
* Contexto do loading screen genérico. Cada contexto resolve um perfil
|
||||
* (lista de etapas) no UZMMOLoadingProfilesDataAsset.
|
||||
* (lista de etapas) no UZeusLoadingProfilesDataAsset.
|
||||
*
|
||||
* Cliente local rastreia o progresso assinando eventos próprios
|
||||
* (HandlePostLoadMap, OnPlayerSpawned, etc) — server não envia opcode de
|
||||
* progresso, ver decisão em [[project_ui_loading_dynamic]].
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOLoadingContext : uint8
|
||||
enum class EZeusLoadingContext : uint8
|
||||
{
|
||||
None,
|
||||
FrontEndEnteringWorld, ///< FrontEnd → mundo (handoff CharServer→WorldServer + spawn).
|
||||
@@ -21,7 +21,7 @@ enum class EZMMOLoadingContext : uint8
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOLoadingStepStatus : uint8
|
||||
enum class EZeusLoadingStepStatus : uint8
|
||||
{
|
||||
Pending, ///< Ainda não começou.
|
||||
Running, ///< Em andamento (o "barber pole").
|
||||
@@ -34,7 +34,7 @@ enum class EZMMOLoadingStepStatus : uint8
|
||||
* pra chamar MarkStepDone(StepId); Label é o texto localizado mostrado.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FZMMOLoadingStepDef
|
||||
struct FZeusLoadingStepDef
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -52,13 +52,13 @@ struct FZMMOLoadingStepDef
|
||||
* consulta StepId pra avançar etapa.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FZMMOLoadingProfile
|
||||
struct FZeusLoadingProfile
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Etapas em ordem. ProgressBar = #Done / #Steps. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading")
|
||||
TArray<FZMMOLoadingStepDef> Steps;
|
||||
TArray<FZeusLoadingStepDef> Steps;
|
||||
|
||||
/** Título da tela (vazio = usa default da classe). */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "ThemeKeys.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOThemeKey : uint8
|
||||
enum class EZeusThemeKey : uint8
|
||||
{
|
||||
// HUD
|
||||
HUD_Frame UMETA(DisplayName = "HUD - Frame"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "UI/UILayerTags.h"
|
||||
|
||||
namespace ZMMOUITags
|
||||
namespace ZeusUITags
|
||||
{
|
||||
UE_DEFINE_GAMEPLAY_TAG(UI_Layer_Game, "UI.Layer.Game");
|
||||
UE_DEFINE_GAMEPLAY_TAG(UI_Layer_GameMenu, "UI.Layer.GameMenu");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* UI.Layer.Menu — front-end (Boot/Login/ServerSelect/Lobby)
|
||||
* UI.Layer.Modal — diálogos/loading por cima de tudo
|
||||
*/
|
||||
namespace ZMMOUITags
|
||||
namespace ZeusUITags
|
||||
{
|
||||
ZMMO_API UE_DECLARE_GAMEPLAY_TAG_EXTERN(UI_Layer_Game);
|
||||
ZMMO_API UE_DECLARE_GAMEPLAY_TAG_EXTERN(UI_Layer_GameMenu);
|
||||
|
||||
@@ -73,7 +73,7 @@ struct ZMMO_API FUIStyle
|
||||
/**
|
||||
* Linha de DT_UI_Styles. O Row Name é o ThemeId (ex.: "Default", "RPG"),
|
||||
* espelhando DT_ThemeCalendar e ThemeRegistry — assim a camada de estilo
|
||||
* é consumidora do ThemeId já resolvido pelo UZMMOThemeSubsystem.
|
||||
* é consumidora do ThemeId já resolvido pelo UZeusThemeSubsystem.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ZMMO_API FUIStyleRow : public FTableRowBase
|
||||
@@ -87,7 +87,7 @@ struct ZMMO_API FUIStyleRow : public FTableRowBase
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style")
|
||||
EUITheme Theme = EUITheme::None;
|
||||
|
||||
/** Ponte para o ThemeId resolvido pelo UZMMOThemeSubsystem. */
|
||||
/** Ponte para o ThemeId resolvido pelo UZeusThemeSubsystem. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UI Style")
|
||||
FName ThemeId;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Enums do sistema de UI Style (tokens de tema visual).
|
||||
*
|
||||
* Espelha ThemeKeys.h: enums fortes, BlueprintType, primeiro valor None.
|
||||
* O conceito de "tema ativo" continua sendo do UZMMOThemeSubsystem
|
||||
* O conceito de "tema ativo" continua sendo do UZeusThemeSubsystem
|
||||
* (resolvido por FName ThemeId). EUITheme é apenas validação tipada de
|
||||
* design-time ao preencher DT_UI_Styles — não é a chave de runtime.
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "MapDef.generated.h"
|
||||
|
||||
/**
|
||||
* FZMMOMapSpawn
|
||||
* FZeusMapSpawn
|
||||
*
|
||||
* Ponto de spawn dentro de um mapa, identificado por `Tag`. Usado pelo
|
||||
* server pra decidir onde materializar um char quando ele entra:
|
||||
@@ -15,12 +15,12 @@
|
||||
* - Char saindo de raid: pode pedir tag="raid_return"
|
||||
* - Char morto: pode pedir tag="graveyard"
|
||||
*
|
||||
* ZeusEditorTools pode auto-popular o `Spawns[]` do FZMMOMapDef varrendo
|
||||
* todos APlayerStart (ou ator custom AZMMOMapSpawnPoint) presentes no
|
||||
* ZeusEditorTools pode auto-popular o `Spawns[]` do FZeusMapDef varrendo
|
||||
* todos APlayerStart (ou ator custom AZeusMapSpawnPoint) presentes no
|
||||
* `.umap` do `ClientLevel` — botao "Sync from level".
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ZMMO_API FZMMOMapSpawn
|
||||
struct ZMMO_API FZeusMapSpawn
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -38,7 +38,7 @@ struct ZMMO_API FZMMOMapSpawn
|
||||
};
|
||||
|
||||
/**
|
||||
* FZMMOMapDef
|
||||
* FZeusMapDef
|
||||
*
|
||||
* Definicao canonica de um mapa do MMO. Linha da DT_Maps no cliente.
|
||||
* Exportada para `Server/ZeusServerEngine/Config/DataTables/maps_config.json`
|
||||
@@ -55,7 +55,7 @@ struct ZMMO_API FZMMOMapSpawn
|
||||
* `mapName` (string), evitando ~10-30 bytes por handoff.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ZMMO_API FZMMOMapDef : public FTableRowBase
|
||||
struct ZMMO_API FZeusMapDef : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -77,7 +77,7 @@ struct ZMMO_API FZMMOMapDef : public FTableRowBase
|
||||
* Pelo menos um com Tag="default" e esperado.
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Map|Spawns")
|
||||
TArray<FZMMOMapSpawn> Spawns;
|
||||
TArray<FZeusMapSpawn> Spawns;
|
||||
|
||||
/** Regras PvP/Safe/Dungeon. Reusa enum de FZoneRow. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Map")
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "ZMMOFrontEndPlayerController.h"
|
||||
#include "ZeusFrontEndPlayerController.h"
|
||||
|
||||
#include "UIFrontEndFlowSubsystem.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
|
||||
AZMMOFrontEndPlayerController::AZMMOFrontEndPlayerController()
|
||||
AZeusFrontEndPlayerController::AZeusFrontEndPlayerController()
|
||||
{
|
||||
bShowMouseCursor = true;
|
||||
}
|
||||
|
||||
void AZMMOFrontEndPlayerController::BeginPlay()
|
||||
void AZeusFrontEndPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "ZMMOFrontEndPlayerController.generated.h"
|
||||
#include "ZeusFrontEndPlayerController.generated.h"
|
||||
|
||||
/**
|
||||
* AZMMOFrontEndPlayerController
|
||||
* AZeusFrontEndPlayerController
|
||||
*
|
||||
* Controller do mapa de front-end. Não herda de AZMMOPlayerController (sem
|
||||
* Controller do mapa de front-end. Não herda de AZeusPlayerController (sem
|
||||
* Enhanced Input de gameplay/touch). Em BeginPlay arranca o fluxo de
|
||||
* front-end (UUIFrontEndFlowSubsystem) — feito aqui, e não no
|
||||
* GameInstance::Init, porque os subsistemas já existem neste ponto (ver
|
||||
* aviso no header do ZeusNetworkSubsystem).
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOFrontEndPlayerController : public APlayerController
|
||||
class ZMMO_API AZeusFrontEndPlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOFrontEndPlayerController();
|
||||
AZeusFrontEndPlayerController();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "ZMMOPlayerController.h"
|
||||
#include "ZeusPlayerController.h"
|
||||
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Components/InputComponent.h"
|
||||
@@ -13,11 +13,11 @@
|
||||
#include "UI/InGame/UIInGameFlowSubsystem.h"
|
||||
#include "UI/InGameTypes.h"
|
||||
|
||||
AZMMOPlayerController::AZMMOPlayerController()
|
||||
AZeusPlayerController::AZeusPlayerController()
|
||||
{
|
||||
// Defaults dos Input Mapping Contexts (alinhados ao ZClientMMO). Permitem
|
||||
// instanciar AZMMOPlayerController directamente como
|
||||
// `PlayerControllerClass` do AZMMOGameMode sem exigir um BP filho. Se o
|
||||
// instanciar AZeusPlayerController directamente como
|
||||
// `PlayerControllerClass` do AZeusGameMode sem exigir um BP filho. Se o
|
||||
// projeto adicionar mais IMCs, podemos extender via BP filho ou via
|
||||
// arquivos de Config (UPROPERTY EditAnywhere abaixo).
|
||||
static ConstructorHelpers::FObjectFinder<UInputMappingContext> DefaultImc(
|
||||
@@ -35,7 +35,7 @@ AZMMOPlayerController::AZMMOPlayerController()
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerController::BeginPlay()
|
||||
void AZeusPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
@@ -43,7 +43,7 @@ void AZMMOPlayerController::BeginPlay()
|
||||
{
|
||||
// Limpa estado de input herdado da UI do FrontEnd (UIManagerSubsystem
|
||||
// e LocalPlayerSubsystem — sobrevive ao travel, e o controller anterior
|
||||
// (AZMMOFrontEndPlayerController) tinha setado FInputModeUIOnly +
|
||||
// (AZeusFrontEndPlayerController) tinha setado FInputModeUIOnly +
|
||||
// bShowMouseCursor=true). Sem este reset, WASD/Look podem nao chegar
|
||||
// ao pawn porque o Slate ainda esta com foco no widget antigo.
|
||||
FInputModeGameOnly InputMode;
|
||||
@@ -67,7 +67,7 @@ void AZMMOPlayerController::BeginPlay()
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerController::SetupInputComponent()
|
||||
void AZeusPlayerController::SetupInputComponent()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
|
||||
@@ -101,7 +101,7 @@ void AZMMOPlayerController::SetupInputComponent()
|
||||
FInputKeyBinding& Binding = InputComponent->BindKey(
|
||||
FInputChord(EKeys::A, /*bShift*/ false, /*bCtrl*/ false, /*bAlt*/ true, /*bCmd*/ false),
|
||||
IE_Pressed,
|
||||
this, &AZMMOPlayerController::ToggleStatusWindow);
|
||||
this, &AZeusPlayerController::ToggleStatusWindow);
|
||||
Binding.bConsumeInput = true;
|
||||
Binding.bExecuteWhenPaused = true; // dispara mesmo com StatusWindow aberto (CommonUI menu mode)
|
||||
|
||||
@@ -109,35 +109,35 @@ void AZMMOPlayerController::SetupInputComponent()
|
||||
FInputKeyBinding& JobBinding = InputComponent->BindKey(
|
||||
FInputChord(EKeys::J, /*bShift*/ false, /*bCtrl*/ false, /*bAlt*/ false, /*bCmd*/ false),
|
||||
IE_Pressed,
|
||||
this, &AZMMOPlayerController::ToggleJobChangePanel);
|
||||
this, &AZeusPlayerController::ToggleJobChangePanel);
|
||||
JobBinding.bConsumeInput = true;
|
||||
JobBinding.bExecuteWhenPaused = true;
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerController::ToggleStatusWindow()
|
||||
void AZeusPlayerController::ToggleStatusWindow()
|
||||
{
|
||||
if (UGameInstance* GI = GetGameInstance())
|
||||
{
|
||||
if (UUIInGameFlowSubsystem* Flow = GI->GetSubsystem<UUIInGameFlowSubsystem>())
|
||||
{
|
||||
Flow->ToggleScreen(EZMMOInGameUIState::StatusWindow);
|
||||
Flow->ToggleScreen(EZeusInGameUIState::StatusWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerController::ToggleJobChangePanel()
|
||||
void AZeusPlayerController::ToggleJobChangePanel()
|
||||
{
|
||||
if (UGameInstance* GI = GetGameInstance())
|
||||
{
|
||||
if (UUIInGameFlowSubsystem* Flow = GI->GetSubsystem<UUIInGameFlowSubsystem>())
|
||||
{
|
||||
Flow->ToggleScreen(EZMMOInGameUIState::JobChangePanel);
|
||||
Flow->ToggleScreen(EZeusInGameUIState::JobChangePanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AZMMOPlayerController::ShouldUseTouchControls() const
|
||||
bool AZeusPlayerController::ShouldUseTouchControls() const
|
||||
{
|
||||
return SVirtualJoystick::ShouldDisplayTouchInterface() || bForceTouchControls;
|
||||
}
|
||||
@@ -2,26 +2,26 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "ZMMOPlayerController.generated.h"
|
||||
#include "ZeusPlayerController.generated.h"
|
||||
|
||||
class UInputMappingContext;
|
||||
class UUserWidget;
|
||||
|
||||
/**
|
||||
* AZMMOPlayerController
|
||||
* AZeusPlayerController
|
||||
*
|
||||
* Player controller do cliente Zeus MMO. Responsavel apenas pela camada de
|
||||
* input do Unreal (Enhanced Input Mapping Contexts e widget opcional de
|
||||
* controlos touch). Toda a logica de identidade Zeus, envio de input e
|
||||
* reconciliacao vive em `AZMMOPlayerCharacter`.
|
||||
* reconciliacao vive em `AZeusCharacter`.
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOPlayerController : public APlayerController
|
||||
class ZMMO_API AZeusPlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOPlayerController();
|
||||
AZeusPlayerController();
|
||||
|
||||
protected:
|
||||
/** Mapping contexts default (sempre adicionados). */
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
||||
#include "ZMMOProxyMovementComponent.generated.h"
|
||||
|
||||
/**
|
||||
* CMC customizado para AZMMOPlayerProxy. Expõe escrita direta de Acceleration
|
||||
* (protected na base) para que o AnimBP veja Acceleration!=0 quando o proxy
|
||||
* recebe snapshots, alimentando a fórmula ShouldMove e a transição Jump_Start
|
||||
* do ABP_Unarmed (ambas dependem de aceleração não-nula). Espelha
|
||||
* UZeusProxyMovementComponent do ZClientMMO.
|
||||
*/
|
||||
UCLASS(ClassGroup = (ZMMO), meta = (BlueprintSpawnableComponent))
|
||||
class ZMMO_API UZMMOProxyMovementComponent : public UCharacterMovementComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
void SetZMMOExternalAcceleration(const FVector& InAccelerationCmS2)
|
||||
{
|
||||
Acceleration = InAccelerationCmS2;
|
||||
}
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "ZMMOPlayerCharacter.h"
|
||||
#include "ZeusCharacter.h"
|
||||
|
||||
#include "Animation/AnimInstance.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
@@ -17,15 +17,20 @@
|
||||
#include "Subsystems/WorldSubsystem.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
#include "ZMMO.h"
|
||||
#include "ZMMOAttributeComponent.h"
|
||||
#include "ZMMOPlayerState.h"
|
||||
#include "ZMMOWorldSubsystem.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "GameplayTagsManager.h"
|
||||
#include "ZeusGASComponent.h"
|
||||
#include "ZeusAOIComponent.h"
|
||||
#include "ZeusPlayerState.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "ZeusWorldSubsystem.h"
|
||||
#include "ZeusNetworkSubsystem.h"
|
||||
#include "UI/FrontEnd/UIFrontEndFlowSubsystem.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY(LogZMMOPlayer);
|
||||
DEFINE_LOG_CATEGORY(LogZeusPlayer);
|
||||
|
||||
AZMMOPlayerCharacter::AZMMOPlayerCharacter()
|
||||
AZeusCharacter::AZeusCharacter()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||
@@ -55,13 +60,20 @@ AZMMOPlayerCharacter::AZMMOPlayerCharacter()
|
||||
FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName);
|
||||
FollowCamera->bUsePawnControlRotation = false;
|
||||
|
||||
// AttributeComponent migrou pro PlayerState (AZMMOPlayerState + Component
|
||||
// AOI do cliente (+ overlays de debug). Implementa IZeusAOIDebugTarget; o
|
||||
// Zeus Admin Tools acha este componente no pawn e dirige os overlays.
|
||||
AOIComponent = CreateDefaultSubobject<UZeusAOIComponent>(TEXT("ZeusAOIComponent"));
|
||||
|
||||
// AdminPanelClass NAO e' resolvido aqui via FClassFinder: na criacao do CDO
|
||||
// (load do modulo) o asset registry pode nao estar pronto e o static cacheia
|
||||
// null pra sempre. Resolvido lazy em ToggleAdminPanel (LoadClass em runtime).
|
||||
|
||||
// AttributeComponent migrou pro PlayerState (AZeusPlayerState + Component
|
||||
// Registry config-driven). Pawn fica leve — so' movement/input/camera.
|
||||
|
||||
// Defaults visuais (mesh + AnimBP) — alinhados ao ZClientMMO. Permitem ao
|
||||
// motor spawnar AZMMOPlayerCharacter directamente como DefaultPawnClass do
|
||||
// AZMMOGameMode sem exigir um BP filho. Um BP filho continua opcional para
|
||||
// trocar mesh/AnimBP por mapa.
|
||||
// Defaults visuais (mesh + AnimBP). Permitem ao motor spawnar AZeusCharacter
|
||||
// directamente como DefaultPawnClass do AZeusGameMode sem exigir um BP filho.
|
||||
// Um BP filho continua opcional para trocar mesh/AnimBP por mapa.
|
||||
if (USkeletalMeshComponent* MeshComponent = GetMesh())
|
||||
{
|
||||
static ConstructorHelpers::FObjectFinder<USkeletalMesh> QuinnMesh(
|
||||
@@ -77,7 +89,7 @@ AZMMOPlayerCharacter::AZMMOPlayerCharacter()
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMOPlayer, Warning, TEXT("Default mesh SKM_Quinn_Simple not found for AZMMOPlayerCharacter."));
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("Default mesh SKM_Quinn_Simple not found for AZeusCharacter."));
|
||||
}
|
||||
|
||||
if (QuinnAnimBp.Succeeded())
|
||||
@@ -87,12 +99,12 @@ AZMMOPlayerCharacter::AZMMOPlayerCharacter()
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMOPlayer, Warning, TEXT("Default anim blueprint ABP_Unarmed not found for AZMMOPlayerCharacter."));
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("Default anim blueprint ABP_Unarmed not found for AZeusCharacter."));
|
||||
}
|
||||
}
|
||||
|
||||
// Input Actions defaults (Enhanced Input) — IMCs sao adicionados pelo
|
||||
// AZMMOPlayerController. As IAs aqui resolvem o asset por path; um BP filho
|
||||
// AZeusPlayerController. As IAs aqui resolvem o asset por path; um BP filho
|
||||
// pode sobrescrever caso queira inputs custom.
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> MoveActionAsset(
|
||||
TEXT("/Game/Input/Actions/IA_Move.IA_Move"));
|
||||
@@ -102,14 +114,17 @@ AZMMOPlayerCharacter::AZMMOPlayerCharacter()
|
||||
TEXT("/Game/Input/Actions/IA_MouseLook.IA_MouseLook"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> JumpActionAsset(
|
||||
TEXT("/Game/Input/Actions/IA_Jump.IA_Jump"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> DashActionAsset(
|
||||
TEXT("/Game/Input/Actions/IA_Dash.IA_Dash"));
|
||||
|
||||
if (MoveActionAsset.Succeeded()) { MoveAction = MoveActionAsset.Object; }
|
||||
if (LookActionAsset.Succeeded()) { LookAction = LookActionAsset.Object; }
|
||||
if (MouseLookActionAsset.Succeeded()) { MouseLookAction = MouseLookActionAsset.Object; }
|
||||
if (JumpActionAsset.Succeeded()) { JumpAction = JumpActionAsset.Object; }
|
||||
if (DashActionAsset.Succeeded()) { DashAction = DashActionAsset.Object; }
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::BeginPlay()
|
||||
void AZeusCharacter::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
ResolveZeusNetworkSubsystem();
|
||||
@@ -134,77 +149,171 @@ void AZMMOPlayerCharacter::BeginPlay()
|
||||
{
|
||||
C->SetControlRotation(NewRot);
|
||||
}
|
||||
UE_LOG(LogZMMOPlayer, Log,
|
||||
TEXT("AZMMOPlayerCharacter: pawn reposicionado pra pos do DB (%s) yaw=%.1f"),
|
||||
UE_LOG(LogZeusPlayer, Log,
|
||||
TEXT("AZeusCharacter: pawn reposicionado pra pos do DB (%s) yaw=%.1f"),
|
||||
*PosCm.ToString(), YawDeg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
void AZeusCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
UnbindZeusSpawnDelegate();
|
||||
ZeusNetwork = nullptr;
|
||||
Super::EndPlay(EndPlayReason);
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::Tick(const float DeltaSeconds)
|
||||
void AZeusCharacter::Tick(const float DeltaSeconds)
|
||||
{
|
||||
Super::Tick(DeltaSeconds);
|
||||
FlushInputAxisToServer(DeltaSeconds);
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
void AZeusCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
{
|
||||
if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(PlayerInputComponent))
|
||||
{
|
||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &AZMMOPlayerCharacter::OnJumpPressed);
|
||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &AZMMOPlayerCharacter::OnJumpReleased);
|
||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &AZeusCharacter::OnJumpPressed);
|
||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &AZeusCharacter::OnJumpReleased);
|
||||
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AZMMOPlayerCharacter::Move);
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Completed, this, &AZMMOPlayerCharacter::MoveCompleted);
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AZeusCharacter::Move);
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Completed, this, &AZeusCharacter::MoveCompleted);
|
||||
|
||||
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AZMMOPlayerCharacter::Look);
|
||||
EnhancedInputComponent->BindAction(MouseLookAction, ETriggerEvent::Triggered, this, &AZMMOPlayerCharacter::Look);
|
||||
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AZeusCharacter::Look);
|
||||
EnhancedInputComponent->BindAction(MouseLookAction, ETriggerEvent::Triggered, this, &AZeusCharacter::Look);
|
||||
|
||||
if (DashAction)
|
||||
{
|
||||
EnhancedInputComponent->BindAction(DashAction, ETriggerEvent::Triggered, this, &AZeusCharacter::OnDashTriggered);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMOPlayer, Error, TEXT("'%s' Failed to find an Enhanced Input component."), *GetNameSafe(this));
|
||||
UE_LOG(LogZeusPlayer, Error, TEXT("'%s' Failed to find an Enhanced Input component."), *GetNameSafe(this));
|
||||
}
|
||||
|
||||
// Debug: F8 abre/fecha o Zeus Admin Tools (AIO Debug). Legacy BindKey
|
||||
// convive com Enhanced Input. Trocar a tecla aqui se conflitar.
|
||||
PlayerInputComponent->BindKey(EKeys::F8, IE_Pressed, this, &AZeusCharacter::ToggleAdminPanel);
|
||||
}
|
||||
|
||||
void AZeusCharacter::ToggleAdminPanel()
|
||||
{
|
||||
APlayerController* PC = Cast<APlayerController>(GetController());
|
||||
if (!PC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Aberto -> fecha + devolve input pro jogo.
|
||||
if (AdminPanelInstance && AdminPanelInstance->IsInViewport())
|
||||
{
|
||||
AdminPanelInstance->RemoveFromParent();
|
||||
PC->SetInputMode(FInputModeGameOnly());
|
||||
PC->bShowMouseCursor = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Lazy load (runtime): no F8 o asset ja' esta carregavel; evita o pitfall do
|
||||
// FClassFinder na criacao do CDO. Path do generated class (_C).
|
||||
// A UI vive no CONTENT DO PLUGIN (mount /ZeusAdminTools/), nao no /Game do projeto:
|
||||
// o plugin ZeusAdminTools e' autocontido (C++ + UI no repo Server).
|
||||
if (!AdminPanelClass)
|
||||
{
|
||||
AdminPanelClass = LoadClass<UUserWidget>(nullptr,
|
||||
TEXT("/ZeusAdminTools/UI/WBP_AdminToolsAIO.WBP_AdminToolsAIO_C"));
|
||||
}
|
||||
if (!AdminPanelClass)
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("[AdminPanel] AdminPanelClass nao resolvido (WBP_AdminToolsAIO ausente?)."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AdminPanelInstance)
|
||||
{
|
||||
AdminPanelInstance = CreateWidget<UUserWidget>(PC, AdminPanelClass);
|
||||
}
|
||||
if (AdminPanelInstance)
|
||||
{
|
||||
AdminPanelInstance->AddToViewport(1000);
|
||||
|
||||
// UIOnly: trava a acao do jogo enquanto o menu esta aberto e garante que
|
||||
// os cliques vao 100% pra UI (no GameAndUI o viewport rouba o clique).
|
||||
// O mundo continua renderizando + os overlays de debug seguem desenhando.
|
||||
FInputModeUIOnly Mode;
|
||||
Mode.SetWidgetToFocus(AdminPanelInstance->TakeWidget());
|
||||
Mode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||
PC->SetInputMode(Mode);
|
||||
PC->bShowMouseCursor = true;
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::Move(const FInputActionValue& Value)
|
||||
void AZeusCharacter::Move(const FInputActionValue& Value)
|
||||
{
|
||||
const FVector2D MovementVector = Value.Get<FVector2D>();
|
||||
DoMove(MovementVector.X, MovementVector.Y);
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::MoveCompleted(const FInputActionValue& Value)
|
||||
void AZeusCharacter::MoveCompleted(const FInputActionValue& Value)
|
||||
{
|
||||
(void)Value;
|
||||
DoMove(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::Look(const FInputActionValue& Value)
|
||||
void AZeusCharacter::Look(const FInputActionValue& Value)
|
||||
{
|
||||
const FVector2D LookAxisVector = Value.Get<FVector2D>();
|
||||
DoLook(LookAxisVector.X, LookAxisVector.Y);
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::OnJumpPressed()
|
||||
void AZeusCharacter::OnJumpPressed()
|
||||
{
|
||||
bPendingJumpPressed = true;
|
||||
DoJumpStart();
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::OnJumpReleased()
|
||||
void AZeusCharacter::OnJumpReleased()
|
||||
{
|
||||
bPendingJumpReleased = true;
|
||||
DoJumpEnd();
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::DoMove(const float Right, const float Forward)
|
||||
void AZeusCharacter::OnDashTriggered()
|
||||
{
|
||||
// Resolve UZeusGASComponent do PlayerState. Component vive la' via
|
||||
// AZeusPlayerState Component Registry (config-driven). Sem el, ASC ausente
|
||||
// e RequestActivateAbilityByTag falha — log warning.
|
||||
const APlayerState* PS = GetPlayerState();
|
||||
if (!PS)
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("OnDashTriggered: PlayerState nullptr — ignorado"));
|
||||
return;
|
||||
}
|
||||
UZeusGASComponent* Comp = PS->FindComponentByClass<UZeusGASComponent>();
|
||||
if (!Comp)
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning, TEXT("OnDashTriggered: UZeusGASComponent nao achado"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Tag canonica casa com row do DT + JSON do server. Hash FNV calculado
|
||||
// dentro do componente (RequestActivateAbilityByTag).
|
||||
const FGameplayTag DashTag = UGameplayTagsManager::Get().RequestGameplayTag(
|
||||
FName(TEXT("Zeus.Ability.Movement.Dash")));
|
||||
if (!DashTag.IsValid())
|
||||
{
|
||||
UE_LOG(LogZeusPlayer, Warning,
|
||||
TEXT("OnDashTriggered: tag Zeus.Ability.Movement.Dash nao registrada no cliente"));
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bSent = Comp->RequestActivateAbilityByTag(DashTag);
|
||||
UE_LOG(LogZeusPlayer, Log, TEXT("OnDashTriggered -> RequestActivateAbilityByTag = %s"),
|
||||
bSent ? TEXT("OK (C_ABILITY_TRY_ACTIVATE enviado)") : TEXT("FALHOU"));
|
||||
}
|
||||
|
||||
void AZeusCharacter::DoMove(const float Right, const float Forward)
|
||||
{
|
||||
PendingMoveRight = FMath::Clamp(Right, -1.0f, 1.0f);
|
||||
PendingMoveForward = FMath::Clamp(Forward, -1.0f, 1.0f);
|
||||
@@ -220,7 +329,7 @@ void AZMMOPlayerCharacter::DoMove(const float Right, const float Forward)
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::DoLook(const float Yaw, const float Pitch)
|
||||
void AZeusCharacter::DoLook(const float Yaw, const float Pitch)
|
||||
{
|
||||
if (GetController() != nullptr)
|
||||
{
|
||||
@@ -229,29 +338,29 @@ void AZMMOPlayerCharacter::DoLook(const float Yaw, const float Pitch)
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::DoJumpStart()
|
||||
void AZeusCharacter::DoJumpStart()
|
||||
{
|
||||
Jump();
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::DoJumpEnd()
|
||||
void AZeusCharacter::DoJumpEnd()
|
||||
{
|
||||
StopJumping();
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::ApplyEntitySnapshot(const FZMMOEntitySnapshot& /*Snapshot*/)
|
||||
void AZeusCharacter::ApplyEntitySnapshot(const FZeusEntitySnapshot& /*Snapshot*/)
|
||||
{
|
||||
// Cliente local solto: o servidor nao reconcilia posicao em V0 (ADR 0038).
|
||||
// Quando colisao de objetos chegar, podemos ligar uma reconciliacao opcional
|
||||
// horizontal aqui (XY only), preservando o Z do CMC local.
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::SetEntityRelevant(bool /*bRelevant*/)
|
||||
void AZeusCharacter::SetEntityRelevant(bool /*bRelevant*/)
|
||||
{
|
||||
// Nunca despawnamos o jogador local via AOI.
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::ResolveZeusNetworkSubsystem()
|
||||
void AZeusCharacter::ResolveZeusNetworkSubsystem()
|
||||
{
|
||||
if (ZeusNetwork)
|
||||
{
|
||||
@@ -267,7 +376,7 @@ void AZMMOPlayerCharacter::ResolveZeusNetworkSubsystem()
|
||||
ZeusNetwork = GI->GetSubsystem<UZeusNetworkSubsystem>();
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::BindZeusSpawnDelegate()
|
||||
void AZeusCharacter::BindZeusSpawnDelegate()
|
||||
{
|
||||
if (bSpawnDelegateBound || !IsLocallyControlled())
|
||||
{
|
||||
@@ -278,24 +387,24 @@ void AZMMOPlayerCharacter::BindZeusSpawnDelegate()
|
||||
return;
|
||||
}
|
||||
|
||||
ZeusNetwork->OnPlayerSpawned.AddDynamic(this, &AZMMOPlayerCharacter::HandleZeusPlayerSpawned);
|
||||
ZeusNetwork->OnCharInfoReceived.AddDynamic(this, &AZMMOPlayerCharacter::HandleZeusCharInfo);
|
||||
ZeusNetwork->OnPlayerSpawned.AddDynamic(this, &AZeusCharacter::HandleZeusPlayerSpawned);
|
||||
ZeusNetwork->OnCharInfoReceived.AddDynamic(this, &AZeusCharacter::HandleZeusCharInfo);
|
||||
bSpawnDelegateBound = true;
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::UnbindZeusSpawnDelegate()
|
||||
void AZeusCharacter::UnbindZeusSpawnDelegate()
|
||||
{
|
||||
if (!bSpawnDelegateBound || !ZeusNetwork)
|
||||
{
|
||||
bSpawnDelegateBound = false;
|
||||
return;
|
||||
}
|
||||
ZeusNetwork->OnPlayerSpawned.RemoveDynamic(this, &AZMMOPlayerCharacter::HandleZeusPlayerSpawned);
|
||||
ZeusNetwork->OnCharInfoReceived.RemoveDynamic(this, &AZMMOPlayerCharacter::HandleZeusCharInfo);
|
||||
ZeusNetwork->OnPlayerSpawned.RemoveDynamic(this, &AZeusCharacter::HandleZeusPlayerSpawned);
|
||||
ZeusNetwork->OnCharInfoReceived.RemoveDynamic(this, &AZeusCharacter::HandleZeusCharInfo);
|
||||
bSpawnDelegateBound = false;
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::TryRegisterLocalEntityFromCachedSpawn()
|
||||
void AZeusCharacter::TryRegisterLocalEntityFromCachedSpawn()
|
||||
{
|
||||
if (!ZeusNetwork)
|
||||
{
|
||||
@@ -316,19 +425,19 @@ void AZMMOPlayerCharacter::TryRegisterLocalEntityFromCachedSpawn()
|
||||
TryApplyCachedCharInfo();
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::HandleZeusPlayerSpawned(const int64 InEntityId, const bool bIsLocal,
|
||||
void AZeusCharacter::HandleZeusPlayerSpawned(const int64 InEntityId, const bool bIsLocal,
|
||||
const FVector PosCm, const float YawDeg, const int64 ServerTimeMs)
|
||||
{
|
||||
if (!bIsLocal)
|
||||
{
|
||||
// Remote spawns sao tratados pelo `UZMMOWorldSubsystem`; aqui so reagimos
|
||||
// Remote spawns sao tratados pelo `UZeusWorldSubsystem`; aqui so reagimos
|
||||
// ao spawn do pawn possessivel local (S_SPAWN_PLAYER com bIsLocal=true).
|
||||
return;
|
||||
}
|
||||
HandleLocalSpawnReady(InEntityId, PosCm, YawDeg, ServerTimeMs);
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::HandleLocalSpawnReady(const int64 InEntityId, const FVector PosCm,
|
||||
void AZeusCharacter::HandleLocalSpawnReady(const int64 InEntityId, const FVector PosCm,
|
||||
const float YawDeg, const int64 ServerTimeMs)
|
||||
{
|
||||
if (InEntityId == 0)
|
||||
@@ -337,57 +446,69 @@ void AZMMOPlayerCharacter::HandleLocalSpawnReady(const int64 InEntityId, const F
|
||||
}
|
||||
|
||||
// PR-HANDOFF-007 — InEntityId é int64 (era int32)
|
||||
if (ZMMOEntityId == InEntityId)
|
||||
if (ZeusEntityId == InEntityId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ZMMOEntityId = InEntityId;
|
||||
ZeusEntityId = InEntityId;
|
||||
|
||||
UE_LOG(LogZMMOPlayer, Log,
|
||||
TEXT("AZMMOPlayerCharacter: local spawn captured EntityId=%lld pos=(%s) yaw=%.1f t=%lld"),
|
||||
UE_LOG(LogZeusPlayer, Log,
|
||||
TEXT("AZeusCharacter: local spawn captured EntityId=%lld pos=(%s) yaw=%.1f t=%lld"),
|
||||
InEntityId, *PosCm.ToString(), YawDeg, ServerTimeMs);
|
||||
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
if (UZMMOWorldSubsystem* WorldSubsystem = World->GetSubsystem<UZMMOWorldSubsystem>())
|
||||
if (UZeusWorldSubsystem* WorldSubsystem = World->GetSubsystem<UZeusWorldSubsystem>())
|
||||
{
|
||||
WorldSubsystem->RegisterLocalEntity(InEntityId, this);
|
||||
}
|
||||
}
|
||||
|
||||
// Identidade publica (EntityId) + seed no AttributeComponent. CharName/Guild
|
||||
// vem separado via S_CHAR_INFO -> HandleZeusCharInfo. AttributeComponent vive
|
||||
// como subobject e recebe seed pra que o ZMMOAttributeNetworkHandler consiga
|
||||
// rotear o snapshot por EntityId desde o primeiro pacote.
|
||||
// Identidade publica (EntityId) + seed no GAS Component. CharName/Guild
|
||||
// vem separado via S_CHAR_INFO -> HandleZeusCharInfo. UZeusGASComponent
|
||||
// vive como subobject do PlayerState (Component Registry) e recebe seed
|
||||
// pra que o UZeusGASNetworkHandler consiga rotear o snapshot por
|
||||
// EntityId desde o primeiro pacote.
|
||||
if (APlayerState* PS = GetPlayerState())
|
||||
{
|
||||
if (AZMMOPlayerState* ZMMOPs = Cast<AZMMOPlayerState>(PS))
|
||||
if (AZeusPlayerState* ZeusPs = Cast<AZeusPlayerState>(PS))
|
||||
{
|
||||
ZMMOPs->SetPublicIdentity(InEntityId, /*CharId*/ FString(),
|
||||
ZeusPs->SetPublicIdentity(InEntityId, /*CharId*/ FString(),
|
||||
/*BaseLevel*/ 1, /*ClassId*/ 0);
|
||||
}
|
||||
if (UZMMOAttributeComponent* AttrComp = PS->FindComponentByClass<UZMMOAttributeComponent>())
|
||||
if (UZeusGASComponent* GASComp = PS->FindComponentByClass<UZeusGASComponent>())
|
||||
{
|
||||
AttrComp->SeedEntityId(InEntityId);
|
||||
GASComp->SeedEntityId(InEntityId);
|
||||
}
|
||||
}
|
||||
|
||||
// Aplica char info cacheada (caso S_CHAR_INFO tenha chegado antes do PS existir).
|
||||
TryApplyCachedCharInfo();
|
||||
|
||||
// UI in-game e' responsabilidade do AZMMOHUD (GameMode.HUDClass), nao do
|
||||
// UI in-game e' responsabilidade do AZeusHUD (GameMode.HUDClass), nao do
|
||||
// Pawn. AHUD::BeginPlay chama UUIInGameFlowSubsystem::StartInGame, que
|
||||
// pushea WBP_HUD em UI.Layer.Game. UZMMOHudWidget::NativeOnActivated auto-binda
|
||||
// no UZMMOAttributeComponent via PlayerState.
|
||||
// pushea WBP_HUD em UI.Layer.Game. UZeusHudWidget::NativeOnActivated auto-binda
|
||||
// no UZeusGASComponent via PlayerState.
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::HandleZeusCharInfo(const int64 InEntityId, const FString& CharName, const FString& GuildName)
|
||||
void AZeusCharacter::HandleZeusCharInfo(const int64 InEntityId, const FString& CharName, const FString& GuildName)
|
||||
{
|
||||
UE_LOG(LogZMMOPlayer, Log,
|
||||
TEXT("AZMMOPlayerCharacter: S_CHAR_INFO recebido EntityId=%lld name=%s guild=%s"),
|
||||
UE_LOG(LogZeusPlayer, Log,
|
||||
TEXT("AZeusCharacter: S_CHAR_INFO recebido EntityId=%lld name=%s guild=%s"),
|
||||
InEntityId, *CharName, *GuildName);
|
||||
|
||||
// 2026-06-03 fix: server envia S_CHAR_INFO de TODOS os players (proprio +
|
||||
// catch-up de proxies pre-existentes). Sem este filtro, o nome do ultimo
|
||||
// proxy recebido sobrescrevia o do pawn local (ex: player Mateuus loga e
|
||||
// ve "Olatudook" em si mesmo porque o catch-up do Olatudook chegou depois
|
||||
// do S_CHAR_INFO proprio). Proxies remotos sao roteados pelo registry no
|
||||
// UZeusWorldSubsystem (futuro nameplate por EntityId).
|
||||
if (ZeusEntityId != 0 && InEntityId != ZeusEntityId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
APlayerState* PS = GetPlayerState();
|
||||
if (!PS)
|
||||
{
|
||||
@@ -396,13 +517,13 @@ void AZMMOPlayerCharacter::HandleZeusCharInfo(const int64 InEntityId, const FStr
|
||||
// HandleLocalSpawnReady ou em outra oportunidade.
|
||||
return;
|
||||
}
|
||||
if (AZMMOPlayerState* ZMMOPs = Cast<AZMMOPlayerState>(PS))
|
||||
if (AZeusPlayerState* ZeusPs = Cast<AZeusPlayerState>(PS))
|
||||
{
|
||||
ZMMOPs->SetCharInfo(CharName, GuildName);
|
||||
ZeusPs->SetCharInfo(CharName, GuildName);
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::TryApplyCachedCharInfo()
|
||||
void AZeusCharacter::TryApplyCachedCharInfo()
|
||||
{
|
||||
if (!ZeusNetwork)
|
||||
{
|
||||
@@ -417,14 +538,14 @@ void AZMMOPlayerCharacter::TryApplyCachedCharInfo()
|
||||
}
|
||||
if (APlayerState* PS = GetPlayerState())
|
||||
{
|
||||
if (AZMMOPlayerState* ZMMOPs = Cast<AZMMOPlayerState>(PS))
|
||||
if (AZeusPlayerState* ZeusPs = Cast<AZeusPlayerState>(PS))
|
||||
{
|
||||
ZMMOPs->SetCharInfo(CachedCharName, CachedGuildName);
|
||||
ZeusPs->SetCharInfo(CachedCharName, CachedGuildName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerCharacter::FlushInputAxisToServer(const float DeltaSeconds)
|
||||
void AZeusCharacter::FlushInputAxisToServer(const float DeltaSeconds)
|
||||
{
|
||||
ResolveZeusNetworkSubsystem();
|
||||
if (!ZeusNetwork || !ZeusNetwork->IsConnected())
|
||||
@@ -3,23 +3,24 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Logging/LogMacros.h"
|
||||
#include "ZMMOEntityInterface.h"
|
||||
#include "ZMMOEntityTypes.h"
|
||||
#include "ZMMOPlayerCharacter.generated.h"
|
||||
#include "ZeusEntityInterface.h"
|
||||
#include "ZeusEntityTypes.h"
|
||||
#include "ZeusCharacter.generated.h"
|
||||
|
||||
class USpringArmComponent;
|
||||
class UCameraComponent;
|
||||
class UInputAction;
|
||||
class UZeusNetworkSubsystem;
|
||||
class UZeusAOIComponent;
|
||||
class UUserWidget;
|
||||
struct FInputActionValue;
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogZMMOPlayer, Log, All);
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogZeusPlayer, Log, All);
|
||||
|
||||
/**
|
||||
* AZMMOPlayerCharacter
|
||||
* AZeusCharacter
|
||||
*
|
||||
* Personagem do jogador local. Diferente do template `ThirdPersonCharacter`
|
||||
* e do antigo `AZMMOCharacter`, este ator e parte do pipeline de rede Zeus:
|
||||
* Personagem do jogador local. Parte do pipeline de rede Zeus:
|
||||
*
|
||||
* - Continua a usar o `UCharacterMovementComponent` LIVRE para correr a
|
||||
* fisica do landscape (ADR 0038): o cliente e autoritativo localmente
|
||||
@@ -27,15 +28,15 @@ DECLARE_LOG_CATEGORY_EXTERN(LogZMMOPlayer, Log, All);
|
||||
* - Envia `C_INPUT_AXIS` ao `UZeusNetworkSubsystem` na cadencia
|
||||
* `InputSendRateHz` (com heartbeat 5 Hz quando parado para evitar
|
||||
* starvation do `MovementSystem` no servidor).
|
||||
* - Implementa `IZMMOEntityInterface` para participar do registry do
|
||||
* `UZMMOWorldSubsystem`, mas `ApplyEntitySnapshot` e `SetEntityRelevant`
|
||||
* - Implementa `IZeusEntityInterface` para participar do registry do
|
||||
* `UZeusWorldSubsystem`, mas `ApplyEntitySnapshot` e `SetEntityRelevant`
|
||||
* sao no-op em V0 — o cliente local nao reconcilia (cliente solto).
|
||||
*
|
||||
* TODO V1: reconciliacao opcional XY quando colisao de objetos chegar; AOI
|
||||
* debug spheres; visual smoothing apos correcao do servidor.
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOPlayerCharacter : public ACharacter, public IZMMOEntityInterface
|
||||
class ZMMO_API AZeusCharacter : public ACharacter, public IZeusEntityInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -47,8 +48,12 @@ class ZMMO_API AZMMOPlayerCharacter : public ACharacter, public IZMMOEntityInter
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
|
||||
UCameraComponent* FollowCamera;
|
||||
|
||||
// AttributeComponent vive no PlayerState (AZMMOPlayerState + Component Registry).
|
||||
// Acesso: GetPlayerState<AZMMOPlayerState>()->GetZMMOComponent<UZMMOAttributeComponent>().
|
||||
/** AOI do cliente (+ overlays de debug dirigidos pelo Zeus Admin Tools). */
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Zeus|AOI", meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<UZeusAOIComponent> AOIComponent;
|
||||
|
||||
// GAS Component vive no PlayerState (AZeusPlayerState + Component Registry).
|
||||
// Acesso: GetPlayerState<AZeusPlayerState>()->GetZeusComponent<UZeusGASComponent>().
|
||||
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
@@ -63,8 +68,18 @@ protected:
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
UInputAction* MouseLookAction;
|
||||
|
||||
/// IA_Dash — dispara C_ABILITY_TRY_ACTIVATE pra Zeus.Ability.Movement.Dash
|
||||
/// via UZeusGASComponent. Bind padrao no IMC_Default: LeftShift -> Pressed.
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
UInputAction* DashAction;
|
||||
|
||||
/** Painel Zeus Admin Tools (AIO Debug), aberto/fechado por F8. Default =
|
||||
* WBP_AdminToolsAIO (resolvido no construtor). */
|
||||
UPROPERTY(EditAnywhere, Category = "Zeus|Admin")
|
||||
TSubclassOf<UUserWidget> AdminPanelClass;
|
||||
|
||||
/** Cadencia de envio dos pacotes `C_INPUT_AXIS` (Hz). */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ZMMO|Networking", meta = (ClampMin = "1", ClampMax = "120"))
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Zeus|Networking", meta = (ClampMin = "1", ClampMax = "120"))
|
||||
int32 InputSendRateHz = 30;
|
||||
|
||||
/**
|
||||
@@ -73,22 +88,22 @@ protected:
|
||||
* evitar starvation do servidor caso pacotes sejam perdidos. Em movimento
|
||||
* o envio segue `InputSendRateHz` (30 Hz).
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ZMMO|Networking", meta = (ClampMin = "0.05", ClampMax = "5.0"))
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Zeus|Networking", meta = (ClampMin = "0.05", ClampMax = "5.0"))
|
||||
float HeartbeatIntervalSec = 0.2f;
|
||||
|
||||
public:
|
||||
AZMMOPlayerCharacter();
|
||||
AZeusCharacter();
|
||||
|
||||
virtual void Tick(float DeltaSeconds) override;
|
||||
|
||||
// --- IZMMOEntityInterface ---
|
||||
virtual int64 GetZMMOEntityId() const override { return ZMMOEntityId; }
|
||||
virtual EZMMOEntityType GetZMMOEntityType() const override { return EZMMOEntityType::Player; }
|
||||
virtual void ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot) override;
|
||||
// --- IZeusEntityInterface ---
|
||||
virtual int64 GetZeusEntityId() const override { return ZeusEntityId; }
|
||||
virtual EZeusEntityType GetZeusEntityType() const override { return EZeusEntityType::Player; }
|
||||
virtual void ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot) override;
|
||||
virtual void SetEntityRelevant(bool bRelevant) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "ZMMO|Entity")
|
||||
void SetZMMOEntityId(int64 InEntityId) { ZMMOEntityId = InEntityId; }
|
||||
UFUNCTION(BlueprintCallable, Category = "Zeus|Entity")
|
||||
void SetZeusEntityId(int64 InEntityId) { ZeusEntityId = InEntityId; }
|
||||
|
||||
FORCEINLINE USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
|
||||
FORCEINLINE UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
||||
@@ -105,6 +120,14 @@ protected:
|
||||
void OnJumpPressed();
|
||||
void OnJumpReleased();
|
||||
|
||||
/// IA_Dash Triggered -> resolve UZeusGASComponent do PlayerState e chama
|
||||
/// RequestActivateAbilityByTag("Zeus.Ability.Movement.Dash"). Server valida
|
||||
/// + responde S_ABILITY_ACTIVATED (HP/SP atualizado, montage roda local).
|
||||
void OnDashTriggered();
|
||||
|
||||
/** F8: cria/mostra ou esconde o painel Zeus Admin Tools (input mode UI + cursor). */
|
||||
void ToggleAdminPanel();
|
||||
|
||||
public:
|
||||
/** Wrappers expostos a Blueprint (UI / mobile / automation). */
|
||||
UFUNCTION(BlueprintCallable, Category = "Input")
|
||||
@@ -131,7 +154,7 @@ private:
|
||||
void TryRegisterLocalEntityFromCachedSpawn();
|
||||
|
||||
/**
|
||||
* Memoriza `EntityId` autoritativo e regista o pawn no `UZMMOWorldSubsystem`
|
||||
* Memoriza `EntityId` autoritativo e regista o pawn no `UZeusWorldSubsystem`
|
||||
* para o registry partilhado por proxies remotos (filtra snapshots locais).
|
||||
* Metadados publicos do char (Name/Guild) chegam via S_CHAR_INFO em
|
||||
* HandleZeusCharInfo (servidor envia ANTES de S_SPAWN_PLAYER).
|
||||
@@ -149,11 +172,15 @@ private:
|
||||
UPROPERTY()
|
||||
TObjectPtr<UZeusNetworkSubsystem> ZeusNetwork;
|
||||
|
||||
/** Instancia viva do painel admin (criada lazy no primeiro F8). */
|
||||
UPROPERTY(Transient)
|
||||
TObjectPtr<UUserWidget> AdminPanelInstance;
|
||||
|
||||
bool bSpawnDelegateBound = false;
|
||||
|
||||
/** Identidade autoritativa atribuida quando o servidor envia S_SPAWN_PLAYER local. */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity", meta = (AllowPrivateAccess = "true"))
|
||||
int64 ZMMOEntityId = 0;
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity", meta = (AllowPrivateAccess = "true"))
|
||||
int64 ZeusEntityId = 0;
|
||||
|
||||
float PendingMoveForward = 0.0f;
|
||||
float PendingMoveRight = 0.0f;
|
||||
@@ -1,31 +1,31 @@
|
||||
#include "ZMMOEntity.h"
|
||||
#include "ZeusEntity.h"
|
||||
|
||||
AZMMOEntity::AZMMOEntity()
|
||||
AZeusEntity::AZeusEntity()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
bReplicates = false;
|
||||
}
|
||||
|
||||
void AZMMOEntity::SetZMMOIdentity(const int64 InEntityId, const EZMMOEntityType InEntityType)
|
||||
void AZeusEntity::SetZeusIdentity(const int64 InEntityId, const EZeusEntityType InEntityType)
|
||||
{
|
||||
EntityId = InEntityId;
|
||||
EntityType = InEntityType;
|
||||
}
|
||||
|
||||
void AZMMOEntity::ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot)
|
||||
void AZeusEntity::ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot)
|
||||
{
|
||||
const FRotator NewRotation(0.0f, Snapshot.YawDeg, 0.0f);
|
||||
SetActorLocationAndRotation(Snapshot.PositionCm, NewRotation);
|
||||
}
|
||||
|
||||
void AZMMOEntity::SetEntityRelevant(const bool bRelevant)
|
||||
void AZeusEntity::SetEntityRelevant(const bool bRelevant)
|
||||
{
|
||||
if (bIsZMMORelevant == bRelevant)
|
||||
if (bIsZeusRelevant == bRelevant)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bIsZMMORelevant = bRelevant;
|
||||
bIsZeusRelevant = bRelevant;
|
||||
SetActorHiddenInGame(!bRelevant);
|
||||
SetActorEnableCollision(bRelevant);
|
||||
SetActorTickEnabled(bRelevant);
|
||||
@@ -2,22 +2,22 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "ZMMOEntityInterface.h"
|
||||
#include "ZMMOEntityTypes.h"
|
||||
#include "ZMMOEntity.generated.h"
|
||||
#include "ZeusEntityInterface.h"
|
||||
#include "ZeusEntityTypes.h"
|
||||
#include "ZeusEntity.generated.h"
|
||||
|
||||
/**
|
||||
* AZMMOEntity
|
||||
* AZeusEntity
|
||||
*
|
||||
* Classe base para entidades replicadas pelo servidor que NAO precisam de
|
||||
* capsula + `UCharacterMovementComponent` — tipicamente NPCs estaticos,
|
||||
* objetos dinamicos do mundo, mobs simples sem locomotion fisica.
|
||||
*
|
||||
* Para personagens com capsula + CMC (proxy de jogador, mobs com locomotion
|
||||
* por capsula), use `AZMMOPlayerProxy` ou uma futura `AZMMOMob` que herde
|
||||
* por capsula), use `AZeusPlayerProxy` ou uma futura `AZeusMob` que herde
|
||||
* de `ACharacter`.
|
||||
*
|
||||
* Implementa `IZMMOEntityInterface` com:
|
||||
* Implementa `IZeusEntityInterface` com:
|
||||
* - getters para `EntityId` / `EntityType`;
|
||||
* - `ApplyEntitySnapshot` default: `SetActorLocationAndRotation` (sem
|
||||
* interpolacao temporal — V1 podera adicionar ring-buffer + lerp);
|
||||
@@ -25,33 +25,33 @@
|
||||
* desativa tick (preserva o ator no mundo para futuro pooling).
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOEntity : public AActor, public IZMMOEntityInterface
|
||||
class ZMMO_API AZeusEntity : public AActor, public IZeusEntityInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOEntity();
|
||||
AZeusEntity();
|
||||
|
||||
// --- IZMMOEntityInterface ---
|
||||
virtual int64 GetZMMOEntityId() const override { return EntityId; }
|
||||
virtual EZMMOEntityType GetZMMOEntityType() const override { return EntityType; }
|
||||
virtual void ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot) override;
|
||||
// --- IZeusEntityInterface ---
|
||||
virtual int64 GetZeusEntityId() const override { return EntityId; }
|
||||
virtual EZeusEntityType GetZeusEntityType() const override { return EntityType; }
|
||||
virtual void ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot) override;
|
||||
virtual void SetEntityRelevant(bool bRelevant) override;
|
||||
|
||||
/** Setter usado pelo `UZMMOWorldSubsystem` apos o spawn para registrar a identidade. */
|
||||
UFUNCTION(BlueprintCallable, Category = "ZMMO|Entity")
|
||||
void SetZMMOIdentity(int64 InEntityId, EZMMOEntityType InEntityType);
|
||||
/** Setter usado pelo `UZeusWorldSubsystem` apos o spawn para registrar a identidade. */
|
||||
UFUNCTION(BlueprintCallable, Category = "Zeus|Entity")
|
||||
void SetZeusIdentity(int64 InEntityId, EZeusEntityType InEntityType);
|
||||
|
||||
protected:
|
||||
/** Identificador autoritativo do servidor. Atribuido em `SetZMMOIdentity`. */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
/** Identificador autoritativo do servidor. Atribuido em `SetZeusIdentity`. */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
int64 EntityId = 0;
|
||||
|
||||
/** Categoria autoritativa (Player/Mob/NPC/Object). */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
EZMMOEntityType EntityType = EZMMOEntityType::Object;
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
EZeusEntityType EntityType = EZeusEntityType::Object;
|
||||
|
||||
/** Estado de relevancia atual (espelha as transicoes Hidden<->Relevant do servidor). */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
bool bIsZMMORelevant = true;
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
bool bIsZeusRelevant = true;
|
||||
};
|
||||
@@ -2,27 +2,27 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Interface.h"
|
||||
#include "ZMMOEntityTypes.h"
|
||||
#include "ZMMOEntityInterface.generated.h"
|
||||
#include "ZeusEntityTypes.h"
|
||||
#include "ZeusEntityInterface.generated.h"
|
||||
|
||||
/**
|
||||
* UZMMOEntityInterface
|
||||
* UZeusEntityInterface
|
||||
*
|
||||
* Marcador `UInterface` necessario para o sistema de reflexao da Unreal. Todo o
|
||||
* contrato vive em `IZMMOEntityInterface` (puro C++).
|
||||
* contrato vive em `IZeusEntityInterface` (puro C++).
|
||||
*/
|
||||
UINTERFACE(BlueprintType, MinimalAPI, meta = (CannotImplementInterfaceInBlueprint))
|
||||
class UZMMOEntityInterface : public UInterface
|
||||
class UZeusEntityInterface : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
/**
|
||||
* IZMMOEntityInterface
|
||||
* IZeusEntityInterface
|
||||
*
|
||||
* Contrato comum de todas as entidades replicadas pelo Zeus Server (player
|
||||
* local, players remotos, mobs, NPCs, objetos). Inspirado em `IZeusEntityInterface`
|
||||
* (ZeusV1) e adaptado para o nosso modelo "cliente solto + servidor valida input".
|
||||
* local, players remotos, mobs, NPCs, objetos). Adaptado para o nosso modelo
|
||||
* "cliente solto + servidor valida input".
|
||||
*
|
||||
* Decisoes:
|
||||
* 1. **Identidade autoritativa**: `EntityId` e `EntityType` vem do servidor; o
|
||||
@@ -30,28 +30,28 @@ class UZMMOEntityInterface : public UInterface
|
||||
* 2. **Visibilidade gated por AOI**: o servidor envia spawn/despawn quando o
|
||||
* target entra/sai da area de interesse. O cliente reage via
|
||||
* `SetEntityRelevant(bool)`.
|
||||
* 3. **Player local nao reconcilia em V0**: para o `AZMMOPlayerCharacter` o
|
||||
* 3. **Player local nao reconcilia em V0**: para o `AZeusCharacter` o
|
||||
* `ApplyEntitySnapshot` e no-op (cliente solto controla landscape). Quando
|
||||
* a colisao de objetos chegar no servidor podemos ligar reconciliacao
|
||||
* horizontal opcional.
|
||||
*
|
||||
* Por que UInterface (e nao heranca classica)?
|
||||
* - `AZMMOPlayerCharacter` ja herda de `ACharacter`. Forcar uma classe base
|
||||
* `AZMMOEntity : AActor` para todos perderia o `ACharacter` gratuito.
|
||||
* - `AZeusCharacter` ja herda de `ACharacter`. Forcar uma classe base
|
||||
* `AZeusEntity : AActor` para todos perderia o `ACharacter` gratuito.
|
||||
* A interface permite que o player local (`ACharacter`), o proxy remoto
|
||||
* (`ACharacter`) e entidades genericas (`AActor`) implementem o mesmo
|
||||
* contrato sem heranca multipla concreta.
|
||||
*/
|
||||
class ZMMO_API IZMMOEntityInterface
|
||||
class ZMMO_API IZeusEntityInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
/** Identificador autoritativo da entidade no servidor. */
|
||||
virtual int64 GetZMMOEntityId() const = 0;
|
||||
virtual int64 GetZeusEntityId() const = 0;
|
||||
|
||||
/** Categoria da entidade (Player, Mob, NPC, Object). */
|
||||
virtual EZMMOEntityType GetZMMOEntityType() const = 0;
|
||||
virtual EZeusEntityType GetZeusEntityType() const = 0;
|
||||
|
||||
/**
|
||||
* Aplica um snapshot autoritativo. Implementacoes podem extender com
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
* fisica do landscape de forma autoritativa local, e o servidor apenas
|
||||
* valida input/velocidade (ADR 0038).
|
||||
*/
|
||||
virtual void ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot) = 0;
|
||||
virtual void ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot) = 0;
|
||||
|
||||
/**
|
||||
* Alterna entre estado visivel/ativo (`true`) e oculto/desativado (`false`).
|
||||
@@ -1,14 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ZMMOEntityTypes.generated.h"
|
||||
#include "ZeusEntityTypes.generated.h"
|
||||
|
||||
/**
|
||||
* Categoria autoritativa replicada pelo servidor. Determina que classe de ator
|
||||
* o `UZMMOWorldSubsystem` deve spawnar para um snapshot recebido.
|
||||
* o `UZeusWorldSubsystem` deve spawnar para um snapshot recebido.
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EZMMOEntityType : uint8
|
||||
enum class EZeusEntityType : uint8
|
||||
{
|
||||
Player UMETA(DisplayName = "Player"),
|
||||
Mob UMETA(DisplayName = "Mob"),
|
||||
@@ -17,48 +17,48 @@ enum class EZMMOEntityType : uint8
|
||||
};
|
||||
|
||||
/**
|
||||
* Snapshot autoritativo aplicado por `IZMMOEntityInterface::ApplyEntitySnapshot`.
|
||||
* Snapshot autoritativo aplicado por `IZeusEntityInterface::ApplyEntitySnapshot`.
|
||||
*
|
||||
* Construido pelo `UZMMOWorldSubsystem` a partir dos delegates do
|
||||
* Construido pelo `UZeusWorldSubsystem` a partir dos delegates do
|
||||
* `UZeusNetworkSubsystem` (`OnPlayerStateUpdate` em V0; opcodes para mobs/NPCs
|
||||
* em V1+). Mantemos os campos minimos que o servidor ja replica hoje
|
||||
* (`S_PLAYER_STATE`); novos campos sao adicionados aqui sempre que o protocolo
|
||||
* evoluir, sem mexer nas classes de proxy.
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FZMMOEntitySnapshot
|
||||
struct FZeusEntitySnapshot
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** EntityId autoritativo do servidor. */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
int64 EntityId = 0;
|
||||
|
||||
/** Categoria do ator (define qual proxy class spawnar). */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
EZMMOEntityType EntityType = EZMMOEntityType::Player;
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
EZeusEntityType EntityType = EZeusEntityType::Player;
|
||||
|
||||
/** Sequencia de input processada no servidor (so faz sentido para players). */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
int32 LastProcessedInputSeq = 0;
|
||||
|
||||
/** Posicao mundo (cm). */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
FVector PositionCm = FVector::ZeroVector;
|
||||
|
||||
/** Velocidade mundo (cm/s) — usada para network smoothing e drivers de animacao. */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
FVector VelocityCmS = FVector::ZeroVector;
|
||||
|
||||
/** Yaw em graus (orientacao visual). */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
float YawDeg = 0.0f;
|
||||
|
||||
/** Indica se o servidor considera o ator em solo. */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
bool bGrounded = false;
|
||||
|
||||
/** Tempo do servidor (ms desde epoch) quando este snapshot foi gerado. */
|
||||
UPROPERTY(BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
int64 ServerTimeMs = 0;
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "ZMMOPlayerProxy.h"
|
||||
#include "ZeusPlayerProxy.h"
|
||||
|
||||
#include "Animation/AnimInstance.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
@@ -8,10 +8,10 @@
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
#include "ZMMO.h"
|
||||
#include "ZMMOProxyMovementComponent.h"
|
||||
#include "ZeusProxyMovementComponent.h"
|
||||
|
||||
AZMMOPlayerProxy::AZMMOPlayerProxy(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer.SetDefaultSubobjectClass<UZMMOProxyMovementComponent>(ACharacter::CharacterMovementComponentName))
|
||||
AZeusPlayerProxy::AZeusPlayerProxy(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer.SetDefaultSubobjectClass<UZeusProxyMovementComponent>(ACharacter::CharacterMovementComponentName))
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||
@@ -43,7 +43,7 @@ AZMMOPlayerProxy::AZMMOPlayerProxy(const FObjectInitializer& ObjectInitializer)
|
||||
CMC->BrakingFrictionFactor = 0.0f;
|
||||
}
|
||||
|
||||
// Defaults visuais (mesh + AnimBP) em paridade com `AZMMOPlayerCharacter`.
|
||||
// Defaults visuais (mesh + AnimBP) em paridade com `AZeusCharacter`.
|
||||
if (USkeletalMeshComponent* MeshComponent = GetMesh())
|
||||
{
|
||||
static ConstructorHelpers::FObjectFinder<USkeletalMesh> QuinnMesh(
|
||||
@@ -60,7 +60,7 @@ AZMMOPlayerProxy::AZMMOPlayerProxy(const FObjectInitializer& ObjectInitializer)
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("AZMMOPlayerProxy: SKM_Quinn_Simple nao encontrado em /Game/Characters/Mannequins/Meshes."));
|
||||
TEXT("AZeusPlayerProxy: SKM_Quinn_Simple nao encontrado em /Game/Characters/Mannequins/Meshes."));
|
||||
}
|
||||
|
||||
if (QuinnAnimBp.Succeeded())
|
||||
@@ -71,7 +71,7 @@ AZMMOPlayerProxy::AZMMOPlayerProxy(const FObjectInitializer& ObjectInitializer)
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("AZMMOPlayerProxy: ABP_Unarmed nao encontrado em /Game/Characters/Mannequins/Anims/Unarmed."));
|
||||
TEXT("AZeusPlayerProxy: ABP_Unarmed nao encontrado em /Game/Characters/Mannequins/Anims/Unarmed."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ AZMMOPlayerProxy::AZMMOPlayerProxy(const FObjectInitializer& ObjectInitializer)
|
||||
bUseControllerRotationRoll = false;
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::BeginPlay()
|
||||
void AZeusPlayerProxy::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
@@ -94,7 +94,7 @@ void AZMMOPlayerProxy::BeginPlay()
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::Tick(const float DeltaSeconds)
|
||||
void AZeusPlayerProxy::Tick(const float DeltaSeconds)
|
||||
{
|
||||
Super::Tick(DeltaSeconds);
|
||||
|
||||
@@ -131,7 +131,7 @@ void AZMMOPlayerProxy::Tick(const float DeltaSeconds)
|
||||
// Sem snapshot futuro: extrapolacao curta com a ultima velocidade
|
||||
// conhecida, clampada por `MaxExtrapolationSeconds` para nao deixar
|
||||
// o proxy fugir se a rede ficar muda.
|
||||
const FZMMOProxySnapshot& Last = SnapshotBuffer.Last();
|
||||
const FZeusProxySnapshot& Last = SnapshotBuffer.Last();
|
||||
const float ExtrapSec = FMath::Clamp(
|
||||
static_cast<float>(RenderMs - Last.ServerTimeMs) / 1000.0f,
|
||||
0.0f, MaxExtrapolationSeconds);
|
||||
@@ -141,8 +141,8 @@ void AZMMOPlayerProxy::Tick(const float DeltaSeconds)
|
||||
}
|
||||
else
|
||||
{
|
||||
const FZMMOProxySnapshot& A = SnapshotBuffer[IdxB - 1];
|
||||
const FZMMOProxySnapshot& B = SnapshotBuffer[IdxB];
|
||||
const FZeusProxySnapshot& A = SnapshotBuffer[IdxB - 1];
|
||||
const FZeusProxySnapshot& B = SnapshotBuffer[IdxB];
|
||||
const double Span = FMath::Max<double>(1.0, static_cast<double>(B.ServerTimeMs - A.ServerTimeMs));
|
||||
InterpAlpha = static_cast<float>(FMath::Clamp(
|
||||
static_cast<double>(RenderMs - A.ServerTimeMs) / Span, 0.0, 1.0));
|
||||
@@ -208,19 +208,19 @@ void AZMMOPlayerProxy::Tick(const float DeltaSeconds)
|
||||
const int64 NewestMs = SnapshotBuffer.Last().ServerTimeMs;
|
||||
const int64 RenderLagMs = ServerNowMs - NewestMs;
|
||||
UE_LOG(LogZMMO, Verbose,
|
||||
TEXT("ZMMOPlayerProxy[%lld] buffer=%d renderLagMs=%lld interpAlpha=%.2f extrap=%d delayMs=%.0f"),
|
||||
TEXT("ZeusPlayerProxy[%lld] buffer=%d renderLagMs=%lld interpAlpha=%.2f extrap=%d delayMs=%.0f"),
|
||||
EntityId, SnapshotBuffer.Num(), RenderLagMs, InterpAlpha,
|
||||
bExtrapolating ? 1 : 0, InterpolationDelayMs);
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::SetZMMOIdentity(const int64 InEntityId, const EZMMOEntityType InEntityType)
|
||||
void AZeusPlayerProxy::SetZeusIdentity(const int64 InEntityId, const EZeusEntityType InEntityType)
|
||||
{
|
||||
EntityId = InEntityId;
|
||||
EntityType = InEntityType;
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot)
|
||||
void AZeusPlayerProxy::ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot)
|
||||
{
|
||||
// Estabiliza o offset de relogio na primeira amostra. Subsequente nao
|
||||
// re-sincroniza para evitar saltos visuais; um esquema mais sofisticado
|
||||
@@ -231,7 +231,7 @@ void AZMMOPlayerProxy::ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot)
|
||||
ServerClockOffsetMs = LocalNowMs - Snapshot.ServerTimeMs;
|
||||
}
|
||||
|
||||
FZMMOProxySnapshot S;
|
||||
FZeusProxySnapshot S;
|
||||
S.PosCm = Snapshot.PositionCm;
|
||||
S.VelCmS = Snapshot.VelocityCmS;
|
||||
S.bGrounded = Snapshot.bGrounded;
|
||||
@@ -282,20 +282,20 @@ void AZMMOPlayerProxy::ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot)
|
||||
ApplyCollisionPolicy();
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::SetEntityRelevant(const bool bRelevant)
|
||||
void AZeusPlayerProxy::SetEntityRelevant(const bool bRelevant)
|
||||
{
|
||||
if (bIsZMMORelevant == bRelevant)
|
||||
if (bIsZeusRelevant == bRelevant)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bIsZMMORelevant = bRelevant;
|
||||
bIsZeusRelevant = bRelevant;
|
||||
SetActorHiddenInGame(!bRelevant);
|
||||
SetActorTickEnabled(bRelevant);
|
||||
ApplyCollisionPolicy();
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::RefreshAnimationDrivers()
|
||||
void AZeusPlayerProxy::RefreshAnimationDrivers()
|
||||
{
|
||||
UCharacterMovementComponent* CMC = GetCharacterMovement();
|
||||
if (!CMC)
|
||||
@@ -314,13 +314,13 @@ void AZMMOPlayerProxy::RefreshAnimationDrivers()
|
||||
|
||||
// Acceleration externa via CMC custom — alimenta `Get Current Acceleration`
|
||||
// que o AnimBP do Quinn usa em `ShouldMove` e nas transições de Jump_Start.
|
||||
if (UZMMOProxyMovementComponent* ProxyCMC = Cast<UZMMOProxyMovementComponent>(CMC))
|
||||
if (UZeusProxyMovementComponent* ProxyCMC = Cast<UZeusProxyMovementComponent>(CMC))
|
||||
{
|
||||
ProxyCMC->SetZMMOExternalAcceleration(LastDerivedAccelerationCmS2);
|
||||
ProxyCMC->SetZeusExternalAcceleration(LastDerivedAccelerationCmS2);
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerProxy::ApplyCollisionPolicy()
|
||||
void AZeusPlayerProxy::ApplyCollisionPolicy()
|
||||
{
|
||||
UCapsuleComponent* Capsule = GetCapsuleComponent();
|
||||
if (!Capsule)
|
||||
@@ -328,6 +328,6 @@ void AZMMOPlayerProxy::ApplyCollisionPolicy()
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bShouldCollide = bIsZMMORelevant && bHasFirstSnapshot;
|
||||
const bool bShouldCollide = bIsZeusRelevant && bHasFirstSnapshot;
|
||||
Capsule->SetCollisionEnabled(bShouldCollide ? ECollisionEnabled::QueryOnly : ECollisionEnabled::NoCollision);
|
||||
}
|
||||
@@ -2,19 +2,18 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "ZMMOEntityInterface.h"
|
||||
#include "ZMMOEntityTypes.h"
|
||||
#include "ZMMOPlayerProxy.generated.h"
|
||||
#include "ZeusEntityInterface.h"
|
||||
#include "ZeusEntityTypes.h"
|
||||
#include "ZeusPlayerProxy.generated.h"
|
||||
|
||||
/**
|
||||
* AZMMOPlayerProxy
|
||||
* AZeusPlayerProxy
|
||||
*
|
||||
* Proxy visual para jogadores remotos (e, no futuro, mobs com locomotion
|
||||
* por capsula) cuja posicao vem 100% do servidor via snapshots
|
||||
* (`UZeusNetworkSubsystem::OnPlayerStateUpdate`).
|
||||
*
|
||||
* Inspirado em `AZeusRemoteCharacter` (ZeusV1). Diferencas chave vs.
|
||||
* `AZMMOPlayerCharacter` (jogador local):
|
||||
* Diferencas chave vs. `AZeusCharacter` (jogador local):
|
||||
* - SEM `EnhancedInput`, sem envio de `C_INPUT_AXIS`.
|
||||
* - SEM buffer de pending inputs nem reconciliacao.
|
||||
* - Posicao aplicada por snapshot (`ApplyEntitySnapshot`); a `ACharacter`
|
||||
@@ -22,19 +21,18 @@
|
||||
* mas o CMC fica em modo "kinematic-ish" (nao integra fisica).
|
||||
*
|
||||
* Animacao no AnimBP do Quinn (`ABP_Unarmed`): a formula `ShouldMove` exige
|
||||
* `Acceleration != 0`. Como proxies nao tem input, adoptamos a mesma
|
||||
* estrategia do ZClientMMO: CMC custom (`UZMMOProxyMovementComponent`) com
|
||||
* escrita externa de `Acceleration`, alimentada pela derivada da velocidade
|
||||
* entre snapshots. Tick do proxy roda **antes** do mesh tick para que
|
||||
* Velocity+Acceleration estejam populados quando o `NativeUpdateAnimation`
|
||||
* do AnimBP os ler.
|
||||
* `Acceleration != 0`. Como proxies nao tem input, adoptamos a estrategia
|
||||
* de CMC custom (`UZeusProxyMovementComponent`) com escrita externa de
|
||||
* `Acceleration`, alimentada pela derivada da velocidade entre snapshots.
|
||||
* Tick do proxy roda **antes** do mesh tick para que Velocity+Acceleration
|
||||
* estejam populados quando o `NativeUpdateAnimation` do AnimBP os ler.
|
||||
*/
|
||||
/**
|
||||
* Snapshot bruto guardado no buffer de interpolacao. Mantido como struct privada
|
||||
* ao .h porque so o proxy (e debugging local) precisa olhar para ele.
|
||||
*/
|
||||
USTRUCT()
|
||||
struct FZMMOProxySnapshot
|
||||
struct FZeusProxySnapshot
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -53,37 +51,37 @@ struct FZMMOProxySnapshot
|
||||
};
|
||||
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOPlayerProxy : public ACharacter, public IZMMOEntityInterface
|
||||
class ZMMO_API AZeusPlayerProxy : public ACharacter, public IZeusEntityInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOPlayerProxy(const FObjectInitializer& ObjectInitializer);
|
||||
AZeusPlayerProxy(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual void Tick(float DeltaSeconds) override;
|
||||
|
||||
// --- IZMMOEntityInterface ---
|
||||
virtual int64 GetZMMOEntityId() const override { return EntityId; }
|
||||
virtual EZMMOEntityType GetZMMOEntityType() const override { return EntityType; }
|
||||
virtual void ApplyEntitySnapshot(const FZMMOEntitySnapshot& Snapshot) override;
|
||||
// --- IZeusEntityInterface ---
|
||||
virtual int64 GetZeusEntityId() const override { return EntityId; }
|
||||
virtual EZeusEntityType GetZeusEntityType() const override { return EntityType; }
|
||||
virtual void ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot) override;
|
||||
virtual void SetEntityRelevant(bool bRelevant) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "ZMMO|Entity")
|
||||
void SetZMMOIdentity(int64 InEntityId, EZMMOEntityType InEntityType);
|
||||
UFUNCTION(BlueprintCallable, Category = "Zeus|Entity")
|
||||
void SetZeusIdentity(int64 InEntityId, EZeusEntityType InEntityType);
|
||||
|
||||
protected:
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
int64 EntityId = 0;
|
||||
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
EZMMOEntityType EntityType = EZMMOEntityType::Player;
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
EZeusEntityType EntityType = EZeusEntityType::Player;
|
||||
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
bool bIsZMMORelevant = true;
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
bool bIsZeusRelevant = true;
|
||||
|
||||
/** True apos o primeiro snapshot ser aplicado — antes disso o ator pode ficar oculto. */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
bool bHasFirstSnapshot = false;
|
||||
|
||||
/**
|
||||
@@ -91,15 +89,15 @@ protected:
|
||||
* de `InterpolatedPosCm` (visual) — separar os dois e essencial para
|
||||
* comparar drift autoritativo vs visual via debug overlay/logs.
|
||||
*/
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
FVector AuthoritativePosCm = FVector::ZeroVector;
|
||||
|
||||
/** Posicao **visual** atual (resultado da interpolacao do tick). */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
FVector InterpolatedPosCm = FVector::ZeroVector;
|
||||
|
||||
/** Compat: alias para `AuthoritativePosCm` (preserva binding de Blueprint, se houver). */
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
FVector LastSnapshotPosition = FVector::ZeroVector;
|
||||
|
||||
/**
|
||||
@@ -108,7 +106,7 @@ protected:
|
||||
* em cada `Tick` para manter os drivers de animacao alimentados entre
|
||||
* updates de rede.
|
||||
*/
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Entity")
|
||||
UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Entity")
|
||||
FVector VisualVelocity = FVector::ZeroVector;
|
||||
|
||||
/**
|
||||
@@ -116,23 +114,23 @@ protected:
|
||||
* expresso no dominio do tempo do servidor. Padrao 100 ms (~3 snapshots a 30 Hz)
|
||||
* cobre 1 perda + 1 jitter sem extrapolar.
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ZMMO|Network",
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|Network",
|
||||
meta = (ClampMin = "0.0", ClampMax = "500.0"))
|
||||
double InterpolationDelayMs = 100.0;
|
||||
|
||||
/** Tamanho maximo do buffer (em snapshots). Cobre ~270 ms a 30 Hz. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ZMMO|Network",
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|Network",
|
||||
meta = (ClampMin = "2", ClampMax = "32"))
|
||||
int32 SnapshotBufferCapacity = 8;
|
||||
|
||||
/** Limite duro de extrapolacao (s) quando nao ha snapshot futuro. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ZMMO|Network",
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|Network",
|
||||
meta = (ClampMin = "0.0", ClampMax = "0.5"))
|
||||
float MaxExtrapolationSeconds = 0.1f;
|
||||
|
||||
/** Buffer ordenado por `ServerTimeMs` ascendente. */
|
||||
UPROPERTY()
|
||||
TArray<FZMMOProxySnapshot> SnapshotBuffer;
|
||||
TArray<FZeusProxySnapshot> SnapshotBuffer;
|
||||
|
||||
/**
|
||||
* Offset entre o relogio local (`FPlatformTime::Seconds * 1000`) e o
|
||||
24
Source/ZMMO/Game/Entity/ZeusProxyMovementComponent.h
Normal file
24
Source/ZMMO/Game/Entity/ZeusProxyMovementComponent.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
||||
#include "ZeusProxyMovementComponent.generated.h"
|
||||
|
||||
/**
|
||||
* CMC customizado para AZeusPlayerProxy. Expõe escrita direta de Acceleration
|
||||
* (protected na base) para que o AnimBP veja Acceleration!=0 quando o proxy
|
||||
* recebe snapshots, alimentando a fórmula ShouldMove e a transição Jump_Start
|
||||
* do ABP_Unarmed (ambas dependem de aceleração não-nula).
|
||||
*/
|
||||
UCLASS(ClassGroup = (Zeus), meta = (BlueprintSpawnableComponent))
|
||||
class ZMMO_API UZeusProxyMovementComponent : public UCharacterMovementComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
void SetZeusExternalAcceleration(const FVector& InAccelerationCmS2)
|
||||
{
|
||||
Acceleration = InAccelerationCmS2;
|
||||
}
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
#include "ZMMOFrontEndGameMode.h"
|
||||
|
||||
#include "ZMMOFrontEndPlayerController.h"
|
||||
|
||||
AZMMOFrontEndGameMode::AZMMOFrontEndGameMode()
|
||||
{
|
||||
// UI pura: sem pawn. O controller cria o root layout e arranca o fluxo.
|
||||
DefaultPawnClass = nullptr;
|
||||
PlayerControllerClass = AZMMOFrontEndPlayerController::StaticClass();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include "ZMMOGameMode.h"
|
||||
|
||||
#include "ZMMOHUD.h"
|
||||
#include "ZMMOPlayerCharacter.h"
|
||||
#include "ZMMOPlayerController.h"
|
||||
#include "ZMMOPlayerState.h"
|
||||
|
||||
AZMMOGameMode::AZMMOGameMode()
|
||||
{
|
||||
DefaultPawnClass = AZMMOPlayerCharacter::StaticClass();
|
||||
PlayerControllerClass = AZMMOPlayerController::StaticClass();
|
||||
PlayerStateClass = AZMMOPlayerState::StaticClass();
|
||||
HUDClass = AZMMOHUD::StaticClass();
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
#include "ZMMOPlayerState.h"
|
||||
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "Misc/ConfigCacheIni.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
#include "ZMMO.h"
|
||||
|
||||
AZMMOPlayerState::AZMMOPlayerState()
|
||||
{
|
||||
// Component Registry: instancia cada classe declarada em
|
||||
// DefaultGame.ini::[/Script/ZMMO.ZMMOPlayerState]+ComponentClasses=...
|
||||
//
|
||||
// Le manualmente via GConfig para evitar timing do UPROPERTY(Config),
|
||||
// que requer LoadConfig() ja ter rodado no CDO antes da instance ser
|
||||
// construida. Pra propriedades em arrays config com `+` syntax, lendo
|
||||
// direto e mais previsivel.
|
||||
if (ComponentClasses.Num() == 0 && GConfig)
|
||||
{
|
||||
TArray<FString> ClassPaths;
|
||||
GConfig->GetArray(TEXT("/Script/ZMMO.ZMMOPlayerState"),
|
||||
TEXT("ComponentClasses"),
|
||||
ClassPaths,
|
||||
GGameIni);
|
||||
for (const FString& Path : ClassPaths)
|
||||
{
|
||||
if (UClass* C = LoadClass<UActorComponent>(nullptr, *Path))
|
||||
{
|
||||
ComponentClasses.Add(C);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZMMOPlayerState: ComponentClasses path nao resolveu: %s"), *Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogZMMO, Log,
|
||||
TEXT("AZMMOPlayerState ctor: %d componente(s) no registry (instance=%s)"),
|
||||
ComponentClasses.Num(), *GetName());
|
||||
|
||||
int32 SubobjectIndex = 0;
|
||||
for (const TSubclassOf<UActorComponent>& CompClassRef : ComponentClasses)
|
||||
{
|
||||
UClass* CompClass = CompClassRef.Get();
|
||||
if (!CompClass)
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZMMOPlayerState: ComponentClass null em ComponentClasses[%d]"),
|
||||
SubobjectIndex);
|
||||
++SubobjectIndex;
|
||||
continue;
|
||||
}
|
||||
const FName CompName = MakeUniqueObjectName(this, CompClass,
|
||||
FName(*FString::Printf(TEXT("ZMMOComp_%d_%s"), SubobjectIndex, *CompClass->GetName())));
|
||||
// Overload runtime de CreateDefaultSubobject retorna UObject* (sem template) —
|
||||
// precisa cast para UActorComponent.
|
||||
UActorComponent* Comp = Cast<UActorComponent>(CreateDefaultSubobject(CompName, CompClass, CompClass,
|
||||
/*bIsRequired*/ false, /*bIsTransient*/ false));
|
||||
if (Comp)
|
||||
{
|
||||
UE_LOG(LogZMMO, Log,
|
||||
TEXT("ZMMOPlayerState: componente registrado [%d] %s"),
|
||||
SubobjectIndex, *CompClass->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZMMOPlayerState: CreateDefaultSubobject falhou para %s"),
|
||||
*CompClass->GetName());
|
||||
}
|
||||
++SubobjectIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
DOREPLIFETIME(AZMMOPlayerState, ZMMOEntityId);
|
||||
DOREPLIFETIME(AZMMOPlayerState, CharId);
|
||||
DOREPLIFETIME(AZMMOPlayerState, CharName);
|
||||
DOREPLIFETIME(AZMMOPlayerState, BaseLevel);
|
||||
DOREPLIFETIME(AZMMOPlayerState, ClassId);
|
||||
DOREPLIFETIME(AZMMOPlayerState, GuildName);
|
||||
}
|
||||
|
||||
void AZMMOPlayerState::SetPublicIdentity(int64 InEntityId, const FString& InCharId,
|
||||
int32 InBaseLevel, int32 InClassId)
|
||||
{
|
||||
ZMMOEntityId = InEntityId;
|
||||
CharId = InCharId;
|
||||
BaseLevel = InBaseLevel;
|
||||
ClassId = InClassId;
|
||||
}
|
||||
|
||||
void AZMMOPlayerState::SetCharInfo(const FString& InCharName, const FString& InGuildName)
|
||||
{
|
||||
CharName = InCharName;
|
||||
GuildName = InGuildName;
|
||||
}
|
||||
10
Source/ZMMO/Game/Modes/ZeusFrontEndGameMode.cpp
Normal file
10
Source/ZMMO/Game/Modes/ZeusFrontEndGameMode.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "ZeusFrontEndGameMode.h"
|
||||
|
||||
#include "ZeusFrontEndPlayerController.h"
|
||||
|
||||
AZeusFrontEndGameMode::AZeusFrontEndGameMode()
|
||||
{
|
||||
// UI pura: sem pawn. O controller cria o root layout e arranca o fluxo.
|
||||
DefaultPawnClass = nullptr;
|
||||
PlayerControllerClass = AZeusFrontEndPlayerController::StaticClass();
|
||||
}
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "ZMMOFrontEndGameMode.generated.h"
|
||||
#include "ZeusFrontEndGameMode.generated.h"
|
||||
|
||||
/**
|
||||
* AZMMOFrontEndGameMode
|
||||
* AZeusFrontEndGameMode
|
||||
*
|
||||
* GameMode do mapa de front-end (L_FrontEnd): só UI, sem pawn nem network
|
||||
* play. NÃO é o GameMode global (esse continua AZMMOGameMode para mapas de
|
||||
* play. NÃO é o GameMode global (esse continua AZeusGameMode para mapas de
|
||||
* mundo) — aplicado via override no World Settings de L_FrontEnd
|
||||
* (ARQUITETURA.md §3.3 / decisão de mapa dedicado).
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOFrontEndGameMode : public AGameModeBase
|
||||
class ZMMO_API AZeusFrontEndGameMode : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOFrontEndGameMode();
|
||||
AZeusFrontEndGameMode();
|
||||
};
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "ZMMOGameInstance.h"
|
||||
#include "ZeusGameInstance.h"
|
||||
|
||||
#include "ZMMO.h"
|
||||
#include "ZeusNetworkSubsystem.h"
|
||||
|
||||
void UZMMOGameInstance::Init()
|
||||
void UZeusGameInstance::Init()
|
||||
{
|
||||
Super::Init();
|
||||
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOGameInstance::Init AutoConnect=%s Host=%s Port=%d"),
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusGameInstance::Init AutoConnect=%s Host=%s Port=%d"),
|
||||
bAutoConnectOnStart ? TEXT("true") : TEXT("false"),
|
||||
*ZeusServerHost,
|
||||
ZeusServerPort);
|
||||
@@ -15,7 +15,7 @@ void UZMMOGameInstance::Init()
|
||||
UZeusNetworkSubsystem* ZeusNet = GetZeusNetwork();
|
||||
if (!ZeusNet)
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZMMOGameInstance: ZeusNetworkSubsystem unavailable; ZeusNetwork plugin enabled?"));
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZeusGameInstance: ZeusNetworkSubsystem unavailable; ZeusNetwork plugin enabled?"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void UZMMOGameInstance::Init()
|
||||
ZeusNet->ConnectToZeusServer(ZeusServerHost, ZeusServerPort);
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::Shutdown()
|
||||
void UZeusGameInstance::Shutdown()
|
||||
{
|
||||
if (UZeusNetworkSubsystem* ZeusNet = GetZeusNetwork())
|
||||
{
|
||||
@@ -43,55 +43,55 @@ void UZMMOGameInstance::Shutdown()
|
||||
Super::Shutdown();
|
||||
}
|
||||
|
||||
UZeusNetworkSubsystem* UZMMOGameInstance::GetZeusNetwork() const
|
||||
UZeusNetworkSubsystem* UZeusGameInstance::GetZeusNetwork() const
|
||||
{
|
||||
return GetSubsystem<UZeusNetworkSubsystem>();
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::BindZeusDelegates(UZeusNetworkSubsystem* Zeus)
|
||||
void UZeusGameInstance::BindZeusDelegates(UZeusNetworkSubsystem* Zeus)
|
||||
{
|
||||
if (!Zeus)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Zeus->OnConnected.AddDynamic(this, &UZMMOGameInstance::HandleZeusConnected);
|
||||
Zeus->OnConnectionFailed.AddDynamic(this, &UZMMOGameInstance::HandleZeusConnectionFailed);
|
||||
Zeus->OnDisconnected.AddDynamic(this, &UZMMOGameInstance::HandleZeusDisconnected);
|
||||
Zeus->OnConnected.AddDynamic(this, &UZeusGameInstance::HandleZeusConnected);
|
||||
Zeus->OnConnectionFailed.AddDynamic(this, &UZeusGameInstance::HandleZeusConnectionFailed);
|
||||
Zeus->OnDisconnected.AddDynamic(this, &UZeusGameInstance::HandleZeusDisconnected);
|
||||
// OnNetworkLog: NAO assinamos. Plugin ja loga em LogZeusNetwork (console)
|
||||
// + arquivo proprio em Saved/Logs/ZeusNetwork/. Forwarding em LogZMMO era
|
||||
// diagnostico inicial (sessao 2026-05-07); agora gera duplicacao de cada
|
||||
// linha. Remova esta nota e descomente abaixo se quiser ver no LogZMMO:
|
||||
// Zeus->OnNetworkLog.AddDynamic(this, &UZMMOGameInstance::HandleZeusNetworkLog);
|
||||
// Zeus->OnNetworkLog.AddDynamic(this, &UZeusGameInstance::HandleZeusNetworkLog);
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::UnbindZeusDelegates(UZeusNetworkSubsystem* Zeus)
|
||||
void UZeusGameInstance::UnbindZeusDelegates(UZeusNetworkSubsystem* Zeus)
|
||||
{
|
||||
if (!Zeus)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Zeus->OnConnected.RemoveDynamic(this, &UZMMOGameInstance::HandleZeusConnected);
|
||||
Zeus->OnConnectionFailed.RemoveDynamic(this, &UZMMOGameInstance::HandleZeusConnectionFailed);
|
||||
Zeus->OnDisconnected.RemoveDynamic(this, &UZMMOGameInstance::HandleZeusDisconnected);
|
||||
Zeus->OnConnected.RemoveDynamic(this, &UZeusGameInstance::HandleZeusConnected);
|
||||
Zeus->OnConnectionFailed.RemoveDynamic(this, &UZeusGameInstance::HandleZeusConnectionFailed);
|
||||
Zeus->OnDisconnected.RemoveDynamic(this, &UZeusGameInstance::HandleZeusDisconnected);
|
||||
// OnNetworkLog: nao foi assinado (ver BindZeusDelegates) — nada a remover.
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::HandleZeusConnected()
|
||||
void UZeusGameInstance::HandleZeusConnected()
|
||||
{
|
||||
UE_LOG(LogZMMO, Log, TEXT("[Zeus] Connected to server %s:%d"), *ZeusServerHost, ZeusServerPort);
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::HandleZeusConnectionFailed(FString Reason)
|
||||
void UZeusGameInstance::HandleZeusConnectionFailed(FString Reason)
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning, TEXT("[Zeus] Connection failed: %s"), *Reason);
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::HandleZeusDisconnected()
|
||||
void UZeusGameInstance::HandleZeusDisconnected()
|
||||
{
|
||||
UE_LOG(LogZMMO, Log, TEXT("[Zeus] Disconnected."));
|
||||
}
|
||||
|
||||
void UZMMOGameInstance::HandleZeusNetworkLog(FString Message)
|
||||
void UZeusGameInstance::HandleZeusNetworkLog(FString Message)
|
||||
{
|
||||
UE_LOG(LogZMMO, Log, TEXT("[Zeus] %s"), *Message);
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "ZMMOGameInstance.generated.h"
|
||||
#include "ZeusGameInstance.generated.h"
|
||||
|
||||
class UZeusNetworkSubsystem;
|
||||
|
||||
/**
|
||||
* UZMMOGameInstance
|
||||
* UZeusGameInstance
|
||||
*
|
||||
* Game instance do cliente Zeus MMO. O `UZeusNetworkSubsystem` (do plugin
|
||||
* `ZeusNetwork`) e um `UGameInstanceSubsystem` e portanto e criado
|
||||
@@ -22,7 +22,7 @@ class UZeusNetworkSubsystem;
|
||||
* overrides de configuracao por build (dev / staging / prod).
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API UZMMOGameInstance : public UGameInstance
|
||||
class ZMMO_API UZeusGameInstance : public UGameInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -36,20 +36,20 @@ public:
|
||||
* dirigida pelo `UUIFrontEndFlowSubsystem` (fluxo Boot→Connecting→Login).
|
||||
* Pôr `true` apenas para smoke test legado sem front-end.
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Config, Category = "ZMMO|Network")
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Config, Category = "Zeus|Network")
|
||||
bool bAutoConnectOnStart = false;
|
||||
|
||||
/** Host (IPv4 ou hostname) do servidor Zeus. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Config, Category = "ZMMO|Network")
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Config, Category = "Zeus|Network")
|
||||
FString ZeusServerHost = TEXT("127.0.0.1");
|
||||
|
||||
/** Porta UDP do servidor Zeus (1..65535). */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Config, Category = "ZMMO|Network", meta = (ClampMin = "1", ClampMax = "65535"))
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Config, Category = "Zeus|Network", meta = (ClampMin = "1", ClampMax = "65535"))
|
||||
int32 ZeusServerPort = 27777;
|
||||
|
||||
protected:
|
||||
/** Devolve o subsystem Zeus desta game instance (criado automaticamente pelo plugin). */
|
||||
UFUNCTION(BlueprintPure, Category = "ZMMO|Network")
|
||||
UFUNCTION(BlueprintPure, Category = "Zeus|Network")
|
||||
UZeusNetworkSubsystem* GetZeusNetwork() const;
|
||||
|
||||
void BindZeusDelegates(UZeusNetworkSubsystem* Zeus);
|
||||
14
Source/ZMMO/Game/Modes/ZeusGameMode.cpp
Normal file
14
Source/ZMMO/Game/Modes/ZeusGameMode.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "ZeusGameMode.h"
|
||||
|
||||
#include "ZeusHUD.h"
|
||||
#include "ZeusCharacter.h"
|
||||
#include "ZeusPlayerController.h"
|
||||
#include "ZeusPlayerState.h"
|
||||
|
||||
AZeusGameMode::AZeusGameMode()
|
||||
{
|
||||
DefaultPawnClass = AZeusCharacter::StaticClass();
|
||||
PlayerControllerClass = AZeusPlayerController::StaticClass();
|
||||
PlayerStateClass = AZeusPlayerState::StaticClass();
|
||||
HUDClass = AZeusHUD::StaticClass();
|
||||
}
|
||||
@@ -2,24 +2,24 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "ZMMOGameMode.generated.h"
|
||||
#include "ZeusGameMode.generated.h"
|
||||
|
||||
/**
|
||||
* AZMMOGameMode
|
||||
* AZeusGameMode
|
||||
*
|
||||
* Game mode do cliente Zeus MMO. Configura `AZMMOPlayerCharacter` como
|
||||
* `DefaultPawnClass` e `AZMMOPlayerController` como `PlayerControllerClass`.
|
||||
* Game mode do cliente Zeus MMO. Configura `AZeusCharacter` como
|
||||
* `DefaultPawnClass` e `AZeusPlayerController` como `PlayerControllerClass`.
|
||||
*
|
||||
* A classe e instanciavel directamente (apontada por
|
||||
* `GlobalDefaultGameMode=/Script/ZMMO.ZMMOGameMode` em
|
||||
* `GlobalDefaultGameMode=/Script/ZMMO.ZeusGameMode` em
|
||||
* `Config/DefaultEngine.ini`); um BP filho e opcional para overrides
|
||||
* por mapa / build (skeletal mesh, AnimBP custom, etc.).
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class ZMMO_API AZMMOGameMode : public AGameModeBase
|
||||
class ZMMO_API AZeusGameMode : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOGameMode();
|
||||
AZeusGameMode();
|
||||
};
|
||||
@@ -1,16 +1,16 @@
|
||||
#include "ZMMOHUD.h"
|
||||
#include "ZeusHUD.h"
|
||||
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "ZMMO.h"
|
||||
#include "UI/InGame/UIInGameFlowSubsystem.h"
|
||||
|
||||
AZMMOHUD::AZMMOHUD()
|
||||
AZeusHUD::AZeusHUD()
|
||||
{
|
||||
// AHUD nao precisa tick — toda atualizacao vem via UMG (delegates +
|
||||
// CommonUI). PrimaryActorTick default e' off; mantemos.
|
||||
}
|
||||
|
||||
void AZMMOHUD::BeginPlay()
|
||||
void AZeusHUD::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
@@ -25,12 +25,12 @@ void AZMMOHUD::BeginPlay()
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("AZMMOHUD: UUIInGameFlowSubsystem nao encontrado — HUD nao sera spawnado"));
|
||||
TEXT("AZeusHUD: UUIInGameFlowSubsystem nao encontrado — HUD nao sera spawnado"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AZMMOHUD::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
void AZeusHUD::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
// UUIInGameFlowSubsystem persiste no GameInstance entre OpenLevel — nao
|
||||
// limpamos UI in-game aqui (o front-end flow vai tomar conta na proxima
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/HUD.h"
|
||||
#include "ZMMOHUD.generated.h"
|
||||
#include "ZeusHUD.generated.h"
|
||||
|
||||
/**
|
||||
* HUD do MMO. Pattern UE5 idiomatico: o GameMode atribui `HUDClass`, o
|
||||
@@ -14,21 +14,21 @@
|
||||
* subsystem cuida do cleanup.
|
||||
*
|
||||
* Separacao de responsabilidades:
|
||||
* - AZMMOPlayerCharacter (Pawn) — movimento, input, AttributeComponent
|
||||
* - AZMMOPlayerController — input mapping, mouse
|
||||
* - AZMMOHUD — UI lifecycle
|
||||
* - AZMMOGameMode — wires tudo via class slots
|
||||
* - AZeusCharacter (Pawn) — movimento, input, AttributeComponent
|
||||
* - AZeusPlayerController — input mapping, mouse
|
||||
* - AZeusHUD — UI lifecycle
|
||||
* - AZeusGameMode — wires tudo via class slots
|
||||
*
|
||||
* NAO desenha nada via canvas (AHUD::DrawHUD). UI inteira vive em UMG +
|
||||
* CommonUI (UI.Layer.Game / GameMenu / Modal).
|
||||
*/
|
||||
UCLASS()
|
||||
class ZMMO_API AZMMOHUD : public AHUD
|
||||
class ZMMO_API AZeusHUD : public AHUD
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOHUD();
|
||||
AZeusHUD();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
133
Source/ZMMO/Game/Modes/ZeusPlayerState.cpp
Normal file
133
Source/ZMMO/Game/Modes/ZeusPlayerState.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
#include "ZeusPlayerState.h"
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "Misc/ConfigCacheIni.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
#include "ZMMO.h"
|
||||
#include "ZeusAbilitySystemComponent.h"
|
||||
#include "ZeusAttributeSet.h"
|
||||
#include "ZeusGASComponent.h"
|
||||
|
||||
AZeusPlayerState::AZeusPlayerState()
|
||||
{
|
||||
// Component Registry: instancia cada classe declarada em
|
||||
// DefaultGame.ini::[/Script/ZMMO.ZeusPlayerState]+ComponentClasses=...
|
||||
//
|
||||
// Le manualmente via GConfig para evitar timing do UPROPERTY(Config),
|
||||
// que requer LoadConfig() ja ter rodado no CDO antes da instance ser
|
||||
// construida. Pra propriedades em arrays config com `+` syntax, lendo
|
||||
// direto e mais previsivel.
|
||||
if (ComponentClasses.Num() == 0 && GConfig)
|
||||
{
|
||||
TArray<FString> ClassPaths;
|
||||
GConfig->GetArray(TEXT("/Script/ZMMO.ZeusPlayerState"),
|
||||
TEXT("ComponentClasses"),
|
||||
ClassPaths,
|
||||
GGameIni);
|
||||
for (const FString& Path : ClassPaths)
|
||||
{
|
||||
if (UClass* C = LoadClass<UActorComponent>(nullptr, *Path))
|
||||
{
|
||||
ComponentClasses.Add(C);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZeusPlayerState: ComponentClasses path nao resolveu: %s"), *Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogZMMO, Log,
|
||||
TEXT("AZeusPlayerState ctor: %d componente(s) no registry (instance=%s)"),
|
||||
ComponentClasses.Num(), *GetName());
|
||||
|
||||
int32 SubobjectIndex = 0;
|
||||
for (const TSubclassOf<UActorComponent>& CompClassRef : ComponentClasses)
|
||||
{
|
||||
UClass* CompClass = CompClassRef.Get();
|
||||
if (!CompClass)
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZeusPlayerState: ComponentClass null em ComponentClasses[%d]"),
|
||||
SubobjectIndex);
|
||||
++SubobjectIndex;
|
||||
continue;
|
||||
}
|
||||
const FName CompName = MakeUniqueObjectName(this, CompClass,
|
||||
FName(*FString::Printf(TEXT("ZeusComp_%d_%s"), SubobjectIndex, *CompClass->GetName())));
|
||||
// Overload runtime de CreateDefaultSubobject retorna UObject* (sem template) —
|
||||
// precisa cast para UActorComponent.
|
||||
UActorComponent* Comp = Cast<UActorComponent>(CreateDefaultSubobject(CompName, CompClass, CompClass,
|
||||
/*bIsRequired*/ false, /*bIsTransient*/ false));
|
||||
if (Comp)
|
||||
{
|
||||
UE_LOG(LogZMMO, Log,
|
||||
TEXT("ZeusPlayerState: componente registrado [%d] %s"),
|
||||
SubobjectIndex, *CompClass->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZeusPlayerState: CreateDefaultSubobject falhou para %s"),
|
||||
*CompClass->GetName());
|
||||
}
|
||||
++SubobjectIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void AZeusPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
DOREPLIFETIME(AZeusPlayerState, ZeusEntityId);
|
||||
DOREPLIFETIME(AZeusPlayerState, CharId);
|
||||
DOREPLIFETIME(AZeusPlayerState, CharName);
|
||||
DOREPLIFETIME(AZeusPlayerState, BaseLevel);
|
||||
DOREPLIFETIME(AZeusPlayerState, ClassId);
|
||||
DOREPLIFETIME(AZeusPlayerState, GuildName);
|
||||
}
|
||||
|
||||
void AZeusPlayerState::SetPublicIdentity(int64 InEntityId, const FString& InCharId,
|
||||
int32 InBaseLevel, int32 InClassId)
|
||||
{
|
||||
ZeusEntityId = InEntityId;
|
||||
CharId = InCharId;
|
||||
BaseLevel = InBaseLevel;
|
||||
ClassId = InClassId;
|
||||
}
|
||||
|
||||
void AZeusPlayerState::SetCharInfo(const FString& InCharName, const FString& InGuildName)
|
||||
{
|
||||
CharName = InCharName;
|
||||
GuildName = InGuildName;
|
||||
}
|
||||
|
||||
UAbilitySystemComponent* AZeusPlayerState::GetAbilitySystemComponent() const
|
||||
{
|
||||
// ASC vive como subobject do UZeusGASComponent (que esta no Component
|
||||
// Registry). UE5 GAS nodes BP ("Get Ability System Component", "Apply
|
||||
// Gameplay Effect To Target", etc.) chamam isto via IAbilitySystemInterface.
|
||||
// O retorno e o ponteiro upcastado pra UAbilitySystemComponent (base) —
|
||||
// mas em runtime e' UZeusAbilitySystemComponent (cast tipado via
|
||||
// GetZeusAbilitySystemComponent abaixo).
|
||||
return GetZeusAbilitySystemComponent();
|
||||
}
|
||||
|
||||
UZeusAbilitySystemComponent* AZeusPlayerState::GetZeusAbilitySystemComponent() const
|
||||
{
|
||||
if (UZeusGASComponent* GAS = GetZeusComponent<UZeusGASComponent>())
|
||||
{
|
||||
return GAS->AbilitySystemComponent.Get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UZeusAttributeSet* AZeusPlayerState::GetZeusAttributeSet() const
|
||||
{
|
||||
if (UZeusGASComponent* GAS = GetZeusComponent<UZeusGASComponent>())
|
||||
{
|
||||
return GAS->AttributeSet.Get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "AbilitySystemInterface.h"
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include "Templates/SubclassOf.h"
|
||||
#include "ZMMOPlayerState.generated.h"
|
||||
#include "ZeusPlayerState.generated.h"
|
||||
|
||||
class FLifetimeProperty;
|
||||
class UActorComponent;
|
||||
class UZeusAbilitySystemComponent;
|
||||
class UZeusAttributeSet;
|
||||
|
||||
/**
|
||||
* PlayerState do MMO. Pattern UE5 idiomatico: o GameMode atribui
|
||||
@@ -28,29 +31,52 @@ class UActorComponent;
|
||||
*
|
||||
* ## Component Registry (Open-Closed)
|
||||
*
|
||||
* Cada modulo (ZMMOAttributes, ZMMOInventory, ZMMOSkills futuros) declara
|
||||
* Cada modulo (ZeusGAS, ZeusInventory, ZeusSkills futuros) declara
|
||||
* sua component class em DefaultGame.ini:
|
||||
*
|
||||
* [/Script/ZMMO.ZMMOPlayerState]
|
||||
* +ComponentClasses=/Script/ZMMOAttributes.ZMMOAttributeComponent
|
||||
* +ComponentClasses=/Script/ZMMOInventory.ZMMOInventoryComponent
|
||||
* +ComponentClasses=/Script/ZMMOSkills.ZMMOSkillComponent
|
||||
* [/Script/ZMMO.ZeusPlayerState]
|
||||
* +ComponentClasses=/Script/ZeusGAS.ZeusGASComponent
|
||||
* +ComponentClasses=/Script/ZeusInventory.ZeusInventoryComponent
|
||||
* +ComponentClasses=/Script/ZeusSkills.ZeusSkillComponent
|
||||
*
|
||||
* O construtor de AZMMOPlayerState le essa lista (Config) e instancia
|
||||
* O construtor de AZeusPlayerState le essa lista (Config) e instancia
|
||||
* cada classe como subobject. PlayerState fica fechado pra modificacao,
|
||||
* modulos abertos pra extensao — adicionar Inventory NAO requer
|
||||
* recompilar/editar AZMMOPlayerState.
|
||||
* recompilar/editar AZeusPlayerState.
|
||||
*
|
||||
* Acesso: `PlayerState->FindComponentByClass<UZMMOAttributeComponent>()`
|
||||
* ou o helper `GetZMMOComponent<T>()`.
|
||||
* Acesso: `PlayerState->FindComponentByClass<UZeusGASComponent>()`
|
||||
* ou o helper `GetZeusComponent<T>()`.
|
||||
*/
|
||||
UCLASS(Config = Game, BlueprintType)
|
||||
class ZMMO_API AZMMOPlayerState : public APlayerState
|
||||
class ZMMO_API AZeusPlayerState : public APlayerState, public IAbilitySystemInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AZMMOPlayerState();
|
||||
AZeusPlayerState();
|
||||
|
||||
// === IAbilitySystemInterface (UE5 GAS) ===
|
||||
//
|
||||
// Padrao Lyra: PlayerState implementa a interface; o ASC vive como
|
||||
// subobject do UZeusGASComponent (Component Registry). Isso permite que
|
||||
// qualquer Actor que receba este PlayerState resolva o ASC via cast
|
||||
// pra IAbilitySystemInterface OU via node BP "Get Ability System
|
||||
// Component" (que faz o mesmo internamente).
|
||||
//
|
||||
// Acesso BP: "Get Ability System Component" + pin do PlayerState.
|
||||
// Acesso C++: `Cast<IAbilitySystemInterface>(PlayerState)->GetAbilitySystemComponent()`.
|
||||
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||||
|
||||
/// Versao tipada do ASC custom — retorna direto UZeusAbilitySystemComponent
|
||||
/// (os 12 overrides que falam com o servidor custom via opcodes ZeusNetwork).
|
||||
/// Prefira este sobre o getter da interface no BP — evita cast + expoe a API
|
||||
/// do ASC custom (RequestActivateAbility, etc.).
|
||||
UFUNCTION(BlueprintPure, Category = "Zeus|GAS")
|
||||
UZeusAbilitySystemComponent* GetZeusAbilitySystemComponent() const;
|
||||
|
||||
/// Helper BP-friendly pro AttributeSet tipado (template C++ nao expoe pra BP).
|
||||
UFUNCTION(BlueprintPure, Category = "Zeus|GAS")
|
||||
UZeusAttributeSet* GetZeusAttributeSet() const;
|
||||
|
||||
// === Identidade publica ===
|
||||
//
|
||||
@@ -60,51 +86,51 @@ public:
|
||||
// passe a usar dedicated UE5 no futuro.
|
||||
|
||||
/** EntityId autoritativo do server. 0 ate o spawn local confirmar. */
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Identity")
|
||||
int64 ZMMOEntityId = 0;
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Identity")
|
||||
int64 ZeusEntityId = 0;
|
||||
|
||||
/** CharId (BIGINT no DB; FString pra preservar 64 bits em Blueprint). */
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Identity")
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Identity")
|
||||
FString CharId;
|
||||
|
||||
/** Nome do char vindo do DB (`characters.name`). Setado por
|
||||
* AZMMOPlayerCharacter::HandleLocalSpawnReady com o payload do
|
||||
* AZeusCharacter::HandleLocalSpawnReady com o payload do
|
||||
* S_SPAWN_PLAYER. UI prefere isto a APlayerState::GetPlayerName(). */
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Identity")
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Identity")
|
||||
FString CharName;
|
||||
|
||||
// === Progressao publica ===
|
||||
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Progress")
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Progress")
|
||||
int32 BaseLevel = 1;
|
||||
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Progress")
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Progress")
|
||||
int32 ClassId = 0;
|
||||
|
||||
// === Guild (futuro) ===
|
||||
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "ZMMO|Guild")
|
||||
UPROPERTY(Replicated, VisibleInstanceOnly, BlueprintReadOnly, Category = "Zeus|Guild")
|
||||
FString GuildName;
|
||||
|
||||
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
||||
|
||||
// === Helpers ===
|
||||
|
||||
/// Setado por AZMMOPlayerCharacter::HandleLocalSpawnReady (pose/EntityId)
|
||||
/// Setado por AZeusCharacter::HandleLocalSpawnReady (pose/EntityId)
|
||||
/// e atualizado por handlers de snapshot/level up para refletir dados
|
||||
/// publicos do char no PlayerState.
|
||||
UFUNCTION(BlueprintCallable, Category = "ZMMO|Identity")
|
||||
UFUNCTION(BlueprintCallable, Category = "Zeus|Identity")
|
||||
void SetPublicIdentity(int64 InEntityId, const FString& InCharId,
|
||||
int32 InBaseLevel, int32 InClassId);
|
||||
|
||||
/// Setado pelo handler do S_CHAR_INFO (chega antes de S_SPAWN_PLAYER) —
|
||||
/// metadados publicos do char vindos do servidor.
|
||||
UFUNCTION(BlueprintCallable, Category = "ZMMO|Identity")
|
||||
UFUNCTION(BlueprintCallable, Category = "Zeus|Identity")
|
||||
void SetCharInfo(const FString& InCharName, const FString& InGuildName);
|
||||
|
||||
/// Template helper: PS->GetZMMOComponent<UZMMOAttributeComponent>()
|
||||
/// Template helper: PS->GetZeusComponent<UZeusGASComponent>()
|
||||
template <typename T>
|
||||
T* GetZMMOComponent() const
|
||||
T* GetZeusComponent() const
|
||||
{
|
||||
return Cast<T>(FindComponentByClass(T::StaticClass()));
|
||||
}
|
||||
@@ -119,6 +145,6 @@ protected:
|
||||
* diretamente. Modulos C++ precisam estar carregados antes do CDO ser
|
||||
* instanciado — garantido por LoadingPhase=PreDefault no .uproject.
|
||||
*/
|
||||
UPROPERTY(Config, EditDefaultsOnly, Category = "ZMMO|Components")
|
||||
UPROPERTY(Config, EditDefaultsOnly, Category = "Zeus|Components")
|
||||
TArray<TSubclassOf<UActorComponent>> ComponentClasses;
|
||||
};
|
||||
223
Source/ZMMO/Game/Network/ZeusAOIComponent.cpp
Normal file
223
Source/ZMMO/Game/Network/ZeusAOIComponent.cpp
Normal file
@@ -0,0 +1,223 @@
|
||||
// Copyright Zeus Server Engine. All rights reserved.
|
||||
|
||||
#include "ZeusAOIComponent.h"
|
||||
|
||||
#include "ZeusNetworkSubsystem.h" // plugin ZeusNetwork: OnDebugAoiInfo + SendDebugAoiRequest
|
||||
|
||||
#include "DrawDebugHelpers.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "Engine/World.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
|
||||
// Console vars — espelham as flags do painel (overlay liga se flag OU CVar).
|
||||
static TAutoConsoleVariable<int32> CVarShowAOI(
|
||||
TEXT("zeus.debug.aoi"), 0, TEXT("Desenha a Zona de Interesse (esfera do raio AOI)."), ECVF_Default);
|
||||
static TAutoConsoleVariable<int32> CVarShowDespawn(
|
||||
TEXT("zeus.debug.despawn"), 0, TEXT("Desenha a Zona de Despawn (esfera externa do AOI)."), ECVF_Default);
|
||||
static TAutoConsoleVariable<int32> CVarShowCell(
|
||||
TEXT("zeus.debug.cell"), 0, TEXT("Desenha os bounds da celula (placeholder)."), ECVF_Default);
|
||||
static TAutoConsoleVariable<int32> CVarShowProxy(
|
||||
TEXT("zeus.debug.proxy"), 0, TEXT("Desenha labels de proxy (TODO)."), ECVF_Default);
|
||||
static TAutoConsoleVariable<int32> CVarShowHandoff(
|
||||
TEXT("zeus.debug.handoff"), 0, TEXT("Desenha a linha de handoff (placeholder)."), ECVF_Default);
|
||||
static TAutoConsoleVariable<int32> CVarShowDrift(
|
||||
TEXT("zeus.debug.drift"), 0, TEXT("Desenha o drift autoritativo (TODO)."), ECVF_Default);
|
||||
|
||||
namespace
|
||||
{
|
||||
const FColor kColorInterest(93, 213, 255); // cyan — Zona de Interesse
|
||||
const FColor kColorDespawn(255, 140, 90); // laranja — Zona de Despawn (externa)
|
||||
const FColor kColorCell(232, 192, 96);
|
||||
const FColor kColorHandoff(255, 155, 190);
|
||||
}
|
||||
|
||||
UZeusAOIComponent::UZeusAOIComponent()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
PrimaryComponentTick.bStartWithTickEnabled = true;
|
||||
SetIsReplicatedByDefault(false); // debug/cliente; gameplay AOI real entra depois
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
// Bind do feed de config de AOI (servidor -> cliente). Multicast plain C++.
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
if (UGameInstance* GI = World->GetGameInstance())
|
||||
{
|
||||
if (UZeusNetworkSubsystem* Net = GI->GetSubsystem<UZeusNetworkSubsystem>())
|
||||
{
|
||||
AoiConfigHandle_ = Net->OnDebugAoiInfo.AddUObject(this, &UZeusAOIComponent::HandleAoiConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Best-effort: ja' pede a config (no-op se ainda nao conectado — o request
|
||||
// e' re-disparado ao ligar um overlay em SetOverlayEnabled).
|
||||
RequestAoiConfig();
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
if (AoiConfigHandle_.IsValid())
|
||||
{
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
if (UGameInstance* GI = World->GetGameInstance())
|
||||
{
|
||||
if (UZeusNetworkSubsystem* Net = GI->GetSubsystem<UZeusNetworkSubsystem>())
|
||||
{
|
||||
Net->OnDebugAoiInfo.Remove(AoiConfigHandle_);
|
||||
}
|
||||
}
|
||||
}
|
||||
AoiConfigHandle_.Reset();
|
||||
}
|
||||
Super::EndPlay(EndPlayReason);
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::TickComponent(float DeltaTime, ELevelTick TickType,
|
||||
FActorComponentTickFunction* ThisTickFunction)
|
||||
{
|
||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||
|
||||
if (AnyOverlayActive())
|
||||
{
|
||||
DrawOverlays();
|
||||
}
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::RequestAoiConfig()
|
||||
{
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
if (UGameInstance* GI = World->GetGameInstance())
|
||||
{
|
||||
if (UZeusNetworkSubsystem* Net = GI->GetSubsystem<UZeusNetworkSubsystem>())
|
||||
{
|
||||
Net->SendDebugAoiRequest(); // no-op se nao conectado
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::HandleAoiConfig(float InterestCm, float DespawnCm)
|
||||
{
|
||||
InterestRadiusCm = InterestCm;
|
||||
DespawnRadiusCm = DespawnCm;
|
||||
}
|
||||
|
||||
bool UZeusAOIComponent::ResolveOverlay(EZeusAOIOverlay Overlay) const
|
||||
{
|
||||
switch (Overlay)
|
||||
{
|
||||
case EZeusAOIOverlay::AOIRadius: return bShowAOIRadius || CVarShowAOI.GetValueOnGameThread() > 0;
|
||||
case EZeusAOIOverlay::DespawnZone: return bShowDespawnZone || CVarShowDespawn.GetValueOnGameThread() > 0;
|
||||
case EZeusAOIOverlay::CellBounds: return bShowCellBounds || CVarShowCell.GetValueOnGameThread() > 0;
|
||||
case EZeusAOIOverlay::ProxyLabels: return bShowProxyLabels || CVarShowProxy.GetValueOnGameThread() > 0;
|
||||
case EZeusAOIOverlay::HandoffLine: return bShowHandoffLine || CVarShowHandoff.GetValueOnGameThread() > 0;
|
||||
case EZeusAOIOverlay::AuthDrift: return bShowAuthDrift || CVarShowDrift.GetValueOnGameThread() > 0;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool UZeusAOIComponent::AnyOverlayActive() const
|
||||
{
|
||||
return ResolveOverlay(EZeusAOIOverlay::AOIRadius)
|
||||
|| ResolveOverlay(EZeusAOIOverlay::DespawnZone)
|
||||
|| ResolveOverlay(EZeusAOIOverlay::CellBounds)
|
||||
|| ResolveOverlay(EZeusAOIOverlay::ProxyLabels)
|
||||
|| ResolveOverlay(EZeusAOIOverlay::HandoffLine)
|
||||
|| ResolveOverlay(EZeusAOIOverlay::AuthDrift);
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::DrawOverlays()
|
||||
{
|
||||
const AActor* Owner = GetOwner();
|
||||
UWorld* World = GetWorld();
|
||||
if (!Owner || !World) { return; }
|
||||
|
||||
const FVector Loc = Owner->GetActorLocation();
|
||||
|
||||
// Zona de Interesse (interna) — raio real do servidor. Sem o raio (==0),
|
||||
// ainda nao chegou a config: nao desenha (loading).
|
||||
if (ResolveOverlay(EZeusAOIOverlay::AOIRadius) && InterestRadiusCm > 0.0f)
|
||||
{
|
||||
DrawDebugSphere(World, Loc, InterestRadiusCm, 32, kColorInterest, false, -1.0f, 0, LineThickness);
|
||||
}
|
||||
// Zona de Despawn (externa, > interesse = histerese) — raio real do servidor.
|
||||
if (ResolveOverlay(EZeusAOIOverlay::DespawnZone) && DespawnRadiusCm > 0.0f)
|
||||
{
|
||||
DrawDebugSphere(World, Loc, DespawnRadiusCm, 32, kColorDespawn, false, -1.0f, 0, LineThickness);
|
||||
}
|
||||
if (ResolveOverlay(EZeusAOIOverlay::CellBounds))
|
||||
{
|
||||
// PLACEHOLDER: box grande centrada no player. TODO bounds reais da cell.
|
||||
DrawDebugBox(World, Loc, FVector(CellBoundsExtentCm, CellBoundsExtentCm, 2000.0f),
|
||||
kColorCell, false, -1.0f, 0, LineThickness);
|
||||
}
|
||||
if (ResolveOverlay(EZeusAOIOverlay::HandoffLine))
|
||||
{
|
||||
// PLACEHOLDER: vetor pra frente. TODO apontar pro centro da cell vizinha.
|
||||
const float Len = InterestRadiusCm > 0.0f ? InterestRadiusCm : 3000.0f;
|
||||
const FVector End = Loc + Owner->GetActorForwardVector() * Len;
|
||||
DrawDebugDirectionalArrow(World, Loc, End, 200.0f, kColorHandoff, false, -1.0f, 0, LineThickness);
|
||||
}
|
||||
// ProxyLabels / AuthDrift: TODO (precisam do registry de proxies/snapshots).
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::SetOverlayEnabled_Implementation(EZeusAOIOverlay Overlay, bool bEnabled)
|
||||
{
|
||||
switch (Overlay)
|
||||
{
|
||||
case EZeusAOIOverlay::AOIRadius: bShowAOIRadius = bEnabled; break;
|
||||
case EZeusAOIOverlay::DespawnZone: bShowDespawnZone = bEnabled; break;
|
||||
case EZeusAOIOverlay::CellBounds: bShowCellBounds = bEnabled; break;
|
||||
case EZeusAOIOverlay::ProxyLabels: bShowProxyLabels = bEnabled; break;
|
||||
case EZeusAOIOverlay::HandoffLine: bShowHandoffLine = bEnabled; break;
|
||||
case EZeusAOIOverlay::AuthDrift: bShowAuthDrift = bEnabled; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// Ao ligar uma zona de AOI sem ter os raios ainda, pede a config (loading).
|
||||
const bool bAoiZone = (Overlay == EZeusAOIOverlay::AOIRadius || Overlay == EZeusAOIOverlay::DespawnZone);
|
||||
if (bEnabled && bAoiZone && InterestRadiusCm <= 0.0f)
|
||||
{
|
||||
RequestAoiConfig();
|
||||
}
|
||||
}
|
||||
|
||||
void UZeusAOIComponent::SetAllOverlays_Implementation(bool bEnabled)
|
||||
{
|
||||
bShowAOIRadius = bShowDespawnZone = bShowCellBounds = bEnabled;
|
||||
bShowProxyLabels = bShowHandoffLine = bShowAuthDrift = bEnabled;
|
||||
|
||||
if (bEnabled && InterestRadiusCm <= 0.0f)
|
||||
{
|
||||
RequestAoiConfig();
|
||||
}
|
||||
}
|
||||
|
||||
bool UZeusAOIComponent::IsOverlayEnabled_Implementation(EZeusAOIOverlay Overlay) const
|
||||
{
|
||||
// Reflete o estado real (flag OU CVar) p/ a UI mostrar o que esta' desenhando.
|
||||
return ResolveOverlay(Overlay);
|
||||
}
|
||||
|
||||
float UZeusAOIComponent::GetInterestRadiusCm_Implementation() const
|
||||
{
|
||||
return InterestRadiusCm; // 0 = config do servidor ainda nao chegou (loading)
|
||||
}
|
||||
|
||||
float UZeusAOIComponent::GetDespawnRadiusCm_Implementation() const
|
||||
{
|
||||
return DespawnRadiusCm;
|
||||
}
|
||||
|
||||
int32 UZeusAOIComponent::GetEnabledOverlayCount() const
|
||||
{
|
||||
return (bShowAOIRadius ? 1 : 0) + (bShowDespawnZone ? 1 : 0) + (bShowCellBounds ? 1 : 0)
|
||||
+ (bShowProxyLabels ? 1 : 0) + (bShowHandoffLine ? 1 : 0) + (bShowAuthDrift ? 1 : 0);
|
||||
}
|
||||
81
Source/ZMMO/Game/Network/ZeusAOIComponent.h
Normal file
81
Source/ZMMO/Game/Network/ZeusAOIComponent.h
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright Zeus Server Engine. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "ZeusAOIDebugTarget.h" // plugin ZeusAdminToolsRuntime: interface + EZeusAOIOverlay
|
||||
#include "ZeusAOIComponent.generated.h"
|
||||
|
||||
/**
|
||||
* UZeusAOIComponent (cliente / jogo)
|
||||
*
|
||||
* Componente de gameplay do player local. Dominio principal: Area of Interest
|
||||
* do cliente (proxies, despawn coordenado, interpolacao — ver
|
||||
* [[project_aoi_client_component]]). AQUI, alem disso, expoe um "plus" de
|
||||
* DEBUG: overlays via DrawDebug* dirigidos pelo painel admin (plugin) atraves
|
||||
* de IZeusAOIDebugTarget, e/ou por console vars (zeus.debug.aoi etc.).
|
||||
*
|
||||
* As DUAS zonas do AOI (Interesse interna + Despawn externa = histerese) vem do
|
||||
* SERVIDOR: ao ligar um overlay (ou no BeginPlay) o componente pede a config via
|
||||
* C_DEBUG_AOI_REQUEST e recebe S_DEBUG_AOI_INFO (delegate OnDebugAoiInfo do
|
||||
* UZeusNetworkSubsystem) com interestRadiusCm + despawnRadiusCm. Enquanto nao
|
||||
* chega (raio == 0), nao desenha (loading).
|
||||
*
|
||||
* Vive na src do ZMMO (nao no plugin): e' um componente do JOGO. O plugin
|
||||
* ZeusAdminTools apenas COMUNICA com ele via a interface — direcao da
|
||||
* dependencia: ZMMO -> plugin (implementa a interface).
|
||||
*/
|
||||
UCLASS(ClassGroup = (Zeus), meta = (BlueprintSpawnableComponent), DisplayName = "Zeus AOI Component")
|
||||
class ZMMO_API UZeusAOIComponent : public UActorComponent, public IZeusAOIDebugTarget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UZeusAOIComponent();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
|
||||
FActorComponentTickFunction* ThisTickFunction) override;
|
||||
|
||||
// === IZeusAOIDebugTarget (dirigido pelo painel admin) ===
|
||||
virtual void SetOverlayEnabled_Implementation(EZeusAOIOverlay Overlay, bool bEnabled) override;
|
||||
virtual void SetAllOverlays_Implementation(bool bEnabled) override;
|
||||
virtual bool IsOverlayEnabled_Implementation(EZeusAOIOverlay Overlay) const override;
|
||||
virtual float GetInterestRadiusCm_Implementation() const override;
|
||||
virtual float GetDespawnRadiusCm_Implementation() const override;
|
||||
|
||||
// === Flags de debug por overlay ===
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Overlays") bool bShowAOIRadius = false; // Zona de Interesse
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Overlays") bool bShowDespawnZone = false; // Zona de Despawn
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Overlays") bool bShowCellBounds = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Overlays") bool bShowProxyLabels = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Overlays") bool bShowHandoffLine = false;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Overlays") bool bShowAuthDrift = false;
|
||||
|
||||
// === Parametros ===
|
||||
// Raios reais vem do servidor (S_DEBUG_AOI_INFO). 0 = ainda nao recebido (loading).
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Zeus|AOI Debug|Params") float InterestRadiusCm = 0.0f;
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Zeus|AOI Debug|Params") float DespawnRadiusCm = 0.0f;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Params") float CellBoundsExtentCm = 50000.0f;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Zeus|AOI Debug|Params") float LineThickness = 2.0f;
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Zeus|AOI Debug")
|
||||
int32 GetEnabledOverlayCount() const;
|
||||
|
||||
private:
|
||||
void DrawOverlays();
|
||||
bool ResolveOverlay(EZeusAOIOverlay Overlay) const;
|
||||
bool AnyOverlayActive() const;
|
||||
|
||||
/** Pede a config de AOI ao servidor (C_DEBUG_AOI_REQUEST). No-op se ja' temos
|
||||
* os raios ou se nao houver UZeusNetworkSubsystem conectado. */
|
||||
void RequestAoiConfig();
|
||||
|
||||
/** Bind de UZeusNetworkSubsystem::OnDebugAoiInfo: armazena os raios reais. */
|
||||
void HandleAoiConfig(float InterestCm, float DespawnCm);
|
||||
|
||||
/** Handle do bind do OnDebugAoiInfo (pra remover no EndPlay). */
|
||||
FDelegateHandle AoiConfigHandle_;
|
||||
};
|
||||
@@ -1,23 +1,26 @@
|
||||
#include "ZMMOWorldSubsystem.h"
|
||||
#include "ZeusWorldSubsystem.h"
|
||||
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "Engine/World.h"
|
||||
#include "GameFramework/GameStateBase.h"
|
||||
#include "ZMMO.h"
|
||||
#include "ZMMOEntity.h"
|
||||
#include "ZMMOEntityInterface.h"
|
||||
#include "ZMMOPlayerProxy.h"
|
||||
#include "ZeusEntity.h"
|
||||
#include "ZeusEntityInterface.h"
|
||||
#include "ZeusGASComponent.h"
|
||||
#include "ZeusPlayerProxy.h"
|
||||
#include "ZeusPlayerState.h"
|
||||
#include "ZeusNetworkSubsystem.h"
|
||||
|
||||
void UZMMOWorldSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
void UZeusWorldSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
{
|
||||
Super::Initialize(Collection);
|
||||
|
||||
if (RemoteEntityClasses.IsEmpty())
|
||||
{
|
||||
RemoteEntityClasses.Add(EZMMOEntityType::Player, AZMMOPlayerProxy::StaticClass());
|
||||
RemoteEntityClasses.Add(EZMMOEntityType::Mob, AZMMOEntity::StaticClass());
|
||||
RemoteEntityClasses.Add(EZMMOEntityType::NPC, AZMMOEntity::StaticClass());
|
||||
RemoteEntityClasses.Add(EZMMOEntityType::Object, AZMMOEntity::StaticClass());
|
||||
RemoteEntityClasses.Add(EZeusEntityType::Player, AZeusPlayerProxy::StaticClass());
|
||||
RemoteEntityClasses.Add(EZeusEntityType::Mob, AZeusEntity::StaticClass());
|
||||
RemoteEntityClasses.Add(EZeusEntityType::NPC, AZeusEntity::StaticClass());
|
||||
RemoteEntityClasses.Add(EZeusEntityType::Object, AZeusEntity::StaticClass());
|
||||
}
|
||||
// Bind + replay vivem em OnWorldBeginPlay (mundo pronto). Initialize roda
|
||||
// MUITO cedo no pipeline de LoadMap — antes do GameMode ser instanciado
|
||||
@@ -25,16 +28,16 @@ void UZMMOWorldSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
// feitos aqui podem ser perdidos durante a fase de setup posterior.
|
||||
}
|
||||
|
||||
void UZMMOWorldSubsystem::OnWorldBeginPlay(UWorld& InWorld)
|
||||
void UZeusWorldSubsystem::OnWorldBeginPlay(UWorld& InWorld)
|
||||
{
|
||||
Super::OnWorldBeginPlay(InWorld);
|
||||
|
||||
if (UZeusNetworkSubsystem* ZeusNet = ResolveZeusNetworkSubsystem())
|
||||
{
|
||||
ZeusNet->OnPlayerSpawned.AddDynamic(this, &UZMMOWorldSubsystem::HandlePlayerSpawned);
|
||||
ZeusNet->OnPlayerDespawned.AddDynamic(this, &UZMMOWorldSubsystem::HandlePlayerDespawned);
|
||||
ZeusNet->OnPlayerStateUpdate.AddDynamic(this, &UZMMOWorldSubsystem::HandlePlayerStateUpdate);
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOWorldSubsystem bound to ZeusNetworkSubsystem delegates."));
|
||||
ZeusNet->OnPlayerSpawned.AddDynamic(this, &UZeusWorldSubsystem::HandlePlayerSpawned);
|
||||
ZeusNet->OnPlayerDespawned.AddDynamic(this, &UZeusWorldSubsystem::HandlePlayerDespawned);
|
||||
ZeusNet->OnPlayerStateUpdate.AddDynamic(this, &UZeusWorldSubsystem::HandlePlayerStateUpdate);
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusWorldSubsystem bound to ZeusNetworkSubsystem delegates."));
|
||||
|
||||
// Catch-up race fix (Fase 3): broadcasts de proxies remotos chegam
|
||||
// enquanto o cliente novo ainda esta em OpenLevel. UZeusNetworkSubsystem
|
||||
@@ -49,22 +52,22 @@ void UZMMOWorldSubsystem::OnWorldBeginPlay(UWorld& InWorld)
|
||||
});
|
||||
if (ReplayCount > 0)
|
||||
{
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOWorldSubsystem: replay de %d proxy(ies) cacheados."), ReplayCount);
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusWorldSubsystem: replay de %d proxy(ies) cacheados."), ReplayCount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZMMOWorldSubsystem: ZeusNetworkSubsystem not found at OnWorldBeginPlay."));
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZeusWorldSubsystem: ZeusNetworkSubsystem not found at OnWorldBeginPlay."));
|
||||
}
|
||||
}
|
||||
|
||||
void UZMMOWorldSubsystem::Deinitialize()
|
||||
void UZeusWorldSubsystem::Deinitialize()
|
||||
{
|
||||
if (UZeusNetworkSubsystem* ZeusNet = ResolveZeusNetworkSubsystem())
|
||||
{
|
||||
ZeusNet->OnPlayerSpawned.RemoveDynamic(this, &UZMMOWorldSubsystem::HandlePlayerSpawned);
|
||||
ZeusNet->OnPlayerDespawned.RemoveDynamic(this, &UZMMOWorldSubsystem::HandlePlayerDespawned);
|
||||
ZeusNet->OnPlayerStateUpdate.RemoveDynamic(this, &UZMMOWorldSubsystem::HandlePlayerStateUpdate);
|
||||
ZeusNet->OnPlayerSpawned.RemoveDynamic(this, &UZeusWorldSubsystem::HandlePlayerSpawned);
|
||||
ZeusNet->OnPlayerDespawned.RemoveDynamic(this, &UZeusWorldSubsystem::HandlePlayerDespawned);
|
||||
ZeusNet->OnPlayerStateUpdate.RemoveDynamic(this, &UZeusWorldSubsystem::HandlePlayerStateUpdate);
|
||||
}
|
||||
|
||||
RemoteEntities.Reset();
|
||||
@@ -72,7 +75,7 @@ void UZMMOWorldSubsystem::Deinitialize()
|
||||
Super::Deinitialize();
|
||||
}
|
||||
|
||||
void UZMMOWorldSubsystem::RegisterLocalEntity(const int64 EntityId, AActor* LocalActor)
|
||||
void UZeusWorldSubsystem::RegisterLocalEntity(const int64 EntityId, AActor* LocalActor)
|
||||
{
|
||||
if (EntityId == 0 || LocalActor == nullptr)
|
||||
{
|
||||
@@ -81,11 +84,11 @@ void UZMMOWorldSubsystem::RegisterLocalEntity(const int64 EntityId, AActor* Loca
|
||||
|
||||
LocalEntityId = EntityId;
|
||||
RemoteEntities.Add(EntityId, TWeakObjectPtr<AActor>(LocalActor));
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOWorldSubsystem: local entity registered EntityId=%lld actor=%s"),
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusWorldSubsystem: local entity registered EntityId=%lld actor=%s"),
|
||||
EntityId, *GetNameSafe(LocalActor));
|
||||
}
|
||||
|
||||
void UZMMOWorldSubsystem::HandlePlayerSpawned(const int64 EntityId, const bool bIsLocal,
|
||||
void UZeusWorldSubsystem::HandlePlayerSpawned(const int64 EntityId, const bool bIsLocal,
|
||||
const FVector PosCm, const float YawDeg, const int64 ServerTimeMs)
|
||||
{
|
||||
if (EntityId == 0)
|
||||
@@ -95,7 +98,7 @@ void UZMMOWorldSubsystem::HandlePlayerSpawned(const int64 EntityId, const bool b
|
||||
|
||||
if (bIsLocal)
|
||||
{
|
||||
// O proprio AZMMOPlayerCharacter cuida da sua identidade quando recebe o
|
||||
// O proprio AZeusCharacter cuida da sua identidade quando recebe o
|
||||
// delegate por outro caminho. Aqui apenas memorizamos para filtrar
|
||||
// snapshots locais (cliente solto, sem reconciliacao em V0).
|
||||
LocalEntityId = EntityId;
|
||||
@@ -110,17 +113,17 @@ void UZMMOWorldSubsystem::HandlePlayerSpawned(const int64 EntityId, const bool b
|
||||
// silenciosamente ignorado depois de oscilacoes na AOI.
|
||||
if (AActor* Existing = RemoteEntities[EntityId].Get())
|
||||
{
|
||||
if (IZMMOEntityInterface* AsEntity = Cast<IZMMOEntityInterface>(Existing))
|
||||
if (IZeusEntityInterface* AsEntity = Cast<IZeusEntityInterface>(Existing))
|
||||
{
|
||||
AsEntity->SetEntityRelevant(true);
|
||||
}
|
||||
Existing->SetActorLocationAndRotation(PosCm, FRotator(0.0f, YawDeg, 0.0f));
|
||||
UE_LOG(LogZMMO, Verbose, TEXT("ZMMOWorldSubsystem: re-snap EntityId=%d"), EntityId);
|
||||
UE_LOG(LogZMMO, Verbose, TEXT("ZeusWorldSubsystem: re-snap EntityId=%d"), EntityId);
|
||||
return;
|
||||
}
|
||||
// weak ptr stale — limpa entry e cai pro spawn novo abaixo.
|
||||
RemoteEntities.Remove(EntityId);
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOWorldSubsystem: stale entry para EntityId=%d, respawnando"), EntityId);
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusWorldSubsystem: stale entry para EntityId=%d, respawnando"), EntityId);
|
||||
}
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
@@ -129,10 +132,10 @@ void UZMMOWorldSubsystem::HandlePlayerSpawned(const int64 EntityId, const bool b
|
||||
return;
|
||||
}
|
||||
|
||||
UClass* ProxyClass = ResolveActorClass(EZMMOEntityType::Player);
|
||||
UClass* ProxyClass = ResolveActorClass(EZeusEntityType::Player);
|
||||
if (!ProxyClass)
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZMMOWorldSubsystem: no class registered for Player; spawn aborted."));
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZeusWorldSubsystem: no class registered for Player; spawn aborted."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -142,30 +145,78 @@ void UZMMOWorldSubsystem::HandlePlayerSpawned(const int64 EntityId, const bool b
|
||||
AActor* SpawnedActor = World->SpawnActor<AActor>(ProxyClass, PosCm, SpawnRot, Params);
|
||||
if (!SpawnedActor)
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZMMOWorldSubsystem: SpawnActor failed for EntityId=%d"), EntityId);
|
||||
UE_LOG(LogZMMO, Warning, TEXT("ZeusWorldSubsystem: SpawnActor failed for EntityId=%d"), EntityId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IZMMOEntityInterface* AsEntity = Cast<IZMMOEntityInterface>(SpawnedActor))
|
||||
if (IZeusEntityInterface* AsEntity = Cast<IZeusEntityInterface>(SpawnedActor))
|
||||
{
|
||||
// Inject identity via dedicated setter when the spawned actor exposes one.
|
||||
if (AZMMOPlayerProxy* Proxy = Cast<AZMMOPlayerProxy>(SpawnedActor))
|
||||
if (AZeusPlayerProxy* Proxy = Cast<AZeusPlayerProxy>(SpawnedActor))
|
||||
{
|
||||
Proxy->SetZMMOIdentity(EntityId, EZMMOEntityType::Player);
|
||||
Proxy->SetZeusIdentity(EntityId, EZeusEntityType::Player);
|
||||
}
|
||||
else if (AZMMOEntity* Entity = Cast<AZMMOEntity>(SpawnedActor))
|
||||
else if (AZeusEntity* Entity = Cast<AZeusEntity>(SpawnedActor))
|
||||
{
|
||||
Entity->SetZMMOIdentity(EntityId, EZMMOEntityType::Player);
|
||||
Entity->SetZeusIdentity(EntityId, EZeusEntityType::Player);
|
||||
}
|
||||
AsEntity->SetEntityRelevant(true);
|
||||
}
|
||||
|
||||
// === PlayerState pra proxies (Batch 2.5+) ===
|
||||
//
|
||||
// Sem PlayerState, o proxy fica fora do GameState->PlayerArray. Daqui pra
|
||||
// cima, qualquer sistema que itera PlayerArray (UZeusGASNetworkHandler::
|
||||
// FindGASComponentForEntity, HUD, chat, friend list) NAO consegue achar o
|
||||
// proxy -> fallback ao local player -> efeito apareceria no char errado
|
||||
// (bug do cue do Dash). Criar PS replicado-fake permite que o pipeline GAS
|
||||
// trate proxies igual a local players.
|
||||
//
|
||||
// PlayerState tem o UZeusGASComponent via DefaultGame.ini Component Registry,
|
||||
// entao GASComp e' auto-instanciado. So' precisamos seed o EntityId.
|
||||
if (APawn* ProxyPawn = Cast<APawn>(SpawnedActor))
|
||||
{
|
||||
FActorSpawnParameters PSParams;
|
||||
PSParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
PSParams.Owner = ProxyPawn;
|
||||
AZeusPlayerState* ProxyPS = World->SpawnActor<AZeusPlayerState>(
|
||||
AZeusPlayerState::StaticClass(), FVector::ZeroVector, FRotator::ZeroRotator, PSParams);
|
||||
if (ProxyPS)
|
||||
{
|
||||
ProxyPawn->SetPlayerState(ProxyPS); // tambem chama ProxyPS->SetPawn(ProxyPawn)
|
||||
|
||||
// Add ao PlayerArray do GameState (replicacao UE faria isso automatico,
|
||||
// mas no nosso pipeline custom o PS local-fake precisa ser inserido).
|
||||
if (AGameStateBase* GS = World->GetGameState())
|
||||
{
|
||||
GS->AddPlayerState(ProxyPS);
|
||||
}
|
||||
|
||||
// Seed EntityId no GASComp do PS (criado via Component Registry).
|
||||
// FindGASComponentForEntity vai resolver via PS->FindComponentByClass.
|
||||
if (UZeusGASComponent* GASComp = ProxyPS->FindComponentByClass<UZeusGASComponent>())
|
||||
{
|
||||
GASComp->SeedEntityId(EntityId);
|
||||
}
|
||||
|
||||
UE_LOG(LogZMMO, Log,
|
||||
TEXT("ZeusWorldSubsystem: PlayerState criado p/ proxy EntityId=%lld PS=%s"),
|
||||
EntityId, *ProxyPS->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogZMMO, Warning,
|
||||
TEXT("ZeusWorldSubsystem: SpawnActor<AZeusPlayerState> falhou pra proxy EntityId=%lld"),
|
||||
EntityId);
|
||||
}
|
||||
}
|
||||
|
||||
RemoteEntities.Add(EntityId, TWeakObjectPtr<AActor>(SpawnedActor));
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOWorldSubsystem: spawned remote EntityId=%d at (%s) yaw=%.1f t=%lld"),
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusWorldSubsystem: spawned remote EntityId=%d at (%s) yaw=%.1f t=%lld"),
|
||||
EntityId, *PosCm.ToString(), YawDeg, ServerTimeMs);
|
||||
}
|
||||
|
||||
void UZMMOWorldSubsystem::HandlePlayerDespawned(const int64 EntityId)
|
||||
void UZeusWorldSubsystem::HandlePlayerDespawned(const int64 EntityId)
|
||||
{
|
||||
const TWeakObjectPtr<AActor>* Entry = RemoteEntities.Find(EntityId);
|
||||
if (!Entry)
|
||||
@@ -181,18 +232,34 @@ void UZMMOWorldSubsystem::HandlePlayerDespawned(const int64 EntityId)
|
||||
// confirmado nos logs do AOI ao oscilar entrada/saida da ZI/ZD.
|
||||
if (AActor* Actor = Entry->Get())
|
||||
{
|
||||
if (IZMMOEntityInterface* AsEntity = Cast<IZMMOEntityInterface>(Actor))
|
||||
if (IZeusEntityInterface* AsEntity = Cast<IZeusEntityInterface>(Actor))
|
||||
{
|
||||
AsEntity->SetEntityRelevant(false);
|
||||
}
|
||||
// Destrui PS proxy linkado (Batch 2.5+). Sem isso o GameState->PlayerArray
|
||||
// fica com PS orfa apos o proxy ser destruido.
|
||||
if (APawn* Pawn = Cast<APawn>(Actor))
|
||||
{
|
||||
if (APlayerState* PS = Pawn->GetPlayerState())
|
||||
{
|
||||
if (UWorld* World = GetWorld())
|
||||
{
|
||||
if (AGameStateBase* GS = World->GetGameState())
|
||||
{
|
||||
GS->RemovePlayerState(PS);
|
||||
}
|
||||
}
|
||||
PS->Destroy();
|
||||
}
|
||||
}
|
||||
Actor->Destroy();
|
||||
}
|
||||
RemoteEntities.Remove(EntityId);
|
||||
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZMMOWorldSubsystem: despawn EntityId=%d (destroyed)"), EntityId);
|
||||
UE_LOG(LogZMMO, Log, TEXT("ZeusWorldSubsystem: despawn EntityId=%d (destroyed)"), EntityId);
|
||||
}
|
||||
|
||||
void UZMMOWorldSubsystem::HandlePlayerStateUpdate(const int64 EntityId, const int32 InputSeq,
|
||||
void UZeusWorldSubsystem::HandlePlayerStateUpdate(const int64 EntityId, const int32 InputSeq,
|
||||
const FVector PosCm, const FVector VelCmS, const bool bGrounded, const int64 ServerTimeMs)
|
||||
{
|
||||
if (EntityId == 0)
|
||||
@@ -204,7 +271,7 @@ void UZMMOWorldSubsystem::HandlePlayerStateUpdate(const int64 EntityId, const in
|
||||
{
|
||||
// Cliente local solto: ignoramos snapshots autoritativos para o nosso
|
||||
// proprio personagem em V0 (ADR 0038). Reconciliacao opcional pode ser
|
||||
// activada por flag em `AZMMOPlayerCharacter` quando colisao de objetos
|
||||
// activada por flag em `AZeusCharacter` quando colisao de objetos
|
||||
// chegar.
|
||||
return;
|
||||
}
|
||||
@@ -223,15 +290,15 @@ void UZMMOWorldSubsystem::HandlePlayerStateUpdate(const int64 EntityId, const in
|
||||
return;
|
||||
}
|
||||
|
||||
IZMMOEntityInterface* AsEntity = Cast<IZMMOEntityInterface>(Actor);
|
||||
IZeusEntityInterface* AsEntity = Cast<IZeusEntityInterface>(Actor);
|
||||
if (!AsEntity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FZMMOEntitySnapshot Snapshot;
|
||||
FZeusEntitySnapshot Snapshot;
|
||||
Snapshot.EntityId = EntityId;
|
||||
Snapshot.EntityType = AsEntity->GetZMMOEntityType();
|
||||
Snapshot.EntityType = AsEntity->GetZeusEntityType();
|
||||
Snapshot.LastProcessedInputSeq = InputSeq;
|
||||
Snapshot.PositionCm = PosCm;
|
||||
Snapshot.VelocityCmS = VelCmS;
|
||||
@@ -281,7 +348,7 @@ void UZMMOWorldSubsystem::HandlePlayerStateUpdate(const int64 EntityId, const in
|
||||
AsEntity->ApplyEntitySnapshot(Snapshot);
|
||||
}
|
||||
|
||||
UClass* UZMMOWorldSubsystem::ResolveActorClass(const EZMMOEntityType EntityType) const
|
||||
UClass* UZeusWorldSubsystem::ResolveActorClass(const EZeusEntityType EntityType) const
|
||||
{
|
||||
if (const TSubclassOf<AActor>* Found = RemoteEntityClasses.Find(EntityType))
|
||||
{
|
||||
@@ -290,10 +357,10 @@ UClass* UZMMOWorldSubsystem::ResolveActorClass(const EZMMOEntityType EntityType)
|
||||
return Found->Get();
|
||||
}
|
||||
}
|
||||
return AZMMOEntity::StaticClass();
|
||||
return AZeusEntity::StaticClass();
|
||||
}
|
||||
|
||||
UZeusNetworkSubsystem* UZMMOWorldSubsystem::ResolveZeusNetworkSubsystem() const
|
||||
UZeusNetworkSubsystem* UZeusWorldSubsystem::ResolveZeusNetworkSubsystem() const
|
||||
{
|
||||
const UWorld* World = GetWorld();
|
||||
if (!World)
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Subsystems/WorldSubsystem.h"
|
||||
#include "ZMMOEntityTypes.h"
|
||||
#include "ZMMOWorldSubsystem.generated.h"
|
||||
#include "ZeusEntityTypes.h"
|
||||
#include "ZeusWorldSubsystem.generated.h"
|
||||
|
||||
class AActor;
|
||||
class AZMMOPlayerCharacter;
|
||||
class AZMMOPlayerProxy;
|
||||
class AZeusCharacter;
|
||||
class AZeusPlayerProxy;
|
||||
class UZeusNetworkSubsystem;
|
||||
|
||||
/**
|
||||
* UZMMOWorldSubsystem
|
||||
* UZeusWorldSubsystem
|
||||
*
|
||||
* Subsistema por-mundo que orquestra a aplicacao de pacotes de replicacao
|
||||
* recebidos do servidor (`S_SPAWN_PLAYER`, `S_DESPAWN_PLAYER`,
|
||||
@@ -26,19 +26,19 @@ class UZeusNetworkSubsystem;
|
||||
* conexao UDP e dos delegates; este subsistema apenas escuta os
|
||||
* delegates e materializa atores na cena atual.
|
||||
*
|
||||
* Resolucao de classe por `EZMMOEntityType`:
|
||||
* Resolucao de classe por `EZeusEntityType`:
|
||||
* - `RemoteEntityClasses` e um TMap configuravel (BlueprintReadWrite)
|
||||
* com defaults seguros em `Initialize`. Permite trocar
|
||||
* `AZMMOPlayerProxy` por um BP filho com mesh customizada sem
|
||||
* `AZeusPlayerProxy` por um BP filho com mesh customizada sem
|
||||
* recompilar C++.
|
||||
*
|
||||
* Despawn:
|
||||
* - V0: chama `IZMMOEntityInterface::SetEntityRelevant(false)` (preserva
|
||||
* - V0: chama `IZeusEntityInterface::SetEntityRelevant(false)` (preserva
|
||||
* o ator para futuro pooling).
|
||||
* - V1: pool real por `EntityType`, limites de memoria, expiracao.
|
||||
*/
|
||||
UCLASS()
|
||||
class ZMMO_API UZMMOWorldSubsystem : public UWorldSubsystem
|
||||
class ZMMO_API UZeusWorldSubsystem : public UWorldSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -48,27 +48,27 @@ public:
|
||||
virtual void Deinitialize() override;
|
||||
|
||||
/**
|
||||
* Regista o jogador local no registry. Chamado por `AZMMOPlayerCharacter`
|
||||
* Regista o jogador local no registry. Chamado por `AZeusCharacter`
|
||||
* apos receber o `EntityId` autoritativo do servidor (delegate
|
||||
* `OnPlayerSpawned` com `bIsLocal=true`).
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "ZMMO|World")
|
||||
UFUNCTION(BlueprintCallable, Category = "Zeus|World")
|
||||
void RegisterLocalEntity(int64 EntityId, AActor* LocalActor);
|
||||
|
||||
/** Numero de entidades remotas actualmente trackeadas. Util em debug overlays. */
|
||||
UFUNCTION(BlueprintPure, Category = "ZMMO|World")
|
||||
UFUNCTION(BlueprintPure, Category = "Zeus|World")
|
||||
int32 GetTrackedEntityCount() const { return RemoteEntities.Num(); }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Mapa configuravel de classe a usar por `EZMMOEntityType`. Caso vazio,
|
||||
* usamos defaults seguros (`AZMMOPlayerProxy` para Player, `AZMMOEntity`
|
||||
* Mapa configuravel de classe a usar por `EZeusEntityType`. Caso vazio,
|
||||
* usamos defaults seguros (`AZeusPlayerProxy` para Player, `AZeusEntity`
|
||||
* para Mob/NPC/Object — actualizado quando classes especificas existirem).
|
||||
*
|
||||
* Pode ser preenchido via Blueprint subclassing ou em runtime.
|
||||
*/
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "ZMMO|World")
|
||||
TMap<EZMMOEntityType, TSubclassOf<AActor>> RemoteEntityClasses;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Zeus|World")
|
||||
TMap<EZeusEntityType, TSubclassOf<AActor>> RemoteEntityClasses;
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
UFUNCTION()
|
||||
void HandlePlayerStateUpdate(int64 EntityId, int32 InputSeq, FVector PosCm, FVector VelCmS, bool bGrounded, int64 ServerTimeMs);
|
||||
|
||||
UClass* ResolveActorClass(EZMMOEntityType EntityType) const;
|
||||
UClass* ResolveActorClass(EZeusEntityType EntityType) const;
|
||||
UZeusNetworkSubsystem* ResolveZeusNetworkSubsystem() const;
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ void UUIDraggableWindow_Base::ApplySavedPosition()
|
||||
const FName Id = GetWindowId();
|
||||
if (Id.IsNone()) return;
|
||||
|
||||
UZMMOUISaveGame* Save = UZMMOUISaveGame::LoadOrCreate();
|
||||
UZeusUISaveGame* Save = UZeusUISaveGame::LoadOrCreate();
|
||||
FVector2D Pos;
|
||||
if (Save && Save->TryGetWindowPosition(Id, Pos))
|
||||
{
|
||||
@@ -33,10 +33,10 @@ void UUIDraggableWindow_Base::PersistCurrentPosition()
|
||||
const FName Id = GetWindowId();
|
||||
if (Id.IsNone()) return;
|
||||
|
||||
UZMMOUISaveGame* Save = UZMMOUISaveGame::LoadOrCreate();
|
||||
UZeusUISaveGame* Save = UZeusUISaveGame::LoadOrCreate();
|
||||
if (!Save) return;
|
||||
Save->SetWindowPosition(Id, GetRenderTransform().Translation);
|
||||
UZMMOUISaveGame::SaveNow(Save);
|
||||
UZeusUISaveGame::SaveNow(Save);
|
||||
}
|
||||
|
||||
bool UUIDraggableWindow_Base::IsDragHandleHit(const FPointerEvent& MouseEvent) const
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include "UIDraggableWindow_Base.generated.h"
|
||||
|
||||
class UBorder;
|
||||
class UZMMOUISaveGame;
|
||||
class UZeusUISaveGame;
|
||||
|
||||
/**
|
||||
* Base de janelas in-game movel + persistente. Subclasse define WindowId
|
||||
* (FName estavel) via override de GetWindowId(); a Base cuida do drag
|
||||
* (RenderTransform.Translation) e da persistencia (UZMMOUISaveGame).
|
||||
* (RenderTransform.Translation) e da persistencia (UZeusUISaveGame).
|
||||
*
|
||||
* Convencao do WBP:
|
||||
* - Bind opcional `Border_DragHandle` cobrindo a area arrastavel (header).
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "UILoadingProfilesDataAsset.h"
|
||||
|
||||
FZMMOLoadingProfile UZMMOLoadingProfilesDataAsset::GetProfile(EZMMOLoadingContext Context) const
|
||||
FZeusLoadingProfile UZeusLoadingProfilesDataAsset::GetProfile(EZeusLoadingContext Context) const
|
||||
{
|
||||
if (const FZMMOLoadingProfile* Found = Profiles.Find(Context))
|
||||
if (const FZeusLoadingProfile* Found = Profiles.Find(Context))
|
||||
{
|
||||
return *Found;
|
||||
}
|
||||
return FZMMOLoadingProfile();
|
||||
return FZeusLoadingProfile();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/**
|
||||
* Mapa data-driven contexto → perfil (etapas + título). Designer edita o
|
||||
* asset; código consulta por EZMMOLoadingContext na hora de configurar a
|
||||
* asset; código consulta por EZeusLoadingContext na hora de configurar a
|
||||
* tela. Asset canônico: DA_LoadingProfiles em /Game/ZMMO/Data/UI/Loading/.
|
||||
*
|
||||
* Configurado em DefaultGame.ini:
|
||||
@@ -15,15 +15,15 @@
|
||||
* LoadingProfilesAsset=/Game/ZMMO/Data/UI/Loading/DA_LoadingProfiles.DA_LoadingProfiles
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class ZMMO_API UZMMOLoadingProfilesDataAsset : public UDataAsset
|
||||
class ZMMO_API UZeusLoadingProfilesDataAsset : public UDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Loading")
|
||||
TMap<EZMMOLoadingContext, FZMMOLoadingProfile> Profiles;
|
||||
TMap<EZeusLoadingContext, FZeusLoadingProfile> Profiles;
|
||||
|
||||
/** Retorna o perfil do contexto ou um perfil vazio (sem etapas). */
|
||||
UFUNCTION(BlueprintCallable, Category = "Loading")
|
||||
FZMMOLoadingProfile GetProfile(EZMMOLoadingContext Context) const;
|
||||
FZeusLoadingProfile GetProfile(EZeusLoadingContext Context) const;
|
||||
};
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "UILoadingProfilesDataAsset.h"
|
||||
#include "UILoadingTipRow.h"
|
||||
|
||||
void UUILoadingScreen_Base::Configure(EZMMOLoadingContext InContext,
|
||||
UZMMOLoadingProfilesDataAsset* Profiles,
|
||||
void UUILoadingScreen_Base::Configure(EZeusLoadingContext InContext,
|
||||
UZeusLoadingProfilesDataAsset* Profiles,
|
||||
UDataTable* TipsTable)
|
||||
{
|
||||
Context_ = InContext;
|
||||
@@ -18,22 +18,22 @@ void UUILoadingScreen_Base::Configure(EZMMOLoadingContext InContext,
|
||||
// Perfil (etapas + título).
|
||||
Profile_ = (Profiles != nullptr)
|
||||
? Profiles->GetProfile(InContext)
|
||||
: FZMMOLoadingProfile();
|
||||
: FZeusLoadingProfile();
|
||||
|
||||
StepStatus_.Reset();
|
||||
for (const FZMMOLoadingStepDef& Step : Profile_.Steps)
|
||||
for (const FZeusLoadingStepDef& Step : Profile_.Steps)
|
||||
{
|
||||
StepStatus_.Add(Step.StepId, EZMMOLoadingStepStatus::Pending);
|
||||
StepStatus_.Add(Step.StepId, EZeusLoadingStepStatus::Pending);
|
||||
}
|
||||
|
||||
// Pool de dicas filtrada por contexto (None = qualquer).
|
||||
TipPool_.Reset();
|
||||
if (TipsTable != nullptr)
|
||||
{
|
||||
TipsTable->ForeachRow<FZMMOLoadingTipRow>(TEXT("UUILoadingScreen_Base::Configure"),
|
||||
[this](const FName& /*Key*/, const FZMMOLoadingTipRow& Row)
|
||||
TipsTable->ForeachRow<FZeusLoadingTipRow>(TEXT("UUILoadingScreen_Base::Configure"),
|
||||
[this](const FName& /*Key*/, const FZeusLoadingTipRow& Row)
|
||||
{
|
||||
if (Row.Context == EZMMOLoadingContext::None || Row.Context == Context_)
|
||||
if (Row.Context == EZeusLoadingContext::None || Row.Context == Context_)
|
||||
{
|
||||
if (!Row.Tip.IsEmpty())
|
||||
{
|
||||
@@ -67,12 +67,12 @@ void UUILoadingScreen_Base::NativeOnDeactivated()
|
||||
|
||||
void UUILoadingScreen_Base::MarkStepRunning(FName StepId)
|
||||
{
|
||||
if (EZMMOLoadingStepStatus* Status = StepStatus_.Find(StepId))
|
||||
if (EZeusLoadingStepStatus* Status = StepStatus_.Find(StepId))
|
||||
{
|
||||
// Já Done não regride.
|
||||
if (*Status != EZMMOLoadingStepStatus::Done && *Status != EZMMOLoadingStepStatus::Failed)
|
||||
if (*Status != EZeusLoadingStepStatus::Done && *Status != EZeusLoadingStepStatus::Failed)
|
||||
{
|
||||
*Status = EZMMOLoadingStepStatus::Running;
|
||||
*Status = EZeusLoadingStepStatus::Running;
|
||||
RefreshUI();
|
||||
}
|
||||
}
|
||||
@@ -80,9 +80,9 @@ void UUILoadingScreen_Base::MarkStepRunning(FName StepId)
|
||||
|
||||
void UUILoadingScreen_Base::MarkStepDone(FName StepId)
|
||||
{
|
||||
if (EZMMOLoadingStepStatus* Status = StepStatus_.Find(StepId))
|
||||
if (EZeusLoadingStepStatus* Status = StepStatus_.Find(StepId))
|
||||
{
|
||||
*Status = EZMMOLoadingStepStatus::Done;
|
||||
*Status = EZeusLoadingStepStatus::Done;
|
||||
RefreshUI();
|
||||
|
||||
if (!bCompleteFired_ && AreAllStepsDone())
|
||||
@@ -95,9 +95,9 @@ void UUILoadingScreen_Base::MarkStepDone(FName StepId)
|
||||
|
||||
void UUILoadingScreen_Base::MarkStepFailed(FName StepId, const FText& Reason)
|
||||
{
|
||||
if (EZMMOLoadingStepStatus* Status = StepStatus_.Find(StepId))
|
||||
if (EZeusLoadingStepStatus* Status = StepStatus_.Find(StepId))
|
||||
{
|
||||
*Status = EZMMOLoadingStepStatus::Failed;
|
||||
*Status = EZeusLoadingStepStatus::Failed;
|
||||
if (Text_Status && !Reason.IsEmpty())
|
||||
{
|
||||
Text_Status->SetText(Reason);
|
||||
@@ -112,10 +112,10 @@ bool UUILoadingScreen_Base::AreAllStepsDone() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (const FZMMOLoadingStepDef& Step : Profile_.Steps)
|
||||
for (const FZeusLoadingStepDef& Step : Profile_.Steps)
|
||||
{
|
||||
const EZMMOLoadingStepStatus* Status = StepStatus_.Find(Step.StepId);
|
||||
if (Status == nullptr || *Status != EZMMOLoadingStepStatus::Done)
|
||||
const EZeusLoadingStepStatus* Status = StepStatus_.Find(Step.StepId);
|
||||
if (Status == nullptr || *Status != EZeusLoadingStepStatus::Done)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -135,11 +135,11 @@ int32 UUILoadingScreen_Base::FindStepIndex(FName StepId) const
|
||||
return INDEX_NONE;
|
||||
}
|
||||
|
||||
EZMMOLoadingStepStatus UUILoadingScreen_Base::GetStepStatus(int32 Index) const
|
||||
EZeusLoadingStepStatus UUILoadingScreen_Base::GetStepStatus(int32 Index) const
|
||||
{
|
||||
if (!Profile_.Steps.IsValidIndex(Index)) return EZMMOLoadingStepStatus::Pending;
|
||||
const EZMMOLoadingStepStatus* Status = StepStatus_.Find(Profile_.Steps[Index].StepId);
|
||||
return Status ? *Status : EZMMOLoadingStepStatus::Pending;
|
||||
if (!Profile_.Steps.IsValidIndex(Index)) return EZeusLoadingStepStatus::Pending;
|
||||
const EZeusLoadingStepStatus* Status = StepStatus_.Find(Profile_.Steps[Index].StepId);
|
||||
return Status ? *Status : EZeusLoadingStepStatus::Pending;
|
||||
}
|
||||
|
||||
FText UUILoadingScreen_Base::ComputeCurrentStatusText() const
|
||||
@@ -148,12 +148,12 @@ FText UUILoadingScreen_Base::ComputeCurrentStatusText() const
|
||||
int32 LastDone = INDEX_NONE;
|
||||
for (int32 i = 0; i < Profile_.Steps.Num(); ++i)
|
||||
{
|
||||
const EZMMOLoadingStepStatus St = GetStepStatus(i);
|
||||
if (St == EZMMOLoadingStepStatus::Running)
|
||||
const EZeusLoadingStepStatus St = GetStepStatus(i);
|
||||
if (St == EZeusLoadingStepStatus::Running)
|
||||
{
|
||||
return Profile_.Steps[i].Label;
|
||||
}
|
||||
if (St == EZMMOLoadingStepStatus::Done)
|
||||
if (St == EZeusLoadingStepStatus::Done)
|
||||
{
|
||||
LastDone = i;
|
||||
}
|
||||
@@ -176,9 +176,9 @@ float UUILoadingScreen_Base::ComputeProgress01() const
|
||||
float Acc = 0.f;
|
||||
for (int32 i = 0; i < N; ++i)
|
||||
{
|
||||
const EZMMOLoadingStepStatus St = GetStepStatus(i);
|
||||
if (St == EZMMOLoadingStepStatus::Done) Acc += 1.f;
|
||||
else if (St == EZMMOLoadingStepStatus::Running) Acc += 0.5f;
|
||||
const EZeusLoadingStepStatus St = GetStepStatus(i);
|
||||
if (St == EZeusLoadingStepStatus::Done) Acc += 1.f;
|
||||
else if (St == EZeusLoadingStepStatus::Running) Acc += 0.5f;
|
||||
}
|
||||
return FMath::Clamp(Acc / static_cast<float>(N), 0.f, 1.f);
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
class UCommonTextBlock;
|
||||
class UProgressBar;
|
||||
class UDataTable;
|
||||
class UZMMOLoadingProfilesDataAsset;
|
||||
class UZeusLoadingProfilesDataAsset;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FZMMOOnLoadingComplete);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FZeusOnLoadingComplete);
|
||||
|
||||
/**
|
||||
* Tela de loading genérica. Reusada pelo FrontEnd (handoff CharServer →
|
||||
* WorldServer) e pelo InGame (entrada em instance/dungeon, respawn). Cada
|
||||
* uso passa um EZMMOLoadingContext em Configure(), que resolve o perfil
|
||||
* no UZMMOLoadingProfilesDataAsset (lista de etapas + título).
|
||||
* uso passa um EZeusLoadingContext em Configure(), que resolve o perfil
|
||||
* no UZeusLoadingProfilesDataAsset (lista de etapas + título).
|
||||
*
|
||||
* Quem orquestra (UIFrontEndFlowSubsystem, futuro UIInGameFlowSubsystem)
|
||||
* assina os próprios eventos (HandlePostLoadMap, OnPlayerSpawned, etc) e
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
* de NativeOnActivated (estado é reaplicado em RefreshUI).
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "Loading")
|
||||
void Configure(EZMMOLoadingContext InContext,
|
||||
UZMMOLoadingProfilesDataAsset* Profiles,
|
||||
void Configure(EZeusLoadingContext InContext,
|
||||
UZeusLoadingProfilesDataAsset* Profiles,
|
||||
UDataTable* TipsTable);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Loading")
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
/** Disparado UMA vez quando todas as etapas viram Done. */
|
||||
UPROPERTY(BlueprintAssignable, Category = "Loading")
|
||||
FZMMOOnLoadingComplete OnLoadingComplete;
|
||||
FZeusOnLoadingComplete OnLoadingComplete;
|
||||
|
||||
protected:
|
||||
virtual void NativeOnActivated() override;
|
||||
@@ -75,7 +75,7 @@ protected:
|
||||
int32 FindStepIndex(FName StepId) const;
|
||||
|
||||
/** Status atual da etapa em [Steps_]; Pending se não rastreada. */
|
||||
EZMMOLoadingStepStatus GetStepStatus(int32 Index) const;
|
||||
EZeusLoadingStepStatus GetStepStatus(int32 Index) const;
|
||||
|
||||
/** Texto exibido em Text_Status — etapa Running atual ou última Done. */
|
||||
FText ComputeCurrentStatusText() const;
|
||||
@@ -107,13 +107,13 @@ protected:
|
||||
float TipRotationIntervalSeconds = 6.f;
|
||||
|
||||
private:
|
||||
EZMMOLoadingContext Context_ = EZMMOLoadingContext::None;
|
||||
EZeusLoadingContext Context_ = EZeusLoadingContext::None;
|
||||
|
||||
UPROPERTY(Transient)
|
||||
FZMMOLoadingProfile Profile_;
|
||||
FZeusLoadingProfile Profile_;
|
||||
|
||||
UPROPERTY(Transient)
|
||||
TMap<FName, EZMMOLoadingStepStatus> StepStatus_;
|
||||
TMap<FName, EZeusLoadingStepStatus> StepStatus_;
|
||||
|
||||
UPROPERTY(Transient)
|
||||
TArray<FText> TipPool_;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* UE). Filtra por contexto: Context=None significa "qualquer loading".
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FZMMOLoadingTipRow : public FTableRowBase
|
||||
struct FZeusLoadingTipRow : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -22,7 +22,7 @@ struct FZMMOLoadingTipRow : public FTableRowBase
|
||||
|
||||
/** Restringe a dica a um contexto. None = todos. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading")
|
||||
EZMMOLoadingContext Context = EZMMOLoadingContext::None;
|
||||
EZeusLoadingContext Context = EZeusLoadingContext::None;
|
||||
|
||||
/** Tag opcional pra categorizar (PvE/PvP/Crafting...) — futuro filtro. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading")
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
const FString UZMMOUISaveGame::SlotName = TEXT("UIPrefs");
|
||||
const FString UZeusUISaveGame::SlotName = TEXT("UIPrefs");
|
||||
|
||||
UZMMOUISaveGame* UZMMOUISaveGame::LoadOrCreate()
|
||||
UZeusUISaveGame* UZeusUISaveGame::LoadOrCreate()
|
||||
{
|
||||
if (UGameplayStatics::DoesSaveGameExist(SlotName, UserIndex))
|
||||
{
|
||||
if (UZMMOUISaveGame* Loaded = Cast<UZMMOUISaveGame>(
|
||||
if (UZeusUISaveGame* Loaded = Cast<UZeusUISaveGame>(
|
||||
UGameplayStatics::LoadGameFromSlot(SlotName, UserIndex)))
|
||||
{
|
||||
return Loaded;
|
||||
}
|
||||
}
|
||||
return Cast<UZMMOUISaveGame>(
|
||||
UGameplayStatics::CreateSaveGameObject(UZMMOUISaveGame::StaticClass()));
|
||||
return Cast<UZeusUISaveGame>(
|
||||
UGameplayStatics::CreateSaveGameObject(UZeusUISaveGame::StaticClass()));
|
||||
}
|
||||
|
||||
void UZMMOUISaveGame::SaveNow(UZMMOUISaveGame* Save)
|
||||
void UZeusUISaveGame::SaveNow(UZeusUISaveGame* Save)
|
||||
{
|
||||
if (Save)
|
||||
{
|
||||
@@ -26,7 +26,7 @@ void UZMMOUISaveGame::SaveNow(UZMMOUISaveGame* Save)
|
||||
}
|
||||
}
|
||||
|
||||
bool UZMMOUISaveGame::TryGetWindowPosition(FName WindowId, FVector2D& OutPos) const
|
||||
bool UZeusUISaveGame::TryGetWindowPosition(FName WindowId, FVector2D& OutPos) const
|
||||
{
|
||||
if (const FVector2D* Found = WindowPositions.Find(WindowId))
|
||||
{
|
||||
@@ -37,7 +37,7 @@ bool UZMMOUISaveGame::TryGetWindowPosition(FName WindowId, FVector2D& OutPos) co
|
||||
return false;
|
||||
}
|
||||
|
||||
void UZMMOUISaveGame::SetWindowPosition(FName WindowId, FVector2D Pos)
|
||||
void UZeusUISaveGame::SetWindowPosition(FName WindowId, FVector2D Pos)
|
||||
{
|
||||
WindowPositions.Add(WindowId, Pos);
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
* movel registra uma chave (FName WindowId) e grava aqui ao soltar o drag.
|
||||
*
|
||||
* Arquivo: [Project]/Saved/SaveGames/UIPrefs_0.sav (binary blob via
|
||||
* UE serializer). Mesmo padrao do [[ZMMOLoginSaveGame]].
|
||||
* UE serializer). Mesmo padrao do [[ZeusLoginSaveGame]].
|
||||
*
|
||||
* Helpers static abaixo encapsulam load-or-create do slot e Get/Set/Save
|
||||
* pra que a Base nao precise repetir a cerimonia.
|
||||
*/
|
||||
UCLASS()
|
||||
class ZMMO_API UZMMOUISaveGame : public USaveGame
|
||||
class ZMMO_API UZeusUISaveGame : public USaveGame
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
* Carrega o save existente ou cria um novo (nao salva ainda).
|
||||
* Sempre retorna instancia valida.
|
||||
*/
|
||||
static UZMMOUISaveGame* LoadOrCreate();
|
||||
static UZeusUISaveGame* LoadOrCreate();
|
||||
|
||||
/** Salva o slot atual (sincrono — chamado on-mouse-up, custo baixo). */
|
||||
static void SaveNow(UZMMOUISaveGame* Save);
|
||||
static void SaveNow(UZeusUISaveGame* Save);
|
||||
|
||||
/** Get com default — se WindowId nao foi gravado retorna FVector2D::ZeroVector. */
|
||||
UFUNCTION(BlueprintCallable, Category = "UI|Prefs")
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* é responsabilidade do UZeusCharServerSubsystem (Send/OnRawMessage operam
|
||||
* sobre o payload já sem header).
|
||||
*/
|
||||
namespace ZMMOCharOp
|
||||
namespace ZeusCharOp
|
||||
{
|
||||
// Autenticação — payload começa com uint8 method (ver ZMMOCharAuthMethod)
|
||||
// Autenticação — payload começa com uint8 method (ver ZeusCharAuthMethod)
|
||||
constexpr int32 C_CHAR_AUTH_REQUEST = 2000;
|
||||
constexpr int32 S_CHAR_AUTH_OK = 2001; // string(accountId)+string(user)+uint64(expiresMs)
|
||||
constexpr int32 S_CHAR_AUTH_REJECT = 2002; // uint16(reason)
|
||||
@@ -52,14 +52,14 @@ namespace ZMMOCharOp
|
||||
* Método de autenticação enviado como uint8 prefix no payload do
|
||||
* C_CHAR_AUTH_REQUEST.
|
||||
*/
|
||||
namespace ZMMOCharAuthMethod
|
||||
namespace ZeusCharAuthMethod
|
||||
{
|
||||
constexpr uint8 TOKEN = 0;
|
||||
constexpr uint8 PASSWORD = 1;
|
||||
}
|
||||
|
||||
/** Espelha `CharRejectReason` em CharOpcodes.ts. */
|
||||
namespace ZMMOCharRejectReason
|
||||
namespace ZeusCharRejectReason
|
||||
{
|
||||
constexpr uint16 Unknown = 0;
|
||||
constexpr uint16 InvalidToken = 1;
|
||||
@@ -85,7 +85,7 @@ namespace ZMMOCharRejectReason
|
||||
}
|
||||
|
||||
/** Estado do Realm no wire (uint8). Espelha `WireRealmState` em CharOpcodes.ts. */
|
||||
namespace ZMMOWireRealmState
|
||||
namespace ZeusWireRealmState
|
||||
{
|
||||
constexpr uint8 Offline = 0;
|
||||
constexpr uint8 Online = 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "UIActivatableScreen_Base.h"
|
||||
|
||||
#include "ZMMOThemeSubsystem.h"
|
||||
#include "ZeusThemeSubsystem.h"
|
||||
#include "UIFrontEndFlowSubsystem.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "Input/UIActionBindingHandle.h"
|
||||
@@ -10,13 +10,13 @@ TOptional<FUIInputConfig> UUIActivatableScreen_Base::GetDesiredInputConfig() con
|
||||
{
|
||||
switch (InputConfig)
|
||||
{
|
||||
case EZMMOScreenInputMode::GameAndMenu:
|
||||
case EZeusScreenInputMode::GameAndMenu:
|
||||
return FUIInputConfig(ECommonInputMode::All, GameMouseCaptureMode);
|
||||
case EZMMOScreenInputMode::Game:
|
||||
case EZeusScreenInputMode::Game:
|
||||
return FUIInputConfig(ECommonInputMode::Game, GameMouseCaptureMode);
|
||||
case EZMMOScreenInputMode::Menu:
|
||||
case EZeusScreenInputMode::Menu:
|
||||
return FUIInputConfig(ECommonInputMode::Menu, EMouseCaptureMode::NoCapture);
|
||||
case EZMMOScreenInputMode::Default:
|
||||
case EZeusScreenInputMode::Default:
|
||||
default:
|
||||
return TOptional<FUIInputConfig>();
|
||||
}
|
||||
@@ -25,7 +25,7 @@ TOptional<FUIInputConfig> UUIActivatableScreen_Base::GetDesiredInputConfig() con
|
||||
void UUIActivatableScreen_Base::RefreshUIStyle_Implementation()
|
||||
{
|
||||
// Base no-op: cada WBP/filho sobrescreve para reaplicar tokens do tema
|
||||
// ativo (via UZMMOThemeSubsystem). Mantém o contrato igual a
|
||||
// ativo (via UZeusThemeSubsystem). Mantém o contrato igual a
|
||||
// UUIButton_Base::RefreshUIStyle / UUIPanel_Base::RefreshUIStyle.
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void UUIActivatableScreen_Base::NativeConstruct()
|
||||
{
|
||||
if (const UGameInstance* GI = GetGameInstance())
|
||||
{
|
||||
if (UZMMOThemeSubsystem* Theme = GI->GetSubsystem<UZMMOThemeSubsystem>())
|
||||
if (UZeusThemeSubsystem* Theme = GI->GetSubsystem<UZeusThemeSubsystem>())
|
||||
{
|
||||
Theme->OnThemeChanged.AddDynamic(this, &UUIActivatableScreen_Base::HandleThemeChanged);
|
||||
bThemeBound = true;
|
||||
@@ -54,7 +54,7 @@ void UUIActivatableScreen_Base::NativeDestruct()
|
||||
{
|
||||
if (const UGameInstance* GI = GetGameInstance())
|
||||
{
|
||||
if (UZMMOThemeSubsystem* Theme = GI->GetSubsystem<UZMMOThemeSubsystem>())
|
||||
if (UZeusThemeSubsystem* Theme = GI->GetSubsystem<UZeusThemeSubsystem>())
|
||||
{
|
||||
Theme->OnThemeChanged.RemoveDynamic(this, &UUIActivatableScreen_Base::HandleThemeChanged);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user