morten
Topic Author
Posts: 2
Joined: 22 Jan 2014, 17:28

GUI Menu Setup

22 Jan 2014, 17:37

Hi.
I'm currently in the works of making a pretty GUI-heavy game with NoesisGUI for Unity. I've got the basics down, but I'm still wondering how to best switch between different menus/submenus in the game.

Say, for instance, I have a Main Menu, consisting of multiple buttons. The Settings-button opens the Settings-menu, and the Profile-button opens the Profile-menu, etc. Each submenu (Profile, Settings, etc.) also has buttons to go back to the Main Menu, as well as to other specific menu-screens.

So my questions is: How would one go about to best implement switching between menus/views taking up the whole screen with NoesisGUI in Unity?
What should the triggered Button-click do? Switch to a separate .xaml-file? Enable/disable buttons (would be a lot of buttons to handle, so maybe enabling/disabling menu-states)?

Hope it's not too much of a silly questions, but I'm kind of unsure of how to go about this.
Thanks!
 
User avatar
sfernandez
Site Admin
Posts: 1915
Joined: 22 Dec 2011, 19:20

Re: GUI Menu Setup

23 Jan 2014, 02:26

There could be many alternatives, I will expose a simple one.

To manage the entire UI you have a master xaml where different panels are loaded and presented in a root container.
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Border x:Name="RootContainer">
    </Border>

</Grid>
You will have each menu panel defined in a different xaml, probably a custom user control. To load a new panel you can call NoesisGUISystem.LoadXaml<T>, or if using user controls, you can directly create a new instance of the user control.
var startMenu = new StartMenu();
this._rootContainer.SetChild(startMenu);
When a menu button is clicked:
var settingsMenu = new SettingsMenu();
this._rootContainer.SetChild(settingsMenu );
To enhance the user experience, you can define animations to transition between menus panels. To do this, you will need a root container that permits adding more than one child, for example, a Canvas or a Grid.

Is this what you are looking for?
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: GUI Menu Setup

23 Jan 2014, 03:09

By the way, our SamplesGallery, whose source is included in the SDK, is organized that way.
 
morten
Topic Author
Posts: 2
Joined: 22 Jan 2014, 17:28

Re: GUI Menu Setup

23 Jan 2014, 12:10

Thanks!
I'll start working on it from the setup in the ControlGallery-sample. Seems to be a good way of doing it ;)
 
User avatar
jsantos
Site Admin
Posts: 2905
Joined: 20 Jan 2012, 17:18
Contact:

Re: GUI Menu Setup

29 Jan 2014, 03:29

We are working in a sample showing a minimal application with several screens and transitions. I think this sample will be a lot easier to study that our Browser.

Who is online

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