Skip to content

Commit

Permalink
WIP: Improve Instrument and MusicVenueTool overlays.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeronica committed Mar 14, 2024
1 parent 518a50d commit d28985d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
33 changes: 18 additions & 15 deletions src/main/java/aeronicamc/mods/mxtune/gui/group/MemberDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public class MemberDisplay {
private final GuiGroup guiGroup;
private final GuiGroup parent;
private final List<MemberInfo> memberButtons = new ArrayList<>();
int xPos;
int yPos;
int padding = 0;
final int maxWidth;
final int maxHeight;
final Split split;
int indexSplit;
private int xPos;
private int yPos;
private int padding = 0;
private final int maxWidth;
private final int maxHeight;
private final Split split;
private int indexSplit;

MemberDisplay(GuiGroup guiGroup, GuiGroup parent, Split split) {
this.guiGroup = guiGroup;
Expand All @@ -42,8 +42,8 @@ void initMemberDisplay(int posX, int posY) {
for (Integer memberId : GroupClient.getGroupById(parent.getGroupId()).getMembers()) {
if (!GroupClient.isLeader(memberId) && split.inSplit(indexSplit)) {
MemberInfo memberInfo = new MemberInfo(posX + padding, y + padding, parent, memberId, parent::promote, parent::remove);
parent.addButton(memberInfo.buttonPromote);
parent.addButton(memberInfo.buttonRemove);
parent.addButton(memberInfo.getButtonPromote());
parent.addButton(memberInfo.getButtonRemove());
memberButtons.add(memberInfo);
y += parent.getLineHeight();
}
Expand All @@ -64,10 +64,12 @@ public int getRight() {
return xPos + maxWidth + padding;
}

@SuppressWarnings("unused")
public int getBottom() {
return yPos + maxHeight + padding;
}

@SuppressWarnings("unused")
public int getPadding() {
return padding;
}
Expand All @@ -80,18 +82,19 @@ public int getWidth() {
return maxWidth + padding;
}

@SuppressWarnings("unused")
public void setPadding(int padding) {
this.padding = padding;
}

int leaderFirst(int posX, int y, int memberId) {
MemberInfo memberInfo = new MemberInfo(posX, y, parent, memberId, parent::promote, parent::remove);
memberInfo.buttonPromote.active = false;
memberInfo.buttonPromote.visible = false;
memberInfo.buttonRemove.active = guiGroup.getPlayer().getId() == memberId;
memberInfo.buttonRemove.visible = guiGroup.getPlayer().getId() == memberId;
parent.addButton(memberInfo.buttonPromote);
parent.addButton(memberInfo.buttonRemove);
memberInfo.getButtonPromote().active = false;
memberInfo.getButtonPromote().visible = false;
memberInfo.getButtonRemove().active = guiGroup.getPlayer().getId() == memberId;
memberInfo.getButtonRemove().visible = guiGroup.getPlayer().getId() == memberId;
parent.addButton(memberInfo.getButtonPromote());
parent.addButton(memberInfo.getButtonRemove());
memberButtons.add(memberInfo);
indexSplit++;
return y + parent.getLineHeight();
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/aeronicamc/mods/mxtune/gui/group/MemberInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public class MemberInfo {
static final ITextComponent REMOVE_HELP03 = new TranslationTextComponent("gui.mxtune.button.member_remove.help03").withStyle(TextFormatting.YELLOW);

private final GuiGroup parent;
final int xPosMember;
final int yPosMember;
final MXButton buttonPromote;
final MXButton buttonRemove;
final int memberId;
final ITextComponent name;
private final int xPosMember;
private final int yPosMember;
private final MXButton buttonPromote;
private final MXButton buttonRemove;
private final int memberId;
private final ITextComponent name;

MemberInfo(int xPosMember, int yPosMember, GuiGroup parent, int memberId, Button.IPressable pPromote, Button.IPressable pRemove) {
this.xPosMember = xPosMember;
Expand Down Expand Up @@ -63,4 +63,12 @@ public class MemberInfo {
void memberDraw(MatrixStack pMatrixStack, int pMouseX, int pMouseY, float pPartialTicks) {
parent.getFont().draw(pMatrixStack, name, (float) xPosMember + 2, (float) yPosMember + 2, GroupClient.isLeader(memberId) ? TextColorFg.YELLOW : TextColorFg.WHITE);
}

MXButton getButtonPromote() {
return buttonPromote;
}

MXButton getButtonRemove() {
return buttonRemove;
}
}

0 comments on commit d28985d

Please sign in to comment.