Minigame
This commit is contained in:
parent
5e8473f27f
commit
60ba66b249
@ -27,6 +27,8 @@ void ACustomPlayerController::AppendInputContext(TSoftObjectPtr<class UInputMapp
|
|||||||
|
|
||||||
void ACustomPlayerController::BeginPlay()
|
void ACustomPlayerController::BeginPlay()
|
||||||
{
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
|
subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
|
||||||
|
@ -23,9 +23,6 @@ void ALevelBase::BeginPlay()
|
|||||||
{
|
{
|
||||||
AMainGameModeBase::leadLevel = TStrongObjectPtr<ALevelBase>{ this };
|
AMainGameModeBase::leadLevel = TStrongObjectPtr<ALevelBase>{ this };
|
||||||
|
|
||||||
for(TActorIterator<AMinigame> it(GetWorld()); it; ++it)
|
|
||||||
ACustomPlayerController::AppendInputContext(it->GetInputMappings());
|
|
||||||
|
|
||||||
ALevelScriptActor::BeginPlay();
|
ALevelScriptActor::BeginPlay();
|
||||||
|
|
||||||
BroadcastNewLevelBeginPlay();
|
BroadcastNewLevelBeginPlay();
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "AgeOfWarManager.h"
|
#include "AgeOfWarManager.h"
|
||||||
|
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "AgeOfWarUnit.h"
|
#include "AgeOfWarUnit.h"
|
||||||
|
|
||||||
|
#include "Components/BoxComponent.h"
|
||||||
#include "Components/StaticMeshComponent.h"
|
#include "Components/StaticMeshComponent.h"
|
||||||
|
|
||||||
#include "AgeOfWarManager.h"
|
#include "AgeOfWarManager.h"
|
||||||
#include <Components/BoxComponent.h>
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "CrossyRoadManager.h"
|
#include "CrossyRoadManager.h"
|
||||||
|
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "CrossyRoadObstacle.h"
|
#include "CrossyRoadObstacle.h"
|
||||||
|
|
||||||
#include "CrossyRoadManager.h"
|
#include "CrossyRoadManager.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "FishingManager.h"
|
#include "FishingManager.h"
|
||||||
|
|
||||||
#include "EnhancedInputComponent.h"
|
#include "EnhancedInputComponent.h"
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "Minigame.h"
|
#include "Minigame.h"
|
||||||
|
|
||||||
#include "EnhancedInputSubsystems.h"
|
#include "CustomPlayerController.h"
|
||||||
#include "InputMappingContext.h"
|
|
||||||
|
|
||||||
#include "PlayerBase.h"
|
#include "PlayerBase.h"
|
||||||
|
|
||||||
AMinigame::AMinigame()
|
AMinigame::AMinigame()
|
||||||
@ -22,23 +19,13 @@ void AMinigame::End()
|
|||||||
OnEnd();
|
OnEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMinigame::Restart()
|
|
||||||
{}
|
|
||||||
|
|
||||||
UInputMappingContext* AMinigame::GetInputMappings()
|
|
||||||
{
|
|
||||||
return context.LoadSynchronous();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AMinigame::Start(APlayerBase* playerPawn, FMinigameEndCallback delegate)
|
void AMinigame::Start(APlayerBase* playerPawn, FMinigameEndCallback delegate)
|
||||||
{
|
{
|
||||||
player = playerPawn;
|
player = playerPawn;
|
||||||
callback = delegate;
|
callback = delegate;
|
||||||
|
|
||||||
if(context)
|
if(context.IsValid())
|
||||||
if(auto PC = Cast<APlayerController>(playerPawn->GetController()))
|
ACustomPlayerController::AppendInputContext(context);
|
||||||
if(auto inputSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer()))
|
|
||||||
inputSubsystem->AddMappingContext(context.LoadSynchronous(), 0);
|
|
||||||
|
|
||||||
OnStart();
|
OnStart();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,14 @@ enum class EMinigameResult : uint8
|
|||||||
|
|
||||||
DECLARE_DYNAMIC_DELEGATE_TwoParams(FMinigameEndCallback, EMinigameResult, result, int32, score);
|
DECLARE_DYNAMIC_DELEGATE_TwoParams(FMinigameEndCallback, EMinigameResult, result, int32, score);
|
||||||
|
|
||||||
UCLASS(Blueprintable, BlueprintType, MinimalAPI, Abstract)
|
/**
|
||||||
|
* Interface for all minigame classes.
|
||||||
|
* Any minigame is started/ended/restarted by executing Start()/End()/Restart() on specific instance.
|
||||||
|
* Each call is after broadcasted into a blueprint event also.
|
||||||
|
* On start the caller can pass a OnEndCallback delegate to receive result and score on a minigame end.
|
||||||
|
* Each minigame can have its own contextInput
|
||||||
|
*/
|
||||||
|
UCLASS(Abstract, Blueprintable, BlueprintType, MinimalAPI)
|
||||||
class AMinigame : public AActor
|
class AMinigame : public AActor
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
@ -25,21 +32,21 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
virtual void Start(class APlayerBase* playerPawn, FMinigameEndCallback delegate);
|
virtual void Start(class APlayerBase* playerPawn, FMinigameEndCallback delegate);
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void OnStart();
|
void OnStart();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
virtual void End();
|
virtual void End();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
virtual void Restart();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void OnEnd();
|
void OnEnd();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
virtual void Restart() {}
|
||||||
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
|
void OnRestart();
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
class UInputMappingContext* GetInputMappings();
|
TSoftObjectPtr<class UInputMappingContext> GetInputMappings() { return context; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FMinigameEndCallback callback;
|
FMinigameEndCallback callback;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "RythmClickManager.h"
|
#include "RythmClickManager.h"
|
||||||
|
|
||||||
#include "MainGameModeBase.h"
|
#include "MainGameModeBase.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "SubwaySurfManager.h"
|
#include "SubwaySurfManager.h"
|
||||||
|
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "SubwaySurfObstacle.h"
|
#include "SubwaySurfObstacle.h"
|
||||||
|
|
||||||
#include "SubwaySurfManager.h"
|
#include "SubwaySurfManager.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "AutohideWidget.h"
|
#include "AutohideWidget.h"
|
||||||
|
|
||||||
#include "Animation/WidgetAnimation.h"
|
#include "Animation/WidgetAnimation.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "DialogueRowWidgetManager.h"
|
#include "DialogueRowWidgetManager.h"
|
||||||
|
|
||||||
#include "Blueprint/WidgetTree.h"
|
#include "Blueprint/WidgetTree.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "InteractableHintWidgetManager.h"
|
#include "InteractableHintWidgetManager.h"
|
||||||
|
|
||||||
#include "Blueprint/WidgetTree.h"
|
#include "Blueprint/WidgetTree.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "JournalWidget.h"
|
#include "JournalWidget.h"
|
||||||
|
|
||||||
#include "Blueprint/WidgetTree.h"
|
#include "Blueprint/WidgetTree.h"
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "MainMenuButtonWidget.h"
|
#include "MainMenuButtonWidget.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "MainMenuWidget.h"
|
#include "MainMenuWidget.h"
|
||||||
|
|
||||||
#include "Animation/WidgetAnimation.h"
|
#include "Animation/WidgetAnimation.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "QuickTimeEventWidget.h"
|
#include "QuickTimeEventWidget.h"
|
||||||
|
|
||||||
#include "Animation/WidgetAnimation.h"
|
#include "Animation/WidgetAnimation.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "QuickTimeEventWidgetManager.h"
|
#include "QuickTimeEventWidgetManager.h"
|
||||||
|
|
||||||
#include "Animation/UMGSequencePlayer.h"
|
#include "Animation/UMGSequencePlayer.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "ResolutionResponsiveUserWidget.h"
|
#include "ResolutionResponsiveUserWidget.h"
|
||||||
|
|
||||||
#include "Components/PanelSlot.h"
|
#include "Components/PanelSlot.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "WidgetsManager.h"
|
#include "WidgetsManager.h"
|
||||||
|
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Oleg Petruny proprietary.
|
// Oleg Petruny proprietary.
|
||||||
|
|
||||||
|
|
||||||
#include "WorldDilationResponsiveUserWidget.h"
|
#include "WorldDilationResponsiveUserWidget.h"
|
||||||
|
|
||||||
#include "Animation/UMGSequencePlayer.h"
|
#include "Animation/UMGSequencePlayer.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user