Implemented PC Display Info USTRUCT

This commit is contained in:
Rafal Swierczek 2023-10-12 10:46:25 +01:00
parent cec447eb73
commit 2b16934644
5 changed files with 58 additions and 41 deletions

View File

@ -66,7 +66,7 @@ public:
return BountyDesc; return BountyDesc;
} }
int GetBountyreardMoney() int GetBountyrewardMoney()
{ {
return RewardMoney; return RewardMoney;
} }

View File

@ -201,11 +201,44 @@ void ABountyDirector::Interact()
PlayerController->bEnableClickEvents = true; PlayerController->bEnableClickEvents = true;
PlayerController->bEnableMouseOverEvents = true; PlayerController->bEnableMouseOverEvents = true;
bool GO = IsValid(ActiveBounty);
UPC_Display* PC_Display = Cast<UPC_Display>(PC_DisplayWidget); UPC_Display* PC_Display = Cast<UPC_Display>(PC_DisplayWidget);
PC_Display->PC_Display_Info.IsGameOver = true; bool GameOver = IsValid(ActiveBounty);
Cast<UPC_Display>(PC_DisplayWidget)->LoadOS(); PC_Display->PC_Display_Info.IsGameOver = GameOver;
if (GameOver) return;
// Info about main bounty
PC_Display->PC_Display_Info.MB_Title = GetBountyTitle();
PC_Display->PC_Display_Info.MB_Icon = GetBountyIcon();
PC_Display->PC_Display_Info.MB_Desc = GetBountyDescription();
PC_Display->PC_Display_Info.MB_Reward = GetBountyReward();
// Info about side bounties
PC_Display->PC_Display_Info.SB_Title.Reset();
PC_Display->PC_Display_Info.SB_Icon.Reset();
PC_Display->PC_Display_Info.SB_Desc.Reset();
PC_Display->PC_Display_Info.SB_Reward.Reset();
for (ASideBountyClass* SideBounty : ActiveSideBounties)
{
if (!IsValid(SideBounty)) continue;
PC_Display->PC_Display_Info.SB_Title.Add(SideBounty->GetBountyTitle());
PC_Display->PC_Display_Info.SB_Icon.Add(SideBounty->GetActiveWaypointIcon());
PC_Display->PC_Display_Info.SB_Desc.Add(SideBounty->GetBountyDesc());
PC_Display->PC_Display_Info.SB_Reward.Add(SideBounty->GetBountyrewardMoney());
}
// Info about main bounty alterations
PC_Display->PC_Display_Info.CustomBountyAlteration_Desc.Reset();
PC_Display->PC_Display_Info.CustomBountyAlteration_Cost.Reset();
PC_Display->PC_Display_Info.CustomBountyAlteration_Desc.Add(ActiveBounty->GetCustomBountyAlteration_1_Description());
PC_Display->PC_Display_Info.CustomBountyAlteration_Desc.Add(ActiveBounty->GetCustomBountyAlteration_2_Description());
PC_Display->PC_Display_Info.CustomBountyAlteration_Desc.Add(ActiveBounty->GetCustomBountyAlteration_3_Description());
PC_Display->PC_Display_Info.CustomBountyAlteration_Cost.Add(ActiveBounty->GetCustomBountyAlteration_1_Cost());
PC_Display->PC_Display_Info.CustomBountyAlteration_Cost.Add(ActiveBounty->GetCustomBountyAlteration_2_Cost());
PC_Display->PC_Display_Info.CustomBountyAlteration_Cost.Add(ActiveBounty->GetCustomBountyAlteration_3_Cost());
PC_Display->LoadOS();
} }

View File

@ -114,16 +114,7 @@ public:
int GetBountyReward() int GetBountyReward()
{ {
return !IsValid(ActiveBounty) ? 0 : ActiveBounty->GetBountyreardMoney(); return !IsValid(ActiveBounty) ? 0 : ActiveBounty->GetBountyrewardMoney();
} }
FString GetSideBountyTitle(int SideBountyIndex)
{
return (SideBountyIndex > 2 || SideBountyIndex < 0 || !IsValid(ActiveSideBounties[SideBountyIndex])) ? FString("") : ActiveSideBounties[SideBountyIndex]->GetBountyTitle();
}
FString GetSideBountyDescription(int SideBountyIndex)
{
return (SideBountyIndex > 2 || SideBountyIndex < 0 || !IsValid(ActiveSideBounties[SideBountyIndex])) ? FString("") : ActiveSideBounties[SideBountyIndex]->GetBountyDesc();
}
}; };

