Minor art rework, update ratios

This commit is contained in:
tobspr 2020-07-06 22:14:45 +02:00
parent feb10c3805
commit 1f438e8c65
16 changed files with 72 additions and 29 deletions

View File

@ -1383,6 +1383,6 @@
"format": "RGBA8888",
"size": {"w":690,"h":127},
"scale": "0.1",
"smartupdate": "$TexturePacker:SmartUpdate:0b0b30763ad223eaf27d38779febe72e:d99996306029a5a7291a271635ca5e37:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:402faa0126e6dcd814be979d8e838c46:68488838c03e95969cf7c09daf42f69a:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -1383,6 +1383,6 @@
"format": "RGBA8888",
"size": {"w":1960,"h":2791},
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:0b0b30763ad223eaf27d38779febe72e:d99996306029a5a7291a271635ca5e37:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:402faa0126e6dcd814be979d8e838c46:68488838c03e95969cf7c09daf42f69a:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -1383,6 +1383,6 @@
"format": "RGBA8888",
"size": {"w":841,"h":481},
"scale": "0.25",
"smartupdate": "$TexturePacker:SmartUpdate:0b0b30763ad223eaf27d38779febe72e:d99996306029a5a7291a271635ca5e37:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:402faa0126e6dcd814be979d8e838c46:68488838c03e95969cf7c09daf42f69a:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 217 KiB

View File

@ -1383,6 +1383,6 @@
"format": "RGBA8888",
"size": {"w":970,"h":1507},
"scale": "0.5",
"smartupdate": "$TexturePacker:SmartUpdate:0b0b30763ad223eaf27d38779febe72e:d99996306029a5a7291a271635ca5e37:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:402faa0126e6dcd814be979d8e838c46:68488838c03e95969cf7c09daf42f69a:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

After

Width:  |  Height:  |  Size: 520 KiB

View File

@ -1383,6 +1383,6 @@
"format": "RGBA8888",
"size": {"w":1863,"h":1690},
"scale": "0.75",
"smartupdate": "$TexturePacker:SmartUpdate:0b0b30763ad223eaf27d38779febe72e:d99996306029a5a7291a271635ca5e37:f159918d23e5952766c6d23ab52278c6$"
"smartupdate": "$TexturePacker:SmartUpdate:402faa0126e6dcd814be979d8e838c46:68488838c03e95969cf7c09daf42f69a:f159918d23e5952766c6d23ab52278c6$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -72,7 +72,7 @@ export const globalConfig = {
painterQuad: 1 / 8,
mixer: 1 / 5,
stacker: 1 / 6,
advancedProcessor: 1 / 6,
advancedProcessor: 1 / 3,
},
// Zooming

View File

