Кривое позиционирование слотов. Разворот лишней функции.

This commit is contained in:
Igor Barkov (iwork) 2020-07-06 12:23:56 +03:00
parent 566d8356d0
commit 5ef6696614
2 changed files with 10 additions and 8 deletions

View File

@ -49,14 +49,14 @@ class User
} }
} }
protected function showItem($item = 0) protected function showItem($item)
{ {
$itemSlot = $item['dressed_slot'] ?? 0; $itemSlot = $item['dressed_slot'] ?? 0;
$itemName = $item['name'] ?? ''; $itemName = $item['name'] ?? '';
$itemImage = $item['image'] ?? ''; $itemImage = $item['image'] ?? '';
if ($itemSlot) { if ($itemSlot) {
echo <<<SLOT echo <<<SLOT
<img src="/i/sh/{$itemImage}" class="item-wrap-normal tip" alt="Слот [{$itemSlot}]"> <img src="/i/sh/{$itemImage}" class="item-wrap-normal tip" alt="{$itemName}">
<span class="tiptext"><strong>{$itemName}</strong></span> <span class="tiptext"><strong>{$itemName}</strong></span>
SLOT; SLOT;
} else { } else {
@ -75,9 +75,11 @@ EMPTY_SLOT;
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
echo sprintf('<div class="slot-%s">', $i); echo sprintf('<div class="slot-%s">', $i);
if (isset($dressed_item[$i])) { if (isset($dressed_item[$i])) {
$this->showItem($dressed_item[$i]); //$this->showItem($dressed_item[$i]);
$itemString = '<img src="/i/sh/%s" class="item-wrap-normal tip" alt="%s"><span class="tiptext"><strong>%s</strong></span>';
echo sprintf($itemString, $dressed_item[$i]['image'], $dressed_item[$i]['name'], $dressed_item[$i]['name']);
} else { } else {
$this->showItem($i); echo sprintf('<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [%s]" alt="Пустой слот [%s]">', $i, $i);
} }
echo sprintf('</div><!-- slot-%s -->', $i); echo sprintf('</div><!-- slot-%s -->', $i);
} }

View File

@ -358,10 +358,10 @@ div.user-info-container > div.slot-8 {
grid-row: 4; grid-row: 4;
} }
div.user-info-container > div.slot-5, div.user-info-container > div.slot-9,
div.user-info-container > div.slot-6, div.user-info-container > div.slot-10,
div.user-info-container > div.slot-7, div.user-info-container > div.slot-11,
div.user-info-container > div.slot-8 { div.user-info-container > div.slot-12 {
grid-row: 5; grid-row: 5;
} }