View File

@ -21,22 +21,10 @@ protected:
// ---------------- Bounty Alterations ---------------- // ---------------- Bounty Alterations ----------------
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomBountyAlteration_1_Description; TArray<FString> CustomBountyAlteration_Description;
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
int CustomBountyAlteration_1_Cost = 2; TArray<int> CustomBountyAlteration_Cost;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomBountyAlteration_2_Description;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
int CustomBountyAlteration_2_Cost = 2;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
FString CustomBountyAlteration_3_Description;
UPROPERTY(EditDefaultsOnly, Category = "Bounty")
int CustomBountyAlteration_3_Cost = 2;
UPROPERTY(EditDefaultsOnly, Category = "Bounty") UPROPERTY(EditDefaultsOnly, Category = "Bounty")
TArray<FTransform> AmmoDropSpawnTransforms; TArray<FTransform> AmmoDropSpawnTransforms;
@ -71,37 +59,37 @@ public:
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteration_1_Description() FString GetCustomBountyAlteration_1_Description()
{ {
return CustomBountyAlteration_1_Description; return CustomBountyAlteration_Description.IsEmpty() ? FString("") : CustomBountyAlteration_Description[0];
} }
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteration_2_Description() FString GetCustomBountyAlteration_2_Description()
{ {
return CustomBountyAlteration_2_Description; return CustomBountyAlteration_Description.Num() < 1 ? FString("") : CustomBountyAlteration_Description[1];
} }
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
FString GetCustomBountyAlteration_3_Description() FString GetCustomBountyAlteration_3_Description()
{ {
return CustomBountyAlteration_3_Description; return CustomBountyAlteration_Description.Num() < 2 ? FString("") : CustomBountyAlteration_Description[2];
} }
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
int GetCustomBountyAlteration_1_Cost() int GetCustomBountyAlteration_1_Cost()
{ {
return CustomBountyAlteration_1_Cost; return CustomBountyAlteration_Cost.IsEmpty() ? 0 : CustomBountyAlteration_Cost[0];
} }
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
int GetCustomBountyAlteration_2_Cost() int GetCustomBountyAlteration_2_Cost()
{ {
return CustomBountyAlteration_2_Cost; return CustomBountyAlteration_Cost.Num() < 1 ? 0 : CustomBountyAlteration_Cost[1];
} }
UFUNCTION(BlueprintCallable, Category = "Bounty") UFUNCTION(BlueprintCallable, Category = "Bounty")
int GetCustomBountyAlteration_3_Cost() int GetCustomBountyAlteration_3_Cost()
{ {
return CustomBountyAlteration_3_Cost; return CustomBountyAlteration_Cost.Num() < 2 ? 0 : CustomBountyAlteration_Cost[2];
} }
// ------------- Simple Bounty Alterations ------------- // ------------- Simple Bounty Alterations -------------

View File

@ -27,16 +27,22 @@ struct FPC_Display_Info
int MB_Reward; int MB_Reward;
UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info") UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info")
FString SB_1_Title; TArray<FString> SB_Title;
UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info") UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info")
UTexture2D* SB_1_Icon; TArray<UTexture2D*> SB_Icon;
UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info") UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info")
FString SB_1_Desc; TArray<FString> SB_Desc;
UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info") UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info")
int SB_1_Reward; TArray<int> SB_Reward;
UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info")
TArray<FString> CustomBountyAlteration_Desc;
UPROPERTY(BlueprintReadWrite, Category = "PC_Display_Info")
TArray<int> CustomBountyAlteration_Cost;
}; };
UCLASS() UCLASS()
@ -50,6 +56,5 @@ public:
UPROPERTY(BlueprintReadOnly) UPROPERTY(BlueprintReadOnly)
FPC_Display_Info PC_Display_Info; FPC_Display_Info PC_Display_Info;
//bool IsGameOver, FString& MB_Title, UTexture2D* MB_Icon, FString& MB_Desc, int MB_Reward
}; };