lanihou
Topic Author
Posts: 7
Joined: 10 Feb 2018, 20:08

navigation between panel

17 Mar 2019, 21:51

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.
 
stonstad
Posts: 99
Joined: 06 Jun 2016, 18:14

Re: navigation between panel

17 Mar 2019, 21:58

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.
 
lanihou
Topic Author
Posts: 7
Joined: 10 Feb 2018, 20:08

Re: navigation between panel

17 Mar 2019, 22:03

thank. great suggestion
 
User avatar
jsantos
Site Admin
Posts: 2563
Joined: 20 Jan 2012, 17:18
Contact:

Re: navigation between panel

18 Mar 2019, 20:14

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.
 
whidbey
Posts: 49
Joined: 26 May 2019, 07:16

Re: navigation between panel

02 Jun 2019, 09:50

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?
 
User avatar
sfernandez
Site Admin
Posts: 1628
Joined: 22 Dec 2011, 19:20

Re: navigation between panel

02 Jun 2019, 12:03

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.
 
whidbey
Posts: 49
Joined: 26 May 2019, 07:16

Re: navigation between panel

02 Jun 2019, 14:44

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
 
jswigart
Posts: 11
Joined: 14 Mar 2019, 02:35

Re: navigation between panel

27 Jun 2019, 05:21

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?
 
User avatar
digimbyte
Posts: 47
Joined: 14 Nov 2017, 21:42

Re: navigation between panel

27 Jun 2019, 05:38

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
 
jswigart
Posts: 11
Joined: 14 Mar 2019, 02:35

Re: navigation between panel

27 Jun 2019, 15:17

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?

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests