This repository has been archived on 2021-02-20. You can view files and clone it, but cannot push or open issues or pull requests.
shapez.io/src/js/game/hud/parts/watermark.js

45 lines
1.5 KiB
JavaScript
Raw Normal View History

import { BaseHUDPart } from "../base_hud_part";
import { DrawParameters } from "../../../core/draw_parameters";
2020-05-23 12:34:01 +02:00
import { makeDiv } from "../../../core/utils";
import { THIRDPARTY_URLS } from "../../../core/config";
2020-06-12 13:47:48 +02:00
import { T } from "../../../translations";
export class HUDWatermark extends BaseHUDPart {
2020-05-23 12:34:01 +02:00
createElements(parent) {
this.element = makeDiv(parent, "ingame_HUD_Watermark");
}
initialize() {
this.trackClicks(this.element, this.onWatermarkClick);
}
2020-05-23 12:34:01 +02:00
onWatermarkClick() {
2020-06-07 12:56:02 +02:00
this.root.app.analytics.trackUiClick("watermark_click_2");
2020-05-23 12:34:01 +02:00
this.root.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.standaloneStorePage);
}
/**
*
* @param {DrawParameters} parameters
*/
drawOverlays(parameters) {
const w = this.root.gameWidth;
2020-05-23 13:02:02 +02:00
const x = 280 * this.root.app.getEffectiveUiScale();
parameters.context.fillStyle = "#f77";
2020-05-21 18:03:57 +02:00
parameters.context.font = "bold " + this.root.app.getEffectiveUiScale() * 17 + "px GameFont";
2020-05-23 13:02:02 +02:00
// parameters.context.textAlign = "center";
2020-06-12 13:49:36 +02:00
parameters.context.fillText(
T.demoBanners.title.toUpperCase(),
x,
this.root.app.getEffectiveUiScale() * 27
);
2020-05-21 18:03:57 +02:00
parameters.context.font = "bold " + this.root.app.getEffectiveUiScale() * 12 + "px GameFont";
2020-05-23 13:02:02 +02:00
// parameters.context.textAlign = "center";
2020-06-12 13:47:48 +02:00
parameters.context.fillText(T.demoBanners.intro, x, this.root.app.getEffectiveUiScale() * 45);
2020-05-21 18:03:57 +02:00
2020-05-23 13:02:02 +02:00
// parameters.context.textAlign = "left";
}
}