Revisão | 9bd0f047614ce6316e19c516bf54b509e0f1a65a (tree) |
---|---|
Hora | 2021-05-14 01:41:33 |
Autor | sebastian_bugiu |
Commiter | sebastian_bugiu |
Got rid of exit game button on mobile.
@@ -1,5 +1,6 @@ | ||
1 | 1 | package headwayent.blackholedarksun.loaders; |
2 | 2 | |
3 | +import headwayent.blackholedarksun.MainApp; | |
3 | 4 | import headwayent.blackholedarksun.menuresource.Menu; |
4 | 5 | import headwayent.blackholedarksun.menuresource.MenuSelection; |
5 | 6 | import headwayent.hotshotengine.exception.ENG_InvalidFormatParsingException; |
@@ -8,6 +9,7 @@ | ||
8 | 9 | import headwayent.hotshotengine.scriptcompiler.ENG_CompilerUtil; |
9 | 10 | |
10 | 11 | import java.io.DataInputStream; |
12 | +import java.util.Iterator; | |
11 | 13 | |
12 | 14 | public class MenuCompiler extends ENG_AbstractCompiler<Menu> { |
13 | 15 |
@@ -27,6 +29,11 @@ | ||
27 | 29 | " determining the current name and next menu"); |
28 | 30 | }*/ |
29 | 31 | MenuSelection menuSelection = new MenuSelection(); |
32 | + if (MainApp.PLATFORM == MainApp.Platform.ANDROID || MainApp.PLATFORM == MainApp.Platform.IOS) { | |
33 | + if (s.equalsIgnoreCase("Exit")) { | |
34 | + return menuSelection; | |
35 | + } | |
36 | + } | |
30 | 37 | menuSelection.name = s.replace("_", " "); |
31 | 38 | s = ENG_CompilerUtil.getNextWord(fp0); |
32 | 39 | checkNull(s); |
@@ -93,6 +100,14 @@ | ||
93 | 100 | break; |
94 | 101 | } |
95 | 102 | } |
103 | + // Hack to get rid of the Exit menu issue when on mobile devices. | |
104 | + for (Iterator<MenuSelection> iterator = menu.selectionList.iterator(); iterator.hasNext(); ) { | |
105 | + MenuSelection menuSelection = iterator.next(); | |
106 | + if (menuSelection.name == null) { | |
107 | + iterator.remove(); | |
108 | + } | |
109 | + } | |
110 | + | |
96 | 111 | return menu; |
97 | 112 | } finally { |
98 | 113 | ENG_CompilerUtil.close(fp0); |
@@ -13,7 +13,7 @@ | ||
13 | 13 | public ArrayList<MenuSelection> getValidSelections() { |
14 | 14 | ArrayList<MenuSelection> menuSelections = new ArrayList<>(); |
15 | 15 | for (MenuSelection s : selectionList) { |
16 | - if (!s.goToPreviousMenu) { | |
16 | + if (!s.goToPreviousMenu && s.name != null) { | |
17 | 17 | menuSelections.add(s); |
18 | 18 | } |
19 | 19 | } |
@@ -326,11 +326,14 @@ | ||
326 | 326 | gameMenu.setOnClickListener(TUTORIAL_BUTTON, createOnClickListenerWithType( |
327 | 327 | StartActivityOnClickListener.StartActivityOnClickListenerFactory.TYPE, bundle)); |
328 | 328 | |
329 | - gameMenu.setOnClickListener(EXIT_BUTTON, createOnClickListenerWithType( | |
330 | - ExitGameOnClickListener.ExitGameOnClickListenerFactory.TYPE)); | |
329 | + if (MainApp.PLATFORM == MainApp.Platform.DESKTOP) { | |
331 | 330 | |
332 | - gameMenu.setOnClickListener(EXIT_TO_MAIN_MENU_BUTTON, createOnClickListenerWithType( | |
333 | - ExitToMainMenuOnClickListener.ExitToMainMenuOnClickListenerFactory.TYPE)); | |
331 | + gameMenu.setOnClickListener(EXIT_BUTTON, createOnClickListenerWithType( | |
332 | + ExitGameOnClickListener.ExitGameOnClickListenerFactory.TYPE)); | |
333 | + | |
334 | + gameMenu.setOnClickListener(EXIT_TO_MAIN_MENU_BUTTON, createOnClickListenerWithType( | |
335 | + ExitToMainMenuOnClickListener.ExitToMainMenuOnClickListenerFactory.TYPE)); | |
336 | + } | |
334 | 337 | |
335 | 338 | bundle = new Bundle(); |
336 | 339 | bundle.putString("activity", LEVEL_SELECTION); |
@@ -366,8 +369,10 @@ | ||
366 | 369 | bundle)); |
367 | 370 | |
368 | 371 | |
369 | - mainMenu.setOnClickListener(EXIT_BUTTON, createOnClickListenerWithType( | |
370 | - ExitGameOnClickListener.ExitGameOnClickListenerFactory.TYPE)); | |
372 | + if (MainApp.PLATFORM == MainApp.Platform.DESKTOP) { | |
373 | + mainMenu.setOnClickListener(EXIT_BUTTON, createOnClickListenerWithType( | |
374 | + ExitGameOnClickListener.ExitGameOnClickListenerFactory.TYPE)); | |
375 | + } | |
371 | 376 | |
372 | 377 | bundle = new Bundle(); |
373 | 378 | bundle.putString("activity", MULTIPLAYER_LOGIN); |