Skip to content

Commit f33e0c4

Browse files
committed
fix
1 parent 314c7d8 commit f33e0c4

2 files changed

Lines changed: 32 additions & 5 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mod_name=Channel
3030
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3131
mod_license=GNU GPL 3.0
3232
# The mod version. See https://semver.org/
33-
mod_version=26.1.2-27+beta
33+
mod_version=26.1.2-28+beta
3434
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
3535
# This should match the base package used for the mod sources.
3636
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/cn/ussshenzhou/channel/gui/OutputConfigPanel.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,31 @@ public OutputConfigPanel() {
7070
List.of(true, false),
7171
bool -> _ -> {
7272
ChannelClientConfig.write(c -> c.muteAll = bool);
73+
OutputConfigPanel.this.container.getChildren().forEach(tWidget -> {
74+
if (tWidget instanceof PlayerVolumePanel playerVolumePanel) {
75+
playerVolumePanel.getChildren().forEach(t -> {
76+
if (t instanceof PlayerVolumeBar playerVolumeBar) {
77+
playerVolumeBar.update();
78+
}
79+
});
80+
}
81+
});
7382
},
7483
entry -> entry.getContent() == cfg.muteAll
7584
).getB().setTooltip(Tooltip.create(Component.translatable("channel.config.post.mute_all.tooltip")));
7685
addOptionSplitter(Component.translatable("channel.config.post.player_control"));
7786
addOption(Component.empty(), new TButton(Component.translatable("channel.config.post.player_control_clear"), _ -> {
7887
ChannelPlayerConfig.clear();
7988
PlayerVolumePanel.PLAYER_VOLUME.replaceAll((_, _) -> 0f);
89+
OutputConfigPanel.this.container.getChildren().forEach(tWidget -> {
90+
if (tWidget instanceof PlayerVolumePanel playerVolumePanel) {
91+
playerVolumePanel.getChildren().forEach(t -> {
92+
if (t instanceof PlayerVolumeBar playerVolumeBar) {
93+
playerVolumeBar.update();
94+
}
95+
});
96+
}
97+
});
8098
})).getB().setTooltip(Tooltip.create(Component.translatable("channel.config.post.player_control_clear.tooltip")));
8199
this.container.add(new PlayerVolumePanel());
82100
}
@@ -190,15 +208,24 @@ public PlayerVolumeBar(UUID id, float db) {
190208
this.volume.setVisibleT(false);
191209
}
192210
});
211+
update();
212+
muteButton.setBorder(null);
213+
muteButton.setTooltip(Tooltip.create(Component.translatable("channel.config.post.mute.tooltip")));
214+
this.add(muteButton);
215+
//TODO show player volume under silder
216+
}
217+
218+
protected void update() {
193219
if (ChannelPlayerConfig.muted(uuid)) {
194220
muteButton.setBorder(new Border(0xffff0000, 1));
195221
muteButton.setNormalBackGround(0x80ff0000);
196222
this.volume.setVisibleT(false);
223+
} else {
224+
muteButton.setBorder(null);
225+
muteButton.setNormalBackGround(0x0);
226+
this.volume.setVisibleT(true);
197227
}
198-
muteButton.setBorder(null);
199-
muteButton.setTooltip(Tooltip.create(Component.translatable("channel.config.post.mute.tooltip")));
200-
this.add(muteButton);
201-
//TODO show player volume under silder
228+
this.volume.setAbsValueWithoutRespond(PlayerVolumePanel.PLAYER_VOLUME.getOrDefault(uuid, 0f));
202229
}
203230

204231
@Override

0 commit comments

Comments
 (0)