Search in sources :

Example 1 with SetContentEventListener

use of com.lilithsthrone.controller.eventListeners.SetContentEventListener in project liliths-throne-public by Innoxia.

the class MainController method setResponseEventListeners.

public void setResponseEventListeners() {
    if (Main.game.getCurrentDialogueNode().getResponseTabTitle(0) != null && !Main.game.getCurrentDialogueNode().getResponseTabTitle(0).isEmpty()) {
        int responsePageCounter = 0;
        while (Main.game.getCurrentDialogueNode().getResponseTabTitle(responsePageCounter) != null) {
            setResponseTabListeners(responsePageCounter);
            responsePageCounter++;
        }
    }
    // Responses:
    for (int i = 0; i < RESPONSE_COUNT; i++) {
        String id = "option_" + i;
        if (((EventTarget) document.getElementById(id)) != null) {
            SetContentEventListener el = new SetContentEventListener().setIndex(i);
            ((EventTarget) document.getElementById(id)).addEventListener("click", el, false);
            addEventListener(document, id, "mousemove", responseTooltipListener, false);
            addEventListener(document, id, "mouseleave", hideTooltipListener, false);
            TooltipResponseDescriptionEventListener el2 = new TooltipResponseDescriptionEventListener().setIndex(i);
            addEventListener(document, id, "mouseenter", el2, false);
        }
    }
    if (((EventTarget) document.getElementById("switch_right")) != null) {
        addEventListener(document, "switch_right", "click", nextResponsePageListener, false);
    }
    if (((EventTarget) document.getElementById("switch_left")) != null) {
        addEventListener(document, "switch_left", "click", previousResponsePageListener, false);
    }
}
Also used : SetContentEventListener(com.lilithsthrone.controller.eventListeners.SetContentEventListener) EventTarget(org.w3c.dom.events.EventTarget) TooltipResponseDescriptionEventListener(com.lilithsthrone.controller.eventListeners.TooltipResponseDescriptionEventListener)

Aggregations

SetContentEventListener (com.lilithsthrone.controller.eventListeners.SetContentEventListener)1 TooltipResponseDescriptionEventListener (com.lilithsthrone.controller.eventListeners.TooltipResponseDescriptionEventListener)1 EventTarget (org.w3c.dom.events.EventTarget)1