mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-06 07:38:46 +00:00
Add spawning window
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "CogAbilityDataAsset_Cheats.h"
|
||||
#include "CogDebugAllegianceInterface.h"
|
||||
#include "CogDebugDraw.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "EngineUtils.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "imgui.h"
|
||||
@@ -86,13 +87,7 @@ void UCogAbilityWindow_Cheats::AddCheat(AActor* CheatInstigator, AActor* Selecte
|
||||
Color = CheatsAsset->NeutralEffectColor;
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(Color.R, Color.G, Color.B, 0.2f * Color.A));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(Color.R, Color.G, Color.B, 0.3f * Color.A));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(Color.R, Color.G, Color.B, 0.5f * Color.A));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(Color.R, Color.G, Color.B, 0.8f * Color.A));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(Color.R, Color.G, Color.B, 0.2f * Color.A));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(Color.R, Color.G, Color.B, 0.3f * Color.A));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(Color.R, Color.G, Color.B, 0.5f * Color.A));
|
||||
FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Color));
|
||||
|
||||
if (IsPersistent)
|
||||
{
|
||||
@@ -124,7 +119,7 @@ void UCogAbilityWindow_Cheats::AddCheat(AActor* CheatInstigator, AActor* Selecte
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(7);
|
||||
FCogWindowWidgets::PopBackColor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -126,11 +126,11 @@ static void DrawRow(const char* Title, float MitigatedValue, float UnmitigatedVa
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
static void DrawDamages(FCogDamageStats& Damage)
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(150, 150, 150, 60));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, IM_COL32(150, 150, 150, 80));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, IM_COL32(150, 150, 150, 120));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, IM_COL32(150, 150, 150, 200));
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(120, 120, 120, 255));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(150, 150, 150, 60));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, IM_COL32(150, 150, 150, 80));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, IM_COL32(150, 150, 150, 120));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, IM_COL32(150, 150, 150, 200));
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, IM_COL32(120, 120, 120, 255));
|
||||
|
||||
if (ImGui::BeginTable("Damages", 4, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize | ImGuiTableFlags_RowBg))
|
||||
{
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
void UCogAbilityWindow_Effects::PreRender(ImGuiWindowFlags& WindowFlags)
|
||||
{
|
||||
Super::PreRender(WindowFlags);
|
||||
|
||||
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -21,6 +19,12 @@ void UCogAbilityWindow_Effects::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
RenderEffectsTable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::RenderEffectsTable()
|
||||
{
|
||||
UAbilitySystemComponent* AbilitySystemComponent = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetSelection(), true);
|
||||
if (AbilitySystemComponent == nullptr)
|
||||
{
|
||||
@@ -40,14 +44,14 @@ void UCogAbilityWindow_Effects::RenderContent()
|
||||
FGameplayEffectQuery Query;
|
||||
for (const FActiveGameplayEffectHandle& ActiveHandle : AbilitySystemComponent->GetActiveEffects(Query))
|
||||
{
|
||||
DrawEffectRow(*AbilitySystemComponent, ActiveHandle, Index, SelectedIndex);
|
||||
RenderEffectRow(*AbilitySystemComponent, ActiveHandle, Index, SelectedIndex);
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::DrawEffectRow(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffectHandle& ActiveHandle, int32 Index, int32& Selected)
|
||||
void UCogAbilityWindow_Effects::RenderEffectRow(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffectHandle& ActiveHandle, int32 Index, int32& Selected)
|
||||
{
|
||||
ImGui::PushID(Index);
|
||||
|
||||
@@ -104,7 +108,7 @@ void UCogAbilityWindow_Effects::DrawEffectRow(const UAbilitySystemComponent& Abi
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
FCogWindowWidgets::BeginTableTooltip();
|
||||
DrawEffectInfo(AbilitySystemComponent, ActiveEffect, Effect);
|
||||
RenderEffectInfo(AbilitySystemComponent, ActiveEffect, Effect);
|
||||
FCogWindowWidgets::EndTableTooltip();
|
||||
}
|
||||
|
||||
@@ -113,7 +117,7 @@ void UCogAbilityWindow_Effects::DrawEffectRow(const UAbilitySystemComponent& Abi
|
||||
//------------------------
|
||||
if (ImGui::BeginPopupContextItem())
|
||||
{
|
||||
if (ImGui::Button("Open Properties"))
|
||||
if (ImGui::Button("Open"))
|
||||
{
|
||||
//GetOwner()->GetPropertyGrid()->Open(EffectPtr);
|
||||
ImGui::CloseCurrentPopup();
|
||||
@@ -125,26 +129,26 @@ void UCogAbilityWindow_Effects::DrawEffectRow(const UAbilitySystemComponent& Abi
|
||||
// Remaining Time
|
||||
//------------------------
|
||||
ImGui::TableNextColumn();
|
||||
DrawRemainingTime(AbilitySystemComponent, ActiveEffect);
|
||||
RenderRemainingTime(AbilitySystemComponent, ActiveEffect);
|
||||
|
||||
//------------------------
|
||||
// Stacks
|
||||
//------------------------
|
||||
ImGui::TableNextColumn();
|
||||
DrawStacks(ActiveEffect, Effect);
|
||||
RenderStacks(ActiveEffect, Effect);
|
||||
|
||||
//------------------------
|
||||
// Prediction
|
||||
//------------------------
|
||||
ImGui::TableNextColumn();
|
||||
DrawPrediction(ActiveEffect, true);
|
||||
RenderPrediction(ActiveEffect, true);
|
||||
|
||||
ImGui::PopID();
|
||||
Index++;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect)
|
||||
void UCogAbilityWindow_Effects::RenderEffectInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect)
|
||||
{
|
||||
if (ImGui::BeginTable("Effect", 2, ImGuiTableFlags_Borders))
|
||||
{
|
||||
@@ -178,7 +182,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Remaining Time");
|
||||
ImGui::TableNextColumn();
|
||||
DrawRemainingTime(AbilitySystemComponent, ActiveEffect);
|
||||
RenderRemainingTime(AbilitySystemComponent, ActiveEffect);
|
||||
|
||||
//------------------------
|
||||
// Period
|
||||
@@ -196,7 +200,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Stacks");
|
||||
ImGui::TableNextColumn();
|
||||
DrawStacks(ActiveEffect, Effect);
|
||||
RenderStacks(ActiveEffect, Effect);
|
||||
|
||||
//------------------------
|
||||
// Prediction
|
||||
@@ -205,7 +209,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Prediction");
|
||||
ImGui::TableNextColumn();
|
||||
DrawPrediction(ActiveEffect, false);
|
||||
RenderPrediction(ActiveEffect, false);
|
||||
|
||||
//------------------------
|
||||
// Dynamic Asset Tags
|
||||
@@ -214,7 +218,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextColored(TextColor, "Dynamic Asset Tags");
|
||||
ImGui::TableNextColumn();
|
||||
DrawTagContainer(ActiveEffect.Spec.GetDynamicAssetTags());
|
||||
RenderTagContainer(ActiveEffect.Spec.GetDynamicAssetTags());
|
||||
|
||||
//------------------------
|
||||
// All Asset Tags
|
||||
@@ -225,7 +229,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
ImGui::TableNextColumn();
|
||||
FGameplayTagContainer AllAssetTagsContainer;
|
||||
ActiveEffect.Spec.GetAllAssetTags(AllAssetTagsContainer);
|
||||
DrawTagContainer(AllAssetTagsContainer);
|
||||
RenderTagContainer(AllAssetTagsContainer);
|
||||
|
||||
//------------------------
|
||||
// All Granted Tags
|
||||
@@ -236,7 +240,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
ImGui::TableNextColumn();
|
||||
FGameplayTagContainer AllGrantedTagsContainer;
|
||||
ActiveEffect.Spec.GetAllGrantedTags(AllGrantedTagsContainer);
|
||||
DrawTagContainer(AllGrantedTagsContainer);
|
||||
RenderTagContainer(AllGrantedTagsContainer);
|
||||
|
||||
//------------------------
|
||||
// Modifiers
|
||||
@@ -262,7 +266,7 @@ void UCogAbilityWindow_Effects::DrawEffectInfo(const UAbilitySystemComponent& Ab
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::DrawTagContainer(const FGameplayTagContainer& Container)
|
||||
void UCogAbilityWindow_Effects::RenderTagContainer(const FGameplayTagContainer& Container)
|
||||
{
|
||||
TArray<FGameplayTag> GameplayTags;
|
||||
Container.GetGameplayTagArray(GameplayTags);
|
||||
@@ -280,7 +284,7 @@ FString UCogAbilityWindow_Effects::GetEffectName(const UGameplayEffect& Effect)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::DrawRemainingTime(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect)
|
||||
void UCogAbilityWindow_Effects::RenderRemainingTime(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect)
|
||||
{
|
||||
float StartTime = ActiveEffect.StartWorldTime;
|
||||
float Duration = ActiveEffect.GetDuration();
|
||||
@@ -302,7 +306,7 @@ void UCogAbilityWindow_Effects::DrawRemainingTime(const UAbilitySystemComponent&
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::DrawStacks(const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect)
|
||||
void UCogAbilityWindow_Effects::RenderStacks(const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect)
|
||||
{
|
||||
const int32 CurrentStackCount = ActiveEffect.Spec.StackCount;
|
||||
if (Effect.StackLimitCount <= 0)
|
||||
@@ -320,7 +324,7 @@ void UCogAbilityWindow_Effects::DrawStacks(const FActiveGameplayEffect& ActiveEf
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void UCogAbilityWindow_Effects::DrawPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short)
|
||||
void UCogAbilityWindow_Effects::RenderPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short)
|
||||
{
|
||||
FString PredictionString;
|
||||
if (ActiveEffect.PredictionKey.IsValidKey())
|
||||
|
||||
@@ -22,20 +22,12 @@ void DrawTweak(ACogAbilityReplicator* Replicator, const UCogAbilityDataAsset_Twe
|
||||
}
|
||||
|
||||
const FCogAbilityTweakCategory& Category = TweaksAsset->TweaksCategories[TweakCategoryIndex];
|
||||
const FLinearColor& Color = Category.Color;
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(Color.R, Color.G, Color.B, Color.A * 0.25f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(Color.R, Color.G, Color.B, Color.A * 0.3f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(Color.R, Color.G, Color.B, Color.A * 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(Color.R, Color.G, Color.B, Color.A * 0.8f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(Color.R, Color.G, Color.B, Color.A * 1.0f));
|
||||
|
||||
|
||||
FCogWindowWidgets::PushBackColor(FCogImguiHelper::ToImVec4(Category.Color));
|
||||
ImGui::PushItemWidth(-1);
|
||||
ImGui::SliderFloat("##Value", Value, TweaksAsset->TweakMinValue, TweaksAsset->TweakMaxValue, "%+0.0f%%", 1.0f);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::PopStyleColor(5);
|
||||
FCogWindowWidgets::PopBackColor();
|
||||
|
||||
bool bUpdateValue = ImGui::IsItemDeactivatedAfterEdit();
|
||||
|
||||
|
||||
@@ -22,17 +22,19 @@ protected:
|
||||
|
||||
virtual void RenderContent() override;
|
||||
|
||||
virtual void DrawEffectRow(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffectHandle& ActiveHandle, int32 Index, int32& Selected);
|
||||
virtual void RenderEffectsTable();
|
||||
|
||||
virtual void DrawEffectInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect);
|
||||
virtual void RenderEffectRow(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffectHandle& ActiveHandle, int32 Index, int32& Selected);
|
||||
|
||||
virtual void RenderEffectInfo(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect);
|
||||
|
||||
virtual void DrawTagContainer(const FGameplayTagContainer& Container);
|
||||
virtual void RenderTagContainer(const FGameplayTagContainer& Container);
|
||||
|
||||
virtual void RenderRemainingTime(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect);
|
||||
|
||||
virtual void RenderStacks(const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect);
|
||||
|
||||
virtual void RenderPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short);
|
||||
|
||||
virtual FString GetEffectName(const UGameplayEffect& Effect);
|
||||
|
||||
virtual void DrawRemainingTime(const UAbilitySystemComponent& AbilitySystemComponent, const FActiveGameplayEffect& ActiveEffect);
|
||||
|
||||
virtual void DrawStacks(const FActiveGameplayEffect& ActiveEffect, const UGameplayEffect& Effect);
|
||||
|
||||
virtual void DrawPrediction(const FActiveGameplayEffect& ActiveEffect, bool Short);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user