Initial Commit - Lesson 31 (Commit #1)
This commit is contained in:
33
Source/FPSTemplate/Public/UI/Elims/ScoreWidget.h
Normal file
33
Source/FPSTemplate/Public/UI/Elims/ScoreWidget.h
Normal file
@@ -0,0 +1,33 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "ScoreWidget.generated.h"
|
||||
|
||||
class UTextBlock;
|
||||
class AMatchPlayerState;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API UScoreWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
UTextBlock* ScoreText;
|
||||
|
||||
protected:
|
||||
UFUNCTION()
|
||||
void OnScoreChanged(int32 NewScore);
|
||||
|
||||
UFUNCTION()
|
||||
void OnPlayerStateInitialized();
|
||||
|
||||
AMatchPlayerState* GetPlayerState() const;
|
||||
};
|
||||
29
Source/FPSTemplate/Public/UI/Elims/SpecialElimWidget.h
Normal file
29
Source/FPSTemplate/Public/UI/Elims/SpecialElimWidget.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "SpecialElimWidget.generated.h"
|
||||
|
||||
class UTextBlock;
|
||||
class UImage;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API USpecialElimWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UTextBlock> ElimText;
|
||||
|
||||
UPROPERTY(meta = (BindWidget), BlueprintReadOnly, EditDefaultsOnly)
|
||||
TObjectPtr<UImage> ElimImage;
|
||||
|
||||
void InitializeWidget(const FString& InElimMessage, UTexture2D* InElimTexture);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
static void CenterWidget(UUserWidget* Widget, float VerticalRatio = 0.f);
|
||||
};
|
||||
49
Source/FPSTemplate/Public/UI/ShooterAmmoCounter.h
Normal file
49
Source/FPSTemplate/Public/UI/ShooterAmmoCounter.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "ShooterAmmoCounter.generated.h"
|
||||
|
||||
class UImage;
|
||||
class UTextBlock;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API UShooterAmmoCounter : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UImage> Image_WeaponIcon;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UTextBlock> Text_Ammo;
|
||||
|
||||
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UMaterialInstanceDynamic> CurrentWeaponIcon_DynMatInst;
|
||||
|
||||
private:
|
||||
|
||||
int32 TotalAmmo;
|
||||
|
||||
UFUNCTION()
|
||||
void OnPossessedPawnChanged(APawn* OldPawn, APawn* NewPawn);
|
||||
|
||||
UFUNCTION()
|
||||
void OnCarriedAmmoChanged(UMaterialInstanceDynamic* WeaponIconDynMatInst, int32 InCarriedAmmo, int32 RoundsInWeapon);
|
||||
|
||||
UFUNCTION()
|
||||
void OnRoundFired(int32 RoundsCurrent, int32 RoundsMax, int32 RoundsCarried);
|
||||
|
||||
UFUNCTION()
|
||||
void OnWeaponFirstReplicated(AWeapon* Weapon);
|
||||
};
|
||||
31
Source/FPSTemplate/Public/UI/ShooterHUD.h
Normal file
31
Source/FPSTemplate/Public/UI/ShooterHUD.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/HUD.h"
|
||||
#include "ShooterHUD.generated.h"
|
||||
|
||||
class UUserWidget;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API AShooterHUD : public AHUD
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UUserWidget* GetShooterOverlay() {return Overlay;}
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Overlay")
|
||||
TSubclassOf<UUserWidget> ShooterOverlayClass;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UUserWidget> Overlay;
|
||||
};
|
||||
86
Source/FPSTemplate/Public/UI/ShooterReticle.h
Normal file
86
Source/FPSTemplate/Public/UI/ShooterReticle.h
Normal file
@@ -0,0 +1,86 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "ShooterTypes/ShooterTypes.h"
|
||||
#include "ShooterReticle.generated.h"
|
||||
|
||||
namespace Reticle
|
||||
{
|
||||
extern FPSTEMPLATE_API const FName Inner_RGBA;
|
||||
extern FPSTEMPLATE_API const FName RoundedCornerScale;
|
||||
extern FPSTEMPLATE_API const FName ShapeCutThickness;
|
||||
}
|
||||
|
||||
namespace Ammo
|
||||
{
|
||||
extern FPSTEMPLATE_API const FName Rounds_Current;
|
||||
extern FPSTEMPLATE_API const FName Rounds_Max;
|
||||
}
|
||||
|
||||
class UImage;
|
||||
class AWeapon;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class FPSTEMPLATE_API UShooterReticle : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
virtual void NativeConstruct() override;
|
||||
virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UImage> Image_Reticle;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UImage> Image_AmmoCounter;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UMaterialInstanceDynamic> CurrentReticle_DynMatInst;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UMaterialInstanceDynamic> CurrentAmmoCounter_DynMatInst;
|
||||
|
||||
FReticleParams CurrentReticleParams;
|
||||
float BaseCornerScaleFactor;
|
||||
float _BaseCornerScaleFactor_TargetingPlayer;
|
||||
float _BaseCornerScaleFactor_Aiming;
|
||||
float _BaseCornerScaleFactor_RoundFired;
|
||||
float BaseShapeCutFactor;
|
||||
float _BaseShapeCutFactor_Aiming;
|
||||
float _BaseShapeCutFactor_RoundFired;
|
||||
bool bTargetingPlayer;
|
||||
bool bAiming;
|
||||
|
||||
UFUNCTION()
|
||||
void OnPossessedPawnChanged(APawn* OldPawn, APawn* NewPawn);
|
||||
|
||||
UFUNCTION()
|
||||
void OnReticleChange(UMaterialInstanceDynamic* ReticleDynMatInst, const FReticleParams& ReticleParams, bool bCurrentlyTargetingPlayer = false);
|
||||
|
||||
UFUNCTION()
|
||||
void OnAmmoCounterChange(UMaterialInstanceDynamic* AmmoCounterDynMatInst, int32 RoundsCurrent, int32 RoundsMax);
|
||||
|
||||
UFUNCTION()
|
||||
void OnTargetingPlayerStatusChanged(bool bIsTargetingPlayer);
|
||||
|
||||
UFUNCTION()
|
||||
void OnRoundFired(int32 RoundsCurrent, int32 RoundsMax, int32 RoundsCarried);
|
||||
|
||||
UFUNCTION()
|
||||
void OnAimingStatusChanged(bool bIsAiming);
|
||||
|
||||
UFUNCTION()
|
||||
void OnWeaponFirstReplicated(AWeapon* Weapon);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user