Skip to content
Mikhail Agapov edited this page Dec 5, 2023 · 12 revisions

We use a pretty traditional approach for handling views:

Controller

Blur and Focus

Connection with ECS

View

Model

MVC Manager

MVCManager is a storage of controllers and an entry for showing a particular view.

Windows Stack Manager

WindowStackManager provides capabilities for maintaining stacks for different view types. It's sub-ordinate to MVCManager and should not be used outside of it.

Sorting Layer

The sorting layer defines how the corresponding view behaves in the Windows Stack. For each type, there is a different unique logic under the hood:

  • Persistent views are always rendered behind everything else and once shown can't be hidden. They are rendered in the same order and should not overlap.
    • Minimap is a good example of a Persistent View.
  • Fullscreen views are rendered in front of the Persistent layer.
    • When a Fullscreen view is pushed into the stack all Popups get hidden and all Persistent views get Blurred.
    • When a Fullscreen view closes all Persistent views receive Focus
  • Popup
    • There could be several Popups in the stack. The next popup pushed is drawn above the previous one
    • Popup receives a Blur signal when it gets obscured by a new Popup; and Focus when it becomes the highest in the hierarchy
    • There is a special IPopupCloserView that exists in a single copy and provides the capability of closing the top-most pop-up by clicking on the background
  • Overlay views are always drawn above every other view.
    • When the Overlay is pushed it hides Fullscreen and Popup views
    • When the Overlay is popped no automatic recovery for hidden views is performed

How to show a view

To show a view a respective ShowCommand<TView, TInputData> should be passed into the UniTask ShowAsync<TView, TInputData>(ShowCommand<TView, TInputData> command) method.

Controller is bound with a view type and input arguments' type one to one: thus, to prevent argument mismatch IssueCommand(TInputData inputData) from the typed Controller should be used, e.g.:

mvcManager.ShowAsync(ExplorePanelController.IssueCommand(new ExplorePanelParameter(ExploreSections.Navmap))).Forget()

Testability

Clone this wiki locally