Helco / zzio

Zanzarah - WIP modding tools and engine remake
MIT License
14 stars 3 forks source link

Check whether multiple screens could respond to the same element click #231

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

Check whether multiple screens could respond to the same element click

https://github.com/Helco/zzio/blob/892495119f382361ef6bc40a0c584dee2e6a86c4/zzre/game/systems/ui/BaseScreen.cs#L92


        if (button != Veldrid.MouseButton.Left)
            return;

        if (!World.Has<components.ui.HoveredElement>())
            return;
        // TODO: Check whether multiple screens could respond to the same element click
        var hovered = World.Get<components.ui.HoveredElement>();
        if (isDown)
            OnElementDown?.Invoke(hovered.Entity, hovered.Id);
        else

7947c937d462f2a766ac13f27feba8924d5a1ab1

Helco commented 1 year ago

This might be a non-issue as screens "usually" are not open simultaneously. There are of course some exceptions to this (e.g. ScrNotification) but we could juts shimmy the element IDs for these a couple thousands to the back and never worry about it.