index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | public/index.html | 35 | ||||
-rw-r--r-- | public/soldier_record_block.css | 20 | ||||
-rw-r--r-- | public/soldier_record_block.js | 5 | ||||
-rw-r--r-- | public/style.css | 33 |
4 files changed, 69 insertions, 24 deletions
diff --git a/public/index.html b/public/index.html index dbb14a9..68acea4 100644 --- a/public/index.html +++ b/public/index.html @@ -83,9 +83,12 @@ <li><span>Short</span> <slot name="primary-weapon-range-short">1-27</slot></li> <li><span>Long</span> <slot name="primary-weapon-range-long">28-75</slot></li> </ul> - <p> + <p class="grenades"> <span>Hand Grenades</span> - <input type="number" min="0" max="4" value="4" /> + <label><input type='checkbox' checked/><svg viewBox="-7 -7 14 14" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/></svg></label> + <label><input type='checkbox' checked/><svg viewBox="-7 -7 14 14" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/></svg></label> + <label><input type='checkbox' checked/><svg viewBox="-7 -7 14 14" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/></svg></label> + <label><input type='checkbox' checked/><svg viewBox="-7 -7 14 14" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/></svg></label> </p> </template> @@ -186,49 +189,49 @@ 17th Kestral Mechanized Infantry --> </p> <div is="soldier-record-block" class="soldier-record" data-troop-number="1" data-troop-allegiance="davion"> - <span slot="troop-number">1</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>1</text></svg></span> <span slot="primary-weapon-type">Rifle</span> <span slot="primary-weapon-damage">4L</span> <span slot="primary-weapon-range-short">1-27</span> <span slot="primary-weapon-range-long">28-75</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="2" data-troop-allegiance="davion"> - <span slot="troop-number">2</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>2</text></svg></span> <span slot="primary-weapon-type">Rifle</span> <span slot="primary-weapon-damage">4L</span> <span slot="primary-weapon-range-short">1-27</span> <span slot="primary-weapon-range-long">28-75</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="3" data-troop-allegiance="davion"> - <span slot="troop-number">3</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>3</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="4" data-troop-allegiance="davion"> - <span slot="troop-number">4</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>4</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="5" data-troop-allegiance="davion"> - <span slot="troop-number">5</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>5</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="6" data-troop-allegiance="davion"> - <span slot="troop-number">6</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>6</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="7" data-troop-allegiance="davion"> - <span slot="troop-number">7</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>7</text></svg></span> <span slot="primary-weapon-type">Blazer</span> <span slot="primary-weapon-damage">4L</span> <span slot="primary-weapon-range-short">1-17</span> @@ -250,49 +253,49 @@ Aldebaran Home Guard --> </p> <div is="soldier-record-block" class="soldier-record" data-troop-number="1" data-troop-allegiance="liao"> - <span slot="troop-number">1</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>1</text></svg></span> <span slot="primary-weapon-type">Rifle</span> <span slot="primary-weapon-damage">4L</span> <span slot="primary-weapon-range-short">1-27</span> <span slot="primary-weapon-range-long">28-75</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="2" data-troop-allegiance="liao"> - <span slot="troop-number">2</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>2</text></svg></span> <span slot="primary-weapon-type">Rifle</span> <span slot="primary-weapon-damage">4L</span> <span slot="primary-weapon-range-short">1-27</span> <span slot="primary-weapon-range-long">28-75</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="3" data-troop-allegiance="liao"> - <span slot="troop-number">3</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>3</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="4" data-troop-allegiance="liao"> - <span slot="troop-number">4</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>4</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="5" data-troop-allegiance="liao"> - <span slot="troop-number">5</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>5</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="6" data-troop-allegiance="liao"> - <span slot="troop-number">6</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>6</text></svg></span> <span slot="primary-weapon-type">SMG</span> <span slot="primary-weapon-damage">3L</span> <span slot="primary-weapon-range-short">1-15</span> <span slot="primary-weapon-range-long">16-25</span> </div> <div is="soldier-record-block" class="soldier-record" data-troop-number="7" data-troop-allegiance="liao"> - <span slot="troop-number">7</span> + <span slot="troop-number"><svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg"><circle cx="0" cy="0" r="5"/><text>7</text></svg></span> <span slot="primary-weapon-type">Blazer</span> <span slot="primary-weapon-damage">4L</span> <span slot="primary-weapon-range-short">1-17</span> diff --git a/public/soldier_record_block.css b/public/soldier_record_block.css index 47bf583..fb1d322 100644 --- a/public/soldier_record_block.css +++ b/public/soldier_record_block.css @@ -33,3 +33,23 @@ ul li { p { margin: 0; } + +.grenades input { + display: none; +} + +.grenades svg { + width: 14px; + height: 14px; + vertical-align: bottom; +} + +.grenades svg circle { + fill: none; + stroke: black; + stroke-width: 2px; +} + +.grenades input:checked + svg circle { + fill: gray; +} diff --git a/public/soldier_record_block.js b/public/soldier_record_block.js index fd1c661..0bf5a9a 100644 --- a/public/soldier_record_block.js +++ b/public/soldier_record_block.js @@ -47,6 +47,11 @@ customElements.define( shadowRoot.appendChild(templateContent.cloneNode(true)); } + + connectedCallback() { + // this.shadowRoot.querySelectorAll('.grenades *').forEach(el => el.addEventListener('click', e => e.stopPropagation())); + this.shadowRoot.querySelector('.grenades').addEventListener('click', e => e.stopPropagation()); + } }, { extends: 'div' } ); diff --git a/public/style.css b/public/style.css index 167254b..00d9d74 100644 --- a/public/style.css +++ b/public/style.css @@ -355,19 +355,36 @@ button.set-firing-arc img { background-color: white; } -.soldier-record [slot="troop-number"] { - color: white; +.soldier-record[data-troop-allegiance="liao"] [slot="troop-number"] svg { + fill: green; +} + +.soldier-record[data-troop-allegiance="davion"] [slot="troop-number"] svg { + fill: red; +} + +.soldier-record [slot="troop-number"] svg { + width: 20px; + height: 20px; + background-color: initial; + vertical-align: middle; +} + +.soldier-record [slot="troop-number"] svg text { + fill: white; + text-anchor: middle; + font-size: 10px; font-weight: bold; - border-radius: 10px; - padding: 0 4px; + transform: translateY(3.5px); + font-family: monospace; } -.soldier-record[data-troop-allegiance="davion"] [slot="troop-number"] { - background-color: red; +.soldier-record[data-troop-allegiance="davion"] [slot="troop-number"] img { + fill: red; } -.soldier-record[data-troop-allegiance="liao"] [slot="troop-number"] { - background-color: green; +.soldier-record[data-troop-allegiance="liao"] [slot="troop-number"] img { + fill: green; } .soldier-record.selected { |