Skip to content

Commit

Permalink
Merge pull request #64 from Pomax/es2021
Browse files Browse the repository at this point in the history
redid the tileset
  • Loading branch information
Pomax authored Jul 5, 2021
2 parents 3a582af + 32bf3aa commit dff9f20
Show file tree
Hide file tree
Showing 54 changed files with 183 additions and 169 deletions.
Binary file added img/tiles/default-tileset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
84 changes: 42 additions & 42 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,68 +143,68 @@ <h1><a href="#explanation">The how of Mahjong</a></h1>
Four sets of the numerical tiles 1 through 9 with "dots" ornamentation (traditionally called 筒, "coin"):
</p>
<div>
<img src="./img/tiles/18.jpg">
<img src="./img/tiles/19.jpg">
<img src="./img/tiles/20.jpg">
<img src="./img/tiles/21.jpg">
<img src="./img/tiles/22.jpg">
<img src="./img/tiles/23.jpg">
<img src="./img/tiles/24.jpg">
<img src="./img/tiles/25.jpg">
<img src="./img/tiles/26.jpg">
<game-tile tile="18" open></game-tile>
<game-tile tile="19"></game-tile>
<game-tile tile="20"></game-tile>
<game-tile tile="21"></game-tile>
<game-tile tile="22"></game-tile>
<game-tile tile="23"></game-tile>
<game-tile tile="24"></game-tile>
<game-tile tile="25"></game-tile>
<game-tile tile="26"></game-tile>
</div>
</li>
<li>
<p>
Four sets of the numerical tiles 1 through 9 with "bamboo"/"sticks" ornamentation (traditionally called 索, "coin string"):
</p>
<div>
<img src="./img/tiles/0.jpg">
<img src="./img/tiles/1.jpg">
<img src="./img/tiles/2.jpg">
<img src="./img/tiles/3.jpg">
<img src="./img/tiles/4.jpg">
<img src="./img/tiles/5.jpg">
<img src="./img/tiles/6.jpg">
<img src="./img/tiles/7.jpg">
<img src="./img/tiles/8.jpg">
<game-tile tile="0"></game-tile>
<game-tile tile="1"></game-tile>
<game-tile tile="2"></game-tile>
<game-tile tile="3"></game-tile>
<game-tile tile="4"></game-tile>
<game-tile tile="5"></game-tile>
<game-tile tile="6"></game-tile>
<game-tile tile="7"></game-tile>
<game-tile tile="8"></game-tile>
</div>
</li>
<li>
<p>
Four sets of the numerical tiles 1 through 9 with "Chinese character" ornamentation (traditionally called 萬, "10,000"):
</p>
<div>
<img src="./img/tiles/9.jpg">
<img src="./img/tiles/10.jpg">
<img src="./img/tiles/11.jpg">
<img src="./img/tiles/12.jpg">
<img src="./img/tiles/13.jpg">
<img src="./img/tiles/14.jpg">
<img src="./img/tiles/15.jpg">
<img src="./img/tiles/16.jpg">
<img src="./img/tiles/17.jpg">
<game-tile tile="9"></game-tile>
<game-tile tile="10"></game-tile>
<game-tile tile="11"></game-tile>
<game-tile tile="12"></game-tile>
<game-tile tile="13"></game-tile>
<game-tile tile="14"></game-tile>
<game-tile tile="15"></game-tile>
<game-tile tile="16"></game-tile>
<game-tile tile="17"></game-tile>
</div>
</li>
<li>
<p>
Four sets of the four cardinal "wind" directions:
</p>
<div>
<img src="./img/tiles/27.jpg">
<img src="./img/tiles/28.jpg">
<img src="./img/tiles/29.jpg">
<img src="./img/tiles/30.jpg">
<game-tile tile="27"></game-tile>
<game-tile tile="28"></game-tile>
<game-tile tile="29"></game-tile>
<game-tile tile="30"></game-tile>
</div>
</li>
<li>
<p>
Four sets of "dragon" tiles:
</p>
<div>
<img src="./img/tiles/31.jpg">
<img src="./img/tiles/32.jpg">
<img src="./img/tiles/33.jpg">
<game-tile tile="31"></game-tile>
<game-tile tile="32"></game-tile>
<game-tile tile="33"></game-tile>
</div>
</li>
</ul>
Expand All @@ -220,10 +220,10 @@ <h1><a href="#explanation">The how of Mahjong</a></h1>
The four seasons (spring, summer, fall, winter, or 春, 夏, 秋, 冬)
</p>
<div>
<img src="./img/tiles/38.jpg">
<img src="./img/tiles/39.jpg">
<img src="./img/tiles/40.jpg">
<img src="./img/tiles/41.jpg">
<game-tile tile="38"></game-tile>
<game-tile tile="39"></game-tile>
<game-tile tile="40"></game-tile>
<game-tile tile="41"></game-tile>
</div>
</li>
<li>
Expand All @@ -232,10 +232,10 @@ <h1><a href="#explanation">The how of Mahjong</a></h1>
chrysanthenum, or 蘭, 梅, 竹, 菊)
</p>
<div>
<img src="./img/tiles/34.jpg">
<img src="./img/tiles/35.jpg">
<img src="./img/tiles/36.jpg">
<img src="./img/tiles/37.jpg">
<game-tile tile="34"></game-tile>
<game-tile tile="35"></game-tile>
<game-tile tile="36"></game-tile>
<game-tile tile="37"></game-tile>
</div>
</li>
</ul>
Expand Down
102 changes: 51 additions & 51 deletions src/css/tiles.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,60 +61,60 @@ game-tile + game-tile {
margin-left: 1px;
}

