Recording Case Information

Hal Brooks
3 min readJan 11, 2022

--

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.

Case class definition

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.

UI Manager variable declaration.

These variables are assigned in the inspector, as shown below. The Case variables will be filled by the app.

UIManager variable assignment in Canvas Inspector.

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.

CreateNewCase() method on UIManager.

The remaining panels in the app will all inherit from the IPanel interface, shown below, which requires the ProcessInfo() method.

IPanel interface requiring 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.

Variable assignment in 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.

CreateClaimPanel variable declaration on Create_Claim_Panel.

When the next button is pressed the ProcessInfo() method on createClaimPanel, i.e. this, script using the On Click() for the Next_Button.

OnClick() on Next_Button of CreateClaimPanel.

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.

ProcessInfo() method on CreateClaimMethod().

In this manner, the user is prompted to enter required information and the data recorded for each case.

CaseID and Name have now been assigned to the case.

--

--