// Fill out your copyright notice in the Description page of Project Settings.


#include "MainGameWidget.h"

#include "Controller/ShelvesStackingController.h"
#include "Faye/GameObjects/PlayerCharacter.h"
#include "Kismet/GameplayStatics.h"

void UMainGameWidget::ToggleOptionsWidget(bool bActive)
{
	OptionsOpen = bActive;
	Options_Widget->SetupWidget(FInstancedStruct{});
	Options_Widget->ToggleWidget(bActive);
}

void UMainGameWidget::TogglePhoneWidget(bool bActive)
{
	PhoneOpen = bActive;
	Phone_Widget->SetupWidget(FInstancedStruct{});
	Phone_Widget->ToggleWidget(bActive);
}

void UMainGameWidget::ToggleShelvesStackingWidget(bool bActive, FShelvesStackingSetupPayload Payload)
{
	FInstancedStruct StructPayload = FInstancedStruct::Make(Payload);
	Shelves_Stacking_Widget->SetupWidget(StructPayload);
	Shelves_Stacking_Widget->ToggleWidget(bActive);
}

void UMainGameWidget::ToggleDialogueWidget(bool bActive, FDialogueWidgetPayload DialoguePayload)
{
	DialogueOpen = bActive;
	if (DialogueOpen)
	{
		check(StaticStruct<FDialogueWidgetPayload>() != nullptr);
		FInstancedStruct StructPayload = FInstancedStruct::Make(DialoguePayload);
		Dialogue_Widget->SetupWidget(StructPayload);
	}
	Dialogue_Widget->ToggleWidget(bActive);
}
