-
Notifications
You must be signed in to change notification settings - Fork 0
Menu
The menus consist of a visual component and the functional logic. The visual aspects are represented using Unity's game objects and are composed of buttons which are created from the button template.
The logical functionality is implemented in a script which is usually attached to the uppermost game object of the menu.
The menus inherit from BaseMenu
. This class already implements the basic functionality to react on localization.
The menus implement a start method which is automatically called by Unity once the menu is instantiated. Usually, the start method calls the button initalization method.
Once the menu is instantiated, the menu scripts store references to the menu's button scripts. They are searched by the name of the button's game object and can later be used to manipulate the buttons.
Additionally, the buttons OnClick
methods are specified in order add functionality to the button.
Finally, the language on the buttons is updated.
The 3D menus all inherit from a base menu class which implements a language updater interface.
Once the menu it created, it registers itself as an update receiver at the localization manager.
Whenever the language in the information manager is changed, the localization manager notifies all receivers by calling their OnUpdateLanguage
method.
Each menu has an individual implementation of this method where the texts for all the menu-specific controls are translated and set.
Thus, if the language is changed, all open menus immediately adapt and display the translations of the newly selected language.
If a menu is closed, it de-registers itself as an update receiver at the localization manager.
- Button Template: Description of the button template which is the basis for buttons on the menus
- Buttons: Description of the different implemented buttons
- Localization Manager: Sets the menu's language