Minor improvements

This commit is contained in:
tobspr 2020-05-30 19:11:18 +02:00
parent ffd011ac45
commit 576bd3166f
8 changed files with 57 additions and 32 deletions

View File

@ -1,4 +1,15 @@
export const CHANGELOG = [ export const CHANGELOG = [
{
version: "1.1.2",
date: "unreleased",
entries: [
"Move default key for deleting from 'X' to 'DEL'",
"Show confirmation when deleting > 100 buildings",
"Reintroduce 'SPACE' keybinding to center on map",
"Improved keybinding hints",
"Fixed some keybindings showing as 'undefined'",
],
},
{ {
version: "1.1.1", version: "1.1.1",
date: "28.05.2020", date: "28.05.2020",

View File

@ -345,15 +345,19 @@ export class Camera extends BasicSerializableObject {
*/ */
bindKeys() { bindKeys() {
const mapper = this.root.keyMapper; const mapper = this.root.keyMapper;
mapper mapper.getBinding(KEYMAPPINGS.navigation.mapMoveUp).add(() => (this.keyboardForce.y = -1));
.getBinding(KEYMAPPINGS.ingame.mapMoveUp) mapper.getBinding(KEYMAPPINGS.navigation.mapMoveDown).add(() => (this.keyboardForce.y = 1));
.add(() => console.log("move up") || (this.keyboardForce.y = -1)); mapper.getBinding(KEYMAPPINGS.navigation.mapMoveRight).add(() => (this.keyboardForce.x = 1));
mapper.getBinding(KEYMAPPINGS.ingame.mapMoveDown).add(() => (this.keyboardForce.y = 1)); mapper.getBinding(KEYMAPPINGS.navigation.mapMoveLeft).add(() => (this.keyboardForce.x = -1));
mapper.getBinding(KEYMAPPINGS.ingame.mapMoveRight).add(() => (this.keyboardForce.x = 1));
mapper.getBinding(KEYMAPPINGS.ingame.mapMoveLeft).add(() => (this.keyboardForce.x = -1));
mapper.getBinding(KEYMAPPINGS.ingame.mapZoomIn).add(() => (this.desiredZoom = this.zoomLevel * 1.2)); mapper
mapper.getBinding(KEYMAPPINGS.ingame.mapZoomOut).add(() => (this.desiredZoom = this.zoomLevel * 0.8)); .getBinding(KEYMAPPINGS.navigation.mapZoomIn)
.add(() => (this.desiredZoom = this.zoomLevel * 1.2));
mapper
.getBinding(KEYMAPPINGS.navigation.mapZoomOut)
.add(() => (this.desiredZoom = this.zoomLevel * 0.8));
mapper.getBinding(KEYMAPPINGS.navigation.centerMap).add(() => this.centerOnMap());
} }
centerOnMap() { centerOnMap() {
@ -881,19 +885,19 @@ export class Camera extends BasicSerializableObject {
let forceY = 0; let forceY = 0;
const actionMapper = this.root.keyMapper; const actionMapper = this.root.keyMapper;
if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveUp).isCurrentlyPressed()) { if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveUp).isCurrentlyPressed()) {
forceY -= 1; forceY -= 1;
} }
if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveDown).isCurrentlyPressed()) { if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveDown).isCurrentlyPressed()) {
forceY += 1; forceY += 1;
} }
if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveLeft).isCurrentlyPressed()) { if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveLeft).isCurrentlyPressed()) {
forceX -= 1; forceX -= 1;
} }
if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveRight).isCurrentlyPressed()) { if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveRight).isCurrentlyPressed()) {
forceX += 1; forceX += 1;
} }

View File

@ -186,7 +186,9 @@ export class GameHUD {
} }
/* dev:start */ /* dev:start */
this.trailerMaker.update(); if (this.trailerMaker) {
this.trailerMaker.update();
}
/* dev:end*/ /* dev:end*/
} }

View File

@ -24,24 +24,25 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
[], [],
` `
<div class="binding"> <div class="binding">
<code class="keybinding">${getKeycode(KEYMAPPINGS.ingame.createMarker)}</code> <code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.createMarker)}</code>
<label>${T.ingame.keybindingsOverlay.createMarker}</label> <label>${T.ingame.keybindingsOverlay.createMarker}</label>
</div> </div>
<div class="binding"> <div class="binding">
<code class="keybinding leftMouse noPlacementOnly"></code><i class="noPlacementOnly"></i> <code class="keybinding leftMouse noPlacementOnly"></code><i class="noPlacementOnly"></i>
<code class="keybinding">${getKeycode(KEYMAPPINGS.ingame.mapMoveUp)}</code> <code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.mapMoveUp)}</code>
<code class="keybinding">${getKeycode(KEYMAPPINGS.ingame.mapMoveLeft)}</code> <code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.mapMoveLeft)}</code>
<code class="keybinding">${getKeycode(KEYMAPPINGS.ingame.mapMoveDown)}</code> <code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.mapMoveDown)}</code>
<code class="keybinding">${getKeycode(KEYMAPPINGS.ingame.mapMoveRight)}</code> <code class="keybinding">${getKeycode(KEYMAPPINGS.navigation.mapMoveRight)}</code>
<label>${T.ingame.keybindingsOverlay.moveMap}</label> <label>${T.ingame.keybindingsOverlay.moveMap}</label>
</div> </div>
<div class="binding noPlacementOnly"> <div class="binding noPlacementOnly">
<code class="keybinding rightMouse"></code><i></i> <code class="keybinding builtinKey">${getKeycode(
<code class="keybinding builtinKey">${T.global.keys.control}</code>+ KEYMAPPINGS.massSelect.massSelectStart
)}</code>+
<code class="keybinding leftMouse"></code> <code class="keybinding leftMouse"></code>
<label>${T.ingame.keybindingsOverlay.removeBuildings}</label> <label>${T.ingame.keybindingsOverlay.selectBuildings}</label>
</div> </div>
@ -62,7 +63,7 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
</div> </div>
<div class="binding placementOnly"> <div class="binding placementOnly">
<code class="keybinding builtinKey shift"> ${getKeycode( <code class="keybinding builtinKey shift">${getKeycode(
KEYMAPPINGS.placementModifiers.placeMultiple KEYMAPPINGS.placementModifiers.placeMultiple
)}</code> )}</code>
<label>${T.ingame.keybindingsOverlay.placeMultiple}</label> <label>${T.ingame.keybindingsOverlay.placeMultiple}</label>

