// Project Lab - NHTV Igad

#pragma once
#include "MenuScreenBase.h"
#include "CharacterSettings.h"
#include "LobbyMenu.generated.h"


UCLASS()
class UNREALPROJECT_API ULobbyMenu : public UMenuScreenBase
{
	GENERATED_BODY()

public:
	virtual void NativeConstruct() override;
	virtual void NativeDestruct() override;
	virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;

	// Must be called from blueprint to setup this element
	void Init();

	UFUNCTION(BlueprintCallable, Category = "Ready")
	void ToggleReadyState();
	UFUNCTION(BlueprintCallable, Category = "Ready")
	void StartGame();
	UFUNCTION(BlueprintCallable, Category = "Ready")
	void GotoTeamSelector();

	UFUNCTION(BlueprintCallable, Category = "Game")
	void BackToMenu();
	UFUNCTION(BlueprintCallable, Category = "Game")
	bool IsHost() const;

	// Called when the local player enters the lobby menu & state
	void OnLobbyEnter();

	// When this menu needs to be hidden
	UFUNCTION(BlueprintImplementableEvent)
	void OnShow();
	// When this menu needs to be shown
	UFUNCTION(BlueprintImplementableEvent)
	void OnHide();

	UPROPERTY(EditDefaultsOnly, Category = "Lobby")
	TSubclassOf<class ULobbySlot> lobbySlotClass;

	UFUNCTION(BlueprintCallable, Category = "Lobby")
	TArray<FCharacterSave> GetCharacterSaves();

private:
	ULobbyMenu(const FObjectInitializer& init);

	UPROPERTY()
	class APlayerStateBase* m_myState;
	UPROPERTY()
	TArray<class ULobbySlot*> m_lobbySlots;
	UPROPERTY()
	class USubMenu* m_teamContainer;

	uint32 m_numTeams;

	TArray<FCharacterSave> m_characters;
};
