|
15 | 15 | public abstract class MenuScreensChanger {
|
16 | 16 |
|
17 | 17 | public static void afterTitleScreenInit(TitleScreen screen) {
|
| 18 | + final int fullButtonWidth = 200; |
| 19 | + int shiftDown = 0; |
18 | 20 | List<ClickableWidget> buttons = Screens.getButtons(screen);
|
19 | 21 |
|
20 |
| - final int buttonWidth = 204; |
| 22 | + for (ClickableWidget button : Screens.getButtons(screen)) { |
21 | 23 |
|
22 |
| - final int spacing = 24; |
23 |
| - int savedY = 0; |
24 |
| - int maxY = 0; |
25 |
| - for (ClickableWidget button : buttons) { |
26 |
| - if (button.y > maxY) maxY = button.y; |
27 |
| - if (buttonHasText(button, "modmenu.title")) { |
| 24 | + if (buttonHasText(button, "modmenu.title") && button.getWidth() == fullButtonWidth) { |
| 25 | + // If we find a wide ModMenu button, shorten it and fit in our button on the same row |
28 | 26 | button.setWidth(98);
|
29 |
| - savedY = button.y; |
| 27 | + button.x = screen.width / 2 + 2; |
| 28 | + |
| 29 | + ClickableWidget msbutton = new ModsConfigButtonWidget(screen.width / 2 - fullButtonWidth / 2, button.y, 98, 20, screen); |
| 30 | + buttons.add(msbutton); |
| 31 | + return; |
| 32 | + } |
| 33 | + if (buttonHasText(button, "menu.options")) { |
| 34 | + // Otherwise put our button as full width, above "Options..." |
| 35 | + shiftDown = 24; |
| 36 | + |
| 37 | + // offset it 12 pixels up |
| 38 | + ClickableWidget msbutton = new ModsConfigButtonWidget(screen.width / 2 - fullButtonWidth / 2, button.y - 12, fullButtonWidth, 20, screen); |
| 39 | + buttons.add(msbutton); |
| 40 | + } |
| 41 | + |
| 42 | + if (!buttonHasText(button, "Mod Settings...")) { |
| 43 | + button.y += shiftDown; |
30 | 44 | }
|
31 |
| - // REALMS button: "menu.online" |
32 | 45 | }
|
33 |
| - ClickableWidget myButton = new ModsConfigButtonWidget(screen.width / 2 + 2, savedY, 98, 20, screen); |
34 |
| - buttons.add(myButton); |
35 |
| - ClickableWidget myButton2 = new ModsConfigButtonWidget(screen.width / 2 + 2, maxY + 24, 98, 20, screen); |
36 |
| - buttons.add(myButton2); |
37 | 46 | }
|
38 | 47 |
|
39 | 48 | public static void afterGameMenuScreenInit(GameMenuScreen screen) {
|
40 |
| - final int buttonWidth = 204; |
41 |
| - final int spacing = 24; |
42 |
| - int yOffset = 0; |
43 |
| - boolean REMOVE_FEEDBACK = false; |
44 |
| - boolean REMOVE_BUGS = false; |
| 49 | + final int fullButtonWidth = 204; |
| 50 | + int shiftDown = 0; |
| 51 | + List<ClickableWidget> buttons = Screens.getButtons(screen); |
45 | 52 |
|
46 | 53 | for (ClickableWidget button : Screens.getButtons(screen)) {
|
47 | 54 |
|
48 |
| - if (buttonHasText(button, "menu.sendFeedback")) { |
49 |
| - button.setWidth(buttonWidth / 2); |
| 55 | + if (buttonHasText(button, "modmenu.title") && button.getWidth() == fullButtonWidth) { |
| 56 | + // If we find a wide ModMenu button, shorten it and fit in our button on the same row |
| 57 | + button.setWidth(98); |
| 58 | + button.x = screen.width / 2 + 4; |
| 59 | + |
| 60 | + ClickableWidget msbutton = new ModsConfigButtonWidget(screen.width / 2 - fullButtonWidth / 2, button.y, 98, 20, screen); |
| 61 | + buttons.add(msbutton); |
| 62 | + return; |
50 | 63 | }
|
51 |
| - if (REMOVE_FEEDBACK) { |
52 |
| - |
53 |
| - if (buttonHasText(button, "menu.sendFeedback")) { |
54 |
| - button.visible = false; |
55 |
| - } |
56 |
| - if (!REMOVE_BUGS) { |
57 |
| - |
58 |
| - if (buttonHasText(button, "menu.reportBugs")) { |
59 |
| - button.setWidth(buttonWidth); |
60 |
| - button.x = screen.width / 2 - buttonWidth / 2; |
61 |
| - } |
62 |
| - } |
| 64 | + if (buttonHasText(button, "menu.options")) { |
| 65 | + // Otherwise put our button as full width, above "Options..." |
| 66 | + shiftDown = 24; |
| 67 | + |
| 68 | + ClickableWidget msbutton = new ModsConfigButtonWidget(screen.width / 2 - fullButtonWidth / 2, button.y, fullButtonWidth, 20, screen); |
| 69 | + buttons.add(msbutton); |
63 | 70 | }
|
64 | 71 |
|
65 |
| - if (REMOVE_BUGS) { |
66 |
| - |
67 |
| - if (buttonHasText(button, "menu.reportBugs")) { |
68 |
| - button.visible = false; |
69 |
| - if (REMOVE_FEEDBACK) { |
70 |
| - yOffset += spacing; |
71 |
| - } |
72 |
| - } |
73 |
| - if (!REMOVE_FEEDBACK) { |
74 |
| - |
75 |
| - if (buttonHasText(button, "menu.sendFeedback")) { |
76 |
| - button.setWidth(buttonWidth); |
77 |
| - button.x = screen.width / 2 - buttonWidth / 2; |
78 |
| - } |
79 |
| - } |
| 72 | + if (!buttonHasText(button, "Mod Settings...")) { |
| 73 | + button.y += shiftDown; |
80 | 74 | }
|
81 |
| - button.y -= yOffset; |
82 | 75 | }
|
83 | 76 | }
|
84 | 77 |
|
|
0 commit comments