Added First Buy Buttons Delegate

This commit is contained in:
Rafal Swierczek 2023-10-14 17:54:03 +01:00
parent d922ceec10
commit 8b4a78435d
5 changed files with 17 additions and 11 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:13c33ca82184ce691baedd731c38c0cb26674a52fa498cfeed21268ef352e0c2 oid sha256:e18f1c5b5a87200f0a39ce1a55e9b8e5f1def9f890d5974e8fe5c767efe868d3
size 1059571 size 1025165

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:e520486c08be16c37c2a57ef464db44baa0bfba73be3fa2e2ffe00891adc5961 oid sha256:27d63c0acfd4fdceacc37b252fac625161c9feddfe9b2ccaeff6b4e84f1d9857
size 23685 size 25558

View File

@ -131,7 +131,7 @@ void ABountyDirector::BuyCustomBountyAlteration_1()
{ {
if (!IsValid(ActiveBounty)) return; if (!IsValid(ActiveBounty)) return;
int Cost = ActiveBounty->GetCustomBountyAlteration_1_Cost(); int Cost = ActiveBounty->GetCustomBountyAlteration_1_Cost();
if (Favours < Cost) return; if (Cost == 0 || Favours < Cost) return;
Favours -= Cost; Favours -= Cost;
ActiveBounty->BuyCustomBountyAlteration_1(); ActiveBounty->BuyCustomBountyAlteration_1();
} }
@ -141,7 +141,7 @@ void ABountyDirector::BuyCustomBountyAlteration_2()
{ {
if (!IsValid(ActiveBounty)) return; if (!IsValid(ActiveBounty)) return;
int Cost = ActiveBounty->GetCustomBountyAlteration_2_Cost(); int Cost = ActiveBounty->GetCustomBountyAlteration_2_Cost();
if (Favours < Cost) return; if (Cost == 0 || Favours < Cost) return;
Favours -= Cost; Favours -= Cost;
ActiveBounty->BuyCustomBountyAlteration_2(); ActiveBounty->BuyCustomBountyAlteration_2();
} }
@ -150,7 +150,7 @@ void ABountyDirector::BuyCustomBountyAlteration_3()
{ {
if (!IsValid(ActiveBounty)) return; if (!IsValid(ActiveBounty)) return;
int Cost = ActiveBounty->GetCustomBountyAlteration_3_Cost(); int Cost = ActiveBounty->GetCustomBountyAlteration_3_Cost();
if (Favours < Cost) return; if (Cost == 0 || Favours < Cost) return;
Favours -= Cost; Favours -= Cost;
ActiveBounty->BuyCustomBountyAlteration_3(); ActiveBounty->BuyCustomBountyAlteration_3();
} }
@ -246,6 +246,9 @@ void ABountyDirector::Interact()
PC_Display->PC_Display_Info.PlayersFavourAmount = Favours; PC_Display->PC_Display_Info.PlayersFavourAmount = Favours;
// Button Delegates
PC_Display->BuyCba_1.AddDynamic(this, &ABountyDirector::BuyCustomBountyAlteration_1);
PC_Display->LoadOS(); PC_Display->LoadOS();
} }

View File

@ -53,7 +53,7 @@ class ENDLESSVENDETTA_API ABountyDirector : public AInteractableActor
void Interact() override; void Interact() override;
protected: protected:
int Favours = 0; int Favours = 20;
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;
@ -71,7 +71,7 @@ protected:
UFUNCTION() UFUNCTION()
void EarnFavours(int FavoursEarned); void EarnFavours(int FavoursEarned);
UFUNCTION(BlueprintCallable, Category = "Bounty Director") UFUNCTION()
void BuyCustomBountyAlteration_1(); void BuyCustomBountyAlteration_1();
UFUNCTION(BlueprintCallable, Category = "Bounty Director") UFUNCTION(BlueprintCallable, Category = "Bounty Director")

View File

@ -46,6 +46,7 @@ struct FPC_Display_Info
}; };
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLogoutFromBountyDirectorPC); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FLogoutFromBountyDirectorPC);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBuyCBA_1);
UCLASS() UCLASS()
class ENDLESSVENDETTA_API UPC_Display : public UUserWidget class ENDLESSVENDETTA_API UPC_Display : public UUserWidget
@ -60,6 +61,8 @@ protected:
public: public:
FLogoutFromBountyDirectorPC LogoutFromBountyDirectorPC; FLogoutFromBountyDirectorPC LogoutFromBountyDirectorPC;
UPROPERTY(BlueprintCallable, Category = PC_Display)
FBuyCBA_1 BuyCba_1;
UPROPERTY(BlueprintReadOnly) UPROPERTY(BlueprintReadOnly)
FPC_Display_Info PC_Display_Info; FPC_Display_Info PC_Display_Info;