Skip to content

Commit

Permalink
fix: 投票可能時のみメッセージを表示するオプションを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Toshimichi0915 committed Oct 13, 2023
1 parent 2bb0023 commit c7a9aa3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,21 @@ private class VoteInfoWidget implements Widget {

@Override
public void update(boolean placeholder) {
this.valid = successful && KzePlus.getInstance().getOptions().isShowNextVote() || placeholder;
if (placeholder) {
canVote = true;
message = "投票できます";
valid = true;
} else if (nextVoteTicks > 0) {
canVote = false;
int hours = nextVoteTicks / 20 / (60 * 60);
int minutes = nextVoteTicks / 20 / 60 % 60;
int seconds = nextVoteTicks / 20 % 60;
message = String.format("投票可能まで: %02d:%02d:%02d", hours, minutes, seconds);
valid = KzePlus.getInstance().getOptions().isShowNextVote() && !KzePlus.getInstance().getOptions().isShowNextVoteOnlyWhenAvailable();
} else {
canVote = true;
message = "投票できます";
valid = KzePlus.getInstance().getOptions().isShowNextVote();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void render(int x, int y, MatrixStack stack, float tickDelta) {

@Override
public int getWidth() {
return weaponContextLength + 10;
return Math.max(125, weaponContextLength + 10);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ public class KzeOptions {
private boolean showTeam = true;
private boolean showBonus = true;
private boolean showNextVote = true;
private boolean showNextVoteOnlyWhenAvailable = false;
private boolean hideVoteMessage = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected void init() {
SimpleOption.ofBoolean("kze_plus.options.show_team", options.isShowTeam(), options::setShowTeam),
SimpleOption.ofBoolean("kze_plus.options.show_bonus", options.isShowBonus(), options::setShowBonus),
SimpleOption.ofBoolean("kze_plus.options.show_next_vote", options.isShowNextVote(), options::setShowNextVote),
SimpleOption.ofBoolean("kze_plus.options.show_next_vote_only_when_available", options.isShowNextVoteOnlyWhenAvailable(), options::setShowNextVoteOnlyWhenAvailable),
SimpleOption.ofBoolean("kze_plus.options.hide_vote_message", options.isHideVoteMessage(), options::setHideVoteMessage),
};

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/kze_plus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"kze_plus.options.show_team": "チームを表示する",
"kze_plus.options.show_bonus": "防衛・被弾ボーナスを表示する",
"kze_plus.options.show_next_vote": "次の投票時刻を表示する",
"kze_plus.options.hide_vote_message": "投票メッセージを非表示にする"
"kze_plus.options.show_next_vote_only_when_available": "投票可能時のみ表示する",
"kze_plus.options.hide_vote_message": "投票を非表示にする"
}

0 comments on commit c7a9aa3

Please sign in to comment.