This commit is contained in:
Arnaud Jamin
2025-02-12 15:18:33 -05:00
parent 0b13879282
commit 362d248866
3 changed files with 11 additions and 18 deletions
+9 -4
View File
@@ -6,21 +6,26 @@
#include "CogAll.h" #include "CogAll.h"
#include "CogSampleWindow_Team.h" #include "CogSampleWindow_Team.h"
#include "CogSubsystem.h" #include "CogSubsystem.h"
#endif #endif
//--------------------------------------------------------------------------------------------------------------------------
void UCogSampleGameInstance::Init() void UCogSampleGameInstance::Init()
{ {
Super::Init(); Super::Init();
#if ENABLE_COG #if ENABLE_COG
// Get the cog subsystem
if (UCogSubsystem* CogSubSystem = GetSubsystem<UCogSubsystem>()) if (UCogSubsystem* CogSubSystem = GetSubsystem<UCogSubsystem>())
{ {
// Add all the built-in windows. You copy paste this function code to organize the menu differently.
Cog::AddAllWindows(*CogSubSystem); Cog::AddAllWindows(*CogSubSystem);
// Add a custom window
CogSubSystem->AddWindow<FCogSampleWindow_Team>("Gameplay.Team"); CogSubSystem->AddWindow<FCogSampleWindow_Team>("Gameplay.Team");
// Activate Cog
CogSubSystem->Activate(); CogSubSystem->Activate();
} }
#endif #endif
} }
+1 -5
View File
@@ -1,15 +1,11 @@
#pragma once #pragma once
#include "CoreMinimal.h"
#include "CogSampleGameInstance.generated.h" #include "CogSampleGameInstance.generated.h"
class UCogSubsystem;
class UCogSampleAbilitySystemComponent;
UCLASS() UCLASS()
class UCogSampleGameInstance : public UGameInstance class UCogSampleGameInstance : public UGameInstance
{ {
GENERATED_BODY() GENERATED_BODY()
virtual void Init() override; void Init() override;
}; };
+1 -9
View File
@@ -30,20 +30,12 @@ private:
UPROPERTY() UPROPERTY()
UCogSampleAbilitySystemComponent* AbilitySystemComponent = nullptr; UCogSampleAbilitySystemComponent* AbilitySystemComponent = nullptr;
//---------------------------------------------------------------------------------
// To make sure it doesn't get garbage collected.
//---------------------------------------------------------------------------------
UPROPERTY()
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
protected: protected:
UPROPERTY(Replicated) UPROPERTY(Replicated)
float _ServerFramerateRaw = 0.0f; float _ServerFramerateRaw = 0.0f;
#if ENABLE_COG #if ENABLE_COG
TObjectPtr<UCogSubsystem> CogWindowManager = nullptr;
float _ClientFramerateSmooth = 0.0f; float _ClientFramerateSmooth = 0.0f;
float _ServerFramerateSmooth = 0.0f; float _ServerFramerateSmooth = 0.0f;