[tile="-1"] { content: "unknown"; background-image: url("../../img/tiles/concealed.jpg"); box-shadow: -1px -1px 1px 0 inset #0d450e; }

[tile="0"] { content: "bamboo-1"; background-image: url("../../img/tiles/0.jpg");}
[tile="1"] { content: "bamboo-2"; background-image: url("../../img/tiles/1.jpg");}
[tile="2"] { content: "bamboo-3"; background-image: url("../../img/tiles/2.jpg");}
[tile="3"] { content: "bamboo-4"; background-image: url("../../img/tiles/3.jpg");}
[tile="4"] { content: "bamboo-5"; background-image: url("../../img/tiles/4.jpg");}
[tile="5"] { content: "bamboo-6"; background-image: url("../../img/tiles/5.jpg");}
[tile="6"] { content: "bamboo-7"; background-image: url("../../img/tiles/6.jpg");}
[tile="7"] { content: "bamboo-8"; background-image: url("../../img/tiles/7.jpg");}
[tile="8"] { content: "bamboo-9"; background-image: url("../../img/tiles/8.jpg");}

[tile="9"] { content: "characters-1"; background-image: url("../../img/tiles/9.jpg");}
[tile="10"] { content: "characters-2"; background-image: url("../../img/tiles/10.jpg");}
[tile="11"] { content: "characters-3"; background-image: url("../../img/tiles/11.jpg");}
[tile="12"] { content: "characters-4"; background-image: url("../../img/tiles/12.jpg");}
[tile="13"] { content: "characters-5"; background-image: url("../../img/tiles/13.jpg");}
[tile="14"] { content: "characters-6"; background-image: url("../../img/tiles/14.jpg");}
[tile="15"] { content: "characters-7"; background-image: url("../../img/tiles/15.jpg");}
[tile="16"] { content: "characters-8"; background-image: url("../../img/tiles/16.jpg");}
[tile="17"] { content: "characters-9"; background-image: url("../../img/tiles/17.jpg");}

[tile="18"] { content: "dots-1"; background-image: url("../../img/tiles/18.jpg");}
[tile="19"] { content: "dots-2"; background-image: url("../../img/tiles/19.jpg");}
[tile="20"] { content: "dots-3"; background-image: url("../../img/tiles/20.jpg");}
[tile="21"] { content: "dots-4"; background-image: url("../../img/tiles/21.jpg");}
[tile="22"] { content: "dots-5"; background-image: url("../../img/tiles/22.jpg");}
[tile="23"] { content: "dots-6"; background-image: url("../../img/tiles/23.jpg");}
[tile="24"] { content: "dots-7"; background-image: url("../../img/tiles/24.jpg");}
[tile="25"] { content: "dots-8"; background-image: url("../../img/tiles/25.jpg");}
[tile="26"] { content: "dots-9"; background-image: url("../../img/tiles/26.jpg");}

[tile="27"] { content: "E"; background-image: url("../../img/tiles/27.jpg");}
[tile="28"] { content: "S"; background-image: url("../../img/tiles/28.jpg");}
[tile="29"] { content: "W"; background-image: url("../../img/tiles/29.jpg");}
[tile="30"] { content: "N"; background-image: url("../../img/tiles/30.jpg");}

[tile="31"] { content: "F"; background-image: url("../../img/tiles/31.jpg");}
[tile="32"] { content: "C"; background-image: url("../../img/tiles/32.jpg");}
[tile="33"] { content: "P"; background-image: url("../../img/tiles/33.jpg");}

[tile="38"] { content: "spring"; background-image: url("../../img/tiles/38.jpg");}
[tile="39"] { content: "summer"; background-image: url("../../img/tiles/39.jpg");}
[tile="40"] { content: "fall"; background-image: url("../../img/tiles/40.jpg");}
[tile="41"] { content: "winter"; background-image: url("../../img/tiles/41.jpg");}

[tile="34"] { content: "orchid"; background-image: url("../../img/tiles/34.jpg");}
[tile="35"] { content: "plum"; background-image: url("../../img/tiles/35.jpg");}
[tile="36"] { content: "chrysanthemum"; background-image: url("../../img/tiles/36.jpg");}
[tile="37"] { content: "bamboo"; background-image: url("../../img/tiles/37.jpg");}
[tile="-1"] { content: "unknown"; background-image: url("../../img/tiles/small/concealed.jpg"); box-shadow: -1px -1px 1px 0 inset #0d450e; }

[tile="0"] { content: "bamboo-1"; background-image: url("../../img/tiles/small/0.jpg");}
[tile="1"] { content: "bamboo-2"; background-image: url("../../img/tiles/small/1.jpg");}
[tile="2"] { content: "bamboo-3"; background-image: url("../../img/tiles/small/2.jpg");}
[tile="3"] { content: "bamboo-4"; background-image: url("../../img/tiles/small/3.jpg");}
[tile="4"] { content: "bamboo-5"; background-image: url("../../img/tiles/small/4.jpg");}
[tile="5"] { content: "bamboo-6"; background-image: url("../../img/tiles/small/5.jpg");}
[tile="6"] { content: "bamboo-7"; background-image: url("../../img/tiles/small/6.jpg");}
[tile="7"] { content: "bamboo-8"; background-image: url("../../img/tiles/small/7.jpg");}
[tile="8"] { content: "bamboo-9"; background-image: url("../../img/tiles/small/8.jpg");}

[tile="9"] { content: "characters-1"; background-image: url("../../img/tiles/small/9.jpg");}
[tile="10"] { content: "characters-2"; background-image: url("../../img/tiles/small/10.jpg");}
[tile="11"] { content: "characters-3"; background-image: url("../../img/tiles/small/11.jpg");}
[tile="12"] { content: "characters-4"; background-image: url("../../img/tiles/small/12.jpg");}
[tile="13"] { content: "characters-5"; background-image: url("../../img/tiles/small/13.jpg");}
[tile="14"] { content: "characters-6"; background-image: url("../../img/tiles/small/14.jpg");}
[tile="15"] { content: "characters-7"; background-image: url("../../img/tiles/small/15.jpg");}
[tile="16"] { content: "characters-8"; background-image: url("../../img/tiles/small/16.jpg");}
[tile="17"] { content: "characters-9"; background-image: url("../../img/tiles/small/17.jpg");}

[tile="18"] { content: "dots-1"; background-image: url("../../img/tiles/small/18.jpg");}
[tile="19"] { content: "dots-2"; background-image: url("../../img/tiles/small/19.jpg");}
[tile="20"] { content: "dots-3"; background-image: url("../../img/tiles/small/20.jpg");}
[tile="21"] { content: "dots-4"; background-image: url("../../img/tiles/small/21.jpg");}
[tile="22"] { content: "dots-5"; background-image: url("../../img/tiles/small/22.jpg");}
[tile="23"] { content: "dots-6"; background-image: url("../../img/tiles/small/23.jpg");}
[tile="24"] { content: "dots-7"; background-image: url("../../img/tiles/small/24.jpg");}
[tile="25"] { content: "dots-8"; background-image: url("../../img/tiles/small/25.jpg");}
[tile="26"] { content: "dots-9"; background-image: url("../../img/tiles/small/26.jpg");}

[tile="27"] { content: "E"; background-image: url("../../img/tiles/small/27.jpg");}
[tile="28"] { content: "S"; background-image: url("../../img/tiles/small/28.jpg");}
[tile="29"] { content: "W"; background-image: url("../../img/tiles/small/29.jpg");}
[tile="30"] { content: "N"; background-image: url("../../img/tiles/small/30.jpg");}

[tile="31"] { content: "F"; background-image: url("../../img/tiles/small/31.jpg");}
[tile="32"] { content: "C"; background-image: url("../../img/tiles/small/32.jpg");}
[tile="33"] { content: "P"; background-image: url("../../img/tiles/small/33.jpg");}

[tile="38"] { content: "spring"; background-image: url("../../img/tiles/small/38.jpg");}
[tile="39"] { content: "summer"; background-image: url("../../img/tiles/small/39.jpg");}
[tile="40"] { content: "fall"; background-image: url("../../img/tiles/small/40.jpg");}
[tile="41"] { content: "winter"; background-image: url("../../img/tiles/small/41.jpg");}

[tile="34"] { content: "orchid"; background-image: url("../../img/tiles/small/34.jpg");}
[tile="35"] { content: "plum"; background-image: url("../../img/tiles/small/35.jpg");}
[tile="36"] { content: "chrysanthemum"; background-image: url("../../img/tiles/small/36.jpg");}
[tile="37"] { content: "bamboo"; background-image: url("../../img/tiles/small/37.jpg");}

game-tile[hidden] {
content: "unknown";
background-image: url("../../img/tiles/concealed.jpg");
background-image: url("../../img/tiles/small/concealed.jpg");
}

game-tile[locked] {
Expand Down
3 changes: 2 additions & 1 deletion src/js/core/game/game-tile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class GameTile extends HTMLElement {
constructor(tile=-1) {
constructor(tile) {
super();
tile = tile ?? this.getAttribute("tile") ?? -1;
this.values = { tile };
this.setAttribute("tile", this.values.tile);
}
Expand Down
6 changes: 4 additions & 2 deletions src/js/page/modal/colors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { setStyleSheet } from "../utils.js";

class ColorModal {
constructor(modal) {
this.modal = modal;
Expand All @@ -24,13 +26,13 @@ class ColorModal {
.join(`\n`)}}`;

localStorage.setItem(`mahjongCSS`, colorCSS);
this.modal.setStyleSheet(`mahjongCSS`, colorCSS);
setStyleSheet(`mahjongCSS`, colorCSS);
}

loadColorScheme() {
const colorCSS = localStorage.getItem("mahjongCSS");
if (colorCSS) {
this.modal.setStyleSheet(`mahjongCSS`, colorCSS);
setStyleSheet(`mahjongCSS`, colorCSS);
}
return !!colorCSS;
}
Expand Down
15 changes: 0 additions & 15 deletions src/js/page/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,6 @@ class Modal {
this.reveal();
this.colors.show();
}

/**
* Theminig/coloring utility function
*/
setStyleSheet(id, css) {
let style = document.getElementById(id);
if (style) {
style.parentNode.removeChild(style);
} else {
style = document.createElement(`style`);
}
style.id = id;
style.textContent = css;
document.body.append(style);
}
}

let modal = new Modal();
Expand Down
Loading

0 comments on commit dff9f20

Please sign in to comment.