Removed animations from countdown

Removed player-speed-textView
This commit is contained in:
= 2018-03-21 16:15:05 +01:00
parent e9142119a0
commit 2b68b1ba7b
10 changed files with 307 additions and 364 deletions

View File

@ -494,64 +494,64 @@ public final class R {
public static final int end_padder = 0x7f08002d;
public static final int expand_activities_button = 0x7f08002e;
public static final int expanded_menu = 0x7f08002f;
public static final int home = 0x7f080048;
public static final int homeAsUp = 0x7f080049;
public static final int icon = 0x7f08004a;
public static final int ifRoom = 0x7f08004b;
public static final int image = 0x7f08004c;
public static final int info = 0x7f08004d;
public static final int line1 = 0x7f08005a;
public static final int line3 = 0x7f08005b;
public static final int listMode = 0x7f08005d;
public static final int list_item = 0x7f08005e;
public static final int media_actions = 0x7f08005f;
public static final int middle = 0x7f080060;
public static final int multiply = 0x7f080061;
public static final int never = 0x7f080062;
public static final int none = 0x7f080063;
public static final int normal = 0x7f080064;
public static final int parentPanel = 0x7f080065;
public static final int progress_circular = 0x7f080069;
public static final int progress_horizontal = 0x7f08006a;
public static final int radio = 0x7f08006b;
public static final int screen = 0x7f08006c;
public static final int scrollIndicatorDown = 0x7f08006d;
public static final int scrollIndicatorUp = 0x7f08006e;
public static final int scrollView = 0x7f08006f;
public static final int search_badge = 0x7f080070;
public static final int search_bar = 0x7f080071;
public static final int search_button = 0x7f080072;
public static final int search_close_btn = 0x7f080073;
public static final int search_edit_frame = 0x7f080074;
public static final int search_go_btn = 0x7f080075;
public static final int search_mag_icon = 0x7f080076;
public static final int search_plate = 0x7f080077;
public static final int search_src_text = 0x7f080078;
public static final int search_voice_btn = 0x7f080079;
public static final int select_dialog_listview = 0x7f08007a;
public static final int shortcut = 0x7f08008e;
public static final int showCustom = 0x7f080093;
public static final int showHome = 0x7f080094;
public static final int showTitle = 0x7f080095;
public static final int spacer = 0x7f080096;
public static final int split_action_bar = 0x7f080097;
public static final int src_atop = 0x7f080098;
public static final int src_in = 0x7f080099;
public static final int src_over = 0x7f08009a;
public static final int status_bar_latest_event_content = 0x7f0800a0;
public static final int submit_area = 0x7f0800a1;
public static final int tabMode = 0x7f0800a2;
public static final int text = 0x7f0800a4;
public static final int text2 = 0x7f0800a5;
public static final int textSpacerNoButtons = 0x7f0800a6;
public static final int time = 0x7f0800a7;
public static final int title = 0x7f0800a8;
public static final int title_template = 0x7f0800a9;
public static final int topPanel = 0x7f0800c1;
public static final int up = 0x7f0800d3;
public static final int useLogo = 0x7f0800d4;
public static final int withText = 0x7f0800d5;
public static final int wrap_content = 0x7f0800de;
public static final int home = 0x7f080047;
public static final int homeAsUp = 0x7f080048;
public static final int icon = 0x7f080049;
public static final int ifRoom = 0x7f08004a;
public static final int image = 0x7f08004b;
public static final int info = 0x7f08004c;
public static final int line1 = 0x7f080059;
public static final int line3 = 0x7f08005a;
public static final int listMode = 0x7f08005c;
public static final int list_item = 0x7f08005d;
public static final int media_actions = 0x7f08005e;
public static final int middle = 0x7f08005f;
public static final int multiply = 0x7f080060;
public static final int never = 0x7f080061;
public static final int none = 0x7f080062;
public static final int normal = 0x7f080063;
public static final int parentPanel = 0x7f080064;
public static final int progress_circular = 0x7f080068;
public static final int progress_horizontal = 0x7f080069;
public static final int radio = 0x7f08006a;
public static final int screen = 0x7f08006b;
public static final int scrollIndicatorDown = 0x7f08006c;
public static final int scrollIndicatorUp = 0x7f08006d;
public static final int scrollView = 0x7f08006e;
public static final int search_badge = 0x7f08006f;
public static final int search_bar = 0x7f080070;
public static final int search_button = 0x7f080071;
public static final int search_close_btn = 0x7f080072;
public static final int search_edit_frame = 0x7f080073;
public static final int search_go_btn = 0x7f080074;
public static final int search_mag_icon = 0x7f080075;
public static final int search_plate = 0x7f080076;
public static final int search_src_text = 0x7f080077;
public static final int search_voice_btn = 0x7f080078;
public static final int select_dialog_listview = 0x7f080079;
public static final int shortcut = 0x7f08008d;
public static final int showCustom = 0x7f080092;
public static final int showHome = 0x7f080093;
public static final int showTitle = 0x7f080094;
public static final int spacer = 0x7f080095;
public static final int split_action_bar = 0x7f080096;
public static final int src_atop = 0x7f080097;
public static final int src_in = 0x7f080098;
public static final int src_over = 0x7f080099;
public static final int status_bar_latest_event_content = 0x7f08009f;
public static final int submit_area = 0x7f0800a0;
public static final int tabMode = 0x7f0800a1;
public static final int text = 0x7f0800a3;
public static final int text2 = 0x7f0800a4;
public static final int textSpacerNoButtons = 0x7f0800a5;
public static final int time = 0x7f0800a6;
public static final int title = 0x7f0800a7;
public static final int title_template = 0x7f0800a8;
public static final int topPanel = 0x7f0800c0;
public static final int up = 0x7f0800d2;
public static final int useLogo = 0x7f0800d3;
public static final int withText = 0x7f0800d4;
public static final int wrap_content = 0x7f0800dd;
}
public static final class integer {
public static final int abc_config_activityDefaultDur = 0x7f090000;

File diff suppressed because one or more lines are too long

View File

@ -8,18 +8,17 @@ int anim abc_slide_in_bottom 0x7f010006
int anim abc_slide_in_top 0x7f010007
int anim abc_slide_out_bottom 0x7f010008
int anim abc_slide_out_top 0x7f010009
int anim countdown 0x7f01000a
int anim decrease 0x7f01000b
int anim fade_in 0x7f01000c
int anim fade_out 0x7f01000d
int anim fade_out_accelerating 0x7f01000e
int anim pulse 0x7f01000f
int anim rotate 0x7f010010
int anim scale_up 0x7f010011
int anim shape_button_rotation 0x7f010012
int anim slide_in_left 0x7f010013
int anim slide_in_right 0x7f010014
int anim slide_in_top 0x7f010015
int anim decrease 0x7f01000a
int anim fade_in 0x7f01000b
int anim fade_out 0x7f01000c
int anim fade_out_accelerating 0x7f01000d
int anim pulse 0x7f01000e
int anim rotate 0x7f01000f
int anim scale_up 0x7f010010
int anim shape_button_rotation 0x7f010011
int anim slide_in_left 0x7f010012
int anim slide_in_right 0x7f010013
int anim slide_in_top 0x7f010014
int array world_names 0x7f020000
int attr actionBarDivider 0x7f030000
int attr actionBarItemBackground 0x7f030001
@ -626,171 +625,170 @@ int id game_over_message_topbar 0x7f080036
int id game_over_message_try_again 0x7f080037
int id game_pausebutton 0x7f080038
int id game_playerprogress 0x7f080039
int id game_playerspeed 0x7f08003a
int id game_shortmenu 0x7f08003b
int id game_toolbuttonbar 0x7f08003c
int id goal_message_bottom_layout 0x7f08003d
int id goal_message_levelbutton_energy 0x7f08003e
int id goal_message_levelbutton_star1 0x7f08003f
int id goal_message_levelbutton_star2 0x7f080040
int id goal_message_levelbutton_star3 0x7f080041
int id goal_message_levelbutton_textview 0x7f080042
int id goal_message_next_level 0x7f080043
int id goal_message_restart 0x7f080044
int id goal_message_title 0x7f080045
int id goal_message_to_menu 0x7f080046
int id goal_message_topbar 0x7f080047
int id home 0x7f080048
int id homeAsUp 0x7f080049
int id icon 0x7f08004a
int id ifRoom 0x7f08004b
int id image 0x7f08004c
int id info 0x7f08004d
int id levelbutton_energy 0x7f08004e
int id levelbutton_lock 0x7f08004f
int id levelbutton_star1 0x7f080050
int id levelbutton_star2 0x7f080051
int id levelbutton_star3 0x7f080052
int id levelbutton_textview 0x7f080053
int id levels_bottom_row 0x7f080054
int id levels_top_row 0x7f080055
int id levels_topbar 0x7f080056
int id levelup_level 0x7f080057
int id levelup_text 0x7f080058
int id levelup_unlocklist 0x7f080059
int id line1 0x7f08005a
int id line3 0x7f08005b
int id linearLayout4 0x7f08005c
int id listMode 0x7f08005d
int id list_item 0x7f08005e
int id media_actions 0x7f08005f
int id middle 0x7f080060
int id multiply 0x7f080061
int id never 0x7f080062
int id none 0x7f080063
int id normal 0x7f080064
int id parentPanel 0x7f080065
int id price_button_currency 0x7f080066
int id price_button_price 0x7f080067
int id price_button_title 0x7f080068
int id progress_circular 0x7f080069
int id progress_horizontal 0x7f08006a
int id radio 0x7f08006b
int id screen 0x7f08006c
int id scrollIndicatorDown 0x7f08006d
int id scrollIndicatorUp 0x7f08006e
int id scrollView 0x7f08006f
int id search_badge 0x7f080070
int id search_bar 0x7f080071
int id search_button 0x7f080072
int id search_close_btn 0x7f080073
int id search_edit_frame 0x7f080074
int id search_go_btn 0x7f080075
int id search_mag_icon 0x7f080076
int id search_plate 0x7f080077
int id search_src_text 0x7f080078
int id search_voice_btn 0x7f080079
int id select_dialog_listview 0x7f08007a
int id settings_credits 0x7f08007b
int id settings_music_label 0x7f08007c
int id settings_musictoggle 0x7f08007d
int id settings_reset 0x7f08007e
int id settings_sounds_label 0x7f08007f
int id settings_soundtoggle 0x7f080080
int id settings_topbar 0x7f080081
int id shape_button_button 0x7f080082
int id shape_button_textview 0x7f080083
int id shape_inspector_check_box 0x7f080084
int id shape_inspector_check_box_image 0x7f080085
int id shape_inspector_check_box_text 0x7f080086
int id shape_inspector_description 0x7f080087
int id shape_inspector_imageview 0x7f080088
int id shape_inspector_title 0x7f080089
int id shape_shop_bottomRow 0x7f08008a
int id shape_shop_shape_inspector 0x7f08008b
int id shape_shop_topRow 0x7f08008c
int id shape_shop_topbar 0x7f08008d
int id shortcut 0x7f08008e
int id shortmenu_continue 0x7f08008f
int id shortmenu_exit 0x7f080090
int id shortmenu_restart 0x7f080091
int id shortmenu_topbar 0x7f080092
int id showCustom 0x7f080093
int id showHome 0x7f080094
int id showTitle 0x7f080095
int id spacer 0x7f080096
int id split_action_bar 0x7f080097
int id src_atop 0x7f080098
int id src_in 0x7f080099
int id src_over 0x7f08009a
int id startscreen_finish_world_1 0x7f08009b
int id startscreen_gain_90_ep 0x7f08009c
int id startscreen_play 0x7f08009d
int id startscreen_to_gl_test_screen 0x7f08009e
int id startscreen_unlock_levels 0x7f08009f
int id status_bar_latest_event_content 0x7f0800a0
int id submit_area 0x7f0800a1
int id tabMode 0x7f0800a2
int id task_completed_unlock_list 0x7f0800a3
int id text 0x7f0800a4
int id text2 0x7f0800a5
int id textSpacerNoButtons 0x7f0800a6
int id time 0x7f0800a7
int id title 0x7f0800a8
int id title_template 0x7f0800a9
int id tool_button_animation_layer 0x7f0800aa
int id tool_button_background_layer 0x7f0800ab
int id tool_button_progress_bar 0x7f0800ac
int id tool_inspector_description 0x7f0800ad
int id tool_inspector_imageview 0x7f0800ae
int id tool_inspector_level_view 0x7f0800af
int id tool_inspector_pricebutton 0x7f0800b0
int id tool_inspector_title 0x7f0800b1
int id toolbutton_1 0x7f0800b2
int id toolbutton_2 0x7f0800b3
int id toolbutton_3 0x7f0800b4
int id toolbutton_4 0x7f0800b5
int id toolofferslot_slot 0x7f0800b6
int id toolofferslot_title 0x7f0800b7
int id toolshop_slot1 0x7f0800b8
int id toolshop_slot2 0x7f0800b9
int id toolshop_slot3 0x7f0800ba
int id toolshop_slot4 0x7f0800bb
int id toolshop_tool_offer_bottom_row 0x7f0800bc
int id toolshop_tool_offer_top_row 0x7f0800bd
int id toolshop_toolinspector 0x7f0800be
int id toolshop_topbar 0x7f0800bf
int id toolslot_image 0x7f0800c0
int id topPanel 0x7f0800c1
int id topbar_back_button 0x7f0800c2
int id topbar_energycount 0x7f0800c3
int id topbar_energycount_decrease 0x7f0800c4
int id topbar_energyview 0x7f0800c5
int id topbar_leveldisplay 0x7f0800c6
int id topbar_levellayout 0x7f0800c7
int id topbar_levelprogress 0x7f0800c8
int id topbar_settings 0x7f0800c9
int id topbar_shapeshop 0x7f0800ca
int id topbar_starcount 0x7f0800cb
int id topbar_starcount_decrease 0x7f0800cc
int id topbar_starview 0x7f0800cd
int id topbar_toolshop 0x7f0800ce
int id tutorial_image_view 0x7f0800cf
int id tutorial_text_view 0x7f0800d0
int id unlockmessage_message 0x7f0800d1
int id unlockmessage_toolimage 0x7f0800d2
int id up 0x7f0800d3
int id useLogo 0x7f0800d4
int id withText 0x7f0800d5
int id worldbutton_energycount 0x7f0800d6
int id worldbutton_levelcount 0x7f0800d7
int id worldbutton_lock 0x7f0800d8
int id worldbutton_preview 0x7f0800d9
int id worldbutton_starcount 0x7f0800da
int id worldbutton_title 0x7f0800db
int id worlds_layout 0x7f0800dc
int id worlds_topbar 0x7f0800dd
int id wrap_content 0x7f0800de
int id game_shortmenu 0x7f08003a
int id game_toolbuttonbar 0x7f08003b
int id goal_message_bottom_layout 0x7f08003c
int id goal_message_levelbutton_energy 0x7f08003d
int id goal_message_levelbutton_star1 0x7f08003e
int id goal_message_levelbutton_star2 0x7f08003f
int id goal_message_levelbutton_star3 0x7f080040
int id goal_message_levelbutton_textview 0x7f080041
int id goal_message_next_level 0x7f080042
int id goal_message_restart 0x7f080043
int id goal_message_title 0x7f080044
int id goal_message_to_menu 0x7f080045
int id goal_message_topbar 0x7f080046
int id home 0x7f080047
int id homeAsUp 0x7f080048
int id icon 0x7f080049
int id ifRoom 0x7f08004a
int id image 0x7f08004b
int id info 0x7f08004c
int id levelbutton_energy 0x7f08004d
int id levelbutton_lock 0x7f08004e
int id levelbutton_star1 0x7f08004f
int id levelbutton_star2 0x7f080050
int id levelbutton_star3 0x7f080051
int id levelbutton_textview 0x7f080052
int id levels_bottom_row 0x7f080053
int id levels_top_row 0x7f080054
int id levels_topbar 0x7f080055
int id levelup_level 0x7f080056
int id levelup_text 0x7f080057
int id levelup_unlocklist 0x7f080058
int id line1 0x7f080059
int id line3 0x7f08005a
int id linearLayout4 0x7f08005b
int id listMode 0x7f08005c
int id list_item 0x7f08005d
int id media_actions 0x7f08005e
int id middle 0x7f08005f
int id multiply 0x7f080060
int id never 0x7f080061
int id none 0x7f080062
int id normal 0x7f080063
int id parentPanel 0x7f080064
int id price_button_currency 0x7f080065
int id price_button_price 0x7f080066
int id price_button_title 0x7f080067
int id progress_circular 0x7f080068
int id progress_horizontal 0x7f080069
int id radio 0x7f08006a
int id screen 0x7f08006b
int id scrollIndicatorDown 0x7f08006c
int id scrollIndicatorUp 0x7f08006d
int id scrollView 0x7f08006e
int id search_badge 0x7f08006f
int id search_bar 0x7f080070
int id search_button 0x7f080071
int id search_close_btn 0x7f080072
int id search_edit_frame 0x7f080073
int id search_go_btn 0x7f080074
int id search_mag_icon 0x7f080075
int id search_plate 0x7f080076
int id search_src_text 0x7f080077
int id search_voice_btn 0x7f080078
int id select_dialog_listview 0x7f080079
int id settings_credits 0x7f08007a
int id settings_music_label 0x7f08007b
int id settings_musictoggle 0x7f08007c
int id settings_reset 0x7f08007d
int id settings_sounds_label 0x7f08007e
int id settings_soundtoggle 0x7f08007f
int id settings_topbar 0x7f080080
int id shape_button_button 0x7f080081
int id shape_button_textview 0x7f080082
int id shape_inspector_check_box 0x7f080083
int id shape_inspector_check_box_image 0x7f080084
int id shape_inspector_check_box_text 0x7f080085
int id shape_inspector_description 0x7f080086
int id shape_inspector_imageview 0x7f080087
int id shape_inspector_title 0x7f080088
int id shape_shop_bottomRow 0x7f080089
int id shape_shop_shape_inspector 0x7f08008a
int id shape_shop_topRow 0x7f08008b
int id shape_shop_topbar 0x7f08008c
int id shortcut 0x7f08008d
int id shortmenu_continue 0x7f08008e
int id shortmenu_exit 0x7f08008f
int id shortmenu_restart 0x7f080090
int id shortmenu_topbar 0x7f080091
int id showCustom 0x7f080092
int id showHome 0x7f080093
int id showTitle 0x7f080094
int id spacer 0x7f080095
int id split_action_bar 0x7f080096
int id src_atop 0x7f080097
int id src_in 0x7f080098
int id src_over 0x7f080099
int id startscreen_finish_world_1 0x7f08009a
int id startscreen_gain_90_ep 0x7f08009b
int id startscreen_play 0x7f08009c
int id startscreen_to_gl_test_screen 0x7f08009d
int id startscreen_unlock_levels 0x7f08009e
int id status_bar_latest_event_content 0x7f08009f
int id submit_area 0x7f0800a0
int id tabMode 0x7f0800a1
int id task_completed_unlock_list 0x7f0800a2
int id text 0x7f0800a3
int id text2 0x7f0800a4
int id textSpacerNoButtons 0x7f0800a5
int id time 0x7f0800a6
int id title 0x7f0800a7
int id title_template 0x7f0800a8
int id tool_button_animation_layer 0x7f0800a9
int id tool_button_background_layer 0x7f0800aa
int id tool_button_progress_bar 0x7f0800ab
int id tool_inspector_description 0x7f0800ac
int id tool_inspector_imageview 0x7f0800ad
int id tool_inspector_level_view 0x7f0800ae
int id tool_inspector_pricebutton 0x7f0800af
int id tool_inspector_title 0x7f0800b0
int id toolbutton_1 0x7f0800b1
int id toolbutton_2 0x7f0800b2
int id toolbutton_3 0x7f0800b3
int id toolbutton_4 0x7f0800b4
int id toolofferslot_slot 0x7f0800b5
int id toolofferslot_title 0x7f0800b6
int id toolshop_slot1 0x7f0800b7
int id toolshop_slot2 0x7f0800b8
int id toolshop_slot3 0x7f0800b9
int id toolshop_slot4 0x7f0800ba
int id toolshop_tool_offer_bottom_row 0x7f0800bb
int id toolshop_tool_offer_top_row 0x7f0800bc
int id toolshop_toolinspector 0x7f0800bd
int id toolshop_topbar 0x7f0800be
int id toolslot_image 0x7f0800bf
int id topPanel 0x7f0800c0
int id topbar_back_button 0x7f0800c1
int id topbar_energycount 0x7f0800c2
int id topbar_energycount_decrease 0x7f0800c3
int id topbar_energyview 0x7f0800c4
int id topbar_leveldisplay 0x7f0800c5
int id topbar_levellayout 0x7f0800c6
int id topbar_levelprogress 0x7f0800c7
int id topbar_settings 0x7f0800c8
int id topbar_shapeshop 0x7f0800c9
int id topbar_starcount 0x7f0800ca
int id topbar_starcount_decrease 0x7f0800cb
int id topbar_starview 0x7f0800cc
int id topbar_toolshop 0x7f0800cd
int id tutorial_image_view 0x7f0800ce
int id tutorial_text_view 0x7f0800cf
int id unlockmessage_message 0x7f0800d0
int id unlockmessage_toolimage 0x7f0800d1
int id up 0x7f0800d2
int id useLogo 0x7f0800d3
int id withText 0x7f0800d4
int id worldbutton_energycount 0x7f0800d5
int id worldbutton_levelcount 0x7f0800d6
int id worldbutton_lock 0x7f0800d7
int id worldbutton_preview 0x7f0800d8
int id worldbutton_starcount 0x7f0800d9
int id worldbutton_title 0x7f0800da
int id worlds_layout 0x7f0800db
int id worlds_topbar 0x7f0800dc
int id wrap_content 0x7f0800dd
int integer abc_config_activityDefaultDur 0x7f090000
int integer abc_config_activityShortDur 0x7f090001
int integer abc_max_action_buttons 0x7f090002

View File

@ -151,6 +151,9 @@ public class Game extends Rendering<GameScene> {
scene.update(timer);
collisionManager.update(physics, scene, timer);
break;
case COUNTDOWN:
viewManager.updateCountdown(timer.getFrameTimeSeconds());
break;
}
} catch (Exception e) {
onException(e);

View File

@ -1,81 +1,92 @@
package de.frajul.endlessroll.views;
import android.graphics.Typeface;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.View;
import android.widget.TextView;
import java.util.concurrent.atomic.AtomicBoolean;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.game.Game;
import de.frajul.endlessroll.sounds.SoundManager;
import de.frajul.endlessroll.sounds.SoundStream;
/**
* Created by Julian on 31.07.2016.
*/
public class Countdown implements Animation.AnimationListener {
public class Countdown {
private Game game;
private AnimationSet animations;
private GameActivity gameActivity;
private TextView textView;
private SoundManager soundManager;
private SoundStream soundStream;
private boolean firstHalfRepeated = true;
private int repeatCount = 0;
private AtomicBoolean running;
private int currentSeconds = 0;
private float time = 0;
public Countdown(Game game, SoundManager soundManager, Typeface typeface, TextView textView) {
public Countdown(Game game, GameActivity gameActivity, TextView textView) {
this.game = game;
this.soundManager = soundManager;
this.gameActivity = gameActivity;
this.textView = textView;
this.textView.setTypeface(typeface);
animations = (AnimationSet) AnimationUtils
.loadAnimation(game.getContext(), R.anim.countdown);
for (Animation animation : animations.getAnimations())
animation.setAnimationListener(this);
this.textView.setTypeface(gameActivity.getTypeface());
running = new AtomicBoolean(false);
}
public void update(float delta) {
if (running.get()) {
time += delta;
if (time >= 1000 && currentSeconds == 0)
onNextSecondInUiThread(1);
if (time >= 2000 && currentSeconds == 1)
onNextSecondInUiThread(2);
if (time >= 3000 && currentSeconds == 2) {
gameActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
textView.setVisibility(View.GONE);
}
});
running.set(false);
game.countdownFinished();
}
}
}
public void start() {
if (textView.getAnimation() == null || !textView.getAnimation().isInitialized()) {
reset();
textView.startAnimation(animations);
soundStream = soundManager.playSound(soundManager.countdownSound);
}
reset();
running.set(true);
textView.setVisibility(View.VISIBLE);
soundStream = gameActivity.getSoundManager()
.playSound(gameActivity.getSoundManager().countdownSound);
}
public void stop() {
textView.clearAnimation();
textView.setVisibility(View.GONE);
running.set(false);
if (soundStream != null)
soundManager.stopSound(soundStream);
gameActivity.getSoundManager().stopSound(soundStream);
}
private void reset() {
repeatCount = 0;
textView.setText("3");
textView.setTextColor(game.getContext().getResources().getColor(R.color.countdown3));
time = 0;
onNextSecondInUiThread(0);
}
@Override
public void onAnimationStart(Animation animation) {
private void onNextSecondInUiThread(final int second) {
gameActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
currentSeconds = second;
textView.setText((3 - second) + "");
int color = R.color.countdown1;
if (second == 1)
color = R.color.countdown2;
else if (second == 2)
color = R.color.countdown3;
textView.setTextColor(game.getContext().getResources().getColor(color));
}
});
}
@Override
public void onAnimationEnd(Animation animation) {
game.countdownFinished();
}
@Override
public void onAnimationRepeat(Animation animation) {
if (!firstHalfRepeated)
repeatCount++;
firstHalfRepeated = !firstHalfRepeated;
textView.setText((3 - repeatCount) + "");
if (repeatCount == 1) {
textView.setTextColor(game.getContext().getResources().getColor(R.color.countdown2));
} else if (repeatCount == 2) {
textView.setTextColor(game.getContext().getResources().getColor(R.color.countdown1));
}
}
}

