-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-vor-station-declination
- Loading branch information
Showing
12 changed files
with
281 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
fbw-a380x/src/systems/instruments/src/AtcMailbox/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: ['../../../../../../.eslintrc.js', 'plugin:jsdoc/recommended-typescript-error'], | ||
|
||
plugins: ['eslint-plugin-jsdoc'], | ||
|
||
// overrides airbnb, use sparingly | ||
rules: { | ||
'react/no-unknown-property': 'off', | ||
'react/style-prop-object': 'off', | ||
'arrow-body-style': 'off', | ||
camelcase: 'off', | ||
}, | ||
}; |
61 changes: 61 additions & 0 deletions
61
fbw-a380x/src/systems/instruments/src/AtcMailbox/AtcMailbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) 2024 FlyByWire Simulations | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import { DisplayComponent, EventBus, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; | ||
import { Button } from 'instruments/src/MFD/pages/common/Button'; | ||
import { MouseCursor } from 'instruments/src/MFD/pages/common/MouseCursor'; | ||
import { CdsDisplayUnit, DisplayUnitID } from '../MsfsAvionicsCommon/CdsDisplayUnit'; | ||
|
||
import './style.scss'; | ||
|
||
export interface AtcMailboxProps { | ||
readonly bus: EventBus; | ||
} | ||
|
||
export class AtcMailbox extends DisplayComponent<AtcMailboxProps> { | ||
private readonly topRef = FSComponent.createRef<HTMLDivElement>(); | ||
|
||
private readonly mouseCursorRef = FSComponent.createRef<MouseCursor>(); | ||
|
||
private onMouseMove(ev: MouseEvent) { | ||
this.mouseCursorRef.getOrDefault()?.updatePosition(ev.clientX, ev.clientY - 768); | ||
} | ||
|
||
private onMouseMoveHandler = this.onMouseMove.bind(this); | ||
|
||
public onAfterRender(node: VNode): void { | ||
super.onAfterRender(node); | ||
|
||
this.topRef.instance.addEventListener('mousemove', this.onMouseMoveHandler); | ||
} | ||
|
||
destroy(): void { | ||
this.topRef.getOrDefault()?.removeEventListener('mousemove', this.onMouseMoveHandler); | ||
|
||
super.destroy(); | ||
} | ||
|
||
render(): VNode | null { | ||
return ( | ||
<CdsDisplayUnit bus={this.props.bus} displayUnitId={DisplayUnitID.Sd}> | ||
<div ref={this.topRef} class="atc-mailbox-top-layout"> | ||
<div class="atc-mailbox-left-layout"> | ||
<Button label="RECALL" onClick={() => {}} buttonStyle="height: 50px;"></Button> | ||
</div> | ||
<div class="atc-mailbox-center-layout"> | ||
<div class="atc-mailbox-center-top"></div> | ||
<div class="atc-mailbox-center-bottom"> | ||
<div class="atc-mailbox-cb-1" /> | ||
<div class="atc-mailbox-cb-2" /> | ||
</div> | ||
</div> | ||
<div class="atc-mailbox-right-layout"> | ||
<Button label="CLOSE" onClick={() => {}} buttonStyle="height: 50px; justify-content: flex-end;"></Button> | ||
<Button label="PRINT" onClick={() => {}} buttonStyle="height: 50px; justify-content: flex-end;"></Button> | ||
</div> | ||
<MouseCursor side={Subject.create('CAPT')} ref={this.mouseCursorRef} /> | ||
</div> | ||
</CdsDisplayUnit> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"index": "./instrument.tsx", | ||
"name": "AtcMailbox", | ||
"isInteractive": true | ||
} |
105 changes: 105 additions & 0 deletions
105
fbw-a380x/src/systems/instruments/src/AtcMailbox/instrument.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { | ||
FSComponent, | ||
EventBus, | ||
HEventPublisher, | ||
InstrumentBackplane, | ||
FsInstrument, | ||
FsBaseInstrument, | ||
ClockPublisher, | ||
} from '@microsoft/msfs-sdk'; | ||
import { FailuresConsumer } from '@flybywiresim/fbw-sdk'; | ||
import { AtcMailbox } from 'instruments/src/AtcMailbox/AtcMailbox'; | ||
|
||
class AtcMailboxInstrument implements FsInstrument { | ||
private readonly bus = new EventBus(); | ||
|
||
private readonly backplane = new InstrumentBackplane(); | ||
|
||
private readonly clockPublisher = new ClockPublisher(this.bus); | ||
|
||
private readonly hEventPublisher = new HEventPublisher(this.bus); | ||
|
||
private readonly failuresConsumer = new FailuresConsumer('A32NX'); | ||
|
||
constructor(public readonly instrument: BaseInstrument) { | ||
this.hEventPublisher = new HEventPublisher(this.bus); | ||
|
||
this.backplane.addPublisher('hEvent', this.hEventPublisher); | ||
this.backplane.addPublisher('clock', this.clockPublisher); | ||
|
||
this.doInit(); | ||
} | ||
|
||
public doInit(): void { | ||
this.backplane.init(); | ||
|
||
const atcMailbox = document.getElementById('AtcMailbox_CONTENT'); | ||
|
||
FSComponent.render(<AtcMailbox bus={this.bus} />, document.getElementById('AtcMailbox_CONTENT')); | ||
|
||
// Remove "instrument didn't load" text | ||
atcMailbox?.querySelector(':scope > h1')?.remove(); | ||
} | ||
|
||
/** | ||
* A callback called when the instrument gets a frame update. | ||
*/ | ||
public Update(): void { | ||
this.backplane.onUpdate(); | ||
this.failuresConsumer.update(); | ||
} | ||
|
||
public onInteractionEvent(args: string[]): void { | ||
this.hEventPublisher.dispatchHEvent(args[0]); | ||
} | ||
|
||
public onGameStateChanged(_oldState: GameState, _newState: GameState): void { | ||
// noop | ||
} | ||
|
||
public onFlightStart(): void { | ||
// noop | ||
} | ||
|
||
public onSoundEnd(_soundEventId: Name_Z): void { | ||
// noop | ||
} | ||
|
||
public onPowerOn(): void { | ||
// noop | ||
} | ||
|
||
public onPowerOff(): void { | ||
// noop | ||
} | ||
} | ||
|
||
class A380X_AtcMailbox extends FsBaseInstrument<AtcMailboxInstrument> { | ||
public constructInstrument(): AtcMailboxInstrument { | ||
return new AtcMailboxInstrument(this); | ||
} | ||
|
||
public get isInteractive(): boolean { | ||
return true; | ||
} | ||
|
||
public get templateID(): string { | ||
return 'A380X_AtcMailbox'; | ||
} | ||
|
||
/** @inheritdoc */ | ||
public onPowerOn(): void { | ||
super.onPowerOn(); | ||
|
||
this.fsInstrument.onPowerOn(); | ||
} | ||
|
||
/** @inheritdoc */ | ||
public onShutDown(): void { | ||
super.onShutDown(); | ||
|
||
this.fsInstrument.onPowerOff(); | ||
} | ||
} | ||
|
||
registerInstrument('a380x-atc-mailbox', A380X_AtcMailbox); |
54 changes: 54 additions & 0 deletions
54
fbw-a380x/src/systems/instruments/src/AtcMailbox/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) 2024 FlyByWire Simulations | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
@import "../MsfsAvionicsCommon/definitions.scss"; | ||
|
||
.atc-mailbox-top-layout { | ||
display: grid; | ||
grid-template-columns: 13% auto 18%; | ||
height: 256px; | ||
width: 768px; | ||
position: absolute; | ||
top: 768px; | ||
} | ||
|
||
.atc-mailbox-left-layout { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-end; | ||
border-right: 2px solid $display-white; | ||
} | ||
|
||
.atc-mailbox-center-layout { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-end; | ||
} | ||
|
||
.atc-mailbox-right-layout { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
border-left: 2px solid $display-white; | ||
} | ||
|
||
.atc-mailbox-center-bottom { | ||
display: flex; | ||
flex: 1; | ||
flex-direction: row; | ||
} | ||
|
||
.atc-mailbox-center-top { | ||
display: flex; | ||
flex: 8; | ||
border-bottom: 2px solid white; | ||
} | ||
|
||
.atc-mailbox-cb-1 { | ||
flex: 1; | ||
border-right: 2px solid white; | ||
} | ||
|
||
.atc-mailbox-cb-2 { | ||
flex: 1; | ||
} |
33 changes: 33 additions & 0 deletions
33
fbw-a380x/src/systems/instruments/src/AtcMailbox/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
|
||
"compilerOptions": { | ||
"incremental": false /* Enables incremental builds */, | ||
"target": "es2017" /* Specifies the ES2017 target, compatible with Coherent GT */, | ||
"module": "es2015" /* Ensures that modules are at least es2015 */, | ||
"strict": true /* Enables strict type checking, highly recommended but optional */, | ||
"esModuleInterop": true /* Emits additional JS to work with CommonJS modules */, | ||
"skipLibCheck": true /* Skip type checking on library .d.ts files */, | ||
"forceConsistentCasingInFileNames": true /* Ensures correct import casing */, | ||
"moduleResolution": "node" /* Enables compatibility with MSFS SDK bare global imports */, | ||
"jsxFactory": "FSComponent.buildComponent" /* Required for FSComponent framework JSX */, | ||
"jsxFragmentFactory": "FSComponent.Fragment" /* Required for FSComponent framework JSX */, | ||
"jsx": "react", /* Required for FSComponent framework JSX */ | ||
"paths": { | ||
"@datalink/aoc": ["../../../fbw-common/src/systems/datalink/aoc/src/index.ts"], | ||
"@datalink/atc": ["../../../fbw-common/src/systems/datalink/atc/src/index.ts"], | ||
"@datalink/common": ["../../../fbw-common/src/systems/datalink/common/src/index.ts"], | ||
"@datalink/router": ["../../../fbw-common/src/systems/datalink/router/src/index.ts"], | ||
"@failures": ["./failures/src/index.ts"], | ||
"@fmgc/*": ["./fmgc/src/*"], | ||
"@instruments/common/*": ["./instruments/src/Common/*"], | ||
"@localization/*": ["../localization/*"], | ||
"@sentry/*": ["./sentry-client/src/*"], | ||
"@simbridge/*": ["./simbridge-client/src/*"], | ||
"@shared/*": ["./shared/src/*"], | ||
"@tcas/*": ["./tcas/src/*"], | ||
"@typings/*": ["../../../fbw-common/src/typings/*"], | ||
"@flybywiresim/fbw-sdk": ["../../../fbw-common/src/systems/index-no-react.ts"], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.