View File

@ -79,7 +79,7 @@ export class HUDMassSelector extends BaseHUDPart {
} }
confirmDelete() { confirmDelete() {
if (this.selectedUids.size > 500) { if (this.selectedUids.size > 100) {
const { ok } = this.root.hud.parts.dialogs.showWarning( const { ok } = this.root.hud.parts.dialogs.showWarning(
T.dialogs.massDeleteConfirm.title, T.dialogs.massDeleteConfirm.title,
T.dialogs.massDeleteConfirm.desc.replace( T.dialogs.massDeleteConfirm.desc.replace(

View File

@ -35,7 +35,7 @@ export class HUDWaypoints extends BaseHUDPart {
<span class='desc'>${T.ingame.waypoints.description.replace( <span class='desc'>${T.ingame.waypoints.description.replace(
"<keybinding>", "<keybinding>",
`<code class='keybinding'>${this.root.keyMapper `<code class='keybinding'>${this.root.keyMapper
.getBinding(KEYMAPPINGS.ingame.createMarker) .getBinding(KEYMAPPINGS.navigation.createMarker)
.getKeyCodeString()}</code>` .getKeyCodeString()}</code>`
)}</span> )}</span>
` `
@ -121,7 +121,9 @@ export class HUDWaypoints extends BaseHUDPart {
this.domAttach = new DynamicDomAttach(this.root, this.hintElement); this.domAttach = new DynamicDomAttach(this.root, this.hintElement);
} }
this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.createMarker).add(this.requestCreateMarker, this); this.root.keyMapper
.getBinding(KEYMAPPINGS.navigation.createMarker)
.add(this.requestCreateMarker, this);
this.currentMarkerOpacity = 1; this.currentMarkerOpacity = 1;
this.rerenderWaypointList(); this.rerenderWaypointList();

View File

@ -20,17 +20,20 @@ export const KEYMAPPINGS = {
}, },
ingame: { ingame: {
mapMoveUp: { keyCode: key("W") },
mapMoveRight: { keyCode: key("D") },
mapMoveDown: { keyCode: key("S") },
mapMoveLeft: { keyCode: key("A") },
menuOpenShop: { keyCode: key("F") }, menuOpenShop: { keyCode: key("F") },
menuOpenStats: { keyCode: key("G") }, menuOpenStats: { keyCode: key("G") },
toggleHud: { keyCode: 113 }, // F2 toggleHud: { keyCode: 113 }, // F2
toggleFPSInfo: { keyCode: 115 }, // F1 toggleFPSInfo: { keyCode: 115 }, // F1
},
navigation: {
mapMoveUp: { keyCode: key("W") },
mapMoveRight: { keyCode: key("D") },
mapMoveDown: { keyCode: key("S") },
mapMoveLeft: { keyCode: key("A") },
centerMap: { keyCode: 32 }, // SPACE
mapZoomIn: { keyCode: 187, repeated: true }, // "+" mapZoomIn: { keyCode: 187, repeated: true }, // "+"
mapZoomOut: { keyCode: 189, repeated: true }, // "-" mapZoomOut: { keyCode: 189, repeated: true }, // "-"
@ -62,7 +65,7 @@ export const KEYMAPPINGS = {
massSelectStart: { keyCode: 17 }, // CTRL massSelectStart: { keyCode: 17 }, // CTRL
massSelectSelectMultiple: { keyCode: 16 }, // SHIFT massSelectSelectMultiple: { keyCode: 16 }, // SHIFT
massSelectCopy: { keyCode: key("C") }, massSelectCopy: { keyCode: key("C") },
confirmMassDelete: { keyCode: key("X") }, confirmMassDelete: { keyCode: 46 }, // DEL
}, },
placementModifiers: { placementModifiers: {

View File

@ -204,7 +204,7 @@ ingame:
# every situation # every situation
keybindingsOverlay: keybindingsOverlay:
moveMap: Move moveMap: Move
removeBuildings: Delete selectBuildings: Select area
stopPlacement: Stop placement stopPlacement: Stop placement
rotateBuilding: Rotate building rotateBuilding: Rotate building
placeMultiple: Place multiple placeMultiple: Place multiple
@ -557,6 +557,7 @@ keybindings:
categoryLabels: categoryLabels:
general: Application general: Application
ingame: Game ingame: Game
navigation: Navigating
placement: Placement placement: Placement
massSelect: Mass Select massSelect: Mass Select
buildings: Building Shortcuts buildings: Building Shortcuts
@ -569,6 +570,7 @@ keybindings:
mapMoveRight: Move Right mapMoveRight: Move Right
mapMoveDown: Move Down mapMoveDown: Move Down
mapMoveLeft: Move Left mapMoveLeft: Move Left
centerMap: Center Map
mapZoomIn: Zoom in mapZoomIn: Zoom in
mapZoomOut: Zoom out mapZoomOut: Zoom out