Skip to content

Commit

Permalink
#fix: Fixed tray display inconsistency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
half-nothing committed Feb 2, 2024
1 parent ff2c546 commit 8fb2fb1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/cn/harryh/arkpets/ArkTray.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class ArkTray extends Tray {
public static Font font;
private final JDialog popWindow;
private final JPopupMenu popMenu;
private final boolean[] button = {false, false};

static {
try {
Expand Down Expand Up @@ -83,6 +84,12 @@ public void firePopupMenuWillBecomeInvisible() {
socketClient.reconnect(() -> {
SystemTray.getSystemTray().remove(icon);
socketClient.sendRequest(new SocketData(this.uuid, SocketData.OperateType.LOGIN, name, arkPets.canChangeStage()));
if (button[0]) {
socketClient.sendRequest(new SocketData(this.uuid, SocketData.OperateType.KEEP_ACTION));
}
if (button[1]) {
socketClient.sendRequest(new SocketData(this.uuid, SocketData.OperateType.TRANSPARENT_MODE));
}
});
return;
}
Expand Down Expand Up @@ -168,6 +175,7 @@ protected void optChangeStageHandler() {
@Override
protected void optTransparentDisHandler() {
Logger.info("Tray", "Transparent disabled");
button[1] = false;
arkPets.windowAlpha.reset(1f);
arkPets.hWndMine.setWindowTransparent(false);
popMenu.remove(optTransparentDis);
Expand All @@ -177,6 +185,7 @@ protected void optTransparentDisHandler() {
@Override
protected void optTransparentEnHandler() {
Logger.info("Tray", "Transparent enabled");
button[1] = true;
arkPets.windowAlpha.reset(0.75f);
arkPets.hWndMine.setWindowTransparent(true);
popMenu.remove(optTransparentEn);
Expand All @@ -186,6 +195,7 @@ protected void optTransparentEnHandler() {
@Override
protected void optKeepAnimDisHandler() {
Logger.info("Tray", "Keep-Anim disabled");
button[0] = false;
keepAnim = null;
popMenu.remove(optKeepAnimDis);
popMenu.add(optKeepAnimEn, 1);
Expand All @@ -194,6 +204,7 @@ protected void optKeepAnimDisHandler() {
@Override
protected void optKeepAnimEnHandler() {
Logger.info("Tray", "Keep-Anim enabled");
button[0] = true;
keepAnim = arkPets.cha.getPlaying();
popMenu.remove(optKeepAnimEn);
popMenu.add(optKeepAnimDis, 1);
Expand Down

0 comments on commit 8fb2fb1

Please sign in to comment.