Compare commits
8 Commits
cd94fbc07f
...
e8e6d37dad
Author | SHA1 | Date |
---|---|---|
eyakm1 | e8e6d37dad | 2 years ago |
m4xxx1m | e27bfbd8a8 | 2 years ago |
eyakm1 | e34909565e | 2 years ago |
m4xxx1m | 1eb65de5e6 | 2 years ago |
eyakm1 | 26b49e2e9d | 2 years ago |
m4xxx1m | 422b1439e5 | 2 years ago |
m4xxx1m | 71fd6242fe | 2 years ago |
m4xxx1m | 6e1fd803f1 | 2 years ago |
@ -1,7 +1,10 @@
|
||||
|
||||
[/Script/EngineSettings.GeneralProjectSettings]
|
||||
ProjectID=D68B8A08410D0195272328B9EAD1AE41
|
||||
bShouldWindowPreserveAspectRatio=False
|
||||
bUseBorderlessWindow=False
|
||||
|
||||
[StartupActions]
|
||||
bAddPacks=True
|
||||
InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent")
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,63 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "BattleUI.h"
|
||||
#include "Components/Button.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "BattlePlayerController.h"
|
||||
#include "BattlePlayerState.h"
|
||||
|
||||
|
||||
void UBattleUI::NativeConstruct() {
|
||||
Super::NativeConstruct();
|
||||
EndTurnButton->OnClicked.AddDynamic(this, &ThisClass::OnEndTurnClicked);
|
||||
ButtonAction_0->OnClicked.AddDynamic(this, &ThisClass::OnActionSwitched_0);
|
||||
ButtonAction_1->OnClicked.AddDynamic(this, &ThisClass::OnActionSwitched_1);
|
||||
ButtonAction_2->OnClicked.AddDynamic(this, &ThisClass::OnActionSwitched_2);
|
||||
}
|
||||
|
||||
void UBattleUI::SetWidgetText_Implementation(const FString &Text) {
|
||||
InformationText->SetText(FText::FromString(Text));
|
||||
}
|
||||
|
||||
void UBattleUI::SetWhoseTurnText_Implementation(bool IsThisPlayerTurn) {
|
||||
if (IsThisPlayerTurn) {
|
||||
SetWidgetText(TEXT("Your turn!"));
|
||||
} else {
|
||||
SetWidgetText(TEXT("Opponent's turn"));
|
||||
}
|
||||
}
|
||||
|
||||
void UBattleUI::OnEndTurnClicked() {
|
||||
Cast<ABattlePlayerController>(GetWorld()->GetFirstPlayerController())->
|
||||
EndTurn();
|
||||
}
|
||||
|
||||
void UBattleUI::OnActionSwitched_0() {
|
||||
ButtonAction_0->SetIsEnabled(false);
|
||||
ButtonAction_1->SetIsEnabled(true);
|
||||
ButtonAction_2->SetIsEnabled(true);
|
||||
ActionType = 0;
|
||||
OnActionSwitched();
|
||||
}
|
||||
|
||||
void UBattleUI::OnActionSwitched_1() {
|
||||
ButtonAction_0->SetIsEnabled(true);
|
||||
ButtonAction_1->SetIsEnabled(false);
|
||||
ButtonAction_2->SetIsEnabled(true);
|
||||
ActionType = 1;
|
||||
OnActionSwitched();
|
||||
}
|
||||
|
||||
void UBattleUI::OnActionSwitched_2() {
|
||||
ButtonAction_0->SetIsEnabled(true);
|
||||
ButtonAction_1->SetIsEnabled(true);
|
||||
ButtonAction_2->SetIsEnabled(false);
|
||||
ActionType = 2;
|
||||
OnActionSwitched();
|
||||
}
|
||||
|
||||
void UBattleUI::OnActionSwitched() const {
|
||||
Cast<ABattlePlayerController>(GetWorld()->GetFirstPlayerController())->
|
||||
GetPlayerState<ABattlePlayerState>()->SetCurrentAction(ActionType);
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "BattleUI.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API UBattleUI : public UUserWidget {
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
UFUNCTION(Client, Reliable)
|
||||
void SetWhoseTurnText(bool IsThisPlayerTurn);
|
||||
|
||||
UFUNCTION(Client, Reliable)
|
||||
void SetWidgetText(const FString &Text);
|
||||
|
||||
protected:
|
||||
int ActionType = 0;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget))
|
||||
class UButton *EndTurnButton;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget))
|
||||
class UButton *ButtonAction_0;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget))
|
||||
class UButton *ButtonAction_1;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget))
|
||||
class UButton *ButtonAction_2;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget))
|
||||
class UTextBlock *InformationText;
|
||||
|
||||
UFUNCTION()
|
||||
void OnEndTurnClicked();
|
||||
|
||||
UFUNCTION()
|
||||
void OnActionSwitched_0();
|
||||
|
||||
UFUNCTION()
|
||||
void OnActionSwitched_1();
|
||||
|
||||
UFUNCTION()
|
||||
void OnActionSwitched_2();
|
||||
|
||||
UFUNCTION()
|
||||
void OnActionSwitched() const;
|
||||
|
||||
};
|
@ -0,0 +1,27 @@
|
||||
// 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();
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "ManageSquadWidget.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API UManageSquadWidget : public UUserWidget {
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidget))
|
||||
class UButton *BackButton;
|
||||
|
||||
UFUNCTION()
|
||||
void OnBackButtonClicked();
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "SelectedTrooperSaveGame.h"
|
||||
|
||||
USelectedTrooperSaveGame::USelectedTrooperSaveGame()
|
||||
: Super() {
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/SaveGame.h"
|
||||
#include "SelectedTrooperSaveGame.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API USelectedTrooperSaveGame : public USaveGame {
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, Category=Basic)
|
||||
TArray<uint8> SelectedTroopers;
|
||||
|
||||
USelectedTrooperSaveGame();
|
||||
};
|
Loading…
Reference in new issue