Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Atomic-Laboratory committed Apr 7, 2024
1 parent 87b1542 commit 96a8226
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/src/mindustry/ui/dialogs/JoinDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,11 @@ void refreshCommunity(){

Table[] groupTable = {null, null};

boolean favorite = group.favorite();
if(group.prioritized){
addHeader(groupTable, group, hidden, false);
} else if (group.favorite()) {
addHeader(groupTable, group, hidden, true);
addHeader(groupTable, group, hidden, favorite, false);
} else if (favorite) {
addHeader(groupTable, group, hidden, true, true);//weird behaviour if false?
}
//table containing all groups
for(String address : group.addresses){
Expand All @@ -433,9 +434,9 @@ void refreshCommunity(){
|| (res.modeName != null && res.modeName.toLowerCase().contains(serverSearch)))) return;

if(groupTable[0] == null){
addHeader(groupTable, group, hidden, true);
addHeader(groupTable, group, hidden, favorite, true);
}else if(!groupTable[0].visible){
addHeader(groupTable, group, hidden, true);
addHeader(groupTable, group, hidden, favorite, true);
}

addCommunityHost(res, groupTable[1]);
Expand All @@ -447,7 +448,7 @@ void refreshCommunity(){
}
}

void addHeader(Table[] groupTable, ServerGroup group, boolean hidden, boolean doInit){ // outlined separately
void addHeader(Table[] groupTable, ServerGroup group, boolean hidden, boolean favorite, boolean doInit){ // outlined separately
if(groupTable[0] == null){
global.table(t -> groupTable[0] = t).fillX().left().row();
}
Expand All @@ -466,14 +467,13 @@ void addHeader(Table[] groupTable, ServerGroup group, boolean hidden, boolean do
//button for showing/hiding servers
ImageButton[] image = {null, null};
image[0] = head.button(Icon.star, new ImageButton.ImageButtonStyle(){{
imageUpColor = group.favorite() ? Pal.accent : Color.lightGray;
imageUpColor = favorite ? Pal.accent : Color.lightGray;
imageDownColor = Color.white;
}}, () -> {
group.setFavorite(!group.favorite());
image[0].getStyle().imageUpColor = group.favorite() ? Pal.accent : Pal.lightishGray;
}).size(40f).get();
image[0].getStyle().imageUpColor = group.favorite() ? Pal.accent : Pal.lightishGray;
image[0].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
image[0].getStyle().imageUpColor = favorite ? Pal.accent : Pal.lightishGray;

//button for showing/hiding servers
image[1] = head.button(hidden ? Icon.eyeOffSmall : Icon.eyeSmall, Styles.grayi, () -> {
Expand All @@ -483,7 +483,7 @@ void addHeader(Table[] groupTable, ServerGroup group, boolean hidden, boolean do
groupTable[0].remove();
}
}).size(40f).get();
image[0].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
image[1].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
}).width(targetWidth() * columns()).padBottom(-2).row();

groupTable[1] = groupTable[0].row().table().top().left().grow().get();
Expand Down

0 comments on commit 96a8226

Please sign in to comment.