void SDeployScenarioSection::Construct()

in GameLiftPlugin/Source/GameLiftPlugin/Private/SMenu/EC2/SDeployScenarioSection.cpp [31:135]


void SDeployScenarioSection::Construct(const FArguments& InArgs)
{
	DeploymentFields = InArgs._SetDeploymentFields;
	DeploymentStatus = SNew(SDeploymentStatus);

	SSectionStep::Construct(
		SSectionStep::FArguments()
		.HeaderTitle(Menu::DeployManagedEC2::kDeploymentScenarioHeader)
		.HeaderDescription(Menu::DeployManagedEC2::kDeploymentStatusInfoRichText)
		.BodyContent()
		[
			SNew(SVerticalBox)
				// Deployment status
				+ SVerticalBox::Slot()
				.AutoHeight()
				[
					DeploymentStatus.ToSharedRef()
				]
				// Buttons
				+ SVerticalBox::Slot()
				.AutoHeight()
				.Padding(SPadding::Top3x)
				[
					SNew(SHorizontalBox)
						+ SHorizontalBox::Slot()
						.AutoWidth()
						.HAlign(HAlign_Left)
						[
							SNew(SWidgetSwitcher)
								.WidgetIndex_Lambda([&]
									{
										UGameLiftDeploymentStatus* DeploySettings = GetMutableDefault<UGameLiftDeploymentStatus>();
										EDeploymentMessageState State = EDeploymentMessageStateFromString(DeploySettings->Status.ToString());
										if (State == EDeploymentMessageState::InProgressMessage || State == EDeploymentMessageState::AbortInProgressMessage)
										{
											// Stop deployment
											return 2;
										}
										else if (State == EDeploymentMessageState::FailureMessage || State == EDeploymentMessageState::NoDeploymentMessage)
										{
											// Deploy scenario
											return 0;
										}
										else {
											// Redeploy scenario
											return 1;
										}
									})
								+ SWidgetSwitcher::Slot()
								[
									SNew(SButton)
										.Text(Menu::DeployManagedEC2::kDeployCloudFormationButtonText)
										.ButtonStyle(FGameLiftPluginStyle::Get(), Style::Button::kSuccessButtonStyleName)
										.TextStyle(FGameLiftPluginStyle::Get(), Style::Text::kButtonLight)
										.OnClicked_Raw(this, &SDeployScenarioSection::DeployCloudFormation)
								]
								+ SWidgetSwitcher::Slot()
								[
									SNew(SButton)
										.Text(Menu::DeployManagedEC2::kRedeployCloudFormationButtonText)
										.ButtonStyle(FGameLiftPluginStyle::Get(), Style::Button::kNormalButtonStyleName)
										.TextStyle(FGameLiftPluginStyle::Get(), Style::Text::kButtonNormal)
										.OnClicked_Raw(this, &SDeployScenarioSection::DeployCloudFormation)
								]
								+ SWidgetSwitcher::Slot()
								[
									// Button to stop
									SNew(SButton)
										.Text(Menu::DeployManagedEC2::kStopCloudFormationButtonText)
										.ButtonStyle(FGameLiftPluginStyle::Get(), Style::Button::kErrorButtonStyleName)
										.TextStyle(FGameLiftPluginStyle::Get(), Style::Text::kButtonLight)
										.ToolTipText_Lambda([&]()
											{
												return HandleStopButtonState().second;
											})
										.OnClicked_Raw(this, &SDeployScenarioSection::StopDeploying)
										.IsEnabled_Lambda([&]()
											{
												return HandleStopButtonState().first;
											})
								]
						]
						// Hyperlink
						+ SHorizontalBox::Slot()
						.FillWidth(1)
						.HAlign(HAlign_Right)
						.Padding(SPadding::Right) // move the link left a bit
						[
							CreateCloudFormationInConsoleHyperLink()
						]
				]
		]);

		SetDefaultValues();
		UpdateUIBasedOnCurrentState();

		// Only collapsed if no deployment on initialization
		UGameLiftDeploymentStatus* DeploySettings = GetMutableDefault<UGameLiftDeploymentStatus>();
		EDeploymentMessageState State = EDeploymentMessageStateFromString(DeploySettings->Status.ToString());

		if (State == EDeploymentMessageState::NoDeploymentMessage)
		{
			SetExpansion(false);
		}
}