Abstract selection menu UI
The next feature we want to add is the ability to choose different frames and photo images for your pictures. For this, we'll develop a menu element using a modal design pattern. When a menu is activated, the user is presented with a set of choices. When a choice is selected, the choice is applied and the menu closes. It is modal because the menu remains active until the user has made his or her choice.
We will begin by writing an abstract PictureMenu
class that implements the basic functionality of a menu. Then we'll use it for selecting the frames and images of the picture.
In our framework, a menu will be enabled by making it active in the Unity scene (using SetActive
). When an object is activated, Unity will call OnEnable()
, which we can use to begin using the menu. The abstract PictureMenu
class expects the following methods in the derived classes:
InitMenu
: Initialization code; called fromStart()
BeginEdit
: When the menu is opened; called fromOnEnable()
ObjectClicked...