Skip to content

Commit

Permalink
UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
solcloud committed Oct 1, 2023
1 parent 2bef201 commit ad6efe8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions www/assets/css/hud.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
src: url("../../resources/font/csgo_icons.ttf");
}

.icons {
font-family: csIcons, Arial, serif;
}

#hud {
--color-attackers: #ff9145;
--color-defenders: #43b4fd;
Expand Down Expand Up @@ -433,7 +437,6 @@
}

#hud .inventory {
font-family: csIcons;
margin-top: auto;
margin-bottom: 1rem;
font-size: 150%;
Expand All @@ -449,7 +452,6 @@
}

#hud .kill-feed {
font-family: csIcons, Arial, serif;
max-height: 220px;
font-size: 0.9rem;
white-space: nowrap;
Expand Down
2 changes: 1 addition & 1 deletion www/assets/js/Enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const ItemIdToIcon = {
1: '\uE03B',
2: '\uE004',
3: '\uE013',
4: '\uE00E',
4: '\uE003',
5: '\uE007',
6: '\uE00E',
7: '\uE009',
Expand Down
13 changes: 8 additions & 5 deletions www/assets/js/Hud.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class HUD {
canBuyIcon: null,
canPlantIcon: null,
haveDefuseKit: null,
haveBomb: null,
spectateUi: null,
inventory: null,
money: null,
Expand Down Expand Up @@ -80,7 +81,7 @@ export class HUD {
bombPlanted(detonationTimeSec) {
this.#resetCountDown()
this.#elements.time.innerText = '⚠️ 💣'
this.displayBottomMessage(`<span class="text-danger">⚠️ Alert</span><br>The bomb has been planted.<br>${detonationTimeSec} seconds to detonation.`)
this.displayBottomMessage(`<span class="text-danger">⚠️ Alert</span><br>The bomb has been planted.<br>${detonationTimeSec} seconds till detonation.`)
setTimeout(() => this.clearBottomMessage(), 3000)
}

Expand Down Expand Up @@ -218,6 +219,7 @@ export class HUD {
this.#elements.canBuyIcon.classList.toggle('hidden', !player.canBuy);
this.#elements.canPlantIcon.classList.toggle('hidden', !player.canPlant);
this.#elements.haveDefuseKit.classList.toggle('hidden', (player.slots[Enum.InventorySlot.SLOT_KIT] === undefined));
this.#elements.haveBomb.classList.toggle('hidden', (player.slots[Enum.InventorySlot.SLOT_BOMB] === undefined));
this.#elements.spectateUi.classList.toggle('hidden', this.#game.playerMe.getId() === this.#game.playerSpectate.getId());
if (player.canBuy && this.#showAble.showBuyMenu) {
if (this.#elements.buyMenu.classList.contains('hidden')) {
Expand Down Expand Up @@ -284,8 +286,8 @@ export class HUD {
<canvas id="radar-canvas"></canvas>
</div>
<div class="money bg"><span data-money>0</span> $ <span data-can-buy>🛒</span></div>
<div data-can-plant class="hidden" style="margin:22px 4px">⇣&nbsp;💣&nbsp;⇣</div>
<div data-have-defuse-kit class="hidden" style="margin:22px 4px;font-size:140%">✂</div>
<div data-have-bomb class="hidden icons" style="margin:22px 4px;font-size:200%;color:#fdf46e"><span data-can-plant class="hidden">🠻&nbsp;</span>\uE031</div>
<div data-have-defuse-kit class="hidden icons" style="margin:22px 4px;font-size:200%;color:#5d8dea">\uE066</div>
</div>
<div class="bottom">
<div id="fps-stats"></div>
Expand Down Expand Up @@ -316,9 +318,9 @@ export class HUD {
<div id="mode-spectate" class="hidden">Spectating player <span></span></div>
</div>
<div class="right">
<div class="kill-feed">
<div class="kill-feed icons">
</div>
<div class="inventory"></div>
<div class="inventory icons"></div>
<div>
<span data-ammo class="ammo bg"></span>
</div>
Expand All @@ -339,6 +341,7 @@ export class HUD {
this.#elements.canBuyIcon = elementHud.querySelector('[data-can-buy]')
this.#elements.canPlantIcon = elementHud.querySelector('[data-can-plant]')
this.#elements.haveDefuseKit = elementHud.querySelector('[data-have-defuse-kit]')
this.#elements.haveBomb = elementHud.querySelector('[data-have-bomb]')
this.#elements.spectateUi = elementHud.querySelector('#mode-spectate')
this.#elements.scoreDetail = elementHud.querySelector('#scoreboard-detail')
this.#elements.inventory = elementHud.querySelector('.inventory')
Expand Down
2 changes: 1 addition & 1 deletion www/resources/font/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ by **ohmygosh** from https://www.unknowncheats.me/forum/downloads.php?do=file&id

# Acknowledgement

Thanks original authors for providing these awesome images for free!
Thanks original authors for providing these awesome fonts for free!

If you find file here that violence license, please open issue.

0 comments on commit ad6efe8

Please sign in to comment.