Recording Case Information
--
Objective: Use a UIManager to acquire and store case information.
The Case class has the following variables as shown below. Each of these needs to be entered by the user through the app.
The UIManager script is a singleton on the Canvas which is globally accessible via its public Instance variable. It contains a public references to Case or activeCase, and the game objects createClaimPanel, borderPanel and mainMenuPanel.
These variables are assigned in the inspector, as shown below. The Case variables will be filled by the app.
When the File New Claim button, Create_Case_Button, on the Main_Menu_Panel is pressed the OnClick() event for the button calls the UIManager’s CreateNewCase() method.
This method is shown below and sets the activeCase to a new Case(). An sets the activeCase’s caseID to a random number between 0 and 999. The design flow between panels is now controlled using script, activating the borderPanel and createClaimPanel, while deactivating the mainMenuPanel.
The remaining panels in the app will all inherit from the IPanel interface, shown below, which requires the ProcessInfo() method.
The CreateClaimPanel is a component of the Create_Claim_Panel, inheriting from IPanel. Variables for Text caseNumberText, as well as firstName and Lastname InputFields are required and assigned in the inspector.
The UnityEngine.UI namespace is required for access to the these classes. A reference to the next panel, createLocationPanel, is also needed. These variables are assigned in the inspector since they are public variables. The caseNumberText is retrieved from the UIManager.Instance.activeCase.caseID, previously assigned when File New Claim button was pressed, and displayed at the top of the screen.
When the next button is pressed the ProcessInfo() method on createClaimPanel, i.e. this, script using the On Click() for the Next_Button.
Within the ProcessInfo() method on CreateClaimPanel, the firstName and lastName are checked for the required user input, before assigning the user’s name to the activeCase. The createLocationPanel is then set to active and the createClaimPanel, i.e. this, is inactivated, progressing to the next screen.
In this manner, the user is prompted to enter required information and the data recorded for each case.