diff --git a/src/client/HelpModal.ts b/src/client/HelpModal.ts index de76c943e..4320854ed 100644 --- a/src/client/HelpModal.ts +++ b/src/client/HelpModal.ts @@ -1,500 +1,294 @@ import { LitElement, css, html } from "lit"; -import { customElement, state } from "lit/decorators.js"; +import { customElement, query, state } from "lit/decorators.js"; import "./components/Difficulties"; +import "./components/baseComponents/Modal"; import "./components/Maps"; @customElement("help-modal") export class HelpModal extends LitElement { - @state() private isModalOpen = false; + @query("o-modal") private modalEl!: HTMLElement & { + open: () => void; + close: () => void; + }; - // Added #helpModal infront of everything to prevent leaks of css in other elements outside this one - private styles = css` - .radial-menu-image { - width: 211px; - height: 200px; - } - - #helpModal.modal-overlay { - display: none; - position: fixed; - z-index: 1000; - left: 0; - top: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.5); - overflow-y: auto; - display: flex; - align-items: center; - justify-content: center; - } + private styles = css``; - #helpModal .modal-content { - background-color: rgb(35 35 35 / 0.8); - -webkit-backdrop-filter: blur(12px); - backdrop-filter: blur(12px); - color: white; - padding: 20px; - border-radius: 8px; - width: 80%; - max-width: 1280px; - max-height: 80vh; - overflow-y: auto; - box-shadow: 0 0 40px rgba(0, 0, 0, 0.5); - border: 1px solid rgba(255, 255, 255, 0.2); - backdrop-filter: blur(8px); - position: relative; - } + public open() { + this.modalEl?.open(); + } - #helpModal .title { - font-size: 28px; - color: #fff; - font-weight: 600; - display: flex; - align-items: center; - justify-content: center; - padding: 0 0 0 20px; - } - - #helpModal .close { - position: sticky; - top: 0px; - right: 0px; - color: #aaa; - float: right; - font-size: 28px; - font-weight: bold; - cursor: pointer; - } - - #helpModal .close:hover, - #helpModal .close:focus { - color: white; - text-decoration: none; - cursor: pointer; - } - - #helpModal table { - border-collapse: collapse; - } - - #helpModal table, - #helpModal table th, - #helpModal table td { - border: 1px solid rgb(255 255 255 / 0.2); - } - - #helpModal table th, - #helpModal table td { - padding: 8px 16px; - } - - #helpModal table td:first-of-type { - text-align: center; - } - - #helpModal .icon { - background-color: white; - width: 32px; - height: 32px; - } - - #helpModal .city-icon { - -webkit-mask: url(/images/CityIconWhite.svg) no-repeat center / cover; - mask: url(/images/CityIconWhite.svg) no-repeat center / cover; - } - - #helpModal .defense-post-icon { - -webkit-mask: url(/images/ShieldIconWhite.svg) no-repeat center / cover; - mask: url(/images/ShieldIconWhite.svg) no-repeat center / cover; - } - - #helpModal .port-icon { - -webkit-mask: url(/images/PortIcon.svg) no-repeat center / cover; - mask: url(/images/PortIcon.svg) no-repeat center / cover; - } - - #helpModal .warship-icon { - -webkit-mask: url(/images/BattleshipIconWhite.svg) no-repeat center / - cover; - mask: url(/images/BattleshipIconWhite.svg) no-repeat center / cover; - } - - #helpModal .missile-silo-icon { - -webkit-mask: url(/images/MissileSiloIconWhite.svg) no-repeat center / - cover; - mask: url(/images/MissileSiloIconWhite.svg) no-repeat center / cover; - } - - #helpModal .sam-launcher-icon { - -webkit-mask: url(/images/SamLauncherIconWhite.svg) no-repeat center / - cover; - mask: url(/images/SamLauncherIconWhite.svg) no-repeat center / cover; - } - - #helpModal .atom-bomb-icon { - -webkit-mask: url(/images/NukeIconWhite.svg) no-repeat center / cover; - mask: url(/images/NukeIconWhite.svg) no-repeat center / cover; - } - - #helpModal .hydrogen-bomb-icon { - -webkit-mask: url(/images/MushroomCloudIconWhite.svg) no-repeat center / - cover; - mask: url(/images/MushroomCloudIconWhite.svg) no-repeat center / cover; - } - - #helpModal .mirv-icon { - -webkit-mask: url(/images/MIRVIcon.svg) no-repeat center / cover; - mask: url(/images/MIRVIcon.svg) no-repeat center / cover; - } - - #helpModal .target-icon { - -webkit-mask: url(/images/TargetIcon.svg) no-repeat center / cover; - mask: url(/images/TargetIcon.svg) no-repeat center / cover; - } - - #helpModal .alliance-icon { - -webkit-mask: url(/images/AllianceIconWhite.svg) no-repeat center / cover; - mask: url(/images/AllianceIconWhite.svg) no-repeat center / cover; - } - - #helpModal .emoji-icon { - -webkit-mask: url(/images/EmojiIconWhite.svg) no-repeat center / cover; - mask: url(/images/EmojiIconWhite.svg) no-repeat center / cover; - } - - #helpModal .betray-icon { - -webkit-mask: url(/images/TraitorIconWhite.svg) no-repeat center / cover; - mask: url(/images/TraitorIconWhite.svg) no-repeat center / cover; - } - - #helpModal .donate-icon { - -webkit-mask: url(/images/DonateIconWhite.svg) no-repeat center / cover; - mask: url(/images/DonateIconWhite.svg) no-repeat center / cover; - } - - #helpModal .build-icon { - -webkit-mask: url(/images/BuildIconWhite.svg) no-repeat center / cover; - mask: url(/images/BuildIconWhite.svg) no-repeat center / cover; - } - - #helpModal .info-icon { - -webkit-mask: url(/images/InfoIcon.svg) no-repeat center / cover; - mask: url(/images/InfoIcon.svg) no-repeat center / cover; - } - - #helpModal .boat-icon { - -webkit-mask: url(/images/BoatIcon.svg) no-repeat center / cover; - mask: url(/images/BoatIcon.svg) no-repeat center / cover; - } - - #helpModal .cancel-icon { - -webkit-mask: url(/images/XIcon.svg) no-repeat center / cover; - mask: url(/images/XIcon.svg) no-repeat center / cover; - } - - @media screen and (max-width: 768px) { - #helpModal .modal-content { - max-height: 90vh; - max-width: 100vw; - width: 100%; - } - `; + public close() { + this.modalEl?.close(); + } createRenderRoot() { - // Disable shadow DOM to allow Tailwind classes to work return this; } render() { return html` - -
| Key | +Action | +
|---|---|
| Space | +Alternate view (terrain/countries) | +
| Shift + left click | +Attack (when left click is set to open menu) | +
| Ctrl + left click | +Open build menu | +
| C | +Center camera on player | +
| Q / E | +Zoom out/in | +
| W / A / S / D | +Move camera | +
| 1 / 2 | +Decrease/Increase attack ratio | +
| Shift + scroll down / scroll up | +Decrease/Increase attack ratio | +
| ALT + R | +Reset graphics | +
| Key | -Action | -
|---|---|
| Space | -Alternate view (terrain/countries) | -
| Shift + left click | -Attack (when left click is set to open menu) | -
| Ctrl + left click | -Open build menu | -
| C | -Center camera on player | -
| Q / E | -Zoom out/in | -
| W / A / S / D | -Move camera | -
| 1 / 2 | -Decrease/Increase attack ratio | -
| Shift + scroll down / scroll up | -Decrease/Increase attack ratio | -
| ALT + R | -Reset graphics | -
- Shows the top players of the game and their names, % owned land and gold.
-
- The control panel contains the following elements:
-
- The following elements can be found inside:
-
- Right clicking (or touch on mobile) opens the radial menu. From there you can:
-
- - Contains information such for the selected player name, gold, troops, and if the player is a traitor. Traitor is a player who betrayed and attacked a player who was in an alliance with them. The icons below represent the following interactions: -
-
- - When you ally with a player, the following new icons become available: -
-| Name | -Icon | -Description | -
|---|---|---|
| City | -- | - Increases your max population. Useful when you can't - expand your territory or you're about to hit your - population limit. - | -
| Defense Post | -- | - Increases defenses around nearby borders. Attacks from - enemies are slower and have more casualties. - | -
| Port | -- | - Automatically sends trade ships between ports of your - country and other countries (except if you clicked "stop - trade" on them or they clicked "stop trade on you"), giving - gold to both sides. Allows building Battleships. Can only - be built near water. - | -
| Warship | -- | - Patrols in an area, capturing trade ships and destroying - enemy Warships and Boats. Spawns from the nearest Port and - patrols the area you first clicked to build it. - | -
| Missile Silo | -- | Allows launching missiles. | -
| SAM Launcher | -- | Has a 75% chance to intercept enemy missiles in it's 100 pixel range. - The SAM has a 7.5 second cooldown and can not intercept MIRVs. | -
| Atom Bomb | -- | Small explosive bomb that destroys territory, buildings, ships and boats. Spawns from the nearest Missile Silo and lands in the area you first clicked to build it. | -
| Hydrogen Bomb | -- | Large explosive bomb. Spawns from the nearest Missile Silo and lands in the area you first clicked to build it. | -
| MIRV | -- | The most powerful bomb in the game. Splits up into smaller bombs that will cover a huge range of territory. Only damages the player that you first clicked on to build it. Spawns from the nearest Missile Silo and lands in the area you first clicked to build it. | -
Examples of some of the ingame icons you will encounter and what they mean:
-
-
-
- Shows the top players of the game and their names, % owned land and gold.
+ The control panel contains the following elements:
+
+ The following elements can be found inside:
+
+ Right clicking (or touch on mobile) opens the radial menu. From there you can:
+
+ + Contains information such for the selected player name, gold, troops, and if the player is a traitor. Traitor is a player who betrayed and attacked a player who was in an alliance with them. The icons below represent the following interactions: +
+
+ + When you ally with a player, the following new icons become available: +
+| Name | +Icon | +Description | +
|---|---|---|
| City | ++ | + Increases your max population. Useful when you can't + expand your territory or you're about to hit your + population limit. + | +
| Defense Post | ++ | + Increases defenses around nearby borders. Attacks from + enemies are slower and have more casualties. + | +
| Port | ++ | + Automatically sends trade ships between ports of your + country and other countries (except if you clicked "stop + trade" on them or they clicked "stop trade on you"), giving + gold to both sides. Allows building Battleships. Can only + be built near water. + | +
| Warship | ++ | + Patrols in an area, capturing trade ships and destroying + enemy Warships and Boats. Spawns from the nearest Port and + patrols the area you first clicked to build it. + | +
| Missile Silo | ++ | Allows launching missiles. | +
| SAM Launcher | ++ | Has a 75% chance to intercept enemy missiles in it's 100 pixel range. + The SAM has a 7.5 second cooldown and can not intercept MIRVs. | +
| Atom Bomb | ++ | Small explosive bomb that destroys territory, buildings, ships and boats. Spawns from the nearest Missile Silo and lands in the area you first clicked to build it. | +
| Hydrogen Bomb | ++ | Large explosive bomb. Spawns from the nearest Missile Silo and lands in the area you first clicked to build it. | +
| MIRV | ++ | The most powerful bomb in the game. Splits up into smaller bombs that will cover a huge range of territory. Only damages the player that you first clicked on to build it. Spawns from the nearest Missile Silo and lands in the area you first clicked to build it. | +
Examples of some of the ingame icons you will encounter and what they mean:
+
+
+
+ - ${DifficultyDescription[key]} -
-+ ${DifficultyDescription[key]} +
+- ${DifficultyDescription[key]} -
-+ ${DifficultyDescription[key]} +
+