mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 08:02:23 -07:00
Display inhibition of gameplay effects
This commit is contained in:
@@ -85,14 +85,14 @@ void FCogAbilityWindow_Effects::RenderContent()
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
{
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Selection has no ability system component");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("Effects", 4, ImGuiTableFlags_SizingFixedFit
|
||||
if (ImGui::BeginTable("Effects", 5, ImGuiTableFlags_SizingFixedFit
|
||||
| ImGuiTableFlags_Resizable
|
||||
| ImGuiTableFlags_NoBordersInBodyUntilResize
|
||||
| ImGuiTableFlags_ScrollY
|
||||
@@ -107,6 +107,7 @@ void FCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
ImGui::TableSetupColumn("Remaining Time");
|
||||
ImGui::TableSetupColumn("Stacks");
|
||||
ImGui::TableSetupColumn("Prediction");
|
||||
ImGui::TableSetupColumn("Inhibited");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
static int SelectedIndex = -1;
|
||||
@@ -258,6 +259,11 @@ void FCogAbilityWindow_Effects::RenderEffectRow(const UAbilitySystemComponent& A
|
||||
ImGui::TableNextColumn();
|
||||
RenderPrediction(ActiveEffect, true);
|
||||
|
||||
//------------------------
|
||||
// Inhibited
|
||||
//------------------------
|
||||
ImGui::TableNextColumn();
|
||||
RenderInhibition(ActiveEffect, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -266,7 +272,7 @@ void FCogAbilityWindow_Effects::RenderEffectInfo(const UAbilitySystemComponent&
|
||||
{
|
||||
if (ImGui::BeginTable("Effect", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
constexpr ImVec4 TextColor(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
|
||||
ImGui::TableSetupColumn("Property");
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
@@ -325,6 +331,15 @@ void FCogAbilityWindow_Effects::RenderEffectInfo(const UAbilitySystemComponent&
|
||||
ImGui::TableNextColumn();
|
||||
RenderPrediction(ActiveEffect, false);
|
||||
|
||||
//------------------------
|
||||
// Inhibited
|
||||
//------------------------
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Inhibited");
|
||||
ImGui::TableNextColumn();
|
||||
RenderInhibition(ActiveEffect, false);
|
||||
|
||||
//------------------------
|
||||
// Dynamic Asset Tags
|
||||
//------------------------
|
||||
@@ -406,7 +421,7 @@ void FCogAbilityWindow_Effects::RenderRemainingTime(const UAbilitySystemComponen
|
||||
|
||||
if (Duration >= 0)
|
||||
{
|
||||
const UWorld* World = AbilitySystemComponent.GetWorld();
|
||||
const UWorld* World = AbilitySystemComponent.GetWorld();
|
||||
const float RemainingTime = StartTime + Duration - World->GetTimeSeconds();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(100, 100, 100, 255));
|
||||
@@ -457,6 +472,19 @@ void FCogAbilityWindow_Effects::RenderPrediction(const FActiveGameplayEffect& Ac
|
||||
ImGui::Text("%s", TCHAR_TO_ANSI(*PredictionString));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::RenderInhibition(const FActiveGameplayEffect& ActiveEffect, bool Short)
|
||||
{
|
||||
if (ActiveEffect.bIsInhibited)
|
||||
{
|
||||
FCogWindowWidgets::SmallButton("Yes", ImVec4(1, 0, 0, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("No");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::OpenEffect(const FActiveGameplayEffectHandle& Handle)
|
||||
{
|
||||
@@ -472,13 +500,13 @@ void FCogAbilityWindow_Effects::CloseEffect(const FActiveGameplayEffectHandle& H
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogAbilityWindow_Effects::RenderOpenEffects()
|
||||
{
|
||||
const AActor* Selection = GetSelection();
|
||||
const AActor* Selection = GetSelection();
|
||||
if (Selection == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true);
|
||||
const UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(Selection, true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -486,7 +514,7 @@ void FCogAbilityWindow_Effects::RenderOpenEffects()
|
||||
|
||||
for (int i = OpenedEffects.Num() - 1; i >= 0; --i)
|
||||
{
|
||||
const FActiveGameplayEffectHandle Handle = OpenedEffects[i];
|
||||
const FActiveGameplayEffectHandle Handle = OpenedEffects[i];
|
||||
|
||||
const FActiveGameplayEffect* ActiveEffectPtr = AbilitySystemComponent->GetActiveGameplayEffect(Handle);
|
||||
if (ActiveEffectPtr == nullptr)
|
||||
|
||||
@@ -48,6 +48,8 @@ protected:
|
||||
|
||||
virtual void RenderPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short);
|
||||
|
||||
virtual void RenderInhibition(const FActiveGameplayEffect& ActiveEffect, bool Short);
|
||||
|
||||
virtual FString GetEffectName(const UGameplayEffect& Effect);
|
||||
|
||||
virtual FString GetEffectNameSafe(const UGameplayEffect* Effect);
|
||||
|
||||
Reference in New Issue
Block a user