|
|
|
@ -6,10 +6,10 @@ selectUp = (event, button) ->
|
|
|
|
|
return |
|
|
|
|
$(".options li").removeClass("active") |
|
|
|
|
count = $(".options li").length |
|
|
|
|
window.selectedoption ?= count + 1 |
|
|
|
|
window.selectedoption-- |
|
|
|
|
if window.selectedoption < 0 |
|
|
|
|
if window.selectedoption <= 0 |
|
|
|
|
window.selectedoption = count |
|
|
|
|
console.log window.selectedoption |
|
|
|
|
$(".options li:nth-child(#{window.selectedoption}").addClass("active") |
|
|
|
|
|
|
|
|
|
# Select the next choice |
|
|
|
@ -19,11 +19,11 @@ selectDown = (event, button) ->
|
|
|
|
|
if $(".options li").length == 0 |
|
|
|
|
return |
|
|
|
|
$(".options li").removeClass("active") |
|
|
|
|
window.selectedoption ?= -1 |
|
|
|
|
window.selectedoption++ |
|
|
|
|
count = $(".options li").length |
|
|
|
|
if window.selectedoption > count |
|
|
|
|
window.selectedoption = 1 |
|
|
|
|
console.log window.selectedoption |
|
|
|
|
$(".options li:nth-child(#{window.selectedoption})").addClass("active") |
|
|
|
|
|
|
|
|
|
selectOption = (event, button) -> |
|
|
|
@ -38,7 +38,8 @@ joystick = () ->
|
|
|
|
|
if pad? |
|
|
|
|
temp = new Gamepad(pad) |
|
|
|
|
if temp.pressed? |
|
|
|
|
$(document).trigger("press", temp.pressed) |
|
|
|
|
if salet.view.gamepads[pad.id].pressed != temp.pressed |
|
|
|
|
$(document).trigger("press", temp.pressed) |
|
|
|
|
salet.view.gamepads[pad.id] = temp |
|
|
|
|
|
|
|
|
|
$(document).on("viewinit", () -> |
|
|
|
@ -59,6 +60,7 @@ $(document).on("viewinit", () ->
|
|
|
|
|
}) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
window.selectedoption ?= 1 |
|
|
|
|
$(document).on("press", selectUp) |
|
|
|
|
$(document).on("press", selectDown) |
|
|
|
|
$(document).on("press", selectOption) |
|
|
|
|