Implemented "Finish 1. world" -> Level is adjusted, Toolshop-tutorial is deactivated

Added resetConfirmDialog
Fixed minor bugs
This commit is contained in:
= 2018-01-12 17:50:43 +01:00
parent 60bc673ffc
commit 3ca689dd60
18 changed files with 374 additions and 219 deletions

View File

@ -538,20 +538,20 @@ public final class R {
public static final int src_atop = 0x7f08008d; public static final int src_atop = 0x7f08008d;
public static final int src_in = 0x7f08008e; public static final int src_in = 0x7f08008e;
public static final int src_over = 0x7f08008f; public static final int src_over = 0x7f08008f;
public static final int status_bar_latest_event_content = 0x7f080095; public static final int status_bar_latest_event_content = 0x7f080096;
public static final int submit_area = 0x7f080096; public static final int submit_area = 0x7f080097;
public static final int tabMode = 0x7f080097; public static final int tabMode = 0x7f080098;
public static final int text = 0x7f080099; public static final int text = 0x7f08009a;
public static final int text2 = 0x7f08009a; public static final int text2 = 0x7f08009b;
public static final int textSpacerNoButtons = 0x7f08009b; public static final int textSpacerNoButtons = 0x7f08009c;
public static final int time = 0x7f08009c; public static final int time = 0x7f08009d;
public static final int title = 0x7f08009d; public static final int title = 0x7f08009e;
public static final int title_template = 0x7f08009e; public static final int title_template = 0x7f08009f;
public static final int topPanel = 0x7f0800bb; public static final int topPanel = 0x7f0800bc;
public static final int up = 0x7f0800cd; public static final int up = 0x7f0800ce;
public static final int useLogo = 0x7f0800ce; public static final int useLogo = 0x7f0800cf;
public static final int withText = 0x7f0800cf; public static final int withText = 0x7f0800d0;
public static final int wrap_content = 0x7f0800d8; public static final int wrap_content = 0x7f0800d9;
} }
public static final class integer { public static final class integer {
public static final int abc_config_activityDefaultDur = 0x7f090000; public static final int abc_config_activityDefaultDur = 0x7f090000;
@ -619,7 +619,7 @@ public final class R {
public static final int abc_shareactionprovider_share_with = 0x7f0d0010; public static final int abc_shareactionprovider_share_with = 0x7f0d0010;
public static final int abc_shareactionprovider_share_with_application = 0x7f0d0011; public static final int abc_shareactionprovider_share_with_application = 0x7f0d0011;
public static final int abc_toolbar_collapse_description = 0x7f0d0012; public static final int abc_toolbar_collapse_description = 0x7f0d0012;
public static final int status_bar_notification_info_overflow = 0x7f0d004c; public static final int status_bar_notification_info_overflow = 0x7f0d004e;
} }
public static final class style { public static final class style {
public static final int AlertDialog_AppCompat = 0x7f0e0000; public static final int AlertDialog_AppCompat = 0x7f0e0000;

File diff suppressed because one or more lines are too long

View File

@ -705,79 +705,80 @@ int id split_action_bar 0x7f08008c
int id src_atop 0x7f08008d int id src_atop 0x7f08008d
int id src_in 0x7f08008e int id src_in 0x7f08008e
int id src_over 0x7f08008f int id src_over 0x7f08008f
int id startscreen_gain_90_ep 0x7f080090 int id startscreen_finish_world_1 0x7f080090
int id startscreen_play 0x7f080091 int id startscreen_gain_90_ep 0x7f080091
int id startscreen_settings 0x7f080092 int id startscreen_play 0x7f080092
int id startscreen_to_gl_test_screen 0x7f080093 int id startscreen_settings 0x7f080093
int id startscreen_unlock_levels 0x7f080094 int id startscreen_to_gl_test_screen 0x7f080094
int id status_bar_latest_event_content 0x7f080095 int id startscreen_unlock_levels 0x7f080095
int id submit_area 0x7f080096 int id status_bar_latest_event_content 0x7f080096
int id tabMode 0x7f080097 int id submit_area 0x7f080097
int id task_completed_unlock_list 0x7f080098 int id tabMode 0x7f080098
int id text 0x7f080099 int id task_completed_unlock_list 0x7f080099
int id text2 0x7f08009a int id text 0x7f08009a
int id textSpacerNoButtons 0x7f08009b int id text2 0x7f08009b
int id time 0x7f08009c int id textSpacerNoButtons 0x7f08009c
int id title 0x7f08009d int id time 0x7f08009d
int id title_template 0x7f08009e int id title 0x7f08009e
int id tool_button_animation_layer 0x7f08009f int id title_template 0x7f08009f
int id tool_button_background_layer 0x7f0800a0 int id tool_button_animation_layer 0x7f0800a0
int id tool_button_progress_bar 0x7f0800a1 int id tool_button_background_layer 0x7f0800a1
int id tool_inspector_description 0x7f0800a2 int id tool_button_progress_bar 0x7f0800a2
int id tool_inspector_imageview 0x7f0800a3 int id tool_inspector_description 0x7f0800a3
int id tool_inspector_level_view 0x7f0800a4 int id tool_inspector_imageview 0x7f0800a4
int id tool_inspector_pricebutton 0x7f0800a5 int id tool_inspector_level_view 0x7f0800a5
int id tool_inspector_title 0x7f0800a6 int id tool_inspector_pricebutton 0x7f0800a6
int id tool_upgrade_imageview 0x7f0800a7 int id tool_inspector_title 0x7f0800a7
int id tool_upgrade_pricebutton 0x7f0800a8 int id tool_upgrade_imageview 0x7f0800a8
int id tool_upgrade_title 0x7f0800a9 int id tool_upgrade_pricebutton 0x7f0800a9
int id tool_upgrade_value_new 0x7f0800aa int id tool_upgrade_title 0x7f0800aa
int id tool_upgrade_value_old 0x7f0800ab int id tool_upgrade_value_new 0x7f0800ab
int id toolbutton_1 0x7f0800ac int id tool_upgrade_value_old 0x7f0800ac
int id toolbutton_2 0x7f0800ad int id toolbutton_1 0x7f0800ad
int id toolbutton_3 0x7f0800ae int id toolbutton_2 0x7f0800ae
int id toolbutton_4 0x7f0800af int id toolbutton_3 0x7f0800af
int id toolofferslot_slot 0x7f0800b0 int id toolbutton_4 0x7f0800b0
int id toolofferslot_title 0x7f0800b1 int id toolofferslot_slot 0x7f0800b1
int id toolshop_slot1 0x7f0800b2 int id toolofferslot_title 0x7f0800b2
int id toolshop_slot2 0x7f0800b3 int id toolshop_slot1 0x7f0800b3
int id toolshop_slot3 0x7f0800b4 int id toolshop_slot2 0x7f0800b4
int id toolshop_slot4 0x7f0800b5 int id toolshop_slot3 0x7f0800b5
int id toolshop_tool_offer_bottom_row 0x7f0800b6 int id toolshop_slot4 0x7f0800b6
int id toolshop_tool_offer_top_row 0x7f0800b7 int id toolshop_tool_offer_bottom_row 0x7f0800b7
int id toolshop_toolinspector 0x7f0800b8 int id toolshop_tool_offer_top_row 0x7f0800b8
int id toolshop_topbar 0x7f0800b9 int id toolshop_toolinspector 0x7f0800b9
int id toolslot_image 0x7f0800ba int id toolshop_topbar 0x7f0800ba
int id topPanel 0x7f0800bb int id toolslot_image 0x7f0800bb
int id topbar_energycount 0x7f0800bc int id topPanel 0x7f0800bc
int id topbar_energycount_decrease 0x7f0800bd int id topbar_energycount 0x7f0800bd
int id topbar_energyview 0x7f0800be int id topbar_energycount_decrease 0x7f0800be
int id topbar_layout 0x7f0800bf int id topbar_energyview 0x7f0800bf
int id topbar_leveldisplay 0x7f0800c0 int id topbar_layout 0x7f0800c0
int id topbar_levellayout 0x7f0800c1 int id topbar_leveldisplay 0x7f0800c1
int id topbar_levelprogress 0x7f0800c2 int id topbar_levellayout 0x7f0800c2
int id topbar_settings 0x7f0800c3 int id topbar_levelprogress 0x7f0800c3
int id topbar_shapeshop 0x7f0800c4 int id topbar_settings 0x7f0800c4
int id topbar_starcount 0x7f0800c5 int id topbar_shapeshop 0x7f0800c5
int id topbar_starcount_decrease 0x7f0800c6 int id topbar_starcount 0x7f0800c6
int id topbar_starview 0x7f0800c7 int id topbar_starcount_decrease 0x7f0800c7
int id topbar_toolshop 0x7f0800c8 int id topbar_starview 0x7f0800c8
int id tutorial_image_view 0x7f0800c9 int id topbar_toolshop 0x7f0800c9
int id tutorial_text_view 0x7f0800ca int id tutorial_image_view 0x7f0800ca
int id unlockmessage_message 0x7f0800cb int id tutorial_text_view 0x7f0800cb
int id unlockmessage_toolimage 0x7f0800cc int id unlockmessage_message 0x7f0800cc
int id up 0x7f0800cd int id unlockmessage_toolimage 0x7f0800cd
int id useLogo 0x7f0800ce int id up 0x7f0800ce
int id withText 0x7f0800cf int id useLogo 0x7f0800cf
int id worldbutton_energycount 0x7f0800d0 int id withText 0x7f0800d0
int id worldbutton_levelcount 0x7f0800d1 int id worldbutton_energycount 0x7f0800d1
int id worldbutton_lock 0x7f0800d2 int id worldbutton_levelcount 0x7f0800d2
int id worldbutton_preview 0x7f0800d3 int id worldbutton_lock 0x7f0800d3
int id worldbutton_starcount 0x7f0800d4 int id worldbutton_preview 0x7f0800d4
int id worldbutton_title 0x7f0800d5 int id worldbutton_starcount 0x7f0800d5
int id worlds_layout 0x7f0800d6 int id worldbutton_title 0x7f0800d6
int id worlds_topbar 0x7f0800d7 int id worlds_layout 0x7f0800d7
int id wrap_content 0x7f0800d8 int id worlds_topbar 0x7f0800d8
int id wrap_content 0x7f0800d9
int integer abc_config_activityDefaultDur 0x7f090000 int integer abc_config_activityDefaultDur 0x7f090000
int integer abc_config_activityShortDur 0x7f090001 int integer abc_config_activityShortDur 0x7f090001
int integer abc_max_action_buttons 0x7f090002 int integer abc_max_action_buttons 0x7f090002
@ -922,67 +923,70 @@ int string playershape_name_wheel 0x7f0d0040
int string pre_start_screen_loading 0x7f0d0041 int string pre_start_screen_loading 0x7f0d0041
int string price_button_buy 0x7f0d0042 int string price_button_buy 0x7f0d0042
int string price_button_upgrade 0x7f0d0043 int string price_button_upgrade 0x7f0d0043
int string settings_reset 0x7f0d0044 int string reset_dialog_question 0x7f0d0044
int string short_menu_continue 0x7f0d0045 int string settings_reset 0x7f0d0045
int string short_menu_exit 0x7f0d0046 int string short_menu_continue 0x7f0d0046
int string short_menu_restart 0x7f0d0047 int string short_menu_exit 0x7f0d0047
int string start_screen_gain_90_ep 0x7f0d0048 int string short_menu_restart 0x7f0d0048
int string start_screen_play 0x7f0d0049 int string start_screen_finish_world_1 0x7f0d0049
int string start_screen_to_gl_test_screen 0x7f0d004a int string start_screen_gain_90_ep 0x7f0d004a
int string start_screen_unlock_all_levels 0x7f0d004b int string start_screen_play 0x7f0d004b
int string status_bar_notification_info_overflow 0x7f0d004c int string start_screen_to_gl_test_screen 0x7f0d004c
int string task_collect_energy_format_d 0x7f0d004d int string start_screen_unlock_all_levels 0x7f0d004d
int string task_collect_energy_progress_format_ddd 0x7f0d004e int string status_bar_notification_info_overflow 0x7f0d004e
int string task_collect_stars_format_d 0x7f0d004f int string task_collect_energy_format_d 0x7f0d004f
int string task_collect_stars_progress_format_ddd 0x7f0d0050 int string task_collect_energy_progress_format_ddd 0x7f0d0050
int string task_complete_world_format_d 0x7f0d0051 int string task_collect_stars_format_d 0x7f0d0051
int string task_completed 0x7f0d0052 int string task_collect_stars_progress_format_ddd 0x7f0d0052
int string task_empty 0x7f0d0053 int string task_complete_world_format_d 0x7f0d0053
int string tool_description_bomb 0x7f0d0054 int string task_completed 0x7f0d0054
int string tool_description_locked_format_d 0x7f0d0055 int string task_empty 0x7f0d0055
int string tool_description_magnet 0x7f0d0056 int string tool_description_bomb 0x7f0d0056
int string tool_description_power_mushroom 0x7f0d0057 int string tool_description_locked_format_d 0x7f0d0057
int string tool_description_ramp 0x7f0d0058 int string tool_description_magnet 0x7f0d0058
int string tool_description_spring 0x7f0d0059 int string tool_description_power_mushroom 0x7f0d0059
int string tool_description_stasis 0x7f0d005a int string tool_description_ramp 0x7f0d005a
int string tool_level_format_d 0x7f0d005b int string tool_description_spring 0x7f0d005b
int string tool_name_bomb 0x7f0d005c int string tool_description_stasis 0x7f0d005c
int string tool_name_locked 0x7f0d005d int string tool_level_format_d 0x7f0d005d
int string tool_name_magnet 0x7f0d005e int string tool_name_bomb 0x7f0d005e
int string tool_name_power_mushroom 0x7f0d005f int string tool_name_locked 0x7f0d005f
int string tool_name_ramp 0x7f0d0060 int string tool_name_magnet 0x7f0d0060
int string tool_name_spring 0x7f0d0061 int string tool_name_power_mushroom 0x7f0d0061
int string tool_name_stasis 0x7f0d0062 int string tool_name_ramp 0x7f0d0062
int string tool_upgrade_force 0x7f0d0063 int string tool_name_spring 0x7f0d0063
int string tool_upgrade_none 0x7f0d0064 int string tool_name_stasis 0x7f0d0064
int string tool_upgrade_radius 0x7f0d0065 int string tool_upgrade_force 0x7f0d0065
int string tool_upgrade_time 0x7f0d0066 int string tool_upgrade_none 0x7f0d0066
int string tool_upgrade_title_format_sd 0x7f0d0067 int string tool_upgrade_radius 0x7f0d0067
int string tool_upgrade_title_placeholder 0x7f0d0068 int string tool_upgrade_time 0x7f0d0068
int string tool_upgrade_value_max 0x7f0d0069 int string tool_upgrade_title_format_sd 0x7f0d0069
int string topbar_level_format_d 0x7f0d006a int string tool_upgrade_title_placeholder 0x7f0d006a
int string topbar_level_placeholder 0x7f0d006b int string tool_upgrade_value_max 0x7f0d006b
int string topbar_toolshop 0x7f0d006c int string topbar_level_format_d 0x7f0d006c
int string tutorial_leveled_up_to_toolshop 0x7f0d006d int string topbar_level_placeholder 0x7f0d006d
int string tutorial_place_ramp_air 0x7f0d006e int string topbar_toolshop 0x7f0d006e
int string tutorial_place_ramp_air_2 0x7f0d006f int string tutorial_leveled_up_to_toolshop 0x7f0d006f
int string tutorial_place_ramp_gap 0x7f0d0070 int string tutorial_place_ramp_air 0x7f0d0070
int string tutorial_place_ramp_obstacle 0x7f0d0071 int string tutorial_place_ramp_air_2 0x7f0d0071
int string tutorial_place_tools 0x7f0d0072 int string tutorial_place_ramp_gap 0x7f0d0072
int string tutorial_placeholder 0x7f0d0073 int string tutorial_place_ramp_obstacle 0x7f0d0073
int string tutorial_switch_tools_switch 0x7f0d0074 int string tutorial_place_tools 0x7f0d0074
int string tutorial_switch_tools_two_neccessary 0x7f0d0075 int string tutorial_placeholder 0x7f0d0075
int string tutorial_toolshop_all_tools 0x7f0d0076 int string tutorial_spring_equipped 0x7f0d0076
int string tutorial_toolshop_equip_spring 0x7f0d0077 int string tutorial_switch_tools_switch 0x7f0d0077
int string tutorial_toolshop_inspector 0x7f0d0078 int string tutorial_switch_tools_two_neccessary 0x7f0d0078
int string tutorial_toolshop_select_buy_spring 0x7f0d0079 int string tutorial_toolshop_all_tools 0x7f0d0079
int string tutorial_toolshop_toolbar 0x7f0d007a int string tutorial_toolshop_equip_spring 0x7f0d007a
int string tutorial_toolshop_welcome 0x7f0d007b int string tutorial_toolshop_inspector 0x7f0d007b
int string tutorial_welcome 0x7f0d007c int string tutorial_toolshop_select_buy_spring 0x7f0d007c
int string unlock_message_placeholder 0x7f0d007d int string tutorial_toolshop_toolbar 0x7f0d007d
int string world_button_count_format_dd 0x7f0d007e int string tutorial_toolshop_welcome 0x7f0d007e
int string world_button_progress_placeholder 0x7f0d007f int string tutorial_welcome 0x7f0d007f
int string world_button_title_placeholder 0x7f0d0080 int string unlock_message_placeholder 0x7f0d0080
int string world_button_count_format_dd 0x7f0d0081
int string world_button_progress_placeholder 0x7f0d0082
int string world_button_title_placeholder 0x7f0d0083
int style AlertDialog_AppCompat 0x7f0e0000 int style AlertDialog_AppCompat 0x7f0e0000
int style AlertDialog_AppCompat_Light 0x7f0e0001 int style AlertDialog_AppCompat_Light 0x7f0e0001
int style Animation_AppCompat_Dialog 0x7f0e0002 int style Animation_AppCompat_Dialog 0x7f0e0002

View File

@ -15,10 +15,10 @@ public enum PlayerShape {
BALL(R.string.playershape_name_ball, R.string.playershape_description_ball, BALL(R.string.playershape_name_ball, R.string.playershape_description_ball,
R.drawable.playershapes_ball, new EmptyTask()), R.drawable.playershapes_ball, new EmptyTask()),
CLOCK(R.string.playershape_name_clock, R.string.playershape_description_clock, CLOCK(R.string.playershape_name_clock, R.string.playershape_description_clock,
R.drawable.playershapes_clock, new CollectStarTask(1)),//15 R.drawable.playershapes_clock, new CollectStarTask(15)),
HYPNO_SPIRAL(R.string.playershape_name_hypno_spiral, HYPNO_SPIRAL(R.string.playershape_name_hypno_spiral,
R.string.playershape_description_hypno_spiral, R.drawable.playershapes_hypno_spiral, R.string.playershape_description_hypno_spiral, R.drawable.playershapes_hypno_spiral,
new CollectEnergyTask(1)),//3 new CollectEnergyTask(3)),
PACMAN(R.string.playershape_name_pacman, R.string.playershape_description_pacman, PACMAN(R.string.playershape_name_pacman, R.string.playershape_description_pacman,
R.drawable.playershapes_pacman, new CompleteWorldTask(1)), R.drawable.playershapes_pacman, new CompleteWorldTask(1)),
SMILEY(R.string.playershape_name_smiley, R.string.playershape_description_smiley, SMILEY(R.string.playershape_name_smiley, R.string.playershape_description_smiley,

View File

@ -56,16 +56,16 @@ public class LevelManager extends ArrayList<LevelPack> {
} }
} }
public int getTotalCollectedStarCount(){ public int getTotalCollectedStarCount() {
int count = 0; int count = 0;
for(LevelPack levelPack : this) for (LevelPack levelPack : this)
count += levelPack.getCollectedStarCount(); count += levelPack.getCollectedStarCount();
return count; return count;
} }
public int getTotalCollectedEnergyCount(){ public int getTotalCollectedEnergyCount() {
int count = 0; int count = 0;
for(LevelPack levelPack : this) for (LevelPack levelPack : this)
count += levelPack.getCollectedEnergyCount(); count += levelPack.getCollectedEnergyCount();
return count; return count;
} }
@ -94,6 +94,20 @@ public class LevelManager extends ArrayList<LevelPack> {
} }
} }
public void finishFirstPack() {
LevelPack pack1 = getPackWithId(1);
if (pack1 != null) {
for (Level level : pack1.getLevels()) {
level.setFinished(true);
level.setLocked(false);
}
}
LevelPack pack2 = getPackWithId(2);
if (pack2 != null) {
pack2.setLocked(false);
}
}
private Comparator<LevelPack> packComparator = new Comparator<LevelPack>() { private Comparator<LevelPack> packComparator = new Comparator<LevelPack>() {
@Override @Override
public int compare(LevelPack lhs, LevelPack rhs) { public int compare(LevelPack lhs, LevelPack rhs) {

View File

@ -12,9 +12,11 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.frajul.endlessroll.entities.shapes.PlayerShape; import de.frajul.endlessroll.entities.shapes.PlayerShape;
import de.frajul.endlessroll.entities.shapes.Task;
import de.frajul.endlessroll.entities.tools.ToolType; import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.levels.Level; import de.frajul.endlessroll.levels.Level;
import de.frajul.endlessroll.levels.LevelManager; import de.frajul.endlessroll.levels.LevelManager;
@ -52,6 +54,8 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
private Typeface typeface; private Typeface typeface;
private TutorialManager tutorialManager; private TutorialManager tutorialManager;
private List<PlayerShape> alreadyUnlockedPlayerShapes = new ArrayList<>();
private MyGlSurfaceView glSurfaceView; private MyGlSurfaceView glSurfaceView;
private ScreenFlipper flipper; private ScreenFlipper flipper;
private PreStartScreen preStartScreen; private PreStartScreen preStartScreen;
@ -93,7 +97,10 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
levelManager = new LevelManager(this, dataStorageHandler); levelManager = new LevelManager(this, dataStorageHandler);
tutorialManager = new TutorialManager(this); tutorialManager = new TutorialManager(this);
tutorialManager.getToolShopTutorial().setFinished(dataStorageHandler.readToolShopTutorialFinished()); tutorialManager.getToolShopTutorial()
.setFinished(dataStorageHandler.readToolShopTutorialFinished());
checkForAlreadyUnlockedPlayerShapes();
this.glSurfaceView = new MyGlSurfaceView(this, new GameRenderer(this)); this.glSurfaceView = new MyGlSurfaceView(this, new GameRenderer(this));
typeface = Typeface.createFromAsset(getAssets(), "fontBaron.ttf"); typeface = Typeface.createFromAsset(getAssets(), "fontBaron.ttf");
@ -148,6 +155,30 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
flipToScreen(Screen.ScreenType.START); flipToScreen(Screen.ScreenType.START);
} }
public void checkForAlreadyUnlockedPlayerShapes() {
alreadyUnlockedPlayerShapes.clear();
for (PlayerShape shape : PlayerShape.values()) {
Task task = shape.getUnlockTask();
task.update(levelManager);
if (task.isConditionFulfilled())
alreadyUnlockedPlayerShapes.add(shape);
}
}
public void showNewFinishedPlayerShapeTasks() {
List<PlayerShape> newUnlockedShapes = new ArrayList<>();
for (PlayerShape shape : PlayerShape.values()) {
Task task = shape.getUnlockTask();
task.update(levelManager);
if (task.isConditionFulfilled() && !alreadyUnlockedPlayerShapes.contains(shape)) {
alreadyUnlockedPlayerShapes.add(shape);
newUnlockedShapes.add(shape);
}
}
if (!newUnlockedShapes.isEmpty())
onTasksCompleted(newUnlockedShapes);
}
public void onWorldSelected(LevelPack levelPack) { public void onWorldSelected(LevelPack levelPack) {
levelsScreen.onLevelPackSelected(levelPack); levelsScreen.onLevelPackSelected(levelPack);
} }
@ -158,7 +189,9 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
} }
@Override @Override
public void onLvUp(final int level) { public void onLvUp(final int level, boolean showLvUpMessage) {
dataStorageHandler.writeUserData(user);
if (showLvUpMessage) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -167,6 +200,7 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
}); });
tutorialManager.onLvUp(user); tutorialManager.onLvUp(user);
} }
}
public void onTasksCompleted(final List<PlayerShape> shapes) { public void onTasksCompleted(final List<PlayerShape> shapes) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@ -178,7 +212,7 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
} }
public void showTutorial(final List<BreakPoint> breakPoints) { public void showTutorial(final List<BreakPoint> breakPoints) {
if(!gameScreen.isLevelFinished()){ if (!gameScreen.isLevelFinished()) {
gameScreen.setGamePausedWithoutMenu(); gameScreen.setGamePausedWithoutMenu();
} }
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {

View File

@ -14,8 +14,6 @@ import de.frajul.endlessroll.entities.collectables.Star;
import de.frajul.endlessroll.entities.collision.CollisionManager; import de.frajul.endlessroll.entities.collision.CollisionManager;
import de.frajul.endlessroll.entities.particles.Firework; import de.frajul.endlessroll.entities.particles.Firework;
import de.frajul.endlessroll.entities.particles.ParticleSystem; import de.frajul.endlessroll.entities.particles.ParticleSystem;
import de.frajul.endlessroll.entities.shapes.PlayerShape;
import de.frajul.endlessroll.entities.shapes.Task;
import de.frajul.endlessroll.entities.textures.TexturePack; import de.frajul.endlessroll.entities.textures.TexturePack;
import de.frajul.endlessroll.entities.tools.ToolType; import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.levels.Level; import de.frajul.endlessroll.levels.Level;
@ -198,7 +196,7 @@ public class Game extends Rendering<GameScene> {
currentTool = toolType; currentTool = toolType;
} }
public void pauseWithoutMenu(){ public void pauseWithoutMenu() {
gameState = GameState.PAUSED; gameState = GameState.PAUSED;
} }
@ -211,7 +209,7 @@ public class Game extends Rendering<GameScene> {
gameState = GameState.PAUSED; gameState = GameState.PAUSED;
} }
public void onGoalMessageKeyBack(){ public void onGoalMessageKeyBack() {
viewManager.onGoalMessageKeyBack(); viewManager.onGoalMessageKeyBack();
} }
@ -239,15 +237,6 @@ public class Game extends Rendering<GameScene> {
} }
private void onGoalReached() { private void onGoalReached() {
List<PlayerShape> alreadyUnlockedShapes = new ArrayList<>();
for (PlayerShape shape : PlayerShape.values()) {
Task task = shape.getUnlockTask();
task.update(gameActivity.getLevelManager());
if (task.isConditionFulfilled())
alreadyUnlockedShapes.add(shape);
}
gameState = GameState.LEVEL_FINISHED; gameState = GameState.LEVEL_FINISHED;
if (!level.isFinished()) if (!level.isFinished())
gameActivity.getUser().gainLvFinishedEp(); gameActivity.getUser().gainLvFinishedEp();
@ -275,15 +264,7 @@ public class Game extends Rendering<GameScene> {
database.open(); database.open();
database.writeLevelProgress(level); database.writeLevelProgress(level);
List<PlayerShape> newUnlockedShapes = new ArrayList<>(); gameActivity.showNewFinishedPlayerShapeTasks();
for (PlayerShape shape : PlayerShape.values()) {
Task task = shape.getUnlockTask();
task.update(gameActivity.getLevelManager());
if (task.isConditionFulfilled() && !alreadyUnlockedShapes.contains(shape))
newUnlockedShapes.add(shape);
}
if (!newUnlockedShapes.isEmpty())
gameActivity.onTasksCompleted(newUnlockedShapes);
Level nextLevel = levelPack.getNextLevel(level); Level nextLevel = levelPack.getNextLevel(level);
if (nextLevel != null) { if (nextLevel != null) {

View File

@ -7,6 +7,7 @@ import android.widget.ToggleButton;
import de.frajul.endlessroll.R; import de.frajul.endlessroll.R;
import de.frajul.endlessroll.main.GameActivity; import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.views.ResetConfirmDialog;
import de.frajul.endlessroll.views.TopBar; import de.frajul.endlessroll.views.TopBar;
/** /**
@ -19,6 +20,8 @@ public class SettingsScreen extends Screen<LinearLayout> implements View.OnClick
private ToggleButton soundToggle; private ToggleButton soundToggle;
private Button resetButton; private Button resetButton;
private ResetConfirmDialog resetConfirmDialog;
public SettingsScreen(GameActivity gameActivity) { public SettingsScreen(GameActivity gameActivity) {
super(ScreenType.SETTINGS, gameActivity, R.layout.settings); super(ScreenType.SETTINGS, gameActivity, R.layout.settings);
topBar = super.createTopBar(R.id.settings_topbar); topBar = super.createTopBar(R.id.settings_topbar);
@ -26,6 +29,8 @@ public class SettingsScreen extends Screen<LinearLayout> implements View.OnClick
soundToggle.setOnClickListener(this); soundToggle.setOnClickListener(this);
resetButton = (Button) layout.findViewById(R.id.settings_reset); resetButton = (Button) layout.findViewById(R.id.settings_reset);
resetButton.setOnClickListener(this); resetButton.setOnClickListener(this);
resetConfirmDialog = new ResetConfirmDialog(gameActivity, this);
} }
@Override @Override
@ -37,6 +42,10 @@ public class SettingsScreen extends Screen<LinearLayout> implements View.OnClick
@Override @Override
public void onBackKeyDown() { public void onBackKeyDown() {
//ResetButton is disabled if caller is GAME, because shortMenu or GoalMessage would still be visible on next level start
if (super.caller == ScreenType.LEVELS || super.caller == ScreenType.GAME) {
super.caller = ScreenType.WORLDS;
}
flipToCaller(); flipToCaller();
} }
@ -45,7 +54,7 @@ public class SettingsScreen extends Screen<LinearLayout> implements View.OnClick
if (v.equals(soundToggle)) { if (v.equals(soundToggle)) {
gameActivity.getSoundManager().setSoundOn(soundToggle.isChecked()); gameActivity.getSoundManager().setSoundOn(soundToggle.isChecked());
} else if (v.equals(resetButton)) { } else if (v.equals(resetButton)) {
gameActivity.resetData(); resetConfirmDialog.show();
} }
} }
} }

View File

@ -1,19 +1,17 @@
package de.frajul.endlessroll.main.screens; package de.frajul.endlessroll.main.screens;
import android.app.AlertDialog;
import android.app.Dialog;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.support.annotation.IdRes; import android.support.annotation.IdRes;
import android.view.View; import android.view.View;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.Button; import android.widget.Button;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.ToggleButton;
import de.frajul.endlessroll.R; import de.frajul.endlessroll.R;
import de.frajul.endlessroll.main.GameActivity; import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.MyGlSurfaceView; import de.frajul.endlessroll.main.MyGlSurfaceView;
import de.frajul.endlessroll.rendering.Rendering; import de.frajul.endlessroll.rendering.Rendering;
import de.frajul.endlessroll.sqlDatabase.MyDatabase;
import de.frajul.endlessroll.views.ExitConfirmDialog; import de.frajul.endlessroll.views.ExitConfirmDialog;
/** /**
@ -26,6 +24,7 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
private Button play; private Button play;
private Button unlockLevels; private Button unlockLevels;
private Button gain90EP; private Button gain90EP;
private Button finishFirstWorld;
private Button toGlTestScreen; private Button toGlTestScreen;
private Button settings; private Button settings;
@ -39,6 +38,7 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
play.startAnimation(AnimationUtils.loadAnimation(gameActivity, R.anim.rotate)); play.startAnimation(AnimationUtils.loadAnimation(gameActivity, R.anim.rotate));
unlockLevels = createButton(R.id.startscreen_unlock_levels, typeface); unlockLevels = createButton(R.id.startscreen_unlock_levels, typeface);
gain90EP = createButton(R.id.startscreen_gain_90_ep, typeface); gain90EP = createButton(R.id.startscreen_gain_90_ep, typeface);
finishFirstWorld = createButton(R.id.startscreen_finish_world_1, typeface);
toGlTestScreen = createButton(R.id.startscreen_to_gl_test_screen, typeface); toGlTestScreen = createButton(R.id.startscreen_to_gl_test_screen, typeface);
settings = (Button) layout.findViewById(R.id.startscreen_settings); settings = (Button) layout.findViewById(R.id.startscreen_settings);
settings.setOnClickListener(this); settings.setOnClickListener(this);
@ -75,10 +75,27 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
gameActivity.flipToScreen(ScreenType.SETTINGS); gameActivity.flipToScreen(ScreenType.SETTINGS);
glView.setCurrentRendering(null); glView.setCurrentRendering(null);
} else if (v.equals(gain90EP)) { } else if (v.equals(gain90EP)) {
gameActivity.getUser().gainEp(90); gameActivity.getUser().gainEp(90, true);
} else if (v.equals(unlockLevels)) { } else if (v.equals(unlockLevels)) {
gameActivity.getLevelManager().unlockAllLevels(); gameActivity.getLevelManager().unlockAllLevels();
gameActivity.getLevelManager().unlockAllPacks(); gameActivity.getLevelManager().unlockAllPacks();
MyDatabase database = gameActivity.getDataStorageHandler().getDatabase();
database.open();
database.writeAllLevelAndPackStatus(gameActivity.getLevelManager());
database.close();
} else if (v.equals(finishFirstWorld)) {
gameActivity.resetData();
gameActivity.getUser().gainEp(320, false);
gameActivity.getLevelManager().finishFirstPack();
gameActivity.showNewFinishedPlayerShapeTasks();
gameActivity.getTutorialManager().getToolShopTutorial().setFinished(true);
gameActivity.getDataStorageHandler().writeUserData(gameActivity.getUser());
gameActivity.getDataStorageHandler().writeToolShopTutorialFinished(true);
MyDatabase database = gameActivity.getDataStorageHandler().getDatabase();
database.open();
database.writeAllLevelAndPackStatus(gameActivity.getLevelManager());
database.close();
} else if (v.equals(toGlTestScreen)) } else if (v.equals(toGlTestScreen))
gameActivity.flipToScreen(ScreenType.GL_TEST); gameActivity.flipToScreen(ScreenType.GL_TEST);
} }

View File

@ -18,7 +18,6 @@ import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.main.DataStorageHandler; import de.frajul.endlessroll.main.DataStorageHandler;
import de.frajul.endlessroll.main.GameActivity; import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.tutorial.ToolShopTutorial; import de.frajul.endlessroll.main.tutorial.ToolShopTutorial;
import de.frajul.endlessroll.user.LevelUpBounties;
import de.frajul.endlessroll.user.ToolSlotSettings; import de.frajul.endlessroll.user.ToolSlotSettings;
import de.frajul.endlessroll.views.ToolInspector; import de.frajul.endlessroll.views.ToolInspector;
import de.frajul.endlessroll.views.ToolOfferSlot; import de.frajul.endlessroll.views.ToolOfferSlot;
@ -98,7 +97,8 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
toolSlotView.setImageResource(toolSlot.getDrawable()); toolSlotView.setImageResource(toolSlot.getDrawable());
} }
for (ToolOfferSlot toolOfferSlot : toolOfferSlots) { for (ToolOfferSlot toolOfferSlot : toolOfferSlots) {
boolean locked = gameActivity.getUser().getLevelUpBounties().isToolLocked(toolOfferSlot.getToolType()); boolean locked = gameActivity.getUser().getLevelUpBounties()
.isToolLocked(toolOfferSlot.getToolType());
toolOfferSlot.setLocked(locked); toolOfferSlot.setLocked(locked);
toolOfferSlot.updateBackgroundColor(); toolOfferSlot.updateBackgroundColor();
} }
@ -110,6 +110,7 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
gameActivity.getUser().increaseStarCount(-price, false); gameActivity.getUser().increaseStarCount(-price, false);
topBar.update(); topBar.update();
DataStorageHandler dataStorageHandler = gameActivity.getDataStorageHandler(); DataStorageHandler dataStorageHandler = gameActivity.getDataStorageHandler();
dataStorageHandler.writeUserData(gameActivity.getUser());
dataStorageHandler.getDatabase().open(); dataStorageHandler.getDatabase().open();
dataStorageHandler.getDatabase().writeToolData(); dataStorageHandler.getDatabase().writeToolData();
dataStorageHandler.getDatabase().close(); dataStorageHandler.getDatabase().close();
@ -124,6 +125,7 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
gameActivity.getUser().increaseEnergyCount(-price, false); gameActivity.getUser().increaseEnergyCount(-price, false);
topBar.update(); topBar.update();
DataStorageHandler dataStorageHandler = gameActivity.getDataStorageHandler(); DataStorageHandler dataStorageHandler = gameActivity.getDataStorageHandler();
dataStorageHandler.writeUserData(gameActivity.getUser());
dataStorageHandler.getDatabase().open(); dataStorageHandler.getDatabase().open();
dataStorageHandler.getDatabase().writeToolData(); dataStorageHandler.getDatabase().writeToolData();
dataStorageHandler.getDatabase().close(); dataStorageHandler.getDatabase().close();
@ -139,6 +141,8 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
private void onToolEquipped(int index) { private void onToolEquipped(int index) {
slotSettings.changeToolSlotType(index, selectedToolOfferSlot.getToolType()); slotSettings.changeToolSlotType(index, selectedToolOfferSlot.getToolType());
DataStorageHandler dataStorageHandler = gameActivity.getDataStorageHandler();
dataStorageHandler.writeUserData(gameActivity.getUser());
for (int i = 0; i < toolSlotViews.size(); i++) { for (int i = 0; i < toolSlotViews.size(); i++) {
ToolSlot toolSlot = slotSettings.get(i); ToolSlot toolSlot = slotSettings.get(i);
ImageView view = toolSlotViews.get(i); ImageView view = toolSlotViews.get(i);
@ -147,9 +151,9 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
tutorial.onToolEquipped(); tutorial.onToolEquipped();
} }
public void stopTutorialAnimations(){ public void stopTutorialAnimations() {
for (ToolOfferSlot toolOfferSlot : toolOfferSlots) for (ToolOfferSlot toolOfferSlot : toolOfferSlots)
if(toolOfferSlot.getToolType() == ToolType.SPRING) if (toolOfferSlot.getToolType() == ToolType.SPRING)
toolOfferSlot.getLayout().clearAnimation(); toolOfferSlot.getLayout().clearAnimation();
toolInspector.clearPriceButtonAnimation(); toolInspector.clearPriceButtonAnimation();
@ -157,21 +161,21 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
toolSlotViews.get(0).clearAnimation(); toolSlotViews.get(0).clearAnimation();
} }
public void tutorialStartSpringOfferSlotPulse(){ public void tutorialStartSpringOfferSlotPulse() {
for (ToolOfferSlot toolOfferSlot : toolOfferSlots) for (ToolOfferSlot toolOfferSlot : toolOfferSlots)
if(toolOfferSlot.getToolType() == ToolType.SPRING) if (toolOfferSlot.getToolType() == ToolType.SPRING)
toolOfferSlot.getLayout().startAnimation(pulse); toolOfferSlot.getLayout().startAnimation(pulse);
} }
public void tutorialStartSpringBuyButtonPulse(){ public void tutorialStartSpringBuyButtonPulse() {
toolInspector.startPriceButtonAnimation(pulse); toolInspector.startPriceButtonAnimation(pulse);
} }
public void tutorialStartSpringToolSlotPulse(){ public void tutorialStartSpringToolSlotPulse() {
toolSlotViews.get(0).startAnimation(pulse); toolSlotViews.get(0).startAnimation(pulse);
} }
public void writeToolShopTutorialIsFinished(){ public void writeToolShopTutorialIsFinished() {
gameActivity.getDataStorageHandler().writeToolShopTutorialFinished(true); gameActivity.getDataStorageHandler().writeToolShopTutorialFinished(true);
} }
@ -179,7 +183,6 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
@Override @Override
public void onBackKeyDown() { public void onBackKeyDown() {
stopTutorialAnimations(); stopTutorialAnimations();
gameActivity.getDataStorageHandler().writeUserData(gameActivity.getUser());
flipToCaller(); flipToCaller();
} }

View File

@ -1,5 +1,7 @@
package de.frajul.endlessroll.main.tutorial; package de.frajul.endlessroll.main.tutorial;
import java.util.Arrays;
import de.frajul.endlessroll.entities.tools.ToolType; import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.main.GameActivity; import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.screens.Screen; import de.frajul.endlessroll.main.screens.Screen;
@ -16,12 +18,14 @@ public class ToolShopTutorial {
private GameActivity gameActivity; private GameActivity gameActivity;
private LevelUpBounties levelUpBounties; private LevelUpBounties levelUpBounties;
private BreakPoint springEquipped;
private ToolShopScreen toolShopScreen; private ToolShopScreen toolShopScreen;
private boolean finished = false; private boolean finished = false;
public ToolShopTutorial(GameActivity gameActivity) { public ToolShopTutorial(GameActivity gameActivity, BreakPoint springEquipped) {
this.gameActivity = gameActivity; this.gameActivity = gameActivity;
levelUpBounties = new LevelUpBounties(0); levelUpBounties = new LevelUpBounties(0);
this.springEquipped = springEquipped;
} }
public void setToolShopScreen(ToolShopScreen toolShopScreen) { public void setToolShopScreen(ToolShopScreen toolShopScreen) {
@ -49,10 +53,11 @@ public class ToolShopTutorial {
} }
public void onToolEquipped() { public void onToolEquipped() {
if (toolShopScreen.getSelectedToolType() == ToolType.SPRING) { if (!finished && toolShopScreen.getSelectedToolType() == ToolType.SPRING) {
toolShopScreen.stopTutorialAnimations(); toolShopScreen.stopTutorialAnimations();
finished = true; finished = true;
toolShopScreen.writeToolShopTutorialIsFinished(); toolShopScreen.writeToolShopTutorialIsFinished();
gameActivity.showTutorial(Arrays.asList(springEquipped));
} }
} }

View File

@ -21,6 +21,12 @@ public class Tutorial {
this.breakPoints = Arrays.asList(breakPoints); this.breakPoints = Arrays.asList(breakPoints);
} }
public void setFinished() {
for (BreakPoint breakPoint : breakPoints)
breakPoint.setAlreadyShown(true);
currentBreakPoints.clear();
}
public void reset() { public void reset() {
for (BreakPoint breakPoint : breakPoints) for (BreakPoint breakPoint : breakPoints)
breakPoint.setAlreadyShown(false); breakPoint.setAlreadyShown(false);

View File

@ -39,10 +39,12 @@ public class TutorialManager {
toToolShopTutorial = new Tutorial(gameActivity, toToolShopTutorial = new Tutorial(gameActivity,
new BreakPoint(BreakPoint.NONE_X, R.string.tutorial_leveled_up_to_toolshop, new BreakPoint(BreakPoint.NONE_X, R.string.tutorial_leveled_up_to_toolshop,
R.drawable.tutorial_to_toolshop)); R.drawable.tutorial_to_toolshop));
toolShopTutorial = new ToolShopTutorial(gameActivity); toolShopTutorial = new ToolShopTutorial(gameActivity,
new BreakPoint(BreakPoint.NONE_X, R.string.tutorial_spring_equipped, -1));
switchToolsTutorial = new Tutorial(gameActivity, switchToolsTutorial = new Tutorial(gameActivity,
new BreakPoint(0, R.string.tutorial_switch_tools_two_neccessary, -1), new BreakPoint(0, R.string.tutorial_switch_tools_two_neccessary, -1),
new BreakPoint(0, R.string.tutorial_switch_tools_switch, R.drawable.tutorial_switch_tools)); new BreakPoint(0, R.string.tutorial_switch_tools_switch,
R.drawable.tutorial_switch_tools));
} }
public void update(Level level, float playerProgress) { public void update(Level level, float playerProgress) {

View File

@ -6,6 +6,7 @@ import android.database.Cursor;
import de.frajul.endlessroll.entities.tools.ToolType; import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.levels.Level; import de.frajul.endlessroll.levels.Level;
import de.frajul.endlessroll.levels.LevelManager;
import de.frajul.endlessroll.levels.LevelPack; import de.frajul.endlessroll.levels.LevelPack;
/** /**
@ -55,6 +56,15 @@ public class MyDatabase extends DatabaseAdapter {
super.update(levelPackTable, values, levelPackIdColumn, levelPack.getId()); super.update(levelPackTable, values, levelPackIdColumn, levelPack.getId());
} }
public void writeAllLevelAndPackStatus(LevelManager levelManager){
for(LevelPack levelPack : levelManager){
writeLevelPackLocked(levelPack);
for(Level level: levelPack.getLevels()){
writeLevelProgress(level);
}
}
}
public void readLevelPackLocked(LevelPack levelPack) { public void readLevelPackLocked(LevelPack levelPack) {
Cursor cursor = super.getCursor(levelPackTable, levelPackIdColumn, levelPack.getId()); Cursor cursor = super.getCursor(levelPackTable, levelPackIdColumn, levelPack.getId());
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {

View File

@ -8,7 +8,7 @@ import de.frajul.endlessroll.entities.shapes.PlayerShape;
public class User { public class User {
public interface LvUpListener { public interface LvUpListener {
public void onLvUp(int level); public void onLvUp(int level, boolean showLvUpMessage);
} }
private final int LV_DONE_EP = 20; private final int LV_DONE_EP = 20;
@ -53,8 +53,8 @@ public class User {
public void increaseStarCount(int starCount, boolean gainEp) { public void increaseStarCount(int starCount, boolean gainEp) {
this.starCount += starCount; this.starCount += starCount;
if(gainEp) if (gainEp)
gainEp(STAR_EP * starCount); gainEp(STAR_EP * starCount, true);
} }
public void onEnergyCollected() { public void onEnergyCollected() {
@ -63,23 +63,23 @@ public class User {
public void increaseEnergyCount(int energyCount, boolean gainEp) { public void increaseEnergyCount(int energyCount, boolean gainEp) {
this.energyCount += energyCount; this.energyCount += energyCount;
if(gainEp) if (gainEp)
gainEp(ENERGY_EP * energyCount); gainEp(ENERGY_EP * energyCount, true);
} }
public void gainLvFinishedEp() { public void gainLvFinishedEp() {
gainEp(LV_DONE_EP); gainEp(LV_DONE_EP, true);
} }
public void gainEp(int amount) { public void gainEp(int amount, boolean showLvUpMessage) {
ep += amount; ep += amount;
if (ep >= 100) { while (ep >= 100) {
ep -= 100; ep -= 100;
levelUp(); levelUp(showLvUpMessage);
} }
} }
private void levelUp() { private void levelUp(boolean showLvUpMessage) {
level++; level++;
levelUpBounties.loadAllForLevel(level); levelUpBounties.loadAllForLevel(level);
@ -89,7 +89,7 @@ public class User {
increaseStarCount(bounty.getStarCount(), false); increaseStarCount(bounty.getStarCount(), false);
increaseEnergyCount(bounty.getEnergyCount(), false); increaseEnergyCount(bounty.getEnergyCount(), false);
} }
lvUpListener.onLvUp(level); lvUpListener.onLvUp(level, showLvUpMessage);
} }
public int getEp() { public int getEp() {

View File

@ -0,0 +1,55 @@
package de.frajul.endlessroll.views;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.screens.SettingsScreen;
/**
* Created by Julian on 31.10.2017.
*/
public class ResetConfirmDialog extends Dialog implements View.OnClickListener {
private GameActivity gameActivity;
private SettingsScreen settingsScreen;
private Button yesButton;
private Button noButton;
public ResetConfirmDialog(GameActivity gameActivity, SettingsScreen settingsScreen) {
super(gameActivity);
this.gameActivity = gameActivity;
this.settingsScreen = settingsScreen;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.exit_confirm_dialog);
TextView textView = (TextView) findViewById(R.id.exit_confirm_dialog_textview);
textView.setTypeface(gameActivity.getTypeface());
textView.setText(R.string.reset_dialog_question);
noButton = (Button) findViewById(R.id.exit_confirm_dialog_no_button);
noButton.setTypeface(gameActivity.getTypeface());
noButton.setOnClickListener(this);
yesButton = (Button) findViewById(R.id.exit_confirm_dialog_yes_button);
yesButton.setTypeface(gameActivity.getTypeface());
yesButton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
dismiss();
if (v.equals(yesButton)) {
gameActivity.resetData();
settingsScreen.prepareToBeShown();
}
}
}

View File

@ -47,6 +47,18 @@
android:text="@string/start_screen_gain_90_ep" android:text="@string/start_screen_gain_90_ep"
android:visibility="visible"/> android:visibility="visible"/>
<Button
android:id="@+id/startscreen_finish_world_1"
style="@style/GameButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:text="@string/start_screen_finish_world_1"
android:visibility="visible"/>
<Button <Button
android:id="@+id/startscreen_to_gl_test_screen" android:id="@+id/startscreen_to_gl_test_screen"
style="@style/GameButton" style="@style/GameButton"

View File

@ -30,6 +30,7 @@
<string name="start_screen_play">Play</string> <string name="start_screen_play">Play</string>
<string name="start_screen_unlock_all_levels">Unlock all levels (Yes! It\'s magic!)</string> <string name="start_screen_unlock_all_levels">Unlock all levels (Yes! It\'s magic!)</string>
<string name="start_screen_gain_90_ep">Gain 90 ep (Nope! No magic at all!)</string> <string name="start_screen_gain_90_ep">Gain 90 ep (Nope! No magic at all!)</string>
<string name="start_screen_finish_world_1">Finish the first world!</string>
<string name="start_screen_to_gl_test_screen">Test GL Stuff!!!</string> <string name="start_screen_to_gl_test_screen">Test GL Stuff!!!</string>
<string name="tool_upgrade_title_placeholder">Time (Lv12)</string> <string name="tool_upgrade_title_placeholder">Time (Lv12)</string>
<string name="topbar_level_placeholder">Level: 24</string> <string name="topbar_level_placeholder">Level: 24</string>
@ -97,6 +98,7 @@
<string name="exit_confirm_dialog_yes">Yes</string> <string name="exit_confirm_dialog_yes">Yes</string>
<string name="exit_confirm_dialog_no">No</string> <string name="exit_confirm_dialog_no">No</string>
<string name="exit_confirm_dialog_question">Do you really want to exit the game?</string> <string name="exit_confirm_dialog_question">Do you really want to exit the game?</string>
<string name="reset_dialog_question">Do you really want to reset ALL your progress?</string>
<string name="tutorial_placeholder">This is a multiline placeholder\nfor all the tutorials I made!!!\nAwesome! - Isn\'t it?</string> <string name="tutorial_placeholder">This is a multiline placeholder\nfor all the tutorials I made!!!\nAwesome! - Isn\'t it?</string>
<string name="tutorial_welcome">Welcome to Endless Roll!\nHave fun!</string> <string name="tutorial_welcome">Welcome to Endless Roll!\nHave fun!</string>
@ -106,6 +108,7 @@
<string name="tutorial_place_ramp_air">You can even set a Tool in mid-air.\nTime carefully!</string> <string name="tutorial_place_ramp_air">You can even set a Tool in mid-air.\nTime carefully!</string>
<string name="tutorial_place_ramp_air_2">Now try again!</string> <string name="tutorial_place_ramp_air_2">Now try again!</string>
<string name="tutorial_leveled_up_to_toolshop">Congratulations! You have leveled up!\nNow go to the toolshop</string> <string name="tutorial_leveled_up_to_toolshop">Congratulations! You have leveled up!\nNow go to the toolshop</string>
<string name="tutorial_spring_equipped">Well done! Now you can start the next level</string>
<string name="tutorial_switch_tools_two_neccessary">For this level you will need two tools equipped</string> <string name="tutorial_switch_tools_two_neccessary">For this level you will need two tools equipped</string>
<string name="tutorial_switch_tools_switch">To select a tool just click on it</string> <string name="tutorial_switch_tools_switch">To select a tool just click on it</string>
<string name="tutorial_toolshop_welcome">Welcome to the toolshop!\nHere you can buy and upgrade all tools and you can customize your toolbar.</string> <string name="tutorial_toolshop_welcome">Welcome to the toolshop!\nHere you can buy and upgrade all tools and you can customize your toolbar.</string>