@@ -6,6 +6,7 @@ import { Events } from "@app/events/events";
66import { DraggableHtmlBox } from "@app/modal/draggable-html-box" ;
77import { ObjectivesManager } from "@app/objectives" ;
88import { ScenarioManager , SimulationSettings } from "@app/scenario-manager" ;
9+ import { SimulationManager } from "@app/simulation/simulation-manager" ;
910import { html } from "../../engine/utils/development/formatter" ;
1011import { Antenna } from '../../equipment/antenna/antenna' ;
1112import { RealTimeSpectrumAnalyzer } from '../../equipment/real-time-spectrum-analyzer/real-time-spectrum-analyzer' ;
@@ -60,14 +61,16 @@ export class Equipment extends BaseElement {
6061 </ div >
6162 </ div >
6263 ` ;
63- missionBriefBox : DraggableHtmlBox ;
64- checklistBox : DraggableHtmlBox ;
6564
6665 constructor ( settings : SimulationSettings ) {
6766 super ( ) ;
6867 this . html_ = settings . layout ? settings . layout : this . html_ ;
6968 this . init_ ( SandboxPage . containerId , 'replace' ) ;
7069 this . initEquipment_ ( settings ) ;
70+
71+ EventBus . getInstance ( ) . on ( Events . ROUTE_CHANGED , ( ) => {
72+ this . stopChecklistRefreshTimer_ ( ) ;
73+ } ) ;
7174 }
7275
7376 protected addEventListeners_ ( ) : void {
@@ -79,8 +82,8 @@ export class Equipment extends BaseElement {
7982 const missionBriefUrl = ScenarioManager . getInstance ( ) . settings . missionBriefUrl ;
8083 if ( missionBriefUrl ) {
8184 qs ( '.mission-brief-icon' ) . addEventListener ( 'click' , ( ) => {
82- this . missionBriefBox ??= new DraggableHtmlBox ( 'Mission Brief' , 'mission-brief' , missionBriefUrl ) ;
83- this . missionBriefBox . open ( ) ;
85+ SimulationManager . getInstance ( ) . missionBriefBox ??= new DraggableHtmlBox ( 'Mission Brief' , 'mission-brief' , missionBriefUrl ) ;
86+ SimulationManager . getInstance ( ) . missionBriefBox . open ( ) ;
8487 } ) ;
8588 }
8689 }
@@ -89,24 +92,24 @@ export class Equipment extends BaseElement {
8992 const missionBriefUrl = ScenarioManager . getInstance ( ) . settings . missionBriefUrl ;
9093 if ( missionBriefUrl ) {
9194 qs ( '.checklist-icon' ) . addEventListener ( 'click' , ( ) => {
92- this . checklistBox ??= new DraggableHtmlBox ( 'Checklist' , 'checklist' , '' ) ;
95+ SimulationManager . getInstance ( ) . checklistBox ??= new DraggableHtmlBox ( 'Checklist' , 'checklist' , '' ) ;
9396 const objectivesManager = ObjectivesManager . getInstance ( ) ;
9497 objectivesManager . syncCollapsedStatesFromDOM ( ) ;
9598 this . lastChecklistHtml_ = objectivesManager . generateHtmlChecklist ( ) ;
96- this . checklistBox . updateContent ( this . lastChecklistHtml_ ) ;
97- this . checklistBox . open ( ) ;
98- this . startChecklistRefreshTimer_ ( this . checklistBox ) ;
99+ SimulationManager . getInstance ( ) . checklistBox . updateContent ( this . lastChecklistHtml_ ) ;
100+ SimulationManager . getInstance ( ) . checklistBox . open ( ) ;
101+ this . startChecklistRefreshTimer_ ( SimulationManager . getInstance ( ) . checklistBox ) ;
99102 } ) ;
100103
101104 EventBus . getInstance ( ) . on ( Events . OBJECTIVE_ACTIVATED , ( ) => {
102105 // Can't update it until they open it for the first time
103- if ( ! this . checklistBox ) {
106+ if ( ! SimulationManager . getInstance ( ) . checklistBox ) {
104107 return ;
105108 }
106109
107110 const objectivesManager = ObjectivesManager . getInstance ( ) ;
108111 this . lastChecklistHtml_ = objectivesManager . generateHtmlChecklist ( ) ;
109- this . checklistBox . updateContent ( this . lastChecklistHtml_ ) ;
112+ SimulationManager . getInstance ( ) . checklistBox . updateContent ( this . lastChecklistHtml_ ) ;
110113 } ) ;
111114 }
112115 }
0 commit comments