Make buildRings private.

This commit is contained in:
punkfairie 2023-05-10 22:10:11 -07:00
parent b8745fa7e3
commit 2da65e94f7

View file

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