View File

@ -86,7 +86,7 @@ public class ToolButton {
if (progress == 100) {
game.onToolButtonFinishedLoading(toolType);
setColor(R.color.toolbuttonActiveReady);
}else
} else
setColor(R.color.toolbuttonActiveNotReady);
} else {
if (progress == 100)

View File

@ -20,22 +20,8 @@ import de.frajul.endlessroll.user.ToolSlotSettings;
/**
* Created by Julian on 16.01.2016.
*/
public class ToolButtonBar implements View.OnClickListener, Animation.AnimationListener {
public class ToolButtonBar implements View.OnClickListener{
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
private Animation fadeIn, fadeOut;
private Game game;
private List<ToolButton> buttons = new ArrayList<>(4);
private RelativeLayout button1;
@ -47,9 +33,6 @@ public class ToolButtonBar implements View.OnClickListener, Animation.AnimationL
public ToolButtonBar(Game game, ToolSlotSettings toolSlotSettings, LinearLayout layout1) {
this.game = game;
Context context = game.getContext();
fadeIn = AnimationUtils.loadAnimation(game.getContext(), R.anim.fade_in);
fadeIn.setAnimationListener(this);
fadeOut = AnimationUtils.loadAnimation(game.getContext(), R.anim.fade_out);
button1 = (RelativeLayout) layout1.findViewById(R.id.toolbutton_1);
button1.setOnClickListener(this);
@ -65,20 +48,6 @@ public class ToolButtonBar implements View.OnClickListener, Animation.AnimationL
buttons.add(new ToolButton(toolSlotSettings.get(3), game, context, button4));
}
public void setTopPrimary() {
button1.startAnimation(fadeIn);
button2.startAnimation(fadeIn);
button3.startAnimation(fadeIn);
button4.startAnimation(fadeIn);
}
public void setBottomPrimary() {
button1.startAnimation(fadeOut);
button2.startAnimation(fadeOut);
button3.startAnimation(fadeOut);
button4.startAnimation(fadeOut);
}
public void changeToolButtonTypes(ToolSlotSettings toolSlotSettings) {
for (int i = 0; i < 4; i++) {
buttons.get(i).changeToolSlot(toolSlotSettings.get(i));
@ -86,7 +55,6 @@ public class ToolButtonBar implements View.OnClickListener, Animation.AnimationL
}
public void reset(ToolSlotSettings toolSlotSettings) {
GameLog.i("Reset toolbuttonBar");
changeToolButtonTypes(toolSlotSettings);
for (int i = 0; i < 4; i++) {
if (toolSlotSettings.get(i).getToolType() != null) {

View File

@ -30,7 +30,6 @@ public class ViewManager implements View.OnClickListener {
private TextView fpsView;
private TextView playerProgress;
private TextView playerSpeed;
private ImageView pauseButton;
private GameOverMessage gameOverMessage;
private GoalMessage goalMessage;
@ -40,7 +39,7 @@ public class ViewManager implements View.OnClickListener {
private List<BombErrorMessage> bombErrorMessages = new ArrayList<>();
private String fpsFormat, playerProgressFormat, playerSpeedFormat;
private String fpsFormat, playerProgressFormat;
public ViewManager(final Game game, final GameScreen gameScreen, final GameHandler gameViewHandler, final GameActivity gameActivity) {
this.game = game;
@ -60,8 +59,7 @@ public class ViewManager implements View.OnClickListener {
layout.findViewById(R.id.game_game_over_message));
goalMessage = new GoalMessage(game, gameScreen, gameActivity,
layout.findViewById(R.id.game_goal_message));
countdown = new Countdown(game, gameActivity.getSoundManager(),
gameActivity.getTypeface(),
countdown = new Countdown(game, gameActivity,
(TextView) layout.findViewById(R.id.game_countdown));
}
});
@ -69,14 +67,11 @@ public class ViewManager implements View.OnClickListener {
pauseButton.setOnClickListener(this);
playerProgress = (TextView) layout.findViewById(R.id.game_playerprogress);
playerProgress.setTypeface(gameActivity.getTypeface());
playerSpeed = (TextView) layout.findViewById(R.id.game_playerspeed);
playerSpeed.setTypeface(gameActivity.getTypeface());
fpsView = (TextView) layout.findViewById(R.id.game_fps);
fpsView.setTypeface(gameActivity.getTypeface());
fpsFormat = game.getContext().getString(R.string.game_fps_format_d);
playerProgressFormat = game.getContext().getString(R.string.game_playerprogress_format_f);
playerSpeedFormat = game.getContext().getString(R.string.game_playerspeed_format_f);
}
public void prepareToBeShown() {
@ -88,6 +83,10 @@ public class ViewManager implements View.OnClickListener {
goalMessage.prepareToBeShown();
}
public void updateCountdown(float delta){
countdown.update(delta);
}
public void showBombErrorMessage(float xPos, float yPos) {
for (BombErrorMessage bombErrorMessage : bombErrorMessages) {
if (!bombErrorMessage.isAnimationRunning()) {
@ -113,7 +112,6 @@ public class ViewManager implements View.OnClickListener {
toolButtonBar.reset(user.getToolSlotSettings());
toolButtonBar.update(0);
playerProgress.setText(R.string.game_playerprogress_placeholder);
playerSpeed.setText(R.string.game_playerspeed_placeholder);
}
});
}
@ -164,8 +162,6 @@ public class ViewManager implements View.OnClickListener {
fpsView.setText(String.format(fpsFormat, timer.getFps()));
if (gameRunning) {
playerProgress.setText(String.format(playerProgressFormat, toMeters(playerX)));
playerSpeed
.setText(String.format(playerSpeedFormat, toMeters(playerXMov * 1000)));
toolButtonBar.update(timer.getFrameTimeSeconds());
}
}

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="700"
android:fromXScale="2"
android:fromYScale="2"
android:interpolator="@android:anim/accelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="2"
android:repeatMode="restart"
android:toXScale="1"
android:toYScale="1" />
<alpha
android:duration="360"
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatCount="2"
android:repeatMode="restart"
android:fromAlpha="1"
android:toAlpha="0"
android:startOffset="340"/>
</set>

View File

@ -27,22 +27,12 @@
android:id="@+id/game_playerprogress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="4dp"
android:text="@string/game_playerprogress_placeholder"
android:textColor="@color/secondary"
android:textSize="22sp"/>
<TextView
android:id="@+id/game_playerspeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/game_playerprogress"
android:layout_alignStart="@+id/game_playerprogress"
android:layout_below="@+id/game_playerprogress"
android:text="@string/game_playerspeed_placeholder"
android:textColor="@color/secondary"
android:textSize="22sp"/>
<TextView
android:id="@+id/game_fps"
android:layout_width="wrap_content"
@ -89,8 +79,7 @@
android:layout_centerVertical="true"
android:text="@string/game_countdown_placeholder"
android:textColor="@color/countdown3"
android:textSize="100sp"
android:textStyle="bold"
android:visibility="invisible"/>
android:textSize="150sp"
android:visibility="gone"/>
</RelativeLayout>