Add gameplay tasks window. Add blocking tags in the gameplay ability window.

This commit is contained in:
Arnaud Jamin
2024-04-26 11:59:12 -04:00
parent 72127c9cdd
commit 87dd681624
11 changed files with 660 additions and 15 deletions
@@ -0,0 +1,50 @@
#pragma once
//--------------------------------------------------------------------------------------------------------------------------
// Hack to access to private members
// https://github.com/YunHsiao/Crysknife/blob/main/SourcePatch/Runtime/Core/Public/Misc/PrivateAccessor.h
// https://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html
//--------------------------------------------------------------------------------------------------------------------------
template<typename Type, Type& Output, Type Input>
struct TRob
{
TRob() { Output = Input; }
static TRob Obj;
};
template<typename Type, Type& Output, Type Input>
TRob<Type, Output, Input> TRob<Type, Output, Input>::Obj;
template<typename OwnerType, typename VariableType>
using TMemberVariableType = VariableType(OwnerType::*);
template<typename OwnerType, typename ReturnType, typename... Args>
using TMemberFunctionType = ReturnType(OwnerType::*)(Args...);
template<typename OwnerType, typename ReturnType, typename... Args>
using TConstMemberFunctionType = ReturnType(OwnerType::*)(Args...) const;
template<typename VariableType>
using TStaticVariableType = VariableType*;
template<typename ReturnType, typename... Args>
using TStaticFunctionType = ReturnType(*)(Args...);
#define INIT_PRIVATE_ACCESSOR(Name, Value) template struct TRob<decltype(Name), Name, &Value>
#define DEFINE_PRIVATE_ACCESSOR(Name, Value, Type, ...) \
static Type<__VA_ARGS__> Name; \
INIT_PRIVATE_ACCESSOR(Name, Value)
/****************************** Syntactic Sugars ******************************/
#define DEFINE_PRIVATE_ACCESSOR_VARIABLE(Name, Class, VariableType, VariableName) DEFINE_PRIVATE_ACCESSOR(Name, Class::VariableName, TMemberVariableType, Class, VariableType)
#define DEFINE_PRIVATE_ACCESSOR_STATIC_VARIABLE(Name, Class, VariableType, VariableName) DEFINE_PRIVATE_ACCESSOR(Name, Class::VariableName, TStaticVariableType, VariableType)
#define DEFINE_PRIVATE_ACCESSOR_FUNCTION(Name, Class, ReturnType, FunctionName, ...) DEFINE_PRIVATE_ACCESSOR(Name, Class::FunctionName, TMemberFunctionType, Class, ReturnType, __VA_ARGS__)
#define DEFINE_PRIVATE_ACCESSOR_CONST_FUNCTION(Name, Class, ReturnType, FunctionName, ...) DEFINE_PRIVATE_ACCESSOR(Name, Class::FunctionName, TConstMemberFunctionType, Class, ReturnType, __VA_ARGS__)
#define DEFINE_PRIVATE_ACCESSOR_STATIC_FUNCTION(Name, Class, ReturnType, FunctionName, ...) DEFINE_PRIVATE_ACCESSOR(Name, Class::FunctionName, TStaticFunctionType, ReturnType, __VA_ARGS__)
#define PRIVATE_ACCESS_OBJ(Obj, Name) (Obj.*Name)
#define PRIVATE_ACCESS_PTR(Ptr, Name) (Ptr->*Name)
#define PRIVATE_ACCESS_STATIC(Name) (*Name)
@@ -1020,3 +1020,13 @@ void FCogWindowWidgets::ActorFrame(const AActor& Actor)
AddTextWithShadow(DrawList, FCogImguiHelper::ToImVec2(ScreenPosMin + FVector2D(0, -14.0f)) + Viewport->Pos, Color, TCHAR_TO_ANSI(*FCogWindowHelper::GetActorName(Actor)));
}
}
//--------------------------------------------------------------------------------------------------------------------------
void FCogWindowWidgets::SmallButton(const char* Text, const ImVec4& Color)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(Color.x, Color.y, Color.z, Color.w * 0.6f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(Color.x, Color.y, Color.z, Color.w * 0.8f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(Color.x, Color.y, Color.z, Color.w * 1.0f));
ImGui::SmallButton(Text);
ImGui::PopStyleColor(3);
}
@@ -102,6 +102,8 @@ public:
static void ActorContextMenu(AActor& Selection, const FCogWindowActorContextMenuFunction& ContextMenuFunction);
static void ActorFrame(const AActor& Actor);
static void SmallButton(const char* Text, const ImVec4& Color);
};
template<typename EnumType>