You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
964 B
28 lines
964 B
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#include "ManageSquadWidget.h"
|
|
|
|
#include "ManageSquadGameState.h"
|
|
#include "SelectedTrooperSaveGame.h"
|
|
#include "Components/Button.h"
|
|
#include "Kismet/GameplayStatics.h"
|
|
|
|
|
|
void UManageSquadWidget::NativeConstruct() {
|
|
Super::NativeConstruct();
|
|
BackButton->OnClicked.AddDynamic(
|
|
this, &ThisClass::UManageSquadWidget::OnBackButtonClicked);
|
|
}
|
|
|
|
void UManageSquadWidget::OnBackButtonClicked() {
|
|
USelectedTrooperSaveGame *SaveGameInstance = Cast<USelectedTrooperSaveGame>(
|
|
UGameplayStatics::CreateSaveGameObject(
|
|
USelectedTrooperSaveGame::StaticClass()));
|
|
SaveGameInstance->SelectedTroopers = GetWorld()->GetGameState<
|
|
AManageSquadGameState>()->GetSquad();
|
|
UGameplayStatics::SaveGameToSlot(
|
|
SaveGameInstance,TEXT("Selected troopers"), 0);
|
|
UGameplayStatics::OpenLevel(GetWorld(), "MainMenuLevel");
|
|
RemoveFromParent();
|
|
}
|