58 lines
1.7 KiB
Markdown
58 lines
1.7 KiB
Markdown
# LeoEnv.js — envanterCiz() (satır 1)
|
||
|
||
[← LeoEnv.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function envanterCiz(uiContext, states, oyuncu)
|
||
{
|
||
var g = uiContext.get("panel");
|
||
g.removeAll();
|
||
g.rect(0, 0, 320, 280, 0xff1e1e28);
|
||
g.rect(0, 0, 320, 30, 0xff262633);
|
||
g.rect(0, 29, 320, 1, 0xff3a3a4a);
|
||
g.text("Item Kopyalama", 160, 9, 0xfff0f0f8, 0.5, 0.0);
|
||
|
||
var secili = parseInt(states.getString("secili_slot"));
|
||
var inv = oyuncu.getInventory();
|
||
|
||
// 36 slot — 4 satır 9 sütun
|
||
for (var i = 0; i < 36; i++)
|
||
{
|
||
var col = i % 9;
|
||
var row = Math.floor(i / 9);
|
||
var x = 10 + col * 33;
|
||
var y = 38 + row * 33;
|
||
|
||
// seçili slot vurgusu
|
||
if (i === secili)
|
||
g.rect(x - 2, y - 2, 30, 30, 0xff5aa9ff);
|
||
else
|
||
g.rect(x - 1, y - 1, 28, 28, 0xff2a2a3a);
|
||
|
||
g.rect(x, y, 26, 26, 0xff1a1a24);
|
||
|
||
var item = inv.getStack(i);
|
||
if (item && !item.isEmpty())
|
||
{
|
||
g.text(item.getItem().getId().split(":")[1].substring(0, 4), x + 13, y + 8, 0xffffffff, 0.5, 0.0);
|
||
g.text("x" + item.getCount(), x + 13, y + 17, 0xffffcc00, 0.5, 0.0);
|
||
}
|
||
}
|
||
|
||
// seçili item bilgisi
|
||
g.rect(10, 173, 300, 20, 0xff111118);
|
||
if (secili >= 0)
|
||
{
|
||
var item = oyuncu.getInventory().getStack(secili);
|
||
if (item && !item.isEmpty())
|
||
g.text("Secili: " + item.getItem().getId() + " x" + item.getCount(), 160, 178, 0xff44ff88, 0.5, 0.0);
|
||
else
|
||
g.text("Bir item secin", 160, 178, 0xff9090a0, 0.5, 0.0);
|
||
}
|
||
else
|
||
{
|
||
g.text("Bir item secin", 160, 178, 0xff9090a0, 0.5, 0.0);
|
||
}
|
||
}
|
||
```
|