1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-16 11:41:50 +00:00
tobspr_shapez.io/src/js/game/hud/parts/watermark.js

43 lines
1.4 KiB
JavaScript
Raw Normal View History

import { BaseHUDPart } from "../base_hud_part";
import { DrawParameters } from "../../../core/draw_parameters";
2020-05-23 10:34:01 +00:00
import { makeDiv } from "../../../core/utils";
import { THIRDPARTY_URLS } from "../../../core/config";
export class HUDWatermark extends BaseHUDPart {
2020-05-23 10:34:01 +00:00
createElements(parent) {
this.element = makeDiv(parent, "ingame_HUD_Watermark");
}
initialize() {
this.trackClicks(this.element, this.onWatermarkClick);
}
2020-05-23 10:34:01 +00:00
onWatermarkClick() {
this.root.app.analytics.trackUiClick("watermark_click");
this.root.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.standaloneStorePage);
}
/**
*
* @param {DrawParameters} parameters
*/
drawOverlays(parameters) {
const w = this.root.gameWidth;
parameters.context.fillStyle = "#f77";
2020-05-21 16:03:57 +00:00
parameters.context.font = "bold " + this.root.app.getEffectiveUiScale() * 17 + "px GameFont";
parameters.context.textAlign = "center";
parameters.context.fillText("DEMO VERSION", w / 2, this.root.app.getEffectiveUiScale() * 35);
2020-05-21 16:03:57 +00:00
parameters.context.font = "bold " + this.root.app.getEffectiveUiScale() * 12 + "px GameFont";
parameters.context.textAlign = "center";
parameters.context.fillText(
"Please consider to buy the full version!",
w / 2,
this.root.app.getEffectiveUiScale() * 55
);
2020-05-21 16:03:57 +00:00
parameters.context.textAlign = "left";
}
}