Make buildRings private.
This commit is contained in:
parent
b8745fa7e3
commit
2da65e94f7
1 changed files with 18 additions and 18 deletions
|
@ -2,81 +2,81 @@ export class UI {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- buildRings ---- */
|
/* -------------------------------------------------------------------------- buildRings ---- */
|
||||||
|
|
||||||
static buildRings(body) {
|
static #buildRings(body) {
|
||||||
const rings = $('<span>')
|
const rings = $('<span>')
|
||||||
const seperator = $('<span>').text(' ) ')
|
const seperator = $('<span>').text(' ) ')
|
||||||
rings.appendChild(seperator)
|
rings.appendChild(seperator)
|
||||||
|
|
||||||
body.Rings.forEach((ring) => {
|
body.Rings.forEach((ring) => {
|
||||||
const ringClass = ring.RingClass.replace('eRingClass_', '')
|
const ringClass = ring.RingClass.replace('eRingClass_', '')
|
||||||
let icon = null
|
let icon = null
|
||||||
|
|
||||||
switch (ringClass) {
|
switch (ringClass) {
|
||||||
case 'MetalRich': {
|
case 'MetalRich': {
|
||||||
icon = 'gold-bars'
|
icon = 'gold-bars'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Metalic':
|
case 'Metalic':
|
||||||
case 'Metallic': {
|
case 'Metallic': {
|
||||||
icon = 'ingot'
|
icon = 'ingot'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Icy': {
|
case 'Icy': {
|
||||||
icon = 'snowflake'
|
icon = 'snowflake'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Rocky': {
|
case 'Rocky': {
|
||||||
icon = 'asteroid-3'
|
icon = 'asteroid-3'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon !== null) {
|
if (icon !== null) {
|
||||||
rings.appendChild($('<i>').addClass(`flaticon-${icon}`))
|
rings.appendChild($('<i>').addClass(`flaticon-${icon}`))
|
||||||
rings.appendChild(seperator)
|
rings.appendChild(seperator)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return rings
|
return rings
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- createBodyRow ---- */
|
/* ----------------------------------------------------------------------- createBodyRow ---- */
|
||||||
|
|
||||||
static createBodyRow(body) {
|
static createBodyRow(body) {
|
||||||
const chartedStyle = body.WasDiscovered && !body.DSSDone ? 'charted' : 'uncharted'
|
const chartedStyle = body.WasDiscovered && !body.DSSDone ? 'charted' : 'uncharted'
|
||||||
const row = $('<div>').addClass('row ms-1 me-1')
|
const row = $('<div>').addClass('row ms-1 me-1')
|
||||||
row.attr('id', body.bodyID)
|
row.attr('id', body.bodyID)
|
||||||
|
|
||||||
// spacer
|
// spacer
|
||||||
row.appendChild($('<div>').addClass('col-1 system'))
|
row.appendChild($('<div>').addClass('col-1 system'))
|
||||||
|
|
||||||
// name
|
// name
|
||||||
const name = $('<div>').addClass(`col-2 text-left system ${chartedStyle}`)
|
const name = $('<div>').addClass(`col-2 text-left system ${chartedStyle}`)
|
||||||
name.appendChild($('<i>')).addClass(`flaticon-${body.nameIcon()}`)
|
name.appendChild($('<i>')).addClass(`flaticon-${body.nameIcon()}`)
|
||||||
name.appendChild($('<span>')).text(body.simpleName())
|
name.appendChild($('<span>')).text(body.simpleName())
|
||||||
row.appendChild(name)
|
row.appendChild(name)
|
||||||
|
|
||||||
// type icon
|
// type icon
|
||||||
const type = $('<div>').addClass(`col pe-0 me-0 system ${chartedStyle}`)
|
const type = $('<div>').addClass(`col pe-0 me-0 system ${chartedStyle}`)
|
||||||
type.appendChild($('<i>').addClass(`flaticon-${body.typeIcon()}`))
|
type.appendChild($('<i>').addClass(`flaticon-${body.typeIcon()}`))
|
||||||
// rings
|
// rings
|
||||||
if (body.Rings !== undefined) {
|
if (body.Rings !== undefined) {
|
||||||
type.appendChild(buildRings(body))
|
type.appendChild(UI.#buildRings(body))
|
||||||
}
|
}
|
||||||
// type
|
// type
|
||||||
const typeName = body.PlanetClass || body.starType || ''
|
const typeName = body.PlanetClass || body.starType || ''
|
||||||
type.appendChild($('<span>').text(typeName))
|
type.appendChild($('<span>').text(typeName))
|
||||||
row.appendChild(type)
|
row.appendChild(type)
|
||||||
|
|
||||||
// distance
|
// distance
|
||||||
const distance = $('<div>').addClass(`col-auto ps-2 ms-0 system ${chartedStyle}`)
|
const distance = $('<div>').addClass(`col-auto ps-2 ms-0 system ${chartedStyle}`)
|
||||||
distance.text(body.distance())
|
distance.text(body.distance())
|
||||||
row.appendChild(distance)
|
row.appendChild(distance)
|
||||||
|
|
||||||
// info
|
// info
|
||||||
const info = $('<div>').addClass(`col-1 system ${chartedStyle}`)
|
const info = $('<div>').addClass(`col-1 system ${chartedStyle}`)
|
||||||
// terraformable
|
// terraformable
|
||||||
|
@ -92,11 +92,11 @@ export class UI {
|
||||||
}
|
}
|
||||||
info.appendChild(mapped)
|
info.appendChild(mapped)
|
||||||
row.appendChild(info)
|
row.appendChild(info)
|
||||||
|
|
||||||
// mapped value
|
// mapped value
|
||||||
const value = $('<div>').addClass(`col-2 text-right system ${chartedStyle}`)
|
const value = $('<div>').addClass(`col-2 text-right system ${chartedStyle}`)
|
||||||
row.appendChild(value)
|
row.appendChild(value)
|
||||||
|
|
||||||
return row
|
return row
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue