Schedule Creator Design - UO-DFM/SimCityOttawa-Documentation GitHub Wiki

Overview

The schedule creator feature is an interactable element that appears at the start of a new game (after character creation) or after a new month has started (as of 2023). Players choose what jobs they would like to work and set their work schedule for the current month.

Architecture

There are two mediums for this system, the front end and managers. The front end handles all user input gives users a way to choose which work types and displays the restrictions for each work type. The managers handle all data input from the users and generate the events that would be added to the schedule.

Front-end (UI) overview

The structure of the UI follows a tabular layout, and each tab houses a work choice. Each choice of work contains its a form and is independent of other forms. Every form handles its domain logic (i.e., only clinic forms can manage clinic logic and change clinic event data). Thus, every form follows the MVC structure where every form has its own UXML (UI document) and a form controller (C# script). Furthermore, every form controller must inherit ScheduleFormController to allow for polymorphism.

The tab navigation is handled by the schedule creator controller and is not concerned with any form of domain logic (due to polymorphism). However, there is an exceptional case, clinic after-hours restrictions are to be enforced with the schedule controller to force players to choose either after-hours or at least two work choices (including clinic). Due to requirements, players can only set their work schedule per work type one at a time.

Managers (back-end) overview

Every choice of work will be managed by a work type service (e.g., ClinicService, ERService) that will be managed under WorkManager. WorkManager only manages the data persistence of each work type service and persists as a singleton. Meanwhile, the work type services are used to create events, which are sent then to the schedule (i.e., conflict resolution and schedule manager). Some services may generate events to be options for users (notably, ERService).

The schedule creator manager maintains the state of the player working (i.e., has set their work schedule) and is responsible for managing the visibility of the schedule controller UI. It is also responsible for resetting the forms after a month and will freeze time to allow for players to choose their work choices.