mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-01 04:10:06 +00:00
CogInput: Add multiple IMC on the input data asset. Maybe propose a current imc
This commit is contained in:
Binary file not shown.
@@ -288,7 +288,7 @@ void UCogEngineWindow_OutputLog::RenderContent()
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginPopupContextItem())
|
if (ImGui::BeginPopupContextItem("OutputLog"))
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Clear"))
|
if (ImGui::MenuItem("Clear"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ void UCogInputWindow_Actions::RenderHelp()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void UCogInputWindow_Actions::ResetConfig()
|
||||||
|
{
|
||||||
|
RepeatPeriod = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
UCogInputWindow_Actions::UCogInputWindow_Actions()
|
UCogInputWindow_Actions::UCogInputWindow_Actions()
|
||||||
{
|
{
|
||||||
@@ -39,12 +45,6 @@ void UCogInputWindow_Actions::RenderContent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Asset->MappingContext == nullptr)
|
|
||||||
{
|
|
||||||
ImGui::Text("No MappingContext");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
|
||||||
if (LocalPlayer == nullptr)
|
if (LocalPlayer == nullptr)
|
||||||
{
|
{
|
||||||
@@ -80,14 +80,22 @@ void UCogInputWindow_Actions::RenderContent()
|
|||||||
|
|
||||||
if (Actions.Num() == 0)
|
if (Actions.Num() == 0)
|
||||||
{
|
{
|
||||||
for (const FEnhancedActionKeyMapping& Mapping : Asset->MappingContext->GetMappings())
|
for (TObjectPtr<const UInputMappingContext> MappingContext : Asset->MappingContexts)
|
||||||
{
|
{
|
||||||
if (Mapping.Action != nullptr && Actions.ContainsByPredicate([&Mapping](const FCogInjectActionInfo& ActionInfo) { return Mapping.Action == ActionInfo.Action; }) == false)
|
for (const FEnhancedActionKeyMapping& Mapping : MappingContext->GetMappings())
|
||||||
{
|
{
|
||||||
FCogInjectActionInfo& ActionInfo = Actions.AddDefaulted_GetRef();
|
if (Mapping.Action != nullptr && Actions.ContainsByPredicate([&Mapping](const FCogInjectActionInfo& ActionInfo) { return Mapping.Action == ActionInfo.Action; }) == false)
|
||||||
ActionInfo.Action = Mapping.Action;
|
{
|
||||||
|
FCogInjectActionInfo& ActionInfo = Actions.AddDefaulted_GetRef();
|
||||||
|
ActionInfo.Action = Mapping.Action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Actions.Sort([](const FCogInjectActionInfo& Lhs, const FCogInjectActionInfo& Rhs)
|
||||||
|
{
|
||||||
|
return GetNameSafe(Lhs.Action).Compare(GetNameSafe(Rhs.Action)) < 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTable("Actions", 3, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize))
|
if (ImGui::BeginTable("Actions", 3, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_NoBordersInBodyUntilResize))
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void UCogInputWindow_Gamepad::InputContextMenu(const FKey& Key, FCogInjectAction
|
|||||||
|
|
||||||
if (ActionInfoButton != nullptr && ActionInfoButton->Action != nullptr && ActionInfoButton->Action->ValueType == EInputActionValueType::Axis1D)
|
if (ActionInfoButton != nullptr && ActionInfoButton->Action != nullptr && ActionInfoButton->Action->ValueType == EInputActionValueType::Axis1D)
|
||||||
{
|
{
|
||||||
FCogWindowWidgets::SliderWithReset("X", &ActionInfo2D->X, -1.0f, 1.0f, 0.0f, "%0.2f");
|
FCogWindowWidgets::SliderWithReset("X", &ActionInfoButton->X, -1.0f, 1.0f, 0.0f, "%0.2f");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActionInfo2D != nullptr)
|
if (ActionInfo2D != nullptr)
|
||||||
@@ -236,7 +236,11 @@ void UCogInputWindow_Gamepad::RenderContent()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Asset != nullptr && Asset->MappingContext != nullptr)
|
if (Asset == nullptr)
|
||||||
|
{
|
||||||
|
ImGui::Text("No Input Asset");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (Actions.Num() == 0)
|
if (Actions.Num() == 0)
|
||||||
{
|
{
|
||||||
@@ -267,20 +271,20 @@ void UCogInputWindow_Gamepad::RenderContent()
|
|||||||
Actions.FindOrAdd(EKeys:: Gamepad_DPad_Right);
|
Actions.FindOrAdd(EKeys:: Gamepad_DPad_Right);
|
||||||
Actions.FindOrAdd(EKeys:: Gamepad_DPad_Left);
|
Actions.FindOrAdd(EKeys:: Gamepad_DPad_Left);
|
||||||
|
|
||||||
for (const FEnhancedActionKeyMapping& Mapping : Asset->MappingContext->GetMappings())
|
for (TObjectPtr<const UInputMappingContext> MappingContext : Asset->MappingContexts)
|
||||||
{
|
{
|
||||||
if (Mapping.Action != nullptr)
|
for (const FEnhancedActionKeyMapping& Mapping : MappingContext->GetMappings())
|
||||||
{
|
{
|
||||||
FCogInjectActionInfo& ActionInfo = Actions.FindOrAdd(Mapping.Key);
|
if (Mapping.Action != nullptr)
|
||||||
ActionInfo.Action = Mapping.Action;
|
{
|
||||||
|
FCogInjectActionInfo& ActionInfo = Actions.FindOrAdd(Mapping.Key);
|
||||||
|
ActionInfo.Action = Mapping.Action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::Text("No Action Asset");
|
|
||||||
}
|
|
||||||
|
|
||||||
const float AspectRatio = 0.55f;
|
const float AspectRatio = 0.55f;
|
||||||
const float StickAmplitude = 0.04f;
|
const float StickAmplitude = 0.04f;
|
||||||
@@ -311,7 +315,7 @@ void UCogInputWindow_Gamepad::RenderContent()
|
|||||||
|
|
||||||
DrawList = ImGui::GetWindowDrawList();
|
DrawList = ImGui::GetWindowDrawList();
|
||||||
ImGui::Dummy(bShowAsOverlay ? CanvasMax - CanvasMin : ContentSize);
|
ImGui::Dummy(bShowAsOverlay ? CanvasMax - CanvasMin : ContentSize);
|
||||||
if (ImGui::BeginPopupContextItem())
|
if (ImGui::BeginPopupContextItem("Gamepad"))
|
||||||
{
|
{
|
||||||
if (ImGui::Button("Close", ImVec2(-1.0f, 0)))
|
if (ImGui::Button("Close", ImVec2(-1.0f, 0)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ public:
|
|||||||
UCogInputDataAsset() {}
|
UCogInputDataAsset() {}
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
TObjectPtr<const UInputMappingContext> MappingContext;
|
TArray<TObjectPtr<const UInputMappingContext>> MappingContexts;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void RenderHelp();
|
virtual void ResetConfig() override;
|
||||||
|
|
||||||
|
virtual void RenderHelp() override;
|
||||||
|
|
||||||
virtual void RenderContent() override;
|
virtual void RenderContent() override;
|
||||||
|
|
||||||
|
|||||||
@@ -393,9 +393,26 @@ void ACogSampleCharacter::OnAbilityInputStarted(const FInputActionValue& Value,
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spec->InputPressed = true;
|
Spec->InputPressed = true;
|
||||||
AbilitySystem->TryActivateAbility(Handle);
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// Replicate button press if ability is already active
|
||||||
|
//-----------------------------------------------------
|
||||||
|
if (Spec->IsActive())
|
||||||
|
{
|
||||||
|
const UGameplayAbility* AbilityToActivate = Spec->GetPrimaryInstance();
|
||||||
|
if (AbilityToActivate->bReplicateInputDirectly && AbilitySystem->IsOwnerActorAuthoritative() == false)
|
||||||
|
{
|
||||||
|
AbilitySystem->ServerSetInputPressed(Spec->Handle);
|
||||||
|
}
|
||||||
|
AbilitySystem->AbilitySpecInputPressed(*Spec);
|
||||||
|
AbilitySystem->InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputPressed, Spec->Handle, Spec->ActivationInfo.GetActivationPredictionKey());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AbilitySystem->TryActivateAbility(Handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -9,10 +9,6 @@
|
|||||||
- CogEngine: Stat main menu widget could have a tooltip on each stat with a control to change set the emulation (FPS, Ping, Packetloss)
|
- CogEngine: Stat main menu widget could have a tooltip on each stat with a control to change set the emulation (FPS, Ping, Packetloss)
|
||||||
- CogEngine: Add screen settings (fullscreen, borderless, window and resolution)
|
- CogEngine: Add screen settings (fullscreen, borderless, window and resolution)
|
||||||
|
|
||||||
- CogInput: Add multiple IMC on the input data asset. Maybe propose a current imc
|
|
||||||
|
|
||||||
- CogAbilities: Apply tweaks on spawn
|
|
||||||
|
|
||||||
- CogSample: Add a custom window in sample (changing the character faction)
|
- CogSample: Add a custom window in sample (changing the character faction)
|
||||||
- CogSample: Create more abilities
|
- CogSample: Create more abilities
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user