|
|
|
|
| #pragma once
|
|
|
| #include "Components/GameStateComponent.h"
|
|
|
| #include "LyraTeamCreationComponent.generated.h"
|
|
|
| class ULyraExperienceDefinition;
|
| class ALyraTeamPublicInfo;
|
| class ALyraTeamPrivateInfo;
|
| class ALyraPlayerState;
|
| class AGameModeBase;
|
| class APlayerController;
|
| class ULyraTeamDisplayAsset;
|
|
|
| UCLASS(Blueprintable)
|
| class ULyraTeamCreationComponent : public UGameStateComponent
|
| {
|
| GENERATED_BODY()
|
|
|
| public:
|
| ULyraTeamCreationComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
|
|
| #if WITH_EDITOR
|
| virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override;
|
| #endif
|
|
|
|
|
|
|
| virtual void BeginPlay() override;
|
|
|
|
|
| private:
|
| void OnExperienceLoaded(const ULyraExperienceDefinition* Experience);
|
|
|
| protected:
|
|
|
| UPROPERTY(EditDefaultsOnly, Category = Teams)
|
| TMap<uint8, TObjectPtr<ULyraTeamDisplayAsset>> TeamsToCreate;
|
|
|
| UPROPERTY(EditDefaultsOnly, Category=Teams)
|
| TSubclassOf<ALyraTeamPublicInfo> PublicTeamInfoClass;
|
|
|
| UPROPERTY(EditDefaultsOnly, Category=Teams)
|
| TSubclassOf<ALyraTeamPrivateInfo> PrivateTeamInfoClass;
|
|
|
| #if WITH_SERVER_CODE
|
| protected:
|
| virtual void ServerCreateTeams();
|
| virtual void ServerAssignPlayersToTeams();
|
|
|
|
|
| virtual void ServerChooseTeamForPlayer(ALyraPlayerState* PS);
|
|
|
| private:
|
| void OnPlayerInitialized(AGameModeBase* GameMode, AController* NewPlayer);
|
| void ServerCreateTeam(int32 TeamId, ULyraTeamDisplayAsset* DisplayAsset);
|
|
|
|
|
| int32 GetLeastPopulatedTeamID() const;
|
| #endif
|
| };
|
|
|