Search in sources :

Example 1 with WHorizontalList

use of mathax.client.gui.widgets.containers.WHorizontalList in project Client by MatHax.

the class WPlaybackControls method add.

@Override
public void add(WTable parent, MusicTab.MusicScreen screen, GuiTheme theme) {
    WHorizontalList list = parent.add(theme.horizontalList()).widget();
    WButton pauseButton = list.add(theme.button(Music.player.isPaused() ? "Resume" : "Pause")).widget();
    pauseButton.action = () -> {
        if (Music.player.isPaused()) {
            Music.trackScheduler.setPaused(false);
            pauseButton.set("Pause");
        } else {
            Music.trackScheduler.setPaused(true);
            pauseButton.set("Resume");
        }
    };
    if (Music.trackScheduler.hasNext()) {
        list.add(theme.button("Shuffle")).widget().action = () -> {
            Collections.shuffle(Music.trackScheduler.tracks);
            screen.construct();
        };
        list.add(theme.button("Clear")).widget().action = () -> {
            Music.trackScheduler.tracks.clear();
            screen.construct();
        };
    }
    list.add(theme.button("Playlists")).widget().action = () -> {
        mc.setScreen(new PlaylistsScreen(theme, screen));
    };
    String duration;
    AudioTrack current = Music.player.getPlayingTrack();
    if (current == null)
        duration = "Not playing";
    else
        duration = Music.getTime();
    list.add(theme.label("Duration: " + duration)).right();
    parent.row();
    super.add(parent, screen, theme);
}
Also used : PlaylistsScreen(mathax.client.gui.screens.music.PlaylistsScreen) AudioTrack(com.sedmelluq.discord.lavaplayer.track.AudioTrack) WButton(mathax.client.gui.widgets.pressable.WButton) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Example 2 with WHorizontalList

use of mathax.client.gui.widgets.containers.WHorizontalList in project Client by MatHax.

the class CapesModule method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    WHorizontalList w = theme.horizontalList();
    WButton reload = w.add(theme.button("Reload")).widget();
    reload.action = () -> {
        if (isActive())
            Capes.init();
    };
    w.add(theme.label("Reloads the capes."));
    return w;
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Example 3 with WHorizontalList

use of mathax.client.gui.widgets.containers.WHorizontalList in project Client by MatHax.

the class FakePlayer method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    WHorizontalList w = theme.horizontalList();
    WButton spawn = w.add(theme.button("Spawn")).widget();
    spawn.action = () -> {
        if (isActive())
            FakePlayerManager.add(name.get(), health.get(), copyInv.get());
    };
    WButton clear = w.add(theme.button("Clear")).widget();
    clear.action = () -> {
        if (isActive())
            FakePlayerManager.clear();
    };
    return w;
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Example 4 with WHorizontalList

use of mathax.client.gui.widgets.containers.WHorizontalList in project Client by MatHax.

the class Marker method fillList.

protected void fillList(GuiTheme theme, WVerticalList list) {
    // Marker List
    for (BaseMarker marker : markers) {
        WHorizontalList hList = list.add(theme.horizontalList()).expandX().widget();
        // Name
        WLabel label = hList.add(theme.label(marker.name.get())).widget();
        label.tooltip = marker.description.get();
        // Dimension
        hList.add(theme.label(" - " + marker.getDimension().toString())).expandX().widget().color = theme.textSecondaryColor();
        // Toggle
        WCheckbox checkbox = hList.add(theme.checkbox(marker.isActive())).widget();
        checkbox.action = () -> {
            if (marker.isActive() != checkbox.checked)
                marker.toggle();
        };
        // Edit
        WButton edit = hList.add(theme.button(GuiRenderer.EDIT)).widget();
        edit.action = () -> mc.setScreen(marker.getScreen(theme));
        // Remove
        WMinus remove = hList.add(theme.minus()).widget();
        remove.action = () -> {
            markers.remove(marker);
            marker.settings.unregisterColorSettings();
            list.clear();
            fillList(theme, list);
        };
    }
    // Bottom
    WHorizontalList bottom = list.add(theme.horizontalList()).expandX().widget();
    WDropdown<String> newMarker = bottom.add(theme.dropdown(factory.getNames(), factory.getNames()[0])).widget();
    WButton add = bottom.add(theme.button("Add")).expandX().widget();
    add.action = () -> {
        String name = newMarker.get();
        markers.add(factory.createMarker(name));
        list.clear();
        fillList(theme, list);
    };
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton) WCheckbox(mathax.client.gui.widgets.pressable.WCheckbox) WMinus(mathax.client.gui.widgets.pressable.WMinus) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList) WLabel(mathax.client.gui.widgets.WLabel)

Example 5 with WHorizontalList

use of mathax.client.gui.widgets.containers.WHorizontalList in project Client by MatHax.

the class Timer method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    if (Modules.get().get(TPSSync.class).isActive()) {
        WHorizontalList list = theme.horizontalList();
        list.add(theme.label("Multiplier is overwritten by TPSSync."));
        WButton disableBtn = list.add(theme.button("Disable TPSSync")).widget();
        disableBtn.action = () -> {
            TPSSync tpsSync = Modules.get().get(TPSSync.class);
            if (tpsSync.isActive())
                tpsSync.toggle();
            list.visible = false;
        };
        return list;
    }
    return null;
}
Also used : TPSSync(mathax.client.systems.modules.misc.TPSSync) WButton(mathax.client.gui.widgets.pressable.WButton) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Aggregations

WHorizontalList (mathax.client.gui.widgets.containers.WHorizontalList)14 WButton (mathax.client.gui.widgets.pressable.WButton)9 WCheckbox (mathax.client.gui.widgets.pressable.WCheckbox)4 WLabel (mathax.client.gui.widgets.WLabel)3 File (java.io.File)2 WTable (mathax.client.gui.widgets.containers.WTable)2 WMinus (mathax.client.gui.widgets.pressable.WMinus)2 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)1 ByteBuffer (java.nio.ByteBuffer)1 PlaylistsScreen (mathax.client.gui.screens.music.PlaylistsScreen)1 WAccount (mathax.client.gui.widgets.WAccount)1 WWidget (mathax.client.gui.widgets.WWidget)1 WContainer (mathax.client.gui.widgets.containers.WContainer)1 WSection (mathax.client.gui.widgets.containers.WSection)1 WVerticalList (mathax.client.gui.widgets.containers.WVerticalList)1 MicrosoftAccount (mathax.client.systems.accounts.types.MicrosoftAccount)1 TPSSync (mathax.client.systems.modules.misc.TPSSync)1 Proxy (mathax.client.systems.proxies.Proxy)1 NbtString (net.minecraft.nbt.NbtString)1 PointerBuffer (org.lwjgl.PointerBuffer)1