Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import io.github.kurrycat.mpkmod.compatibility.MCClasses.Renderer2D;
import io.github.kurrycat.mpkmod.compatibility.MCClasses.WorldInteraction;
import io.github.kurrycat.mpkmod.gui.ComponentScreen;
import io.github.kurrycat.mpkmod.gui.components.Button;
import io.github.kurrycat.mpkmod.gui.components.*;
import io.github.kurrycat.mpkmod.gui.components.Button;
import io.github.kurrycat.mpkmod.gui.interfaces.KeyInputListener;
import io.github.kurrycat.mpkmod.gui.interfaces.MouseInputListener;
import io.github.kurrycat.mpkmod.landingblock.LandingBlock;
Expand All @@ -22,6 +22,7 @@ public class LandingBlockGuiScreen extends ComponentScreen {
public static Color lbListColorBg = new Color(31, 31, 31, 150);

private LBList lbList;
private DeletePane deletePane;

public static List<Vector3D> calculateLBOffsets() {
List<Vector3D> returnOffsets = new ArrayList<>();
Expand All @@ -47,6 +48,15 @@ public void onGuiInit() {
new Vector2D(3 / 5D, 0.9)
);
addChild(lbList, PERCENT.ALL, Anchor.TOP_CENTER);
lbList.topCover.addChild(
new Button(
"Delete All",
new Vector2D(20, 1),
new Vector2D(50, 11),
mouseButton -> this.openPane(deletePane)
),
PERCENT.NONE, Anchor.CENTER_RIGHT
);
lbList.topCover.addChild(
new Button(
"x",
Expand All @@ -56,6 +66,9 @@ public void onGuiInit() {
),
PERCENT.NONE, Anchor.CENTER_RIGHT
);

deletePane = new DeletePane();
passPositionTo(deletePane, PERCENT.ALL, Anchor.CENTER);
}

@Override
Expand Down Expand Up @@ -263,4 +276,57 @@ public boolean handleKeyInput(int keyCode, int scanCode, int modifiers, boolean
);
}
}

public static class DeletePane extends Pane<LandingBlockGuiScreen> {

public DeletePane() {
super(Vector2D.ZERO, new Vector2D(0.4, 0.4));

addChild(
new TextRectangle(
new Vector2D(0, 10),
new Vector2D(100, 40),
"Are you sure you want to",
null,
Color.WHITE
),
PERCENT.NONE, Anchor.TOP_CENTER
);

addChild(
new TextRectangle(
new Vector2D(0, 20),
new Vector2D(100, 40),
"delete all landing blocks?",
null,
Color.WHITE
),
PERCENT.NONE, Anchor.TOP_CENTER
);

addChild(
new Button(
"Cancel",
new Vector2D(20, 10),
new Vector2D(60, 17),
mouseButton -> this.close()
),
PERCENT.NONE, Anchor.BOTTOM_LEFT
);

addChild(
new Button(
"Confirm",
new Vector2D(20, 10),
new Vector2D(60, 17),
mouseButton -> {
this.paneHolder.lbList.items.clear();
LandingBlockGuiScreen.lbs.clear();
this.close();
}
),
PERCENT.NONE, Anchor.BOTTOM_RIGHT
);
}
}
}