diff --git a/Content/BP_MyPlayerController.uasset b/Content/BP_MyPlayerController.uasset index 42ec990..3006c01 100644 Binary files a/Content/BP_MyPlayerController.uasset and b/Content/BP_MyPlayerController.uasset differ diff --git a/Content/BattleField/BattleFieldMap.umap b/Content/BattleField/BattleFieldMap.umap index 97450eb..ad02be2 100644 Binary files a/Content/BattleField/BattleFieldMap.umap and b/Content/BattleField/BattleFieldMap.umap differ diff --git a/Content/MainMenu/BP_MainMenuGameMode.uasset b/Content/MainMenu/BP_MainMenuGameMode.uasset new file mode 100644 index 0000000..0f7a079 Binary files /dev/null and b/Content/MainMenu/BP_MainMenuGameMode.uasset differ diff --git a/Content/MainMenu/BP_MainMenuPlayerController.uasset b/Content/MainMenu/BP_MainMenuPlayerController.uasset new file mode 100644 index 0000000..4a59f6f Binary files /dev/null and b/Content/MainMenu/BP_MainMenuPlayerController.uasset differ diff --git a/Content/MainMenu/BP_ManageSquad_TrooperItem.uasset b/Content/MainMenu/BP_ManageSquad_TrooperItem.uasset deleted file mode 100644 index dd8d609..0000000 Binary files a/Content/MainMenu/BP_ManageSquad_TrooperItem.uasset and /dev/null differ diff --git a/Content/MainMenu/MainMenuLevel.umap b/Content/MainMenu/MainMenuLevel.umap index 4c50f68..7295fca 100644 Binary files a/Content/MainMenu/MainMenuLevel.umap and b/Content/MainMenu/MainMenuLevel.umap differ diff --git a/Content/MainMenu/ManageSquadWidget.uasset b/Content/MainMenu/ManageSquadWidget.uasset deleted file mode 100644 index 073d01e..0000000 Binary files a/Content/MainMenu/ManageSquadWidget.uasset and /dev/null differ diff --git a/Content/MainMenu/ManageSquad_TrooperEntry.uasset b/Content/MainMenu/ManageSquad_TrooperEntry.uasset deleted file mode 100644 index 1cf4bef..0000000 Binary files a/Content/MainMenu/ManageSquad_TrooperEntry.uasset and /dev/null differ diff --git a/Content/Troopers/TrooperSkeletonMelee.uasset b/Content/Troopers/TrooperSkeletonMelee.uasset index 0eed9e2..c8753e4 100644 Binary files a/Content/Troopers/TrooperSkeletonMelee.uasset and b/Content/Troopers/TrooperSkeletonMelee.uasset differ diff --git a/Source/TurnBasedTutorial/MainMenuPlayerController.cpp b/Source/TurnBasedTutorial/MainMenuPlayerController.cpp new file mode 100644 index 0000000..02ca458 --- /dev/null +++ b/Source/TurnBasedTutorial/MainMenuPlayerController.cpp @@ -0,0 +1,13 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "MainMenuPlayerController.h" +#include "Blueprint/UserWidget.h" + +void AMainMenuPlayerController::BeginPlay() { + Super::BeginPlay(); + SetShowMouseCursor(true); + UUserWidget *CreatedWidget = CreateWidget( + GetWorld(), WidgetClass); + CreatedWidget->AddToViewport(); +} diff --git a/Source/TurnBasedTutorial/MainMenuPlayerController.h b/Source/TurnBasedTutorial/MainMenuPlayerController.h new file mode 100644 index 0000000..8ad88e6 --- /dev/null +++ b/Source/TurnBasedTutorial/MainMenuPlayerController.h @@ -0,0 +1,22 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/PlayerController.h" +#include "MainMenuPlayerController.generated.h" + +/** + * + */ +UCLASS() +class TURNBASEDTUTORIAL_API + AMainMenuPlayerController : public APlayerController { + GENERATED_BODY() + + virtual void BeginPlay() override; + +protected: + UPROPERTY(EditAnywhere) + TSubclassOf WidgetClass; +}; diff --git a/Source/TurnBasedTutorial/MyPlayerController.cpp b/Source/TurnBasedTutorial/MyPlayerController.cpp index cf74f71..3f7332b 100644 --- a/Source/TurnBasedTutorial/MyPlayerController.cpp +++ b/Source/TurnBasedTutorial/MyPlayerController.cpp @@ -5,6 +5,7 @@ #include "MyGameMode.h" #include "MyGameState.h" #include "MyPlayerState.h" +#include "Blueprint/UserWidget.h" #include "Net/UnrealNetwork.h" AMyPlayerController::AMyPlayerController() @@ -13,6 +14,13 @@ AMyPlayerController::AMyPlayerController() SetShowMouseCursor(true); } +void AMyPlayerController::BeginPlay() { + Super::BeginPlay(); + UUserWidget *CreatedWidget = CreateWidget( + GetWorld(), WidgetClass); + CreatedWidget->AddToViewport(); +} + void AMyPlayerController::SetupInputComponent() { Super::SetupInputComponent(); InputComponent->BindAction("MyAction", IE_Pressed, this, @@ -129,7 +137,7 @@ void AMyPlayerController::EndTurn_Implementation() { void AMyPlayerController::SetPlayerIndex(uint8 NewPlayerIndex) { PlayerIndex = NewPlayerIndex; - + GetMyPlayerState()->SetPlayerIndex(NewPlayerIndex); // GetMyPlayerState()->PlayerIndex = NewPlayerIndex; } diff --git a/Source/TurnBasedTutorial/MyPlayerController.h b/Source/TurnBasedTutorial/MyPlayerController.h index 006d25d..9b962e7 100644 --- a/Source/TurnBasedTutorial/MyPlayerController.h +++ b/Source/TurnBasedTutorial/MyPlayerController.h @@ -12,6 +12,8 @@ class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController { GENERATED_BODY() public: + virtual void BeginPlay() override; + // FOnMyTurnChangedDelegate OnMyTurnChanged; virtual void SetupInputComponent() override; @@ -49,6 +51,9 @@ public: // void SetEnemySelection(const TArray &Troopers) const; private: + UPROPERTY(EditAnywhere) + TSubclassOf WidgetClass; + // UPROPERTY(Replicated) // bool bIsMyTurn; //