diff --git a/dist/index.css b/dist/index.css
index 227c6f4..6def074 100644
--- a/dist/index.css
+++ b/dist/index.css
@@ -46,8 +46,8 @@ p {
#snookerScoreOverlay {
position: absolute;
- bottom: 0.5em;
- right: 0.5em;
+ bottom: 1em;
+ right: 3em;
}
.view3d {
diff --git a/src/controller/rules/snooker.ts b/src/controller/rules/snooker.ts
index 769fb6d..2560a02 100644
--- a/src/controller/rules/snooker.ts
+++ b/src/controller/rules/snooker.ts
@@ -235,7 +235,6 @@ export class Snooker implements Rules {
continueBreak() {
const table = this.container.table
this.container.sound.playSuccess(table.inPockets())
- console.log(this.currentBreak)
if (Outcome.isClearTable(table)) {
this.container.eventQueue.push(new ChatEvent(null, `game over`))
this.container.recorder.wholeGameLink()
diff --git a/src/events/recorder.ts b/src/events/recorder.ts
index 74cd223..fb33cad 100644
--- a/src/events/recorder.ts
+++ b/src/events/recorder.ts
@@ -80,7 +80,7 @@ export class Recorder {
this.breakLink(isEndOfGame)
}
- this.lastShotLink(isPartOfBreak || isEndOfGame, potCount)
+ this.lastShotLink(isPartOfBreak || isEndOfGame, potCount, Outcome.pots(outcome))
if (isEndOfGame) {
this.breakLink(isEndOfGame)
@@ -97,16 +97,24 @@ export class Recorder {
}
}
- lastShotLink(isPartOfBreak, potCount) {
+ lastShotLink(isPartOfBreak, potCount, balls) {
const pots = potCount > 1 ? potCount - 1 : 0
const breakPoints =
this.container.rules.currentBreak > 0
? " " + this.container.rules.currentBreak
: ""
+
+ var colourString = "#000000"
+ if (balls.length > 0) {
+ balls.forEach(element => {
+ colourString = "#" + element.ballmesh.color.getHexString()
+ });
+ }
+
const shotIcon =
"⚈".repeat(pots) + (isPartOfBreak ? "⚈" : "⚆") + breakPoints
const serialisedShot = JSON.stringify(this.lastShot())
- this.generateLink(shotIcon, serialisedShot)
+ this.generateLink(shotIcon, serialisedShot, colourString)
}
breakLink(includeLastShot) {
@@ -127,7 +135,7 @@ export class Recorder {
const text = `break(${breakScore})`
const serialisedShot = JSON.stringify(currentBreak)
const compressed = JSONCrush.crush(serialisedShot)
- this.generateLink(text, compressed)
+ this.generateLink(text, compressed, "black")
}
wholeGameLink() {
@@ -135,12 +143,13 @@ export class Recorder {
const text = `frame(${game.shots.length} shots)`
const serialisedGame = JSON.stringify(game)
const compressed = JSONCrush.crush(serialisedGame)
- this.generateLink(text, compressed)
+ this.generateLink(text, compressed, "black")
}
- private generateLink(text, state) {
+
+ private generateLink(text, state, colour) {
const shotUri = `${this.replayUrl}${encodeURIComponent(state)}`
- const shotLink = `${text}`
+ const shotLink = `${text}`
this.container.eventQueue.push(new ChatEvent(null, `${shotLink}`))
}
}
diff --git a/src/view/hud.ts b/src/view/hud.ts
index c2e04f5..ccc2d3c 100644
--- a/src/view/hud.ts
+++ b/src/view/hud.ts
@@ -1,8 +1,5 @@
export class Hud {
element: HTMLDivElement
- current_break: HTMLStyleElement
-
- disabled = true
constructor() {
this.element = this.getElement("snookerScore")