98 lines
2.5 KiB
C++
98 lines
2.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "Components/CanvasPanelSlot.h"
|
|
#include "WBP_PlayerUI.generated.h"
|
|
/**
|
|
*
|
|
*/
|
|
enum class EAmmoType: uint8;
|
|
class UUWBP_Buf;
|
|
UCLASS()
|
|
class UWBP_PlayerUI : public UUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
void SetHp(float hp,float hpMax);
|
|
|
|
void SetAmmoType(EAmmoType ammoType);
|
|
|
|
void SetAmmoNumber(int ammo);
|
|
|
|
void SetDialogueText(FText text);
|
|
|
|
UUWBP_Buf* AddBuf(UTexture2D* texture,float procent);
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UUWBP_RoundProgressBar* HPBar;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UTextBlock* AmmoText;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UImage* AmmoImage;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UImage* ViewFinder;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UCanvasPanel* BufPanel;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UCanvasPanel* AmmoPanel;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UCanvasPanel* DialoguePanel;
|
|
|
|
UPROPERTY(EditAnywhere, meta = (BindWidget))
|
|
class UTextBlock* DialogueText;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buf")
|
|
float BufRange;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buf")
|
|
float BufAngleDiff;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buf")
|
|
TSubclassOf<UUWBP_Buf> BufClass;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
|
|
TMap<EAmmoType, UTexture2D*> AmmoIconMap;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Display")
|
|
float DisplaySpeed = 1.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Display")
|
|
float DialogueSpeed = 0.1f;
|
|
|
|
void SetVisibilityHP(bool visibility);
|
|
|
|
void SetVisibilityBuf(bool visibility);
|
|
|
|
void SetVisibilityAmmo(bool visibility);
|
|
|
|
void SetVisibilityViewFinder(bool visibility);
|
|
|
|
void SetShootingViewFinder(bool Shooting);
|
|
|
|
void SetVisibilityDialogue(bool visibility);
|
|
protected:
|
|
void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
|
|
private:
|
|
TArray<UCanvasPanelSlot*> bufsSlots;
|
|
|
|
void updateBufPosition();
|
|
|
|
bool showHp = true, showBuf = true, showAmmo = true, showViewFinder = true, showDialogue = true;
|
|
float opacityHp = 1.0f, opacityBuf = 1.0f, opacityAmmo = 1.0f, opacityViewFinder = 1.0f, opacityDialogue = 1.0f;
|
|
bool shootingViewFinder = false;
|
|
float shootingViewFinderPercent = 1.0f;
|
|
float timerDialogue = 0.0f;
|
|
FText textDialogue = FText();
|
|
|
|
UMaterialInstanceDynamic* DynamicViewFinderMaterial = nullptr;
|
|
};
|