Ground units' name no longer repeats, unit name now dynamic.

This commit is contained in:
PeekabooSteam 2023-03-23 10:02:03 +00:00
parent 735e257900
commit ab01003ae6
2 changed files with 18 additions and 3 deletions

View File

@ -77,19 +77,34 @@ export class UnitControlPanel extends Panel {
}
var button = document.createElement("button");
button.innerText = baseData.unitName;
let callsign;
const unitName = <HTMLInputElement>this.getElement().querySelector( "#unit-name" );
if (unit instanceof Aircraft) {
button.innerText = "";
button.setAttribute( "data-short-label", aircraftDatabase.getLabelByName( baseData.name ) );
button.setAttribute( "data-callsign", aircraftDatabase.getLabelByName( baseData.unitName ) );
callsign = aircraftDatabase.getLabelByName( baseData.unitName );
button.setAttribute( "data-callsign", callsign );
unitName.value = callsign;
} else if (unit instanceof GroundUnit) {
button.setAttribute( "data-short-label", groundUnitsDatabase.getShortLabelByName(baseData.name));
callsign = aircraftDatabase.getLabelByName( baseData.unitName ) || "";
button.setAttribute( "data-callsign", groundUnitsDatabase.getLabelByName( baseData.unitName ) );
unitName.value = callsign;
} else {
button.setAttribute( "data-short-label", "");
button.setAttribute( "data-callsign", "" );
}
button.setAttribute( "data-coalition", unit.getMissionData().coalition );

View File

@ -8,7 +8,7 @@
<div class="unit-short-label"></div>
</div>
<input id="unit-name" value="Olympus 1-1" readonly disabled />
<input id="unit-name" value="" readonly disabled />
<!-- <button id="edit-unit-name" data-on-click="editUnitName"></button> -->
</div>