Page 1 of 2

navigation between panel

Posted: 17 Mar 2019, 21:51
by lanihou
hi , I have been trough the northgame demo but I have a hard time understanding how navigation is done .
the game has 10 different screens (all fullscreen) , I want to navigate to a diferent screen when i click a button in the current screen.
can some one point me to a tutorial where it is explained ? thank.

Re: navigation between panel

Posted: 17 Mar 2019, 21:58
by stonstad
The experts here will likely provide a better explanation. I can share what I do. I have a single top level XAML element <UserControl></UserControl>. I then dynamically swap in user controls as needed to show and hide screens. As a first step, I had my screens declared in the XAML and set to hidden.
<UserControl>
   <local:MyScreen1 x:Name="_Screen1" Visibility="Collapsed"/>
  <local:MyScreen2 x:Name="_Screen2" Visibility="Collapsed"/>
  <local:MyScreen3 x:Name="_Screen3" Visibility="Collapsed"/>
 </UserControl
When I display screen two, for example, I have code similar to as follows: _Screen2.Visibility = Visibility.Visibile.

Re: navigation between panel

Posted: 17 Mar 2019, 22:03
by lanihou
thank. great suggestion

Re: navigation between panel

Posted: 18 Mar 2019, 20:14
by jsantos
Menu3D is also a good and simple example about this.

Note that the Unity version is still using 2.1 and was not tested on 2.2. We are working on it.

Re: navigation between panel

Posted: 02 Jun 2019, 09:50
by whidbey
The experts here will likely provide a better explanation. I can share what I do. I have a single top level XAML element <UserControl></UserControl>. I then dynamically swap in user controls as needed to show and hide screens. As a first step, I had my screens declared in the XAML and set to hidden.
<UserControl>
   <local:MyScreen1 x:Name="_Screen1" Visibility="Collapsed"/>
  <local:MyScreen2 x:Name="_Screen2" Visibility="Collapsed"/>
  <local:MyScreen3 x:Name="_Screen3" Visibility="Collapsed"/>
 </UserControl
When I display screen two, for example, I have code similar to as follows: _Screen2.Visibility = Visibility.Visibile.
is this too weight if the screen count is a lot?

Re: navigation between panel

Posted: 02 Jun 2019, 12:03
by sfernandez
Collapsed controls are not processed during layout so they don't affect the performance.
Although the elements in that tree will be initially created, so the memory consumption will be bigger when having all the screens defined in the main window.

Re: navigation between panel

Posted: 02 Jun 2019, 14:44
by whidbey
Collapsed controls are not processed during layout so they don't affect the performance.
Although the elements in that tree will be initially created, so the memory consumption will be bigger when having all the screens defined in the main window.
i see, thanks

Re: navigation between panel

Posted: 27 Jun 2019, 05:21
by jswigart
Most games have panels of UI open over the top of each other. For instance, you could hit escape and a menu would pop up over the existing game UI. How can you do that with Noesis?

Re: navigation between panel

Posted: 27 Jun 2019, 05:38
by digimbyte
you can instantiate them as templates and add them through code behind, or with c# in unity directly.
typically you would get the uiRoot and add it to the children in that case

if you need to reference the objects, you want to declare them first
noesis = this.GetComponent<NoesisView>();
uiRoot = (Noesis.Grid)noesis.Content;

Noesis.Grid Header = new Noesis.Grid
{
            Height = 20;
            VerticalAlignment = VerticalAlignment.Top,
            HorizontalAlignment = HorizontalAlignment.Stretch,}
uiRoot.Children.Add(Header);

uiRoot.Children.Add(new Noesis.DockPanel
        {
            Height = 64,
            Width = 500,
            VerticalAlignment = VerticalAlignment.Bottom,
            HorizontalAlignment = HorizontalAlignment.Stretch,
        });
my approach is 100% programatic and not the usual way for Noesis. but it should give you some insight
you can instantiate xaml files and add them the same way, its all about how those resources are declared
ultimatly, its important to know that whatever is on the bottom of the list of children will be rendered ontop of other items

Re: navigation between panel

Posted: 27 Jun 2019, 15:17
by jswigart
But isn't that adding to a grid, and so it would be arranged in a grid like fashion, rather than in an overlay window sort of fashion?