unity-renderer icon indicating copy to clipboard operation
unity-renderer copied to clipboard

feat: ECS7 update pointer event result with a new approach

Open D4rWiNSS opened this issue 3 years ago • 1 comments

Context

In order to have a better understanding of why are we changing the way that pointer event result works you should go to this issue: decentraland/sdk#352

We have defined a new way to retrieve the result of the pointer event and we need to implement it.

This is the first step going forward decentraland/sdk#358.

The reason behind implementing this approach instead of the complete Append decentraland/sdk#358. This is because of the time that we have to achieve feature parity with ECS6. This is an intermediary approach that won't break the API when we implement the Append to the CRDT message

Approach

Implement a new variable inside SystemContext that will reference a Queue of pointer events that are pending to be sent back to the scene.

The PointerInputRepresentantion class will fill that list each time that it detects a new event.

After that. For each frame in LateUpdate, a new system PointerEventResolver will get all the pointer-events that have been added to that frame and send only 1 component with an array of all the PointerEvents that we have received. Then, it will clear the queue to ensure that an event is only sent 1 time

What does this PR change?

This PR is divided into two parts. This part implements the changes in the pointer event result component and the other ones change the way we define PointerEvents

The second part ( link to second pr)

  • Removes the old PointerEvents result components ( OnPointerUpResult and OnPointerDownResult) and implements a generic PointerEventResult component.

  • Implements a new system that will resolve all the pending pointer events that are needed to be sent to the scene. Before now, we will send all the new events 1 by 1. This new system will group the last 30 events and send them to their scenes when a new event is added

  • Added a new general context for the ECS7. This will prevent to add new assembly definitions when we want to pass some variable across differents systems

  • Added a bunch of unit testing and integration test to some systems to ensure that they are covered correctly

Know issues

PointerEventUp is not working as expected since the hover text is not appearing correctly. This is happening already so it is not related to this PR

How to test the changes?

This is a first part of a big PR.

Those changes must be tested in the following PR ( it includes part 2): https://github.com/decentraland/unity-renderer/pull/2976

Our Code Review Standards

https://github.com/decentraland/unity-renderer/blob/master/docs/code-review-standards.md

D4rWiNSS avatar Aug 26 '22 11:08 D4rWiNSS

After the CI passes:

github-actions[bot] avatar Aug 26 '22 11:08 github-actions[bot]