unify abilities data asset

This commit is contained in:
Arnaud Jamin
2023-10-11 01:28:24 -04:00
parent f2d320ceca
commit c5d1d14ac6
28 changed files with 347 additions and 347 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -216,13 +216,13 @@ void ACogAbilityReplicator::Server_ResetAllTweaks_Implementation()
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::SetTweakValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value) void ACogAbilityReplicator::SetTweakValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value)
{ {
Server_SetTweakValue(TweaksAsset, TweakIndex, TweakCategoryIndex, Value); Server_SetTweakValue(TweaksAsset, TweakIndex, TweakCategoryIndex, Value);
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::Server_SetTweakValue_Implementation(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value) void ACogAbilityReplicator::Server_SetTweakValue_Implementation(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value)
{ {
if (TweaksAsset == nullptr) if (TweaksAsset == nullptr)
{ {
@@ -252,7 +252,7 @@ void ACogAbilityReplicator::Server_SetTweakValue_Implementation(const UCogAbilit
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::ApplyAllTweaksOnActor(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakCategoryIndex, AActor* Actor) void ACogAbilityReplicator::ApplyAllTweaksOnActor(const UCogAbilityDataAsset* TweaksAsset, int32 TweakCategoryIndex, AActor* Actor)
{ {
if (TweaksAsset == nullptr) if (TweaksAsset == nullptr)
{ {
@@ -297,7 +297,7 @@ void ACogAbilityReplicator::ApplyTweakOnActor(AActor* Actor, const FCogAbilityTw
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
float ACogAbilityReplicator::GetTweakCurrentValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex) float ACogAbilityReplicator::GetTweakCurrentValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex)
{ {
float* Value = GetTweakCurrentValuePtr(TweaksAsset, TweakIndex, TweakCategoryIndex); float* Value = GetTweakCurrentValuePtr(TweaksAsset, TweakIndex, TweakCategoryIndex);
if (Value == nullptr) if (Value == nullptr)
@@ -309,7 +309,7 @@ float ACogAbilityReplicator::GetTweakCurrentValue(const UCogAbilityDataAsset_Twe
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
float* ACogAbilityReplicator::GetTweakCurrentValuePtr(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex) float* ACogAbilityReplicator::GetTweakCurrentValuePtr(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex)
{ {
TweakCurrentValues.SetNum(TweaksAsset->Tweaks.Num() * TweaksAsset->TweaksCategories.Num()); TweakCurrentValues.SetNum(TweaksAsset->Tweaks.Num() * TweaksAsset->TweaksCategories.Num());
@@ -324,7 +324,7 @@ float* ACogAbilityReplicator::GetTweakCurrentValuePtr(const UCogAbilityDataAsset
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::SetTweakCurrentValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value) void ACogAbilityReplicator::SetTweakCurrentValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value)
{ {
if (TweaksAsset == nullptr) if (TweaksAsset == nullptr)
{ {
@@ -344,13 +344,13 @@ void ACogAbilityReplicator::SetTweakCurrentValue(const UCogAbilityDataAsset_Twea
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::SetTweakProfile(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 ProfileIndex) void ACogAbilityReplicator::SetTweakProfile(const UCogAbilityDataAsset* TweaksAsset, int32 ProfileIndex)
{ {
Server_SetTweakProfile(TweaksAsset, ProfileIndex); Server_SetTweakProfile(TweaksAsset, ProfileIndex);
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::Server_SetTweakProfile_Implementation(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 ProfileIndex) void ACogAbilityReplicator::Server_SetTweakProfile_Implementation(const UCogAbilityDataAsset* TweaksAsset, int32 ProfileIndex)
{ {
if (TweaksAsset == nullptr) if (TweaksAsset == nullptr)
{ {
@@ -396,7 +396,7 @@ void ACogAbilityReplicator::Server_SetTweakProfile_Implementation(const UCogAbil
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::GetActorsFromTweakCategory(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakCategoryIndex, TArray<AActor*>& Actors) void ACogAbilityReplicator::GetActorsFromTweakCategory(const UCogAbilityDataAsset* TweaksAsset, int32 TweakCategoryIndex, TArray<AActor*>& Actors)
{ {
if (TweaksAsset == nullptr) if (TweaksAsset == nullptr)
{ {
@@ -1,14 +1,12 @@
#include "CogAbilityWindow_Abilities.h" #include "CogAbilityWindow_Abilities.h"
#include "CogAbilityDataAsset_Abilities.h" #include "CogAbilityDataAsset.h"
#include "CogAbilityHelper.h" #include "CogAbilityHelper.h"
#include "CogImguiHelper.h"
#include "CogWindowWidgets.h" #include "CogWindowWidgets.h"
#include "imgui.h" #include "imgui.h"
#include "imgui_internal.h" #include "imgui_internal.h"
ImVec4 ActiveColor(1.0f, 0.8f, 0.0f, 1.0f);
ImVec4 DeactiveColor(1.0f, 1.0f, 1.0f, 1.0f);
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void UCogAbilityWindow_Abilities::RenderHelp() void UCogAbilityWindow_Abilities::RenderHelp()
{ {
@@ -17,7 +15,7 @@ void UCogAbilityWindow_Abilities::RenderHelp()
"Click the ability check box to force its activation or deactivation. " "Click the ability check box to force its activation or deactivation. "
"Right click an ability to open or close the ability separate window. " "Right click an ability to open or close the ability separate window. "
"Use the 'Give Ability' menu to manually give an ability from a list defined in the '%s' data asset. " "Use the 'Give Ability' menu to manually give an ability from a list defined in the '%s' data asset. "
, TCHAR_TO_ANSI(*GetNameSafe(AbilitiesAsset.Get()))); , TCHAR_TO_ANSI(*GetNameSafe(Asset.Get())));
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -108,10 +106,10 @@ void UCogAbilityWindow_Abilities::RenderAbiltiesMenu(AActor* Selection)
{ {
if (ImGui::BeginMenu("Give Ability")) if (ImGui::BeginMenu("Give Ability"))
{ {
if (AbilitiesAsset != nullptr) if (Asset != nullptr)
{ {
int Index = 0; int Index = 0;
for (TSubclassOf<UGameplayAbility> AbilityClass : AbilitiesAsset->Abilities) for (TSubclassOf<UGameplayAbility> AbilityClass : Asset->Abilities)
{ {
ImGui::PushID(Index); ImGui::PushID(Index);
@@ -164,7 +162,11 @@ void UCogAbilityWindow_Abilities::RenderAbilitiesTable(UAbilitySystemComponent&
ImGui::PushID(Index); ImGui::PushID(Index);
ImVec4 Color = Spec.ActiveCount > 0 ? ActiveColor : DeactiveColor; ImVec4 Color(1.0f, 1.0f, 1.0f, 1.0f);
if (Asset != nullptr)
{
Color = FCogImguiHelper::ToImVec4(Spec.ActiveCount > 0 ? Asset->AbilityActiveColor : Asset->AbilityInactiveColor);
}
ImGui::PushStyleColor(ImGuiCol_Text, Color); ImGui::PushStyleColor(ImGuiCol_Text, Color);
//------------------------ //------------------------
@@ -332,6 +334,12 @@ void UCogAbilityWindow_Abilities::RenderAbilityInfo(const UAbilitySystemComponen
ImGui::TableSetupColumn("Property"); ImGui::TableSetupColumn("Property");
ImGui::TableSetupColumn("Value"); ImGui::TableSetupColumn("Value");
ImVec4 Color(1.0f, 1.0f, 1.0f, 1.0f);
if (Asset != nullptr)
{
Color = FCogImguiHelper::ToImVec4(Spec.ActiveCount > 0 ? Asset->AbilityActiveColor : Asset->AbilityInactiveColor);
}
//------------------------ //------------------------
// Name // Name
//------------------------ //------------------------
@@ -339,7 +347,6 @@ void UCogAbilityWindow_Abilities::RenderAbilityInfo(const UAbilitySystemComponen
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextColored(TextColor, "Name"); ImGui::TextColored(TextColor, "Name");
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImVec4 Color = Spec.ActiveCount > 0 ? ActiveColor : DeactiveColor;
ImGui::PushStyleColor(ImGuiCol_Text, Color); ImGui::PushStyleColor(ImGuiCol_Text, Color);
ImGui::Text("%s", TCHAR_TO_ANSI(*GetAbilityName(Ability))); ImGui::Text("%s", TCHAR_TO_ANSI(*GetAbilityName(Ability)));
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
@@ -2,7 +2,9 @@
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "AbilitySystemGlobals.h" #include "AbilitySystemGlobals.h"
#include "CogAbilityDataAsset.h"
#include "CogAbilityHelper.h" #include "CogAbilityHelper.h"
#include "CogImguiHelper.h"
#include "CogWindowWidgets.h" #include "CogWindowWidgets.h"
#include "AttributeSet.h" #include "AttributeSet.h"
#include "EngineUtils.h" #include "EngineUtils.h"
@@ -190,21 +192,24 @@ void UCogAbilityWindow_Attributes::RenderContent()
ImGui::TableNextRow(); ImGui::TableNextRow();
ImVec4 Color; FLinearColor Color = FLinearColor::White;
if (CurrentValue > BaseValue) if (Asset != nullptr)
{ {
Color = ImVec4(0.0f, 1.0f, 0.0f, 1.0f); if (CurrentValue > BaseValue)
} {
else if (CurrentValue < BaseValue) Color = Asset->PositiveEffectColor;
{ }
Color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); else if (CurrentValue < BaseValue)
} {
else Color = Asset->NegativeEffectColor;
{ }
Color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); else
{
Color = Asset->NeutralEffectColor;
}
} }
ImGui::PushStyleColor(ImGuiCol_Text, Color); ImGui::PushStyleColor(ImGuiCol_Text, FCogImguiHelper::ToImVec4(Color));
//------------------------ //------------------------
// Name // Name
@@ -228,7 +233,7 @@ void UCogAbilityWindow_Attributes::RenderContent()
FCogWindowWidgets::EndTableTooltip(); FCogWindowWidgets::EndTableTooltip();
} }
ImGui::PushStyleColor(ImGuiCol_Text, Color); ImGui::PushStyleColor(ImGuiCol_Text, FCogImguiHelper::ToImVec4(Color));
//------------------------ //------------------------
// Base Value // Base Value
@@ -1,7 +1,7 @@
#include "CogAbilityWindow_Cheats.h" #include "CogAbilityWindow_Cheats.h"
#include "AbilitySystemGlobals.h" #include "AbilitySystemGlobals.h"
#include "CogAbilityDataAsset_Cheats.h" #include "CogAbilityDataAsset.h"
#include "CogAbilityReplicator.h" #include "CogAbilityReplicator.h"
#include "CogCommonAllegianceActorInterface.h" #include "CogCommonAllegianceActorInterface.h"
#include "CogDebugDraw.h" #include "CogDebugDraw.h"
@@ -21,7 +21,7 @@ void UCogAbilityWindow_Cheats::RenderHelp()
" [CTRL] to apply the cheat to controlled actor\n" " [CTRL] to apply the cheat to controlled actor\n"
" [ALT] to apply the cheat to the allies of the selected actor\n" " [ALT] to apply the cheat to the allies of the selected actor\n"
" [SHIFT] to apply the cheat to the enemies of the selected actor\n" " [SHIFT] to apply the cheat to the enemies of the selected actor\n"
, TCHAR_TO_ANSI(*GetNameSafe(CheatsAsset.Get())) , TCHAR_TO_ANSI(*GetNameSafe(Asset.Get()))
); );
} }
@@ -32,9 +32,9 @@ UCogAbilityWindow_Cheats::UCogAbilityWindow_Cheats()
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void UCogAbilityWindow_Cheats::SetCheatsAsset(const UCogAbilityDataAsset_Cheats* Value) void UCogAbilityWindow_Cheats::SetAsset(const UCogAbilityDataAsset* Value)
{ {
CheatsAsset = Value; Asset = Value;
if (bReapplyCheatsBetweenPlays == false) if (bReapplyCheatsBetweenPlays == false)
{ {
@@ -48,7 +48,7 @@ void UCogAbilityWindow_Cheats::SetCheatsAsset(const UCogAbilityDataAsset_Cheats*
} }
IsFirstLaunch = false; IsFirstLaunch = false;
if (CheatsAsset == nullptr) if (Asset == nullptr)
{ {
return; return;
} }
@@ -69,7 +69,7 @@ void UCogAbilityWindow_Cheats::SetCheatsAsset(const UCogAbilityDataAsset_Cheats*
for (const FString& AppliedCheatName : AppliedCheats) for (const FString& AppliedCheatName : AppliedCheats)
{ {
if (const FCogAbilityCheat* Cheat = CheatsAsset->PersistentEffects.FindByPredicate( if (const FCogAbilityCheat* Cheat = Asset->PersistentEffects.FindByPredicate(
[AppliedCheatName](const FCogAbilityCheat& Cheat) { return Cheat.Name == AppliedCheatName; })) [AppliedCheatName](const FCogAbilityCheat& Cheat) { return Cheat.Name == AppliedCheatName; }))
{ {
Replicator->ApplyCheat(LocalPawn, Targets, *Cheat); Replicator->ApplyCheat(LocalPawn, Targets, *Cheat);
@@ -88,7 +88,7 @@ void UCogAbilityWindow_Cheats::RenderContent()
return; return;
} }
if (CheatsAsset == nullptr) if (Asset == nullptr)
{ {
return; return;
} }
@@ -128,7 +128,7 @@ void UCogAbilityWindow_Cheats::RenderContent()
bool bHasChanged = false; bool bHasChanged = false;
int Index = 0; int Index = 0;
for (const FCogAbilityCheat& CheatEffect : CheatsAsset->PersistentEffects) for (const FCogAbilityCheat& CheatEffect : Asset->PersistentEffects)
{ {
ImGui::PushID(Index); ImGui::PushID(Index);
bHasChanged |= AddCheat(ControlledActor, SelectedActor, CheatEffect, true); bHasChanged |= AddCheat(ControlledActor, SelectedActor, CheatEffect, true);
@@ -144,7 +144,7 @@ void UCogAbilityWindow_Cheats::RenderContent()
{ {
AppliedCheats.Empty(); AppliedCheats.Empty();
for (const FCogAbilityCheat& CheatEffect : CheatsAsset->PersistentEffects) for (const FCogAbilityCheat& CheatEffect : Asset->PersistentEffects)
{ {
if (ACogAbilityReplicator::IsCheatActive(SelectedActor, CheatEffect)) if (ACogAbilityReplicator::IsCheatActive(SelectedActor, CheatEffect))
{ {
@@ -155,7 +155,7 @@ void UCogAbilityWindow_Cheats::RenderContent()
ImGui::TableNextColumn(); ImGui::TableNextColumn();
for (const FCogAbilityCheat& CheatEffect : CheatsAsset->InstantEffects) for (const FCogAbilityCheat& CheatEffect : Asset->InstantEffects)
{ {
ImGui::PushID(Index); ImGui::PushID(Index);
AddCheat(ControlledActor, SelectedActor, CheatEffect, false); AddCheat(ControlledActor, SelectedActor, CheatEffect, false);
@@ -180,17 +180,17 @@ bool UCogAbilityWindow_Cheats::AddCheat(AActor* ControlledActor, AActor* Selecte
const FGameplayTagContainer& Tags = Cheat.Effect->GetDefaultObject<UGameplayEffect>()->InheritableGameplayEffectTags.CombinedTags; const FGameplayTagContainer& Tags = Cheat.Effect->GetDefaultObject<UGameplayEffect>()->InheritableGameplayEffectTags.CombinedTags;
FLinearColor Color; FLinearColor Color;
if (Tags.HasTag(CheatsAsset->NegativeEffectTag)) if (Tags.HasTag(Asset->NegativeEffectTag))
{ {
Color = CheatsAsset->NegativeEffectColor; Color = Asset->NegativeEffectColor;
} }
else if (Tags.HasTag(CheatsAsset->PositiveEffectTag)) else if (Tags.HasTag(Asset->PositiveEffectTag))
{ {
Color = CheatsAsset->PositiveEffectColor; Color = Asset->PositiveEffectColor;
} }
else else
{ {
Color = CheatsAsset->NeutralEffectColor; Color = Asset->NeutralEffectColor;
} }
FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Color)); FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Color));
@@ -3,6 +3,7 @@
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "AbilitySystemGlobals.h" #include "AbilitySystemGlobals.h"
#include "AttributeSet.h" #include "AttributeSet.h"
#include "CogAbilityDataAsset.h"
#include "CogAbilityHelper.h" #include "CogAbilityHelper.h"
#include "CogWindowWidgets.h" #include "CogWindowWidgets.h"
#include "EngineUtils.h" #include "EngineUtils.h"
@@ -20,7 +21,7 @@ void UCogAbilityWindow_Effects::RenderHelp()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCogAbilityWindow_Effects::UCogAbilityWindow_Effects() UCogAbilityWindow_Effects::UCogAbilityWindow_Effects()
{ {
bHasMenu = true; bHasMenu = false;
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -88,21 +89,24 @@ void UCogAbilityWindow_Effects::RenderEffectRow(const UAbilitySystemComponent& A
const FGameplayTagContainer& Tags = Effect.InheritableGameplayEffectTags.CombinedTags; const FGameplayTagContainer& Tags = Effect.InheritableGameplayEffectTags.CombinedTags;
ImVec4 Color; FLinearColor Color = FLinearColor::White;
if (Tags.HasTag(NegativeEffectTag)) if (Asset != nullptr)
{ {
Color = ImVec4(1.0f, 0.5f, 0.5f, 1.0f); if (Tags.HasTag(Asset->NegativeEffectTag))
} {
else if (Tags.HasTag(PositiveEffectTag)) Color = Asset->NegativeEffectColor;
{ }
Color = ImVec4(0.5f, 1.0f, 0.5f, 1.0f); else if (Tags.HasTag(Asset->PositiveEffectTag))
} {
else Color = Asset->PositiveEffectColor;
{ }
Color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); else
{
Color = Asset->NeutralEffectColor;
}
} }
ImGui::PushStyleColor(ImGuiCol_Text, Color); ImGui::PushStyleColor(ImGuiCol_Text, FCogImguiHelper::ToImVec4(Color));
if (ImGui::Selectable(TCHAR_TO_ANSI(*GetEffectName(Effect)), Selected == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap | ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::Selectable(TCHAR_TO_ANSI(*GetEffectName(Effect)), Selected == Index, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap | ImGuiSelectableFlags_AllowDoubleClick))
{ {
@@ -1,6 +1,7 @@
#include "CogAbilityWindow_Pools.h" #include "CogAbilityWindow_Pools.h"
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "CogAbilityDataAsset.h"
#include "CogImguiHelper.h" #include "CogImguiHelper.h"
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -9,7 +10,7 @@ void UCogAbilityWindow_Pools::RenderHelp()
ImGui::Text( ImGui::Text(
"This window displays attributes of the selected actor as pools. " "This window displays attributes of the selected actor as pools. "
"The pools can be configured in the '%s' data asset." "The pools can be configured in the '%s' data asset."
, TCHAR_TO_ANSI(*GetNameSafe(PoolsAsset.Get())) , TCHAR_TO_ANSI(*GetNameSafe(Asset.Get()))
); );
} }
@@ -18,7 +19,7 @@ void UCogAbilityWindow_Pools::RenderContent()
{ {
Super::RenderContent(); Super::RenderContent();
if (PoolsAsset == nullptr) if (Asset == nullptr)
{ {
return; return;
} }
@@ -34,7 +35,7 @@ void UCogAbilityWindow_Pools::RenderContent()
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("Pool", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Pool", ImGuiTableColumnFlags_WidthStretch);
for (const FCogAbilityPool& Pool : PoolsAsset->Pools) for (const FCogAbilityPool& Pool : Asset->Pools)
{ {
DrawPool(AbilitySystem, Pool); DrawPool(AbilitySystem, Pool);
} }
@@ -13,7 +13,7 @@ void UCogAbilityWindow_Tags::RenderHelp()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCogAbilityWindow_Tags::UCogAbilityWindow_Tags() UCogAbilityWindow_Tags::UCogAbilityWindow_Tags()
{ {
bHasMenu = true; bHasMenu = false;
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
@@ -1,6 +1,7 @@
#include "CogAbilityWindow_Tweaks.h" #include "CogAbilityWindow_Tweaks.h"
#include "AbilitySystemComponent.h" #include "AbilitySystemComponent.h"
#include "CogAbilityDataAsset.h"
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void UCogAbilityWindow_Tweaks::RenderHelp() void UCogAbilityWindow_Tweaks::RenderHelp()
@@ -9,7 +10,7 @@ void UCogAbilityWindow_Tweaks::RenderHelp()
"This window can be used to apply tweaks to all the loaded actors. " "This window can be used to apply tweaks to all the loaded actors. "
"The tweaks are used to test various gameplay settings by actor category. " "The tweaks are used to test various gameplay settings by actor category. "
"The tweaks can be configured in the '%s' data asset. " "The tweaks can be configured in the '%s' data asset. "
, TCHAR_TO_ANSI(*GetNameSafe(TweaksAsset.Get())) , TCHAR_TO_ANSI(*GetNameSafe(Asset.Get()))
); );
} }
@@ -18,7 +19,7 @@ void UCogAbilityWindow_Tweaks::RenderContent()
{ {
Super::RenderContent(); Super::RenderContent();
if (TweaksAsset == nullptr) if (Asset == nullptr)
{ {
return; return;
} }
@@ -41,9 +42,9 @@ void UCogAbilityWindow_Tweaks::RenderContent()
int32 CurrentTweakProfileIndex = Replicator->GetTweakProfileIndex(); int32 CurrentTweakProfileIndex = Replicator->GetTweakProfileIndex();
FName CurrentProfileName = FName("None"); FName CurrentProfileName = FName("None");
if (TweaksAsset->TweakProfiles.IsValidIndex(CurrentTweakProfileIndex)) if (Asset->TweakProfiles.IsValidIndex(CurrentTweakProfileIndex))
{ {
CurrentProfileName = TweaksAsset->TweakProfiles[CurrentTweakProfileIndex].Name; CurrentProfileName = Asset->TweakProfiles[CurrentTweakProfileIndex].Name;
} }
if (ImGui::BeginCombo("Profile", TCHAR_TO_ANSI(*CurrentProfileName.ToString()))) if (ImGui::BeginCombo("Profile", TCHAR_TO_ANSI(*CurrentProfileName.ToString())))
@@ -52,18 +53,18 @@ void UCogAbilityWindow_Tweaks::RenderContent()
bool IsSelected = CurrentTweakProfileIndex == INDEX_NONE; bool IsSelected = CurrentTweakProfileIndex == INDEX_NONE;
if (ImGui::Selectable("None", IsSelected)) if (ImGui::Selectable("None", IsSelected))
{ {
Replicator->SetTweakProfile(TweaksAsset.Get(), INDEX_NONE); Replicator->SetTweakProfile(Asset.Get(), INDEX_NONE);
} }
} }
for (int32 TweakProfileIndex = 0; TweakProfileIndex < TweaksAsset->TweakProfiles.Num(); ++TweakProfileIndex) for (int32 TweakProfileIndex = 0; TweakProfileIndex < Asset->TweakProfiles.Num(); ++TweakProfileIndex)
{ {
const FCogAbilityTweakProfile& TweakProfile = TweaksAsset->TweakProfiles[TweakProfileIndex]; const FCogAbilityTweakProfile& TweakProfile = Asset->TweakProfiles[TweakProfileIndex];
bool IsSelected = TweakProfileIndex == CurrentTweakProfileIndex; bool IsSelected = TweakProfileIndex == CurrentTweakProfileIndex;
if (ImGui::Selectable(TCHAR_TO_ANSI(*TweakProfile.Name.ToString()), IsSelected)) if (ImGui::Selectable(TCHAR_TO_ANSI(*TweakProfile.Name.ToString()), IsSelected))
{ {
Replicator->SetTweakProfile(TweaksAsset.Get(), TweakProfileIndex); Replicator->SetTweakProfile(Asset.Get(), TweakProfileIndex);
} }
} }
ImGui::EndCombo(); ImGui::EndCombo();
@@ -71,12 +72,12 @@ void UCogAbilityWindow_Tweaks::RenderContent()
ImGui::Separator(); ImGui::Separator();
if (ImGui::BeginTable("Tweaks", 1 + TweaksAsset->TweaksCategories.Num(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize)) if (ImGui::BeginTable("Tweaks", 1 + Asset->TweaksCategories.Num(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize))
{ {
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch);
for (int32 TweakCategoryIndex = 0; TweakCategoryIndex < TweaksAsset->TweaksCategories.Num(); ++TweakCategoryIndex) for (int32 TweakCategoryIndex = 0; TweakCategoryIndex < Asset->TweaksCategories.Num(); ++TweakCategoryIndex)
{ {
FCogAbilityTweakCategory& Category = TweaksAsset->TweaksCategories[TweakCategoryIndex]; const FCogAbilityTweakCategory& Category = Asset->TweaksCategories[TweakCategoryIndex];
ImGui::TableSetupColumn(TCHAR_TO_ANSI(*Category.Name), ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn(TCHAR_TO_ANSI(*Category.Name), ImGuiTableColumnFlags_WidthStretch);
} }
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
@@ -84,7 +85,7 @@ void UCogAbilityWindow_Tweaks::RenderContent()
ImGui::TableNextRow(); ImGui::TableNextRow();
int32 TweakIndex = 0; int32 TweakIndex = 0;
for (FCogAbilityTweak& Tweak : TweaksAsset->Tweaks) for (const FCogAbilityTweak& Tweak : Asset->Tweaks)
{ {
if (Tweak.Effect != nullptr) if (Tweak.Effect != nullptr)
{ {
@@ -93,7 +94,7 @@ void UCogAbilityWindow_Tweaks::RenderContent()
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%s", TCHAR_TO_ANSI(*Tweak.Name.ToString())); ImGui::Text("%s", TCHAR_TO_ANSI(*Tweak.Name.ToString()));
for (int TweakCategoryIndex = 0; TweakCategoryIndex < TweaksAsset->TweaksCategories.Num(); ++TweakCategoryIndex) for (int TweakCategoryIndex = 0; TweakCategoryIndex < Asset->TweaksCategories.Num(); ++TweakCategoryIndex)
{ {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::PushID(TweakCategoryIndex); ImGui::PushID(TweakCategoryIndex);
@@ -113,22 +114,22 @@ void UCogAbilityWindow_Tweaks::RenderContent()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void UCogAbilityWindow_Tweaks::DrawTweak(ACogAbilityReplicator* Replicator, int32 TweakIndex, int32 TweakCategoryIndex) void UCogAbilityWindow_Tweaks::DrawTweak(ACogAbilityReplicator* Replicator, int32 TweakIndex, int32 TweakCategoryIndex)
{ {
if (TweaksAsset->TweaksCategories.IsValidIndex(TweakCategoryIndex) == false) if (Asset->TweaksCategories.IsValidIndex(TweakCategoryIndex) == false)
{ {
return; return;
} }
float* Value = Replicator->GetTweakCurrentValuePtr(TweaksAsset.Get(), TweakIndex, TweakCategoryIndex); float* Value = Replicator->GetTweakCurrentValuePtr(Asset.Get(), TweakIndex, TweakCategoryIndex);
if (Value == nullptr) if (Value == nullptr)
{ {
return; return;
} }
const FCogAbilityTweakCategory& Category = TweaksAsset->TweaksCategories[TweakCategoryIndex]; const FCogAbilityTweakCategory& Category = Asset->TweaksCategories[TweakCategoryIndex];
FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Category.Color)); FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Category.Color));
ImGui::PushItemWidth(-1); ImGui::PushItemWidth(-1);
ImGui::SliderFloat("##Value", Value, TweaksAsset->TweakMinValue, TweaksAsset->TweakMaxValue, "%+0.0f%%", 1.0f); ImGui::SliderFloat("##Value", Value, Asset->TweakMinValue, Asset->TweakMaxValue, "%+0.0f%%", 1.0f);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
FCogWindowWidgets::PopBackColor(); FCogWindowWidgets::PopBackColor();
@@ -146,6 +147,6 @@ void UCogAbilityWindow_Tweaks::DrawTweak(ACogAbilityReplicator* Replicator, int3
if (bUpdateValue) if (bUpdateValue)
{ {
Replicator->SetTweakValue(TweaksAsset.Get(), TweakIndex, TweakCategoryIndex, *Value); Replicator->SetTweakValue(Asset.Get(), TweakIndex, TweakCategoryIndex, *Value);
} }
} }
@@ -0,0 +1,203 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "GameplayEffect.h"
#include "CogAbilityDataAsset.generated.h"
class UGameplayEffect;
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct COGABILITY_API FCogAbilityCheat
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
TSubclassOf<UGameplayEffect> Effect;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct COGABILITY_API FCogAbilityPool
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
FGameplayAttribute Value;
UPROPERTY(EditAnywhere)
FGameplayAttribute Min;
UPROPERTY(EditAnywhere)
FGameplayAttribute Max;
UPROPERTY(EditAnywhere)
FGameplayAttribute Regen;
UPROPERTY(EditAnywhere)
FLinearColor Color = FLinearColor(0.5f, 0.5f, 0.5f, 1.0f);
UPROPERTY(EditAnywhere)
FLinearColor BackColor = FLinearColor(0.15, 0.15, 0.15, 1.0f);
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweak
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FName Name;
UPROPERTY(EditAnywhere)
TSubclassOf<UGameplayEffect> Effect;
UPROPERTY(EditAnywhere)
float Multiplier = 0.01f;
UPROPERTY(EditAnywhere)
float AddPostMultiplier = 1.0f;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweakCategory
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
FGameplayTag Id;
UPROPERTY(EditAnywhere)
TSubclassOf<AActor> ActorClass;
UPROPERTY(EditAnywhere)
FGameplayTagContainer RequiredTags;
UPROPERTY(EditAnywhere)
FGameplayTagContainer IgnoredTags;
UPROPERTY(EditAnywhere)
FLinearColor Color = FLinearColor::White;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweakProfileValue
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
TSubclassOf<UGameplayEffect> Effect;
UPROPERTY(EditAnywhere)
FGameplayTag CategoryId;
UPROPERTY(EditAnywhere)
float Value = 0.0f;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweakProfile
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FName Name;
UPROPERTY(EditAnywhere)
TArray<FCogAbilityTweakProfileValue> Tweaks;
};
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Blueprintable)
class COGABILITY_API UCogAbilityDataAsset : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UCogAbilityDataAsset() {}
//----------------------------------------------------------------------------------------------------------------------
// Abilities
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(Category = "Abilities", EditAnywhere)
TArray<TSubclassOf<UGameplayAbility>> Abilities;
UPROPERTY(Category = "Abilities", EditAnywhere)
FLinearColor AbilityActiveColor = FLinearColor(1.0f, 0.8f, 0.0f, 1.0f);
UPROPERTY(Category = "Abilities", EditAnywhere)
FLinearColor AbilityInactiveColor = FLinearColor(1.0f, 1.0f, 1.0f, 1.0f);
//----------------------------------------------------------------------------------------------------------------------
// Cheats
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(Category="Cheats", EditAnywhere)
FGameplayTag NegativeEffectTag;
UPROPERTY(Category = "Cheats", EditAnywhere)
FGameplayTag PositiveEffectTag;
UPROPERTY(Category = "Cheats", EditAnywhere)
FLinearColor NeutralEffectColor = FLinearColor(0.5f, 0.5f, 0.5f, 1.0f);
UPROPERTY(Category = "Cheats", EditAnywhere)
FLinearColor NegativeEffectColor = FLinearColor(1.0f, 0.5f, 0.5f, 1.0f);
UPROPERTY(Category = "Cheats", EditAnywhere)
FLinearColor PositiveEffectColor = FLinearColor(0.0f, 1.0f, 0.5f, 1.0f);
UPROPERTY(Category = "Cheats", EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityCheat> PersistentEffects;
UPROPERTY(Category = "Cheats", EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityCheat> InstantEffects;
//----------------------------------------------------------------------------------------------------------------------
// Pools
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(Category = "Pools", EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityPool> Pools;
//----------------------------------------------------------------------------------------------------------------------
// Tweaks
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(Category = "Tweaks", EditAnywhere)
float TweakMinValue = -100.0f;
UPROPERTY(Category = "Tweaks", EditAnywhere)
float TweakMaxValue = 200.0f;
UPROPERTY(Category = "Tweaks", EditAnywhere)
FGameplayTag SetByCallerMagnitudeTag;
UPROPERTY(Category = "Tweaks", EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityTweak> Tweaks;
UPROPERTY(Category = "Tweaks", EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityTweakCategory> TweaksCategories;
UPROPERTY(Category = "Tweaks", EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityTweakProfile> TweakProfiles;
};
@@ -1,21 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "CogAbilityDataAsset_Abilities.generated.h"
class UGameplayAbility;
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Blueprintable)
class COGABILITY_API UCogAbilityDataAsset_Abilities : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UCogAbilityDataAsset_Abilities() {}
UPROPERTY(EditAnywhere)
TArray<TSubclassOf<UGameplayAbility>> Abilities;
};
@@ -1,51 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "GameplayEffect.h"
#include "CogAbilityDataAsset_Cheats.generated.h"
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct COGABILITY_API FCogAbilityCheat
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
TSubclassOf<UGameplayEffect> Effect;
};
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Blueprintable)
class COGABILITY_API UCogAbilityDataAsset_Cheats : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UCogAbilityDataAsset_Cheats() {}
UPROPERTY(EditAnywhere)
FGameplayTag NegativeEffectTag;
UPROPERTY(EditAnywhere)
FGameplayTag PositiveEffectTag;
UPROPERTY(EditAnywhere)
FLinearColor NeutralEffectColor = FLinearColor(0.5f, 0.5f, 0.5f, 1.0f);
UPROPERTY(EditAnywhere)
FLinearColor NegativeEffectColor = FLinearColor(1.0f, 0.5f, 0.5f, 1.0f);
UPROPERTY(EditAnywhere)
FLinearColor PositiveEffectColor = FLinearColor(0.0f, 1.0f, 0.5f, 1.0f);
UPROPERTY(EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityCheat> PersistentEffects;
UPROPERTY(EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityCheat> InstantEffects;
};
@@ -1,47 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "CogAbilityDataAsset_Pools.generated.h"
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct COGABILITY_API FCogAbilityPool
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
FGameplayAttribute Value;
UPROPERTY(EditAnywhere)
FGameplayAttribute Min;
UPROPERTY(EditAnywhere)
FGameplayAttribute Max;
UPROPERTY(EditAnywhere)
FGameplayAttribute Regen;
UPROPERTY(EditAnywhere)
FLinearColor Color = FLinearColor(0.5f, 0.5f, 0.5f, 1.0f);
UPROPERTY(EditAnywhere)
FLinearColor BackColor = FLinearColor(0.15, 0.15, 0.15, 1.0f);
};
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Blueprintable)
class COGABILITY_API UCogAbilityDataAsset_Pools : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UCogAbilityDataAsset_Pools() {}
UPROPERTY(EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityPool> Pools;
};
@@ -1,108 +0,0 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "CogAbilityDataAsset_Tweaks.generated.h"
class UGameplayEffect;
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweak
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FName Name;
UPROPERTY(EditAnywhere)
TSubclassOf<UGameplayEffect> Effect;
UPROPERTY(EditAnywhere)
float Multiplier = 0.01f;
UPROPERTY(EditAnywhere)
float AddPostMultiplier = 1.0f;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweakCategory
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
FGameplayTag Id;
UPROPERTY(EditAnywhere)
TSubclassOf<AActor> ActorClass;
UPROPERTY(EditAnywhere)
FGameplayTagContainer RequiredTags;
UPROPERTY(EditAnywhere)
FGameplayTagContainer IgnoredTags;
UPROPERTY(EditAnywhere)
FLinearColor Color = FLinearColor::White;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweakProfileValue
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
TSubclassOf<UGameplayEffect> Effect;
UPROPERTY(EditAnywhere)
FGameplayTag CategoryId;
UPROPERTY(EditAnywhere)
float Value = 0.0f;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT()
struct FCogAbilityTweakProfile
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
FName Name;
UPROPERTY(EditAnywhere)
TArray<FCogAbilityTweakProfileValue> Tweaks;
};
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(Blueprintable)
class COGABILITY_API UCogAbilityDataAsset_Tweaks : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UCogAbilityDataAsset_Tweaks() {}
UPROPERTY(EditAnywhere)
float TweakMinValue = -100.0f;
UPROPERTY(EditAnywhere)
float TweakMaxValue = 200.0f;
UPROPERTY(EditAnywhere)
FGameplayTag SetByCallerMagnitudeTag;
UPROPERTY(EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityTweak> Tweaks;
UPROPERTY(EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityTweakCategory> TweaksCategories;
UPROPERTY(EditAnywhere, meta = (TitleProperty = "Name"))
TArray<FCogAbilityTweakProfile> TweakProfiles;
};
@@ -6,7 +6,7 @@
class AActor; class AActor;
class UAbilitySystemComponent; class UAbilitySystemComponent;
class UCogAbilityDataAsset_Tweaks; class UCogAbilityDataAsset;
struct FCogAbilityCheat; struct FCogAbilityCheat;
struct FCogAbilityTweak; struct FCogAbilityTweak;
struct FGameplayTag; struct FGameplayTag;
@@ -38,15 +38,15 @@ public:
void ResetAllTweaks(); void ResetAllTweaks();
void SetTweakValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 CategoryIndex, float Value); void SetTweakValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 CategoryIndex, float Value);
void SetTweakProfile(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 ProfileIndex); void SetTweakProfile(const UCogAbilityDataAsset* TweaksAsset, int32 ProfileIndex);
int32 GetTweakProfileIndex() const { return TweakProfileIndex; } int32 GetTweakProfileIndex() const { return TweakProfileIndex; }
float GetTweakCurrentValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 CategoryIndex); float GetTweakCurrentValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 CategoryIndex);
float* GetTweakCurrentValuePtr(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 CategoryIndex); float* GetTweakCurrentValuePtr(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 CategoryIndex);
private: private:
@@ -63,15 +63,15 @@ private:
void Server_ResetAllTweaks(); void Server_ResetAllTweaks();
UFUNCTION(Reliable, Server) UFUNCTION(Reliable, Server)
void Server_SetTweakValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value); void Server_SetTweakValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 TweakCategoryIndex, float Value);
UFUNCTION(Reliable, Server) UFUNCTION(Reliable, Server)
void Server_SetTweakProfile(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 ProfileIndex); void Server_SetTweakProfile(const UCogAbilityDataAsset* TweaksAsset, int32 ProfileIndex);
void SetTweakCurrentValue(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakIndex, int32 CategoryIndex, float Value); void SetTweakCurrentValue(const UCogAbilityDataAsset* TweaksAsset, int32 TweakIndex, int32 CategoryIndex, float Value);
void ApplyTweakOnActor(AActor* Actor, const FCogAbilityTweak& Tweak, float Value, const FGameplayTag& SetByCallerMagnitudeTag); void ApplyTweakOnActor(AActor* Actor, const FCogAbilityTweak& Tweak, float Value, const FGameplayTag& SetByCallerMagnitudeTag);
void ApplyAllTweaksOnActor(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 TweakCategoryIndex, AActor* Actor); void ApplyAllTweaksOnActor(const UCogAbilityDataAsset* TweaksAsset, int32 TweakCategoryIndex, AActor* Actor);
void GetActorsFromTweakCategory(const UCogAbilityDataAsset_Tweaks* TweaksAsset, int32 CategoryIndex, TArray<AActor*>& Actors); void GetActorsFromTweakCategory(const UCogAbilityDataAsset* TweaksAsset, int32 CategoryIndex, TArray<AActor*>& Actors);
TObjectPtr<APlayerController> OwnerPlayerController; TObjectPtr<APlayerController> OwnerPlayerController;
@@ -5,7 +5,7 @@
#include "CogAbilityWindow_Abilities.generated.h" #include "CogAbilityWindow_Abilities.generated.h"
class UGameplayAbility; class UGameplayAbility;
class UCogAbilityDataAsset_Abilities; class UCogAbilityDataAsset;
struct FGameplayAbilitySpec; struct FGameplayAbilitySpec;
UCLASS() UCLASS()
@@ -17,7 +17,7 @@ public:
UCogAbilityWindow_Abilities(); UCogAbilityWindow_Abilities();
TWeakObjectPtr<UCogAbilityDataAsset_Abilities> AbilitiesAsset; TWeakObjectPtr<const UCogAbilityDataAsset> Asset;
protected: protected:
@@ -4,6 +4,8 @@
#include "CogWindow.h" #include "CogWindow.h"
#include "CogAbilityWindow_Attributes.generated.h" #include "CogAbilityWindow_Attributes.generated.h"
class UCogAbilityDataAsset;
UCLASS(Config = Cog) UCLASS(Config = Cog)
class COGABILITY_API UCogAbilityWindow_Attributes : public UCogWindow class COGABILITY_API UCogAbilityWindow_Attributes : public UCogWindow
{ {
@@ -13,6 +15,8 @@ public:
UCogAbilityWindow_Attributes(); UCogAbilityWindow_Attributes();
TWeakObjectPtr<const UCogAbilityDataAsset> Asset;
protected: protected:
virtual void RenderHelp() override; virtual void RenderHelp() override;
@@ -5,7 +5,7 @@
#include "CogAbilityWindow_Cheats.generated.h" #include "CogAbilityWindow_Cheats.generated.h"
class AActor; class AActor;
class UCogAbilityDataAsset_Cheats; class UCogAbilityDataAsset;
struct FCogAbilityCheat; struct FCogAbilityCheat;
UCLASS(Config = Cog) UCLASS(Config = Cog)
@@ -17,9 +17,9 @@ public:
UCogAbilityWindow_Cheats(); UCogAbilityWindow_Cheats();
const UCogAbilityDataAsset_Cheats* GetCheatsAsset() const { return CheatsAsset.Get(); } const UCogAbilityDataAsset* GetAsset() const { return Asset.Get(); }
void SetCheatsAsset(const UCogAbilityDataAsset_Cheats* Value); void SetAsset(const UCogAbilityDataAsset* Value);
protected: protected:
@@ -42,5 +42,5 @@ private:
UPROPERTY(Config) UPROPERTY(Config)
TArray<FString> AppliedCheats; TArray<FString> AppliedCheats;
TWeakObjectPtr<const UCogAbilityDataAsset_Cheats> CheatsAsset; TWeakObjectPtr<const UCogAbilityDataAsset> Asset;
}; };
@@ -5,6 +5,8 @@
#include "CogWindow.h" #include "CogWindow.h"
#include "CogAbilityWindow_Effects.generated.h" #include "CogAbilityWindow_Effects.generated.h"
class UCogAbilityDataAsset;
UCLASS() UCLASS()
class COGABILITY_API UCogAbilityWindow_Effects : public UCogWindow class COGABILITY_API UCogAbilityWindow_Effects : public UCogWindow
{ {
@@ -14,9 +16,7 @@ public:
UCogAbilityWindow_Effects(); UCogAbilityWindow_Effects();
FGameplayTag NegativeEffectTag; TWeakObjectPtr<const UCogAbilityDataAsset> Asset;
FGameplayTag PositiveEffectTag;
protected: protected:
@@ -5,7 +5,7 @@
#include "CogWindow.h" #include "CogWindow.h"
#include "CogAbilityWindow_Pools.generated.h" #include "CogAbilityWindow_Pools.generated.h"
class UCogAbilityDataAsset_Pools; class UCogAbilityDataAsset;
class UAbilitySystemComponent; class UAbilitySystemComponent;
struct FCogAbilityPool; struct FCogAbilityPool;
@@ -16,7 +16,7 @@ class COGABILITY_API UCogAbilityWindow_Pools : public UCogWindow
public: public:
TWeakObjectPtr<UCogAbilityDataAsset_Pools> PoolsAsset; TWeakObjectPtr<const UCogAbilityDataAsset> Asset;
protected: protected:
@@ -5,7 +5,7 @@
#include "CogAbilityWindow_Tweaks.generated.h" #include "CogAbilityWindow_Tweaks.generated.h"
class ACogAbilityReplicator; class ACogAbilityReplicator;
class UCogAbilityDataAsset_Tweaks; class UCogAbilityDataAsset;
UCLASS() UCLASS()
class COGABILITY_API UCogAbilityWindow_Tweaks : public UCogWindow class COGABILITY_API UCogAbilityWindow_Tweaks : public UCogWindow
@@ -13,7 +13,7 @@ class COGABILITY_API UCogAbilityWindow_Tweaks : public UCogWindow
GENERATED_BODY() GENERATED_BODY()
public: public:
TWeakObjectPtr<UCogAbilityDataAsset_Tweaks> TweaksAsset; TWeakObjectPtr<const UCogAbilityDataAsset> Asset;
protected: protected:
@@ -5,6 +5,7 @@
#include "CogWindowManager.h" #include "CogWindowManager.h"
#include "CogWindowWidgets.h" #include "CogWindowWidgets.h"
#include "EngineUtils.h" #include "EngineUtils.h"
#include "GameFramework/Character.h"
#include "imgui.h" #include "imgui.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
@@ -23,6 +24,7 @@ void UCogEngineWindow_Selection::RenderHelp()
UCogEngineWindow_Selection::UCogEngineWindow_Selection() UCogEngineWindow_Selection::UCogEngineWindow_Selection()
{ {
bHasMenu = true; bHasMenu = true;
SubClasses = { AActor::StaticClass(), ACharacter::StaticClass() };
} }
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
-1
View File
@@ -16,7 +16,6 @@ public class CogSample : ModuleRules
"GameplayTasks", "GameplayTasks",
"GameplayAbilities", "GameplayAbilities",
"GameplayTags", "GameplayTags",
"HeadMountedDisplay",
"InputCore", "InputCore",
"NetCore", "NetCore",
}); });
+11 -13
View File
@@ -2,7 +2,6 @@
#include "AssetRegistry/AssetRegistryModule.h" #include "AssetRegistry/AssetRegistryModule.h"
#include "AssetRegistry/IAssetRegistry.h" #include "AssetRegistry/IAssetRegistry.h"
#include "CogCommon.h"
#include "CogSampleFunctionLibrary_Tag.h" #include "CogSampleFunctionLibrary_Tag.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "GameFramework/GameMode.h" #include "GameFramework/GameMode.h"
@@ -10,10 +9,7 @@
#include "Modules/ModuleManager.h" #include "Modules/ModuleManager.h"
#if ENABLE_COG #if ENABLE_COG
#include "CogAbilityDataAsset_Abilities.h" #include "CogAbilityDataAsset.h"
#include "CogAbilityDataAsset_Cheats.h"
#include "CogAbilityDataAsset_Pools.h"
#include "CogAbilityDataAsset_Tweaks.h"
#include "CogAbilityModule.h" #include "CogAbilityModule.h"
#include "CogAbilityWindow_Abilities.h" #include "CogAbilityWindow_Abilities.h"
#include "CogAbilityWindow_Attributes.h" #include "CogAbilityWindow_Attributes.h"
@@ -167,25 +163,27 @@ void ACogSampleGameState::InitializeCog()
//--------------------------------------- //---------------------------------------
// Abilities // Abilities
//--------------------------------------- //---------------------------------------
UCogAbilityWindow_Abilities* AbilitiesWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Abilities>("Gameplay.Abilities"); const UCogAbilityDataAsset* AbilitiesAsset = GetFirstAssetByClass<UCogAbilityDataAsset>();
AbilitiesWindow->AbilitiesAsset = GetFirstAssetByClass<UCogAbilityDataAsset_Abilities>();
CogWindowManager->CreateWindow<UCogAbilityWindow_Attributes>("Gameplay.Attributes"); UCogAbilityWindow_Abilities* AbilitiesWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Abilities>("Gameplay.Abilities");
AbilitiesWindow->Asset = AbilitiesAsset;
UCogAbilityWindow_Attributes* AttributesWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Attributes>("Gameplay.Attributes");
AttributesWindow->Asset = AbilitiesAsset;
UCogAbilityWindow_Cheats* CheatsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Cheats>("Gameplay.Cheats"); UCogAbilityWindow_Cheats* CheatsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Cheats>("Gameplay.Cheats");
CheatsWindow->SetCheatsAsset(GetFirstAssetByClass<UCogAbilityDataAsset_Cheats>()); CheatsWindow->SetAsset(AbilitiesAsset);
UCogAbilityWindow_Effects* EffectsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Effects>("Gameplay.Effects"); UCogAbilityWindow_Effects* EffectsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Effects>("Gameplay.Effects");
EffectsWindow->NegativeEffectTag = Tag_Effect_Alignment_Negative; EffectsWindow->Asset = AbilitiesAsset;
EffectsWindow->PositiveEffectTag = Tag_Effect_Alignment_Positive;
UCogAbilityWindow_Pools* PoolsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Pools>("Gameplay.Pools"); UCogAbilityWindow_Pools* PoolsWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Pools>("Gameplay.Pools");
PoolsWindow->PoolsAsset = GetFirstAssetByClass<UCogAbilityDataAsset_Pools>(); PoolsWindow->Asset = AbilitiesAsset;
CogWindowManager->CreateWindow<UCogAbilityWindow_Tags>("Gameplay.Tags"); CogWindowManager->CreateWindow<UCogAbilityWindow_Tags>("Gameplay.Tags");
UCogAbilityWindow_Tweaks* TweaksWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Tweaks>("Gameplay.Tweaks"); UCogAbilityWindow_Tweaks* TweaksWindow = CogWindowManager->CreateWindow<UCogAbilityWindow_Tweaks>("Gameplay.Tweaks");
TweaksWindow->TweaksAsset = GetFirstAssetByClass<UCogAbilityDataAsset_Tweaks>(); TweaksWindow->Asset = AbilitiesAsset;
//--------------------------------------- //---------------------------------------
// Input // Input
+5 -2
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "CogSampleDefines.h" #include "CogCommon.h"
#include "GameFramework/GameStateBase.h" #include "GameFramework/GameStateBase.h"
#include "CogSampleGameState.generated.h" #include "CogSampleGameState.generated.h"
@@ -10,7 +10,7 @@ class UCogWindowManager;
UCLASS() UCLASS()
class ACogSampleGameState : public AGameStateBase class ACogSampleGameState : public AGameStateBase
{ {
GENERATED_BODY() GENERATED_BODY()
ACogSampleGameState(const FObjectInitializer& ObjectInitializer); ACogSampleGameState(const FObjectInitializer& ObjectInitializer);
@@ -22,6 +22,9 @@ class ACogSampleGameState : public AGameStateBase
private: private:
//--------------------------------------------------------------
// To make sure it doesn't get garbage collected.
//--------------------------------------------------------------
UPROPERTY() UPROPERTY()
TObjectPtr<UObject> CogWindowManagerRef = nullptr; TObjectPtr<UObject> CogWindowManagerRef = nullptr;