@ -65,7 +65,7 @@ export class MetaAdvancedProcessorBuilding extends MetaBuilding {
entity.addComponent(
new EnergyConsumerComponent({
bufferSize: 3,
perCharge: 0.25,
perCharge: 1,
batteryPosition: new Vector(0.63, 0.7),
acceptorSlotIndex: 1,
ejectorSlotIndex: 1,

View File

@ -1,7 +1,7 @@
import { ClickDetector } from "../../../core/click_detector";
import { globalConfig } from "../../../core/config";
import { globalConfig, THIRDPARTY_URLS } from "../../../core/config";
import { DrawParameters } from "../../../core/draw_parameters";
import { drawRotatedSprite } from "../../../core/draw_utils";
import { drawRotatedSprite, rotateTrapezRightFaced } from "../../../core/draw_utils";
import { Loader } from "../../../core/loader";
import { clamp, makeDiv, removeAllChildren } from "../../../core/utils";
import {
@ -16,6 +16,8 @@ import { defaultBuildingVariant } from "../../meta_building";
import { THEME } from "../../theme";
import { DynamicDomAttach } from "../dynamic_dom_attach";
import { HUDBuildingPlacerLogic } from "./building_placer_logic";
import { makeOffscreenBuffer } from "../../../core/buffer_utils";
import { enumLayer } from "../../root";
export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
/**
@ -56,7 +58,12 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
this.currentInterpolatedCornerTile = new Vector();
this.lockIndicatorSprite = Loader.getSprite("sprites/misc/lock_direction_indicator.png");
this.lockIndicatorSprites = {};
for (const layerId in enumLayer) {
this.lockIndicatorSprites[layerId] = this.makeLockIndicatorSprite(layerId);
}
//
/**
* Stores the click detectors for the variants so we can clean them up later
@ -65,6 +72,37 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
this.variantClickDetectors = [];
}
/**
* Makes the lock indicator sprite for the given layer
* @param {enumLayer} layer
*/
makeLockIndicatorSprite(layer) {
const dims = 48;
const [canvas, context] = makeOffscreenBuffer(dims, dims, {
smooth: true,
reusable: false,
label: "lock-direction-indicator",
});
// Loader.getSprite("sprites/misc/lock_direction_indicator.png").draw(context, 0, 0, 48, 48);
context.fillStyle = THEME.map.directionLock[enumLayer.wires].color;
context.strokeStyle = THEME.map.directionLock[enumLayer.wires].color;
context.lineWidth = 2;
const padding = 5;
const height = dims * 0.5;
const bottom = (dims + height) / 2;
context.moveTo(padding, bottom);
context.lineTo(dims / 2, bottom - height);
context.lineTo(dims - padding, bottom);
context.closePath();
context.stroke();
context.fill();
return canvas;
}
/**
* Rerenders the building info dialog
*/
@ -352,23 +390,28 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
parameters.context.beginCircle(endLine.x, endLine.y, 5);
parameters.context.fill();
// Draw arrows
// Draw arrow
const arrowSprite = this.lockIndicatorSprites[this.root.currentLayer];
const path = this.computeDirectionLockPath();
for (let i = 0; i < path.length - 1; i += 1) {
const { rotation, tile } = path[i];
const worldPos = tile.toWorldSpaceCenterOfTile();
drawRotatedSprite({
parameters,
sprite: this.lockIndicatorSprite,
x: worldPos.x,
y: worldPos.y,
angle: Math.radians(rotation),
size: 12,
offsetY:
-globalConfig.halfTileSize -
const angle = Math.radians(rotation);
parameters.context.translate(worldPos.x, worldPos.y);
parameters.context.rotate(angle);
parameters.context.drawImage(
arrowSprite,
-6,
-globalConfig.halfTileSize -
clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize +
globalConfig.halfTileSize,
});
globalConfig.halfTileSize -
6,
12,
12
);
parameters.context.rotate(-angle);
parameters.context.translate(-worldPos.x, -worldPos.y);
}
}
}

View File

@ -75,7 +75,7 @@ export class HUDWiresOverlay extends BaseHUDPart {
const scaleFactor = 1 / wiresBackgroundDpi;
parameters.context.globalAlpha = 0.7 * this.currentAlpha;
parameters.context.globalAlpha = 0.9 * this.currentAlpha;
parameters.context.globalCompositeOperation = "darken";
parameters.context.scale(scaleFactor, scaleFactor);
parameters.context.fillStyle = this.cachedPatternBackground;
@ -89,9 +89,9 @@ export class HUDWiresOverlay extends BaseHUDPart {
parameters.context.globalCompositeOperation = "source-over";
parameters.context.globalAlpha = 1;
parameters.context.fillStyle = "#3abf88";
parameters.context.globalAlpha = 0.3 * this.currentAlpha;
parameters.context.fillRect(bounds.x, bounds.y, bounds.w, bounds.h);
parameters.context.globalAlpha = 1;
// parameters.context.fillStyle = "#3a85bf";
// parameters.context.globalAlpha = 0.0 * this.currentAlpha;
// parameters.context.fillRect(bounds.x, bounds.y, bounds.w, bounds.h);
// parameters.context.globalAlpha = 1;
}
}

View File

@ -15,8 +15,8 @@
"background": "rgba(74, 237, 134, 0.2)"
},
"wires": {
"color": "rgb(144, 24, 255)",
"background": "rgba(144, 24, 255, 0.2)"
"color": "rgb(74, 237, 134)",
"background": "rgba(74, 237, 134, 0.5)"
}
},