Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: block camera input #2999

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 8 additions & 41 deletions Explorer/Assets/DCL/Input/ECSInputBlock.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
popuz marked this conversation as resolved.
Show resolved Hide resolved
using Arch.Core;
using DCL.Input.Component;
using ECS.Abstract;
Expand All @@ -23,30 +24,6 @@ public void Disable(params InputMapComponent.Kind[] kinds)
inputMapComponent.BlockInput(kind);
}

public void Disable(InputMapComponent.Kind kind)
{
inputMap ??= globalWorld.CacheInputMap();
ref InputMapComponent inputMapComponent = ref inputMap.Value.GetInputMapComponent(globalWorld);
inputMapComponent.BlockInput(kind);
}

public void Disable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2)
{
inputMap ??= globalWorld.CacheInputMap();
ref InputMapComponent inputMapComponent = ref inputMap.Value.GetInputMapComponent(globalWorld);
inputMapComponent.BlockInput(kind);
inputMapComponent.BlockInput(kind2);
}

public void Disable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2, InputMapComponent.Kind kind3)
{
inputMap ??= globalWorld.CacheInputMap();
ref InputMapComponent inputMapComponent = ref inputMap.Value.GetInputMapComponent(globalWorld);
inputMapComponent.BlockInput(kind);
inputMapComponent.BlockInput(kind2);
inputMapComponent.BlockInput(kind3);
}

public void Enable(params InputMapComponent.Kind[] kinds)
{
inputMap ??= globalWorld.CacheInputMap();
Expand All @@ -56,28 +33,18 @@ public void Enable(params InputMapComponent.Kind[] kinds)
inputMapComponent.UnblockInput(kind);
}

public void Enable(InputMapComponent.Kind kind)
public void EnableAll(params InputMapComponent.Kind[] except)
{
inputMap ??= globalWorld.CacheInputMap();
ref InputMapComponent inputMapComponent = ref inputMap.Value.GetInputMapComponent(globalWorld);
inputMapComponent.UnblockInput(kind);
}

public void Enable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2)
{
inputMap ??= globalWorld.CacheInputMap();
ref InputMapComponent inputMapComponent = ref inputMap.Value.GetInputMapComponent(globalWorld);
inputMapComponent.UnblockInput(kind);
inputMapComponent.UnblockInput(kind2);
}
foreach (var kind in InputMapComponent.VALUES)
{
if (except != null && except.Contains(kind))
continue;

public void Enable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2, InputMapComponent.Kind kind3)
{
inputMap ??= globalWorld.CacheInputMap();
ref InputMapComponent inputMapComponent = ref inputMap.Value.GetInputMapComponent(globalWorld);
inputMapComponent.UnblockInput(kind);
inputMapComponent.UnblockInput(kind2);
inputMapComponent.UnblockInput(kind3);
inputMapComponent.UnblockInput(kind);
}
}
}
}
8 changes: 2 additions & 6 deletions Explorer/Assets/DCL/Input/IInputBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ namespace DCL.Input
public interface IInputBlock
{
public void Disable(params InputMapComponent.Kind[] kinds);
public void Disable(InputMapComponent.Kind kind);
public void Disable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2);
public void Disable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2, InputMapComponent.Kind kind3);

public void Enable(params InputMapComponent.Kind[] kinds);
public void Enable(InputMapComponent.Kind kind);
public void Enable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2);
public void Enable(InputMapComponent.Kind kind, InputMapComponent.Kind kind2, InputMapComponent.Kind kind3);

public void EnableAll(params InputMapComponent.Kind[] except);

}
}
5 changes: 3 additions & 2 deletions Explorer/Assets/Scripts/Global/Dynamic/MainSceneLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ private void RestoreInputs()
{
// We enable Inputs through the inputBlock so the block counters can be properly updated and the component Active flags are up-to-date as well
// We restore all inputs except EmoteWheel and FreeCamera as they should be disabled by default
staticContainer!.InputBlock.Enable(InputMapComponent.Kind.IN_WORLD_CAMERA, InputMapComponent.Kind.SHORTCUTS,
InputMapComponent.Kind.PLAYER, InputMapComponent.Kind.EMOTES, InputMapComponent.Kind.CAMERA);
staticContainer!.InputBlock.EnableAll(InputMapComponent.Kind.FREE_CAMERA,
InputMapComponent.Kind.EMOTE_WHEEL);

}

[ContextMenu(nameof(ValidateSettingsAsync))]
Expand Down
Loading