Skip to content

Activity Manager

Fridolin Wild edited this page Aug 22, 2024 · 26 revisions

New classes

Some of the tasks that this class currently has and which should all be separated into own classes:

  • ActivityModel: rename Activity.cs to ActivityModel.cs; this is the data model, already exists
  • ActivityLoader: provide different access methods for loading from web or file no matter whether ARLEM zip or activity.json
  • ActivityParser: Parse activity: Split this into the actual data parsing and into logic that applies data to the scene (ActivitySetup). One of the main things that makes this method problematic is that you cannot just parse the activity on a data level and, e.g., inspect in the code what it contains. By calling the current method ActivityParser(), immediately everything changes in the scene, setting up all necessary GameObjects, manipulating the user interfaces, etc.
  • ActivityView: once the data model is parsed, the view receives the data translated by the ActivitySceneManager as gameobjects
  • ActivitySceneSetup: setup and arrange augmentations in the scene (may not be the perfect name yet!)
  • WorkplaceController: Control workplace manager (this requires refactoring the WorkplaceManager as well - doing the same split between WorkplaceParser, may require WorkplaceSetup and WorkplaceController/ WorkplaceRecorderController)
  • WorkplaceLoader: provide different access methods for loading from file (or other) the workplace.json
  • WorkplaceParser: parse the workplace
  • ActivityController:
    • Viewer: initialization; move back / next between action steps; resuming activities (restoreState); keeping track of the current action step; Handling the GameObject shifting to switch from one step to another ('Keep Alive')
    • Editing the activity: adding and removing activity steps; adding and removing augmentations for a step - or would we keep this with the ActivityController?

TODO refactoring:

  • WorkplaceManager: LoadWorkplace() now triggers an event, but this still required to update in the WorkplaceViewUpdater.cs
  • WorkplaceManager: CalibrateWorkplace now triggers an event, but the two original method calls to PerformEditModeCalibration() and PerformPlayModeCalibration() still need to be fixed, and added to the WorkplaceController.cs
  • WorkplaceManager: InitContainers commented out, needs to move to a view / controller
  • ActionEditor needs to listen to event EventManager.OnDisableAllPoiEditors and then do Object.FindObjectOfType<ActionEditor>().DisableAllPoiEditors();
  • ActionEditor: would need to implement OnShowUploadWarningPanel and OnShowCloneWarningPanel listeners to then call the ShowCloneWarningPanel and ShowUploadWarningPanel routines

Diagram

graph TD;
  ActivityManager --> ActivityLoader;
  ActivityManager --> ActivitySceneSetup;
  ActivitySceneSetup --> ActivityView;
  ActivityLoader --> ActivityParser;
  ActivityParser --> ActivityModel;
  ActivityManager --> ActivityViewerController;
  ActivityManager --> ActivityEditorController;
  ActivityController --> ActivityView;
  ActivityController --> ActivityModel;
  ActivityModel --> WorkplaceModel;
  ActivityManager --> WorkplaceLoader;
  WorkplaceLoader --> WorkplaceModel;
Loading

Classes

ActivityManagerCD