56 lines
1.8 KiB
Markdown
56 lines
1.8 KiB
Markdown
# EmoteMenu.js — handler() (satır 117)
|
||
|
||
[← EmoteMenu.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function handler(c)
|
||
{
|
||
var uiContext = c.getSubject().getUIContext();
|
||
if (!uiContext || uiContext.isClosed()) return;
|
||
|
||
var last = uiContext.getLast();
|
||
var states = c.getSubject().getStates();
|
||
|
||
if (last === "kapat") { c.getSubject().closeUI(); return; }
|
||
|
||
if (last === "kullan")
|
||
{
|
||
var secili = parseInt(states.getString("emote_secili"));
|
||
if (secili < 0) return;
|
||
|
||
var isimler = ["Otur","Yat","Kalk","İşaret","???","???","???","???","???","???","???","???"];
|
||
var emoteEventler = ["Otur","Yat","Kalk","Isaret","emote_electro","emote_groove","emote_wiggle","emote_bestmates","emote_fresh","emote_dab","emote_default","emote_rockout"];
|
||
|
||
c.getSubject().closeUI();
|
||
c.executeCommand("mp event trigger " + c.getSubject().getName() + " " + emoteEventler[secili]);
|
||
return;
|
||
}
|
||
|
||
if (last === "click")
|
||
{
|
||
var data = uiContext.getData();
|
||
var list = data.getList("click");
|
||
var mx = Math.floor(list.getFloat(0));
|
||
var my = Math.floor(list.getFloat(1));
|
||
|
||
var slotW = 90, slotH = 70, gap = 8, ox = 12, oy = 48;
|
||
|
||
if (my >= oy && my <= oy + 3 * (slotH + gap))
|
||
{
|
||
var col = Math.floor((mx - ox) / (slotW + gap));
|
||
var row = Math.floor((my - oy) / (slotH + gap));
|
||
|
||
if (col >= 0 && col < 4 && row >= 0 && row < 3)
|
||
{
|
||
var idx = row * 4 + col;
|
||
if (idx < 12)
|
||
{
|
||
states.setString("emote_secili", "" + idx);
|
||
menuCiz(uiContext, idx);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
```
|