// Project Lab - NHTV Igad

#pragma once

#include "GameFramework/GameMode.h"
#include "MenuGameMode.generated.h"

class AGameNameCharacter;
class AGameNamePlayerController;
class AGameNameSpectator;

UCLASS(minimalapi)
class AMenuGameMode : public AGameMode
{
	GENERATED_BODY()
	friend class AGameStateBase;
	friend class APlayerStateBase;
public:
	AMenuGameMode(); 
	virtual void PreInitializeComponents() override;
	virtual void BeginPlay() override;
	virtual void GetSeamlessTravelActorList(bool bToEntry, TArray<AActor*>& ActorList) override;

	virtual APlayerController* Login(class UPlayer* NewPlayer, ENetRole InRemoteRole, const FString& Portal, const FString& Options, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage) override;
	virtual FString InitNewPlayer(class APlayerController* NewPlayerController, const TSharedPtr<const FUniqueNetId>& UniqueId, const FString& Options, const FString& Portal /* = TEXT("") */) override;
	virtual void Logout(AController* existing) override;
	virtual void PostLogin(APlayerController* NewPlayer) override;

	// Player joined callback
	DECLARE_MULTICAST_DELEGATE_OneParam(FOnPlayerJoined, APlayerController*)
	FOnPlayerJoined onPlayerJoined;

	void SetMap(FString mapPath);
	bool StartGame();
	void AssignMapData(class UMapData* mapData);
private:
	UPROPERTY()
	class ALobbyState* m_lobbyState;

	FString m_mapPath;
	class UMapData* m_mapData;
};