Search in sources :

Example 1 with WurstClient

use of net.wurstclient.WurstClient in project Wurst-MC-1.12 by Wurst-Imperium.

the class NavigatorFeatureScreen method onMouseRelease.

@Override
protected void onMouseRelease(int x, int y, int button) {
    if (sliding != -1) {
        WurstClient wurst = WurstClient.INSTANCE;
        sliding = -1;
        wurst.navigator.addPreference(feature.getName());
        ConfigFiles.NAVIGATOR.save();
    }
}
Also used : WurstClient(net.wurstclient.WurstClient)

Example 2 with WurstClient

use of net.wurstclient.WurstClient in project Wurst-MC-1.12 by Wurst-Imperium.

the class NavigatorFeatureScreen method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) throws IOException {
    if (!button.enabled)
        return;
    WurstClient wurst = WurstClient.INSTANCE;
    switch(button.id) {
        case 0:
            feature.doPrimaryAction();
            primaryButton.displayString = feature.getPrimaryAction();
            break;
        case 1:
            MiscUtils.openLink("https://www.wurstclient.net/wiki/" + feature.getHelpPage() + "/");
            wurst.navigator.analytics.trackEvent("help", "open", feature.getName());
            break;
    }
    wurst.navigator.addPreference(feature.getName());
    ConfigFiles.NAVIGATOR.save();
}
Also used : WurstClient(net.wurstclient.WurstClient)

Example 3 with WurstClient

use of net.wurstclient.WurstClient in project Wurst-MC-1.12 by Wurst-Imperium.

the class NavigatorFeatureScreen method onMouseClick.

@Override
protected void onMouseClick(int x, int y, int button) {
    // popups
    if (WurstClient.INSTANCE.getGui().handleNavigatorPopupClick(x - middleX + 154, y - 60 - scroll + 13, button))
        return;
    Rectangle area = new Rectangle(width / 2 - 154, 60, 308, height - 103);
    if (!area.contains(x, y))
        return;
    // buttons
    if (activeButton != null) {
        WSoundEvents.playButtonClick();
        activeButton.press();
        WurstClient.INSTANCE.navigator.addPreference(feature.getName());
        ConfigFiles.NAVIGATOR.save();
        return;
    }
    // sliders
    area.height = 12;
    for (int i = 0; i < sliders.size(); i++) {
        area.y = sliders.get(i).getY() + scroll;
        if (area.contains(x, y)) {
            sliding = i;
            return;
        }
    }
    // checkboxes
    for (int i = 0; i < checkboxes.size(); i++) {
        CheckboxSetting checkbox = checkboxes.get(i);
        area.y = checkbox.getY() + scroll;
        if (area.contains(x, y)) {
            checkbox.toggle();
            WurstClient wurst = WurstClient.INSTANCE;
            wurst.navigator.addPreference(feature.getName());
            ConfigFiles.NAVIGATOR.save();
            return;
        }
    }
    // component settings
    WurstClient.INSTANCE.getGui().handleNavigatorMouseClick(x - middleX + 154, y - 60 - scroll - window.getY(), button, window);
}
Also used : WurstClient(net.wurstclient.WurstClient) Rectangle(java.awt.Rectangle) CheckboxSetting(net.wurstclient.settings.CheckboxSetting)

Example 4 with WurstClient

use of net.wurstclient.WurstClient in project Wurst-MC-1.12 by Wurst-Imperium.

the class NavigatorMainScreen method onMouseClick.

@Override
protected void onMouseClick(int x, int y, int button) {
    if (clickTimer == -1 && hoveredFeature != -1)
        if (button == 0 && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || hoveringArrow) || button == 2)
            // arrow click, shift click, wheel click
            expanding = true;
        else if (button == 0) {
            // left click
            Feature feature = navigatorDisplayList.get(hoveredFeature);
            if (feature.getPrimaryAction().isEmpty())
                expanding = true;
            else {
                feature.doPrimaryAction();
                WurstClient wurst = WurstClient.INSTANCE;
                wurst.navigator.addPreference(feature.getName());
                ConfigFiles.NAVIGATOR.save();
            }
        } else if (button == 1) {
            // right click
            Feature feature = navigatorDisplayList.get(hoveredFeature);
            if (feature.getHelpPage().isEmpty())
                return;
            MiscUtils.openLink("https://www.wurstclient.net/wiki/" + feature.getHelpPage() + "/");
            WurstClient wurst = WurstClient.INSTANCE;
            wurst.navigator.addPreference(feature.getName());
            ConfigFiles.NAVIGATOR.save();
            wurst.navigator.analytics.trackEvent("help", "open", feature.getName());
        }
}
Also used : WurstClient(net.wurstclient.WurstClient) Feature(net.wurstclient.features.Feature)

Aggregations

WurstClient (net.wurstclient.WurstClient)4 Rectangle (java.awt.Rectangle)1 Feature (net.wurstclient.features.Feature)1 CheckboxSetting (net.wurstclient.settings.CheckboxSetting)1