From ad9167528ab6f43686cfbc15bf985c7ddb553c37 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Sat, 21 Apr 2018 01:45:00 -0400 Subject: [PATCH] Add unused Signal. private textStyle for labels --- src/Signal.ts | 11 +++++++++++ src/Station.ts | 11 +++++++++-- src/Train.ts | 11 +++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/Signal.ts diff --git a/src/Signal.ts b/src/Signal.ts new file mode 100644 index 0000000..9e224e4 --- /dev/null +++ b/src/Signal.ts @@ -0,0 +1,11 @@ +import * as PIXI from 'pixi.js'; + +export default class Signal { + public location: PIXI.Point; + + constructor( + location: PIXI.Point, + ) { + this.location = location; + } +} diff --git a/src/Station.ts b/src/Station.ts index ce01e1c..d1780ad 100644 --- a/src/Station.ts +++ b/src/Station.ts @@ -71,6 +71,8 @@ export default class Station { public label: PIXI.Text; public color: tinycolorInstance; + private textStyle: object; + constructor( location: PIXI.Point, population: number, @@ -85,10 +87,15 @@ export default class Station { // for debugging stationCount += 1; this.id = stationCount; - this.label = new PIXI.Text(`${this.id}`, { + this.textStyle = { fill: '#FFA500', fontFamily: 'monospace', fontSize: '12px', - }); + }; + this.renderLabel(); + } + + public renderLabel() { + this.label = new PIXI.Text(`${this.id}`, this.textStyle); } } diff --git a/src/Train.ts b/src/Train.ts index 9a48b24..d3dcf21 100644 --- a/src/Train.ts +++ b/src/Train.ts @@ -15,6 +15,8 @@ export default class Train { public color: tinycolorInstance; public sprite: PIXI.Sprite; + private textStyle: object; + constructor( location: PIXI.Point, speed: number, @@ -35,15 +37,20 @@ export default class Train { // for debugging trainCount += 1; this.id = trainCount; - this.label = new PIXI.Text(`${this.id}`, { + this.textStyle = { fill: '#AEAEAE', fontFamily: 'monospace', fontSize: '12px', - }); + }; + this.renderLabel(); } public boardPassengers() { if (this.location === this.origin.location) { // about to leave a station } } + + public renderLabel() { + this.label = new PIXI.Text(`${this.id}`, this.textStyle); + } }