Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion #282 #88

Draft
wants to merge 3 commits into
base: v7
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,8 @@ setting.showreactors.name = Show Reactor Ranges
setting.showreactors.description = Press [lightgray]f9[] to toggle
setting.showdomes.name = Show Overdrive Ranges
setting.showdomes.description = Press [lightgray]f9[] to toggle
setting.showpopups.name = Show Popups
setting.showpopups.description = Show all popups

setting.misc.category = Miscellaneous
setting.updateurl.name = Update Repository
Expand Down
7 changes: 7 additions & 0 deletions core/src/mindustry/ui/Menus.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static int registerMenu(MenuListener listener){

@Remote(variants = Variant.both)
public static void menu(int menuId, String title, String message, String[][] options){
if (!Core.settings.getBool("showpopups")) return;
if(title == null) title = "";
if(options == null) options = new String[0][0];
if(options[0][0].contains("") && options[0][1].contains("")) return; // .io is annoying
Expand All @@ -36,6 +37,7 @@ public static void menu(int menuId, String title, String message, String[][] opt

@Remote(targets = Loc.both, called = Loc.both)
public static void menuChoose(@Nullable Player player, int menuId, int option){
if (!Core.settings.getBool("showpopups")) return;
if(player != null){
Events.fire(new MenuOptionChooseEvent(player, menuId, option));
if(menuId >= 0 && menuId < menuListeners.size){
Expand Down Expand Up @@ -72,6 +74,7 @@ public static void announce(String message){
@Remote(variants = Variant.both)
public static void infoMessage(String message){
if(message == null) return;
if (!Core.settings.getBool("showpopups")) return;
if((ClientUtilsKt.io() || ClientUtilsKt.phoenix()) && Time.timeSinceMillis(ClientVars.lastJoinTime) < 1000) return;

ui.showText("", message);
Expand All @@ -80,6 +83,7 @@ public static void infoMessage(String message){
@Remote(variants = Variant.both, unreliable = true)
public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){
if(message == null) return;
if (!Core.settings.getBool("showpopups")) return;

ui.showInfoPopup(message, duration, align, top, left, bottom, right);
}
Expand All @@ -94,6 +98,7 @@ public static void label(String message, float duration, float worldx, float wor
@Remote(variants = Variant.both)
public static void infoPopupReliable(String message, float duration, int align, int top, int left, int bottom, int right){
if(message == null) return;
if (!Core.settings.getBool("showpopups")) return;

ui.showInfoPopup(message, duration, align, top, left, bottom, right);
}
Expand All @@ -106,13 +111,15 @@ public static void labelReliable(String message, float duration, float worldx, f
@Remote(variants = Variant.both)
public static void infoToast(String message, float duration){
if(message == null) return;
if (!Core.settings.getBool("showpopups")) return;

ui.showInfoToast(message, duration);
}

@Remote(variants = Variant.both)
public static void warningToast(int unicode, String text){
if(text == null || Fonts.icon.getData().getGlyph((char)unicode) == null) return;
if (!Core.settings.getBool("showpopups")) return;

ui.hudfrag.showToast(Fonts.getGlyph(Fonts.icon, (char)unicode), text);
}
Expand Down
1 change: 1 addition & 0 deletions core/src/mindustry/ui/dialogs/SettingsMenuDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ void addSettings(){
client.checkPref("mobileui", false, i -> mobile = !mobile);
client.checkPref("showreactors", false);
client.checkPref("showdomes", false);
client.checkPref("showpopups", true);

client.category("misc");
client.updatePref();
Expand Down