diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6a22cef..3c7974e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -17,6 +17,269 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; B852C1352BCABB5E00A53FC4 /* GameMessageChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B852C1342BCABB5E00A53FC4 /* GameMessageChannel.swift */; }; + B891A2E12BCD1392006CB06E /* TouchInterceptingLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2622BCD1392006CB06E /* TouchInterceptingLayer.cpp */; }; + B891A2E22BCD1392006CB06E /* LevelPickerLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2652BCD1392006CB06E /* LevelPickerLayer.cpp */; }; + B891A2E32BCD1392006CB06E /* LevelPickerView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2672BCD1392006CB06E /* LevelPickerView.cpp */; }; + B891A2E42BCD1392006CB06E /* SimpleLevelPickerView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2692BCD1392006CB06E /* SimpleLevelPickerView.cpp */; }; + B891A2E52BCD1392006CB06E /* AlertView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A26C2BCD1392006CB06E /* AlertView.cpp */; }; + B891A2E62BCD1392006CB06E /* AppLinksView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A26E2BCD1392006CB06E /* AppLinksView.cpp */; }; + B891A2E72BCD1392006CB06E /* GameLifeIndicatorView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2702BCD1392006CB06E /* GameLifeIndicatorView.cpp */; }; + B891A2E82BCD1392006CB06E /* LevelView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2722BCD1392006CB06E /* LevelView.cpp */; }; + B891A2E92BCD1392006CB06E /* ParentalGateShowInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2742BCD1392006CB06E /* ParentalGateShowInterface.cpp */; }; + B891A2EA2BCD1392006CB06E /* ParentalGateView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2762BCD1392006CB06E /* ParentalGateView.cpp */; }; + B891A2EB2BCD1392006CB06E /* SettingsLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2782BCD1392006CB06E /* SettingsLayer.cpp */; }; + B891A2EC2BCD1392006CB06E /* TOSAcceptPopupView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A27A2BCD1392006CB06E /* TOSAcceptPopupView.cpp */; }; + B891A2ED2BCD1392006CB06E /* ChangingSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A27D2BCD1392006CB06E /* ChangingSprite.cpp */; }; + B891A2EE2BCD1392006CB06E /* ContainerSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A27F2BCD1392006CB06E /* ContainerSprite.cpp */; }; + B891A2EF2BCD1392006CB06E /* PlainLabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2812BCD1392006CB06E /* PlainLabel.cpp */; }; + B891A2F02BCD1392006CB06E /* PlainNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2832BCD1392006CB06E /* PlainNode.cpp */; }; + B891A2F12BCD1392006CB06E /* PlainSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2852BCD1392006CB06E /* PlainSprite.cpp */; }; + B891A2F22BCD1392006CB06E /* ProgressSliderNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2872BCD1392006CB06E /* ProgressSliderNode.cpp */; }; + B891A2F32BCD1392006CB06E /* SimpleButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2892BCD1392006CB06E /* SimpleButton.cpp */; }; + B891A2F42BCD1392006CB06E /* TouchableSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A28B2BCD1392006CB06E /* TouchableSprite.cpp */; }; + B891A2F52BCD1392006CB06E /* TwoStateButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A28D2BCD1392006CB06E /* TwoStateButton.cpp */; }; + B891A2F62BCD1392006CB06E /* ResourcesConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2912BCD1392006CB06E /* ResourcesConfig.cpp */; }; + B891A2F72BCD1392006CB06E /* Strings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2932BCD1392006CB06E /* Strings.cpp */; }; + B891A2F92BCD1392006CB06E /* GameConfigParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2992BCD1392006CB06E /* GameConfigParser.cpp */; }; + B891A2FA2BCD1392006CB06E /* LayoutObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A29C2BCD1392006CB06E /* LayoutObject.cpp */; }; + B891A2FB2BCD1392006CB06E /* LayoutParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A29E2BCD1392006CB06E /* LayoutParser.cpp */; }; + B891A2FC2BCD1392006CB06E /* ActionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2A12BCD1392006CB06E /* ActionData.cpp */; }; + B891A3042BCD1392006CB06E /* JSONParseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2B52BCD1392006CB06E /* JSONParseUtils.cpp */; }; + B891A3052BCD1392006CB06E /* StaticActionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2B82BCD1392006CB06E /* StaticActionParser.cpp */; }; + B891A3062BCD1392006CB06E /* ValueStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2BA2BCD1392006CB06E /* ValueStorage.cpp */; }; + B891A3072BCD1392006CB06E /* SubGameScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2BD2BCD1392006CB06E /* SubGameScene.cpp */; }; + B891A3082BCD1392006CB06E /* SubGameSceneShoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2BF2BCD1392006CB06E /* SubGameSceneShoot.cpp */; }; + B891A30A2BCD1392006CB06E /* ParentScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2C42BCD1392006CB06E /* ParentScene.cpp */; }; + B891A30B2BCD1392006CB06E /* SceneWithUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2C62BCD1392006CB06E /* SceneWithUtils.cpp */; }; + B891A30C2BCD1392006CB06E /* DrawingUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2C92BCD1392006CB06E /* DrawingUtils.cpp */; }; + B891A30D2BCD1392006CB06E /* GeometryUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2CB2BCD1392006CB06E /* GeometryUtils.cpp */; }; + B891A30E2BCD1392006CB06E /* MathUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2CD2BCD1392006CB06E /* MathUtils.cpp */; }; + B891A30F2BCD1392006CB06E /* MiscUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2CF2BCD1392006CB06E /* MiscUtils.cpp */; }; + B891A3102BCD1392006CB06E /* ResourceUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2D12BCD1392006CB06E /* ResourceUtilities.cpp */; }; + B891A3112BCD1392006CB06E /* ScalingUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2D32BCD1392006CB06E /* ScalingUtils.cpp */; }; + B891A3122BCD1392006CB06E /* SoundsRepo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2D52BCD1392006CB06E /* SoundsRepo.cpp */; }; + B891A3132BCD1392006CB06E /* SoundUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2D72BCD1392006CB06E /* SoundUtils.cpp */; }; + B891A3142BCD1392006CB06E /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B891A2D92BCD1392006CB06E /* StringUtils.cpp */; }; + B891A4F92BCD2429006CB06E /* ComicSansMSBold.ttf in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3162BCD13AB006CB06E /* ComicSansMSBold.ttf */; }; + B891A4FA2BCD2429006CB06E /* ComicSansMSRegular.ttf in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3172BCD13AB006CB06E /* ComicSansMSRegular.ttf */; }; + B891A4FB2BCD2449006CB06E /* .gitkeep in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A40F2BCD13AB006CB06E /* .gitkeep */; }; + B891A4FC2BCD2488006CB06E /* gconfig.gcf in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3192BCD13AB006CB06E /* gconfig.gcf */; }; + B891A4FD2BCD24CA006CB06E /* g_no.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3392BCD13AB006CB06E /* g_no.mp3 */; }; + B891A4FE2BCD24CA006CB06E /* g_oops.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A33A2BCD13AB006CB06E /* g_oops.mp3 */; }; + B891A4FF2BCD24CA006CB06E /* g_uh_oh.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A33B2BCD13AB006CB06E /* g_uh_oh.mp3 */; }; + B891A5002BCD24CA006CB06E /* g_well_done.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A33C2BCD13AB006CB06E /* g_well_done.mp3 */; }; + B891A5012BCD24CA006CB06E /* g_whoo_hoo.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A33D2BCD13AB006CB06E /* g_whoo_hoo.mp3 */; }; + B891A5022BCD24CA006CB06E /* g_yeah.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A33E2BCD13AB006CB06E /* g_yeah.mp3 */; }; + B891A5032BCD24CA006CB06E /* maggie_super.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A33F2BCD13AB006CB06E /* maggie_super.mp3 */; }; + B891A5042BCD24CA006CB06E /* maggie_thats_right.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3402BCD13AB006CB06E /* maggie_thats_right.mp3 */; }; + B891A5052BCD24CA006CB06E /* maggie_yeah.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3412BCD13AB006CB06E /* maggie_yeah.mp3 */; }; + B891A50F2BCD2524006CB06E /* all_in_trolley.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A31C2BCD13AB006CB06E /* all_in_trolley.mp3 */; }; + B891A5102BCD2524006CB06E /* apple.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A31D2BCD13AB006CB06E /* apple.mp3 */; }; + B891A5112BCD2524006CB06E /* banana.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A31E2BCD13AB006CB06E /* banana.mp3 */; }; + B891A5122BCD2524006CB06E /* cake.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A31F2BCD13AB006CB06E /* cake.mp3 */; }; + B891A5132BCD2524006CB06E /* chocolate.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3202BCD13AB006CB06E /* chocolate.mp3 */; }; + B891A5142BCD2524006CB06E /* cucumber.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3212BCD13AB006CB06E /* cucumber.mp3 */; }; + B891A5152BCD2524006CB06E /* donut.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3222BCD13AB006CB06E /* donut.mp3 */; }; + B891A5162BCD2524006CB06E /* effect_catapult.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3232BCD13AB006CB06E /* effect_catapult.mp3 */; }; + B891A5172BCD2524006CB06E /* effect_hit.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3242BCD13AB006CB06E /* effect_hit.mp3 */; }; + B891A5182BCD2524006CB06E /* effect_in_trolley.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3252BCD13AB006CB06E /* effect_in_trolley.mp3 */; }; + B891A5192BCD2524006CB06E /* hit_maggie.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3262BCD13AB006CB06E /* hit_maggie.mp3 */; }; + B891A51A2BCD2524006CB06E /* hit_steve.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3272BCD13AB006CB06E /* hit_steve.mp3 */; }; + B891A51B2BCD2524006CB06E /* icecream.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3282BCD13AB006CB06E /* icecream.mp3 */; }; + B891A51C2BCD2524006CB06E /* in_trolley.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3292BCD13AB006CB06E /* in_trolley.mp3 */; }; + B891A51D2BCD2524006CB06E /* not_apple.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A32A2BCD13AB006CB06E /* not_apple.mp3 */; }; + B891A51E2BCD2524006CB06E /* not_banana.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A32B2BCD13AB006CB06E /* not_banana.mp3 */; }; + B891A51F2BCD2524006CB06E /* not_cake.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A32C2BCD13AB006CB06E /* not_cake.mp3 */; }; + B891A5202BCD2524006CB06E /* not_chocolate.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A32D2BCD13AB006CB06E /* not_chocolate.mp3 */; }; + B891A5212BCD2524006CB06E /* not_cucumber.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A32E2BCD13AB006CB06E /* not_cucumber.mp3 */; }; + B891A5222BCD2524006CB06E /* not_donut.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A32F2BCD13AB006CB06E /* not_donut.mp3 */; }; + B891A5232BCD2524006CB06E /* not_icecream.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3302BCD13AB006CB06E /* not_icecream.mp3 */; }; + B891A5242BCD2524006CB06E /* not_in_trolley.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3312BCD13AB006CB06E /* not_in_trolley.mp3 */; }; + B891A5252BCD2524006CB06E /* not_tomato.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3322BCD13AB006CB06E /* not_tomato.mp3 */; }; + B891A5262BCD2524006CB06E /* put_it_trolley.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3332BCD13AB006CB06E /* put_it_trolley.mp3 */; }; + B891A5272BCD2524006CB06E /* shop_closed.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3342BCD13AB006CB06E /* shop_closed.mp3 */; }; + B891A5282BCD2524006CB06E /* start.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3352BCD13AB006CB06E /* start.mp3 */; }; + B891A5292BCD2524006CB06E /* tomato.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3362BCD13AB006CB06E /* tomato.mp3 */; }; + B891A52A2BCD2524006CB06E /* wrong_3_times.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3372BCD13AB006CB06E /* wrong_3_times.mp3 */; }; + B891A52B2BCD2547006CB06E /* g_pick_level.mp3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3432BCD13AB006CB06E /* g_pick_level.mp3 */; }; + B891A52C2BCD2576006CB06E /* app_link_halloween.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3472BCD13AB006CB06E /* app_link_halloween.png */; }; + B891A52D2BCD2576006CB06E /* app_link_toy.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3482BCD13AB006CB06E /* app_link_toy.png */; }; + B891A52E2BCD2576006CB06E /* doll_toy_app.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3492BCD13AB006CB06E /* doll_toy_app.png */; }; + B891A52F2BCD2576006CB06E /* halo_icon.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A34A2BCD13AB006CB06E /* halo_icon.png */; }; + B891A5302BCD2576006CB06E /* steve_maggie.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A34B2BCD13AB006CB06E /* steve_maggie.png */; }; + B891A5312BCD2576006CB06E /* witch_halloween_app.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A34C2BCD13AB006CB06E /* witch_halloween_app.png */; }; + B891A5322BCD259B006CB06E /* horizontalButtonPanelBackFFPause.obl in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A35F2BCD13AB006CB06E /* horizontalButtonPanelBackFFPause.obl */; }; + B891A5332BCD25B4006CB06E /* button_back.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A34E2BCD13AB006CB06E /* button_back.png */; }; + B891A5342BCD25B4006CB06E /* button_go.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A34F2BCD13AB006CB06E /* button_go.png */; }; + B891A5352BCD25B4006CB06E /* button_green.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3502BCD13AB006CB06E /* button_green.png */; }; + B891A5362BCD25B4006CB06E /* button_grey.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3512BCD13AB006CB06E /* button_grey.png */; }; + B891A5372BCD25B4006CB06E /* button_orange.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3522BCD13AB006CB06E /* button_orange.png */; }; + B891A5382BCD25B4006CB06E /* button_pause.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3532BCD13AB006CB06E /* button_pause.png */; }; + B891A5392BCD25B4006CB06E /* button_purple.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3542BCD13AB006CB06E /* button_purple.png */; }; + B891A53A2BCD25B4006CB06E /* button_red.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3552BCD13AB006CB06E /* button_red.png */; }; + B891A53B2BCD25B4006CB06E /* button_repeat.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3562BCD13AB006CB06E /* button_repeat.png */; }; + B891A53C2BCD25B4006CB06E /* button_setting.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3572BCD13AB006CB06E /* button_setting.png */; }; + B891A53D2BCD25B4006CB06E /* button_sound_off.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3582BCD13AB006CB06E /* button_sound_off.png */; }; + B891A53E2BCD25B4006CB06E /* button_sound_on.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3592BCD13AB006CB06E /* button_sound_on.png */; }; + B891A53F2BCD25B4006CB06E /* button_turquoise.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A35A2BCD13AB006CB06E /* button_turquoise.png */; }; + B891A5402BCD25B4006CB06E /* button_yellow.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A35B2BCD13AB006CB06E /* button_yellow.png */; }; + B891A5412BCD25B4006CB06E /* buttonff.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A35C2BCD13AB006CB06E /* buttonff.png */; }; + B891A5422BCD25B4006CB06E /* dark_green.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A35D2BCD13AB006CB06E /* dark_green.png */; }; + B891A5432BCD25D4006CB06E /* g_finger.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3A42BCD13AB006CB06E /* g_finger.png */; }; + B891A5442BCD25D4006CB06E /* g_life_indicator_dead.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3A52BCD13AB006CB06E /* g_life_indicator_dead.png */; }; + B891A5452BCD25D4006CB06E /* g_life_indicator_ok.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3A62BCD13AB006CB06E /* g_life_indicator_ok.png */; }; + B891A5462BCD25D4006CB06E /* level_halo.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3A72BCD13AB006CB06E /* level_halo.png */; }; + B891A5472BCD25F0006CB06E /* level_1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3612BCD13AB006CB06E /* level_1.png */; }; + B891A5482BCD25F0006CB06E /* level_2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3622BCD13AB006CB06E /* level_2.png */; }; + B891A5492BCD25F0006CB06E /* level_3.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3632BCD13AB006CB06E /* level_3.png */; }; + B891A54A2BCD2615006CB06E /* scene_layout.scl in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A39F2BCD13AB006CB06E /* scene_layout.scl */; }; + B891A5572BCD266A006CB06E /* cart_back1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A38F2BCD13AB006CB06E /* cart_back1.png */; }; + B891A5582BCD266A006CB06E /* cart_back2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3902BCD13AB006CB06E /* cart_back2.png */; }; + B891A5592BCD266A006CB06E /* cart_front.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3912BCD13AB006CB06E /* cart_front.png */; }; + B891A55A2BCD266A006CB06E /* clock.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3922BCD13AB006CB06E /* clock.png */; }; + B891A55B2BCD266A006CB06E /* food_in_cart.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3932BCD13AB006CB06E /* food_in_cart.png */; }; + B891A55C2BCD266A006CB06E /* gum.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3942BCD13AB006CB06E /* gum.png */; }; + B891A55D2BCD266A006CB06E /* hand_leather.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3952BCD13AB006CB06E /* hand_leather.png */; }; + B891A55E2BCD266A006CB06E /* hand_sling.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3962BCD13AB006CB06E /* hand_sling.png */; }; + B891A55F2BCD266A006CB06E /* sling.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3972BCD13AB006CB06E /* sling.png */; }; + B891A5602BCD266A006CB06E /* steve_head1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3982BCD13AB006CB06E /* steve_head1.png */; }; + B891A5612BCD266A006CB06E /* steve_head2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3992BCD13AB006CB06E /* steve_head2.png */; }; + B891A5622BCD266A006CB06E /* steve_head3.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A39A2BCD13AB006CB06E /* steve_head3.png */; }; + B891A5632BCD266A006CB06E /* steve_head4.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A39B2BCD13AB006CB06E /* steve_head4.png */; }; + B891A5642BCD266A006CB06E /* steve_head5.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A39C2BCD13AB006CB06E /* steve_head5.png */; }; + B891A5652BCD266A006CB06E /* wooden_shelf.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A39D2BCD13AB006CB06E /* wooden_shelf.png */; }; + B891A5662BCD2694006CB06E /* apples.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3652BCD13AB006CB06E /* apples.png */; }; + B891A5672BCD2694006CB06E /* baguettes.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3662BCD13AB006CB06E /* baguettes.png */; }; + B891A5682BCD2694006CB06E /* bananas.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3672BCD13AB006CB06E /* bananas.png */; }; + B891A5692BCD2694006CB06E /* cakes.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3682BCD13AB006CB06E /* cakes.png */; }; + B891A56A2BCD2694006CB06E /* chocolate.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3692BCD13AB006CB06E /* chocolate.png */; }; + B891A56B2BCD2694006CB06E /* cucumbers.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A36A2BCD13AB006CB06E /* cucumbers.png */; }; + B891A56C2BCD2694006CB06E /* donuts.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A36B2BCD13AB006CB06E /* donuts.png */; }; + B891A56D2BCD2694006CB06E /* icecream.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A36C2BCD13AB006CB06E /* icecream.png */; }; + B891A56E2BCD2695006CB06E /* lettuce.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A36D2BCD13AB006CB06E /* lettuce.png */; }; + B891A56F2BCD2695006CB06E /* milk.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A36E2BCD13AB006CB06E /* milk.png */; }; + B891A5702BCD2695006CB06E /* orange.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A36F2BCD13AB006CB06E /* orange.png */; }; + B891A5712BCD2695006CB06E /* tomatoes.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3702BCD13AB006CB06E /* tomatoes.png */; }; + B891A5722BCD26DA006CB06E /* apple_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3722BCD13AB006CB06E /* apple_splodge.png */; }; + B891A5732BCD26DA006CB06E /* apple1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3732BCD13AB006CB06E /* apple1.png */; }; + B891A5742BCD26DA006CB06E /* apple2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3742BCD13AB006CB06E /* apple2.png */; }; + B891A5752BCD26DA006CB06E /* baguette.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3752BCD13AB006CB06E /* baguette.png */; }; + B891A5762BCD26DA006CB06E /* banana_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3762BCD13AB006CB06E /* banana_splodge.png */; }; + B891A5772BCD26DA006CB06E /* banana1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3772BCD13AB006CB06E /* banana1.png */; }; + B891A5782BCD26DA006CB06E /* banana2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3782BCD13AB006CB06E /* banana2.png */; }; + B891A5792BCD26DA006CB06E /* cake_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3792BCD13AB006CB06E /* cake_splodge.png */; }; + B891A57A2BCD26DA006CB06E /* cake1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A37A2BCD13AB006CB06E /* cake1.png */; }; + B891A57B2BCD26DA006CB06E /* cake2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A37B2BCD13AB006CB06E /* cake2.png */; }; + B891A57C2BCD26DA006CB06E /* chocolate_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A37C2BCD13AB006CB06E /* chocolate_splodge.png */; }; + B891A57D2BCD26DA006CB06E /* chocolate1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A37D2BCD13AB006CB06E /* chocolate1.png */; }; + B891A57E2BCD26DA006CB06E /* chocolate2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A37E2BCD13AB006CB06E /* chocolate2.png */; }; + B891A57F2BCD26DA006CB06E /* cucumber_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A37F2BCD13AB006CB06E /* cucumber_splodge.png */; }; + B891A5802BCD26DA006CB06E /* cucumber1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3802BCD13AB006CB06E /* cucumber1.png */; }; + B891A5812BCD26DA006CB06E /* cucumber2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3812BCD13AB006CB06E /* cucumber2.png */; }; + B891A5822BCD26DA006CB06E /* donut_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3822BCD13AB006CB06E /* donut_splodge.png */; }; + B891A5832BCD26DA006CB06E /* donut1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3832BCD13AB006CB06E /* donut1.png */; }; + B891A5842BCD26DA006CB06E /* donut2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3842BCD13AB006CB06E /* donut2.png */; }; + B891A5852BCD26DA006CB06E /* icecream_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3852BCD13AB006CB06E /* icecream_splodge.png */; }; + B891A5862BCD26DA006CB06E /* icecream1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3862BCD13AB006CB06E /* icecream1.png */; }; + B891A5872BCD26DA006CB06E /* icecream2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3872BCD13AB006CB06E /* icecream2.png */; }; + B891A5882BCD26DA006CB06E /* lettuce.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3882BCD13AB006CB06E /* lettuce.png */; }; + B891A5892BCD26DA006CB06E /* milk.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3892BCD13AB006CB06E /* milk.png */; }; + B891A58A2BCD26DA006CB06E /* orange.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A38A2BCD13AB006CB06E /* orange.png */; }; + B891A58B2BCD26DA006CB06E /* tomato_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A38B2BCD13AB006CB06E /* tomato_splodge.png */; }; + B891A58C2BCD26DA006CB06E /* tomato1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A38C2BCD13AB006CB06E /* tomato1.png */; }; + B891A58D2BCD26DA006CB06E /* tomato2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A38D2BCD13AB006CB06E /* tomato2.png */; }; + B891A58E2BCD26F9006CB06E /* accept_button.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3A12BCD13AB006CB06E /* accept_button.png */; }; + B891A58F2BCD26F9006CB06E /* accept_popup.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3A22BCD13AB006CB06E /* accept_popup.png */; }; + B891A5902BCD271D006CB06E /* app_link_halloween.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3AA2BCD13AB006CB06E /* app_link_halloween.png */; }; + B891A5912BCD271D006CB06E /* app_link_toy.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3AB2BCD13AB006CB06E /* app_link_toy.png */; }; + B891A5922BCD271D006CB06E /* doll_toy_app.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3AC2BCD13AB006CB06E /* doll_toy_app.png */; }; + B891A5932BCD271D006CB06E /* halo_icon.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3AD2BCD13AB006CB06E /* halo_icon.png */; }; + B891A5942BCD271D006CB06E /* steve_maggie.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3AE2BCD13AB006CB06E /* steve_maggie.png */; }; + B891A5952BCD271D006CB06E /* witch_halloween_app.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3AF2BCD13AB006CB06E /* witch_halloween_app.png */; }; + B891A5962BCD2734006CB06E /* horizontalButtonPanelBackFFPause.obl in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C22BCD13AB006CB06E /* horizontalButtonPanelBackFFPause.obl */; }; + B891A5972BCD274C006CB06E /* button_back.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B12BCD13AB006CB06E /* button_back.png */; }; + B891A5982BCD274C006CB06E /* button_go.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B22BCD13AB006CB06E /* button_go.png */; }; + B891A5992BCD274C006CB06E /* button_green.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B32BCD13AB006CB06E /* button_green.png */; }; + B891A59A2BCD274C006CB06E /* button_grey.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B42BCD13AB006CB06E /* button_grey.png */; }; + B891A59B2BCD274C006CB06E /* button_orange.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B52BCD13AB006CB06E /* button_orange.png */; }; + B891A59C2BCD274C006CB06E /* button_pause.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B62BCD13AB006CB06E /* button_pause.png */; }; + B891A59D2BCD274C006CB06E /* button_purple.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B72BCD13AB006CB06E /* button_purple.png */; }; + B891A59E2BCD274C006CB06E /* button_red.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B82BCD13AB006CB06E /* button_red.png */; }; + B891A59F2BCD274C006CB06E /* button_repeat.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3B92BCD13AB006CB06E /* button_repeat.png */; }; + B891A5A02BCD274C006CB06E /* button_setting.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3BA2BCD13AB006CB06E /* button_setting.png */; }; + B891A5A12BCD274C006CB06E /* button_sound_off.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3BB2BCD13AB006CB06E /* button_sound_off.png */; }; + B891A5A22BCD274C006CB06E /* button_sound_on.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3BC2BCD13AB006CB06E /* button_sound_on.png */; }; + B891A5A32BCD274C006CB06E /* button_turquoise.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3BD2BCD13AB006CB06E /* button_turquoise.png */; }; + B891A5A42BCD274C006CB06E /* button_yellow.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3BE2BCD13AB006CB06E /* button_yellow.png */; }; + B891A5A52BCD274C006CB06E /* buttonff.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3BF2BCD13AB006CB06E /* buttonff.png */; }; + B891A5A62BCD274C006CB06E /* dark_green.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C02BCD13AB006CB06E /* dark_green.png */; }; + B891A5A72BCD2768006CB06E /* g_finger.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4092BCD13AB006CB06E /* g_finger.png */; }; + B891A5A82BCD2768006CB06E /* g_life_indicator_dead.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A40A2BCD13AB006CB06E /* g_life_indicator_dead.png */; }; + B891A5A92BCD2768006CB06E /* g_life_indicator_ok.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A40B2BCD13AB006CB06E /* g_life_indicator_ok.png */; }; + B891A5AA2BCD2768006CB06E /* level_halo.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A40C2BCD13AB006CB06E /* level_halo.png */; }; + B891A5AB2BCD278E006CB06E /* level_1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C42BCD13AB006CB06E /* level_1.png */; }; + B891A5AC2BCD278E006CB06E /* level_2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C52BCD13AB006CB06E /* level_2.png */; }; + B891A5AD2BCD278E006CB06E /* level_3.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C62BCD13AB006CB06E /* level_3.png */; }; + B891A5AE2BCD27A7006CB06E /* scene_layout.scl in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4042BCD13AB006CB06E /* scene_layout.scl */; }; + B891A5AF2BCD27C5006CB06E /* background.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F22BCD13AB006CB06E /* background.png */; }; + B891A5B02BCD27C5006CB06E /* cart_back1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F32BCD13AB006CB06E /* cart_back1.png */; }; + B891A5B12BCD27C5006CB06E /* cart_back2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F42BCD13AB006CB06E /* cart_back2.png */; }; + B891A5B22BCD27C5006CB06E /* cart_front.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F52BCD13AB006CB06E /* cart_front.png */; }; + B891A5B32BCD27C5006CB06E /* clock.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F62BCD13AB006CB06E /* clock.png */; }; + B891A5B42BCD27C5006CB06E /* food_in_cart.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F72BCD13AB006CB06E /* food_in_cart.png */; }; + B891A5B52BCD27C5006CB06E /* gum.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F82BCD13AB006CB06E /* gum.png */; }; + B891A5B62BCD27C5006CB06E /* hand_leather.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F92BCD13AB006CB06E /* hand_leather.png */; }; + B891A5B72BCD27C5006CB06E /* hand_sling.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3FA2BCD13AB006CB06E /* hand_sling.png */; }; + B891A5B82BCD27C5006CB06E /* sling.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3FB2BCD13AB006CB06E /* sling.png */; }; + B891A5B92BCD27C5006CB06E /* steve_head1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3FC2BCD13AB006CB06E /* steve_head1.png */; }; + B891A5BA2BCD27C5006CB06E /* steve_head2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3FD2BCD13AB006CB06E /* steve_head2.png */; }; + B891A5BB2BCD27C5006CB06E /* steve_head3.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3FE2BCD13AB006CB06E /* steve_head3.png */; }; + B891A5BC2BCD27C5006CB06E /* steve_head4.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3FF2BCD13AB006CB06E /* steve_head4.png */; }; + B891A5BD2BCD27C5006CB06E /* steve_head5.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4002BCD13AB006CB06E /* steve_head5.png */; }; + B891A5BE2BCD27C5006CB06E /* well_done_pic.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4012BCD13AB006CB06E /* well_done_pic.png */; }; + B891A5BF2BCD27C5006CB06E /* wooden_shelf.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4022BCD13AB006CB06E /* wooden_shelf.png */; }; + B891A5C42BCD27FC006CB06E /* apples.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C82BCD13AB006CB06E /* apples.png */; }; + B891A5C52BCD27FC006CB06E /* baguettes.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3C92BCD13AB006CB06E /* baguettes.png */; }; + B891A5C62BCD27FC006CB06E /* bananas.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3CA2BCD13AB006CB06E /* bananas.png */; }; + B891A5C72BCD27FC006CB06E /* cakes.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3CB2BCD13AB006CB06E /* cakes.png */; }; + B891A5C82BCD27FC006CB06E /* chocolate.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3CC2BCD13AB006CB06E /* chocolate.png */; }; + B891A5C92BCD27FC006CB06E /* cucumbers.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3CD2BCD13AB006CB06E /* cucumbers.png */; }; + B891A5CA2BCD27FC006CB06E /* donuts.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3CE2BCD13AB006CB06E /* donuts.png */; }; + B891A5CB2BCD27FC006CB06E /* icecream.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3CF2BCD13AB006CB06E /* icecream.png */; }; + B891A5CC2BCD27FC006CB06E /* lettuce.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D02BCD13AB006CB06E /* lettuce.png */; }; + B891A5CD2BCD27FC006CB06E /* milk.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D12BCD13AB006CB06E /* milk.png */; }; + B891A5CE2BCD27FC006CB06E /* orange.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D22BCD13AB006CB06E /* orange.png */; }; + B891A5CF2BCD27FC006CB06E /* tomatoes.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D32BCD13AB006CB06E /* tomatoes.png */; }; + B891A5D02BCD286F006CB06E /* apple_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D52BCD13AB006CB06E /* apple_splodge.png */; }; + B891A5D12BCD286F006CB06E /* apple1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D62BCD13AB006CB06E /* apple1.png */; }; + B891A5D22BCD286F006CB06E /* apple2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D72BCD13AB006CB06E /* apple2.png */; }; + B891A5D32BCD286F006CB06E /* baguette.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D82BCD13AB006CB06E /* baguette.png */; }; + B891A5D42BCD286F006CB06E /* banana_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3D92BCD13AB006CB06E /* banana_splodge.png */; }; + B891A5D52BCD286F006CB06E /* banana1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3DA2BCD13AB006CB06E /* banana1.png */; }; + B891A5D62BCD286F006CB06E /* banana2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3DB2BCD13AB006CB06E /* banana2.png */; }; + B891A5D72BCD286F006CB06E /* cake_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3DC2BCD13AB006CB06E /* cake_splodge.png */; }; + B891A5D82BCD286F006CB06E /* cake1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3DD2BCD13AB006CB06E /* cake1.png */; }; + B891A5D92BCD286F006CB06E /* cake2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3DE2BCD13AB006CB06E /* cake2.png */; }; + B891A5DA2BCD2870006CB06E /* chocolate_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3DF2BCD13AB006CB06E /* chocolate_splodge.png */; }; + B891A5DB2BCD2870006CB06E /* chocolate1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E02BCD13AB006CB06E /* chocolate1.png */; }; + B891A5DC2BCD2870006CB06E /* chocolate2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E12BCD13AB006CB06E /* chocolate2.png */; }; + B891A5DD2BCD2870006CB06E /* cucumber_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E22BCD13AB006CB06E /* cucumber_splodge.png */; }; + B891A5DE2BCD2870006CB06E /* cucumber1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E32BCD13AB006CB06E /* cucumber1.png */; }; + B891A5DF2BCD2870006CB06E /* cucumber2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E42BCD13AB006CB06E /* cucumber2.png */; }; + B891A5E02BCD2870006CB06E /* donut_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E52BCD13AB006CB06E /* donut_splodge.png */; }; + B891A5E12BCD2870006CB06E /* donut1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E62BCD13AB006CB06E /* donut1.png */; }; + B891A5E22BCD2870006CB06E /* donut2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E72BCD13AB006CB06E /* donut2.png */; }; + B891A5E32BCD2870006CB06E /* icecream_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E82BCD13AB006CB06E /* icecream_splodge.png */; }; + B891A5E42BCD2870006CB06E /* icecream1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3E92BCD13AB006CB06E /* icecream1.png */; }; + B891A5E52BCD2870006CB06E /* icecream2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3EA2BCD13AB006CB06E /* icecream2.png */; }; + B891A5E62BCD2870006CB06E /* lettuce.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3EB2BCD13AB006CB06E /* lettuce.png */; }; + B891A5E72BCD2870006CB06E /* milk.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3EC2BCD13AB006CB06E /* milk.png */; }; + B891A5E82BCD2870006CB06E /* orange.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3ED2BCD13AB006CB06E /* orange.png */; }; + B891A5E92BCD2870006CB06E /* tomato_splodge.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3EE2BCD13AB006CB06E /* tomato_splodge.png */; }; + B891A5EA2BCD2870006CB06E /* tomato1.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3EF2BCD13AB006CB06E /* tomato1.png */; }; + B891A5EB2BCD2870006CB06E /* tomato2.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A3F02BCD13AB006CB06E /* tomato2.png */; }; + B891A5EC2BCD2881006CB06E /* accept_button.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4062BCD13AB006CB06E /* accept_button.png */; }; + B891A5ED2BCD2881006CB06E /* accept_popup.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = B891A4072BCD13AB006CB06E /* accept_popup.png */; }; F5FCE34FB9E028C20A7850DE /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A3DBEAB6142776646A34D9C /* Pods_RunnerTests.framework */; }; FB8AFCB0A8C34B5508A68F45 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6DEBBC1D861BE053F3ECE0B9 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -113,6 +376,90 @@ remoteGlobalIDString = B7090455528040A188F88B63; remoteInfo = external; }; + B891A2372BCD0799006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 3807F551AD064687B13953E9; + remoteInfo = cocos2d; + }; + B891A2472BCD07A0006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 93D47B87033C4D7FAE278F63; + remoteInfo = ext_clipper; + }; + B891A2492BCD07A4006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 9B5B61961265480B9501BB85; + remoteInfo = ext_convertUTF; + }; + B891A24B2BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 640C23AC632B46BCB77CCD82; + remoteInfo = ext_edtaa3func; + }; + B891A24D2BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 618D32556072465F93DE7875; + remoteInfo = ext_md5; + }; + B891A24F2BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 8C44DCE97EE54C668F009408; + remoteInfo = ext_poly2tri; + }; + B891A2512BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 0CD8E5254AFF4CC6A098CCCD; + remoteInfo = ext_recast; + }; + B891A2532BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 7D4C0E93B1B6458FB6F41437; + remoteInfo = ext_tinyxml2; + }; + B891A2552BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 14848C4B886C463A8DDC1934; + remoteInfo = ext_unzip; + }; + B891A2572BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 660C78B688AA476E92DA3337; + remoteInfo = ext_xxhash; + }; + B891A2592BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = F4506C5795E24DF09078A7A5; + remoteInfo = ext_xxtea; + }; + B891A25B2BCD07AE006CB06E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 3035DDACD99D43368F5F0015; + remoteInfo = external; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -123,152 +470,1652 @@ dstSubfolderSpec = 10; files = ( ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F12BCD17E2006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F22BCD240A006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = fonts; + dstSubfolderSpec = 7; + files = ( + B891A4F92BCD2429006CB06E /* ComicSansMSBold.ttf in CopyFiles */, + B891A4FA2BCD2429006CB06E /* ComicSansMSRegular.ttf in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F32BCD240C006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res; + dstSubfolderSpec = 7; + files = ( + B891A4FB2BCD2449006CB06E /* .gitkeep in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F42BCD240D006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F52BCD240E006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common/games; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F62BCD240F006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common/games/shoot_game; + dstSubfolderSpec = 7; + files = ( + B891A4FC2BCD2488006CB06E /* gconfig.gcf in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F72BCD2410006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common/sounds; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A4F82BCD2411006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common/sounds/games; + dstSubfolderSpec = 7; + files = ( + B891A4FD2BCD24CA006CB06E /* g_no.mp3 in CopyFiles */, + B891A4FE2BCD24CA006CB06E /* g_oops.mp3 in CopyFiles */, + B891A4FF2BCD24CA006CB06E /* g_uh_oh.mp3 in CopyFiles */, + B891A5002BCD24CA006CB06E /* g_well_done.mp3 in CopyFiles */, + B891A5012BCD24CA006CB06E /* g_whoo_hoo.mp3 in CopyFiles */, + B891A5022BCD24CA006CB06E /* g_yeah.mp3 in CopyFiles */, + B891A5032BCD24CA006CB06E /* maggie_super.mp3 in CopyFiles */, + B891A5042BCD24CA006CB06E /* maggie_thats_right.mp3 in CopyFiles */, + B891A5052BCD24CA006CB06E /* maggie_yeah.mp3 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5062BCD24CE006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common/sounds/games/game_shoot; + dstSubfolderSpec = 7; + files = ( + B891A50F2BCD2524006CB06E /* all_in_trolley.mp3 in CopyFiles */, + B891A5102BCD2524006CB06E /* apple.mp3 in CopyFiles */, + B891A5112BCD2524006CB06E /* banana.mp3 in CopyFiles */, + B891A5122BCD2524006CB06E /* cake.mp3 in CopyFiles */, + B891A5132BCD2524006CB06E /* chocolate.mp3 in CopyFiles */, + B891A5142BCD2524006CB06E /* cucumber.mp3 in CopyFiles */, + B891A5152BCD2524006CB06E /* donut.mp3 in CopyFiles */, + B891A5162BCD2524006CB06E /* effect_catapult.mp3 in CopyFiles */, + B891A5172BCD2524006CB06E /* effect_hit.mp3 in CopyFiles */, + B891A5182BCD2524006CB06E /* effect_in_trolley.mp3 in CopyFiles */, + B891A5192BCD2524006CB06E /* hit_maggie.mp3 in CopyFiles */, + B891A51A2BCD2524006CB06E /* hit_steve.mp3 in CopyFiles */, + B891A51B2BCD2524006CB06E /* icecream.mp3 in CopyFiles */, + B891A51C2BCD2524006CB06E /* in_trolley.mp3 in CopyFiles */, + B891A51D2BCD2524006CB06E /* not_apple.mp3 in CopyFiles */, + B891A51E2BCD2524006CB06E /* not_banana.mp3 in CopyFiles */, + B891A51F2BCD2524006CB06E /* not_cake.mp3 in CopyFiles */, + B891A5202BCD2524006CB06E /* not_chocolate.mp3 in CopyFiles */, + B891A5212BCD2524006CB06E /* not_cucumber.mp3 in CopyFiles */, + B891A5222BCD2524006CB06E /* not_donut.mp3 in CopyFiles */, + B891A5232BCD2524006CB06E /* not_icecream.mp3 in CopyFiles */, + B891A5242BCD2524006CB06E /* not_in_trolley.mp3 in CopyFiles */, + B891A5252BCD2524006CB06E /* not_tomato.mp3 in CopyFiles */, + B891A5262BCD2524006CB06E /* put_it_trolley.mp3 in CopyFiles */, + B891A5272BCD2524006CB06E /* shop_closed.mp3 in CopyFiles */, + B891A5282BCD2524006CB06E /* start.mp3 in CopyFiles */, + B891A5292BCD2524006CB06E /* tomato.mp3 in CopyFiles */, + B891A52A2BCD2524006CB06E /* wrong_3_times.mp3 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5072BCD24DF006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/common/sounds/level_picking; + dstSubfolderSpec = 7; + files = ( + B891A52B2BCD2547006CB06E /* g_pick_level.mp3 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5082BCD24E0006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5092BCD24E1006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/app_links; + dstSubfolderSpec = 7; + files = ( + B891A52C2BCD2576006CB06E /* app_link_halloween.png in CopyFiles */, + B891A52D2BCD2576006CB06E /* app_link_toy.png in CopyFiles */, + B891A52E2BCD2576006CB06E /* doll_toy_app.png in CopyFiles */, + B891A52F2BCD2576006CB06E /* halo_icon.png in CopyFiles */, + B891A5302BCD2576006CB06E /* steve_maggie.png in CopyFiles */, + B891A5312BCD2576006CB06E /* witch_halloween_app.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A50A2BCD24E2006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/buttons; + dstSubfolderSpec = 7; + files = ( + B891A5322BCD259B006CB06E /* horizontalButtonPanelBackFFPause.obl in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A50B2BCD24E3006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/buttons/graphics; + dstSubfolderSpec = 7; + files = ( + B891A5332BCD25B4006CB06E /* button_back.png in CopyFiles */, + B891A5342BCD25B4006CB06E /* button_go.png in CopyFiles */, + B891A5352BCD25B4006CB06E /* button_green.png in CopyFiles */, + B891A5362BCD25B4006CB06E /* button_grey.png in CopyFiles */, + B891A5372BCD25B4006CB06E /* button_orange.png in CopyFiles */, + B891A5382BCD25B4006CB06E /* button_pause.png in CopyFiles */, + B891A5392BCD25B4006CB06E /* button_purple.png in CopyFiles */, + B891A53A2BCD25B4006CB06E /* button_red.png in CopyFiles */, + B891A53B2BCD25B4006CB06E /* button_repeat.png in CopyFiles */, + B891A53C2BCD25B4006CB06E /* button_setting.png in CopyFiles */, + B891A53D2BCD25B4006CB06E /* button_sound_off.png in CopyFiles */, + B891A53E2BCD25B4006CB06E /* button_sound_on.png in CopyFiles */, + B891A53F2BCD25B4006CB06E /* button_turquoise.png in CopyFiles */, + B891A5402BCD25B4006CB06E /* button_yellow.png in CopyFiles */, + B891A5412BCD25B4006CB06E /* buttonff.png in CopyFiles */, + B891A5422BCD25B4006CB06E /* dark_green.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A50C2BCD24E4006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics; + dstSubfolderSpec = 7; + files = ( + B891A5432BCD25D4006CB06E /* g_finger.png in CopyFiles */, + B891A5442BCD25D4006CB06E /* g_life_indicator_dead.png in CopyFiles */, + B891A5452BCD25D4006CB06E /* g_life_indicator_ok.png in CopyFiles */, + B891A5462BCD25D4006CB06E /* level_halo.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A50D2BCD24E5006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics/levels; + dstSubfolderSpec = 7; + files = ( + B891A5472BCD25F0006CB06E /* level_1.png in CopyFiles */, + B891A5482BCD25F0006CB06E /* level_2.png in CopyFiles */, + B891A5492BCD25F0006CB06E /* level_3.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A50E2BCD24E6006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics/shoot_game; + dstSubfolderSpec = 7; + files = ( + B891A54A2BCD2615006CB06E /* scene_layout.scl in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A54B2BCD261A006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics/shoot_game/graphics; + dstSubfolderSpec = 7; + files = ( + B891A5572BCD266A006CB06E /* cart_back1.png in CopyFiles */, + B891A5582BCD266A006CB06E /* cart_back2.png in CopyFiles */, + B891A5592BCD266A006CB06E /* cart_front.png in CopyFiles */, + B891A55A2BCD266A006CB06E /* clock.png in CopyFiles */, + B891A55B2BCD266A006CB06E /* food_in_cart.png in CopyFiles */, + B891A55C2BCD266A006CB06E /* gum.png in CopyFiles */, + B891A55D2BCD266A006CB06E /* hand_leather.png in CopyFiles */, + B891A55E2BCD266A006CB06E /* hand_sling.png in CopyFiles */, + B891A55F2BCD266A006CB06E /* sling.png in CopyFiles */, + B891A5602BCD266A006CB06E /* steve_head1.png in CopyFiles */, + B891A5612BCD266A006CB06E /* steve_head2.png in CopyFiles */, + B891A5622BCD266A006CB06E /* steve_head3.png in CopyFiles */, + B891A5632BCD266A006CB06E /* steve_head4.png in CopyFiles */, + B891A5642BCD266A006CB06E /* steve_head5.png in CopyFiles */, + B891A5652BCD266A006CB06E /* wooden_shelf.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A54C2BCD261B006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics/shoot_game/graphics/shelf_food; + dstSubfolderSpec = 7; + files = ( + B891A5662BCD2694006CB06E /* apples.png in CopyFiles */, + B891A5672BCD2694006CB06E /* baguettes.png in CopyFiles */, + B891A5682BCD2694006CB06E /* bananas.png in CopyFiles */, + B891A5692BCD2694006CB06E /* cakes.png in CopyFiles */, + B891A56A2BCD2694006CB06E /* chocolate.png in CopyFiles */, + B891A56B2BCD2694006CB06E /* cucumbers.png in CopyFiles */, + B891A56C2BCD2694006CB06E /* donuts.png in CopyFiles */, + B891A56D2BCD2694006CB06E /* icecream.png in CopyFiles */, + B891A56E2BCD2695006CB06E /* lettuce.png in CopyFiles */, + B891A56F2BCD2695006CB06E /* milk.png in CopyFiles */, + B891A5702BCD2695006CB06E /* orange.png in CopyFiles */, + B891A5712BCD2695006CB06E /* tomatoes.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A54D2BCD261C006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics/shoot_game/graphics/single_food; + dstSubfolderSpec = 7; + files = ( + B891A5722BCD26DA006CB06E /* apple_splodge.png in CopyFiles */, + B891A5732BCD26DA006CB06E /* apple1.png in CopyFiles */, + B891A5742BCD26DA006CB06E /* apple2.png in CopyFiles */, + B891A5752BCD26DA006CB06E /* baguette.png in CopyFiles */, + B891A5762BCD26DA006CB06E /* banana_splodge.png in CopyFiles */, + B891A5772BCD26DA006CB06E /* banana1.png in CopyFiles */, + B891A5782BCD26DA006CB06E /* banana2.png in CopyFiles */, + B891A5792BCD26DA006CB06E /* cake_splodge.png in CopyFiles */, + B891A57A2BCD26DA006CB06E /* cake1.png in CopyFiles */, + B891A57B2BCD26DA006CB06E /* cake2.png in CopyFiles */, + B891A57C2BCD26DA006CB06E /* chocolate_splodge.png in CopyFiles */, + B891A57D2BCD26DA006CB06E /* chocolate1.png in CopyFiles */, + B891A57E2BCD26DA006CB06E /* chocolate2.png in CopyFiles */, + B891A57F2BCD26DA006CB06E /* cucumber_splodge.png in CopyFiles */, + B891A5802BCD26DA006CB06E /* cucumber1.png in CopyFiles */, + B891A5812BCD26DA006CB06E /* cucumber2.png in CopyFiles */, + B891A5822BCD26DA006CB06E /* donut_splodge.png in CopyFiles */, + B891A5832BCD26DA006CB06E /* donut1.png in CopyFiles */, + B891A5842BCD26DA006CB06E /* donut2.png in CopyFiles */, + B891A5852BCD26DA006CB06E /* icecream_splodge.png in CopyFiles */, + B891A5862BCD26DA006CB06E /* icecream1.png in CopyFiles */, + B891A5872BCD26DA006CB06E /* icecream2.png in CopyFiles */, + B891A5882BCD26DA006CB06E /* lettuce.png in CopyFiles */, + B891A5892BCD26DA006CB06E /* milk.png in CopyFiles */, + B891A58A2BCD26DA006CB06E /* orange.png in CopyFiles */, + B891A58B2BCD26DA006CB06E /* tomato_splodge.png in CopyFiles */, + B891A58C2BCD26DA006CB06E /* tomato1.png in CopyFiles */, + B891A58D2BCD26DA006CB06E /* tomato2.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A54E2BCD261D006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/small/graphics/tos_popup; + dstSubfolderSpec = 7; + files = ( + B891A58E2BCD26F9006CB06E /* accept_button.png in CopyFiles */, + B891A58F2BCD26F9006CB06E /* accept_popup.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A54F2BCD261E006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5502BCD261F006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/app_links; + dstSubfolderSpec = 7; + files = ( + B891A5902BCD271D006CB06E /* app_link_halloween.png in CopyFiles */, + B891A5912BCD271D006CB06E /* app_link_toy.png in CopyFiles */, + B891A5922BCD271D006CB06E /* doll_toy_app.png in CopyFiles */, + B891A5932BCD271D006CB06E /* halo_icon.png in CopyFiles */, + B891A5942BCD271D006CB06E /* steve_maggie.png in CopyFiles */, + B891A5952BCD271D006CB06E /* witch_halloween_app.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5512BCD2620006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/buttons; + dstSubfolderSpec = 7; + files = ( + B891A5962BCD2734006CB06E /* horizontalButtonPanelBackFFPause.obl in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5522BCD2621006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/buttons/graphics; + dstSubfolderSpec = 7; + files = ( + B891A5972BCD274C006CB06E /* button_back.png in CopyFiles */, + B891A5982BCD274C006CB06E /* button_go.png in CopyFiles */, + B891A5992BCD274C006CB06E /* button_green.png in CopyFiles */, + B891A59A2BCD274C006CB06E /* button_grey.png in CopyFiles */, + B891A59B2BCD274C006CB06E /* button_orange.png in CopyFiles */, + B891A59C2BCD274C006CB06E /* button_pause.png in CopyFiles */, + B891A59D2BCD274C006CB06E /* button_purple.png in CopyFiles */, + B891A59E2BCD274C006CB06E /* button_red.png in CopyFiles */, + B891A59F2BCD274C006CB06E /* button_repeat.png in CopyFiles */, + B891A5A02BCD274C006CB06E /* button_setting.png in CopyFiles */, + B891A5A12BCD274C006CB06E /* button_sound_off.png in CopyFiles */, + B891A5A22BCD274C006CB06E /* button_sound_on.png in CopyFiles */, + B891A5A32BCD274C006CB06E /* button_turquoise.png in CopyFiles */, + B891A5A42BCD274C006CB06E /* button_yellow.png in CopyFiles */, + B891A5A52BCD274C006CB06E /* buttonff.png in CopyFiles */, + B891A5A62BCD274C006CB06E /* dark_green.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5532BCD2622006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics; + dstSubfolderSpec = 7; + files = ( + B891A5A72BCD2768006CB06E /* g_finger.png in CopyFiles */, + B891A5A82BCD2768006CB06E /* g_life_indicator_dead.png in CopyFiles */, + B891A5A92BCD2768006CB06E /* g_life_indicator_ok.png in CopyFiles */, + B891A5AA2BCD2768006CB06E /* level_halo.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5542BCD2623006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics/levels; + dstSubfolderSpec = 7; + files = ( + B891A5AB2BCD278E006CB06E /* level_1.png in CopyFiles */, + B891A5AC2BCD278E006CB06E /* level_2.png in CopyFiles */, + B891A5AD2BCD278E006CB06E /* level_3.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5552BCD2624006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics/shoot_game; + dstSubfolderSpec = 7; + files = ( + B891A5AE2BCD27A7006CB06E /* scene_layout.scl in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5562BCD2625006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics/shoot_game/graphics; + dstSubfolderSpec = 7; + files = ( + B891A5AF2BCD27C5006CB06E /* background.png in CopyFiles */, + B891A5B02BCD27C5006CB06E /* cart_back1.png in CopyFiles */, + B891A5B12BCD27C5006CB06E /* cart_back2.png in CopyFiles */, + B891A5B22BCD27C5006CB06E /* cart_front.png in CopyFiles */, + B891A5B32BCD27C5006CB06E /* clock.png in CopyFiles */, + B891A5B42BCD27C5006CB06E /* food_in_cart.png in CopyFiles */, + B891A5B52BCD27C5006CB06E /* gum.png in CopyFiles */, + B891A5B62BCD27C5006CB06E /* hand_leather.png in CopyFiles */, + B891A5B72BCD27C5006CB06E /* hand_sling.png in CopyFiles */, + B891A5B82BCD27C5006CB06E /* sling.png in CopyFiles */, + B891A5B92BCD27C5006CB06E /* steve_head1.png in CopyFiles */, + B891A5BA2BCD27C5006CB06E /* steve_head2.png in CopyFiles */, + B891A5BB2BCD27C5006CB06E /* steve_head3.png in CopyFiles */, + B891A5BC2BCD27C5006CB06E /* steve_head4.png in CopyFiles */, + B891A5BD2BCD27C5006CB06E /* steve_head5.png in CopyFiles */, + B891A5BE2BCD27C5006CB06E /* well_done_pic.png in CopyFiles */, + B891A5BF2BCD27C5006CB06E /* wooden_shelf.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5C02BCD27CC006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics/shoot_game/graphics/shelf_food; + dstSubfolderSpec = 7; + files = ( + B891A5C42BCD27FC006CB06E /* apples.png in CopyFiles */, + B891A5C52BCD27FC006CB06E /* baguettes.png in CopyFiles */, + B891A5C62BCD27FC006CB06E /* bananas.png in CopyFiles */, + B891A5C72BCD27FC006CB06E /* cakes.png in CopyFiles */, + B891A5C82BCD27FC006CB06E /* chocolate.png in CopyFiles */, + B891A5C92BCD27FC006CB06E /* cucumbers.png in CopyFiles */, + B891A5CA2BCD27FC006CB06E /* donuts.png in CopyFiles */, + B891A5CB2BCD27FC006CB06E /* icecream.png in CopyFiles */, + B891A5CC2BCD27FC006CB06E /* lettuce.png in CopyFiles */, + B891A5CD2BCD27FC006CB06E /* milk.png in CopyFiles */, + B891A5CE2BCD27FC006CB06E /* orange.png in CopyFiles */, + B891A5CF2BCD27FC006CB06E /* tomatoes.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5C12BCD27CD006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics/shoot_game/graphics/single_food; + dstSubfolderSpec = 7; + files = ( + B891A5D02BCD286F006CB06E /* apple_splodge.png in CopyFiles */, + B891A5D12BCD286F006CB06E /* apple1.png in CopyFiles */, + B891A5D22BCD286F006CB06E /* apple2.png in CopyFiles */, + B891A5D32BCD286F006CB06E /* baguette.png in CopyFiles */, + B891A5D42BCD286F006CB06E /* banana_splodge.png in CopyFiles */, + B891A5D52BCD286F006CB06E /* banana1.png in CopyFiles */, + B891A5D62BCD286F006CB06E /* banana2.png in CopyFiles */, + B891A5D72BCD286F006CB06E /* cake_splodge.png in CopyFiles */, + B891A5D82BCD286F006CB06E /* cake1.png in CopyFiles */, + B891A5D92BCD286F006CB06E /* cake2.png in CopyFiles */, + B891A5DA2BCD2870006CB06E /* chocolate_splodge.png in CopyFiles */, + B891A5DB2BCD2870006CB06E /* chocolate1.png in CopyFiles */, + B891A5DC2BCD2870006CB06E /* chocolate2.png in CopyFiles */, + B891A5DD2BCD2870006CB06E /* cucumber_splodge.png in CopyFiles */, + B891A5DE2BCD2870006CB06E /* cucumber1.png in CopyFiles */, + B891A5DF2BCD2870006CB06E /* cucumber2.png in CopyFiles */, + B891A5E02BCD2870006CB06E /* donut_splodge.png in CopyFiles */, + B891A5E12BCD2870006CB06E /* donut1.png in CopyFiles */, + B891A5E22BCD2870006CB06E /* donut2.png in CopyFiles */, + B891A5E32BCD2870006CB06E /* icecream_splodge.png in CopyFiles */, + B891A5E42BCD2870006CB06E /* icecream1.png in CopyFiles */, + B891A5E52BCD2870006CB06E /* icecream2.png in CopyFiles */, + B891A5E62BCD2870006CB06E /* lettuce.png in CopyFiles */, + B891A5E72BCD2870006CB06E /* milk.png in CopyFiles */, + B891A5E82BCD2870006CB06E /* orange.png in CopyFiles */, + B891A5E92BCD2870006CB06E /* tomato_splodge.png in CopyFiles */, + B891A5EA2BCD2870006CB06E /* tomato1.png in CopyFiles */, + B891A5EB2BCD2870006CB06E /* tomato2.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B891A5C22BCD27CE006CB06E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = res/xlarge/graphics/tos_popup; + dstSubfolderSpec = 7; + files = ( + B891A5EC2BCD2881006CB06E /* accept_button.png in CopyFiles */, + B891A5ED2BCD2881006CB06E /* accept_popup.png in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2A3DBEAB6142776646A34D9C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2DE9FE013448D0821175591C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3563EC8D55A646823FD26A83 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 48BCA0827DCB98991774F5AC /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 52450AF02A4C415B007B3E4B /* XSMessageMehtodChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XSMessageMehtodChannel.swift; sourceTree = ""; }; + 52450AF22A4ED0EC007B3E4B /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + 525E17192A4BD03900104CDF /* VoiceXSMessageChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceXSMessageChannel.swift; sourceTree = ""; }; + 6DEBBC1D861BE053F3ECE0B9 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B852C1342BCABB5E00A53FC4 /* GameMessageChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameMessageChannel.swift; sourceTree = ""; }; + B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_libs.xcodeproj; path = cocosgame/engine/cocos/core/cocos2d_libs.xcodeproj; sourceTree = ""; }; + B891A2622BCD1392006CB06E /* TouchInterceptingLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchInterceptingLayer.cpp; sourceTree = ""; }; + B891A2632BCD1392006CB06E /* TouchInterceptingLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchInterceptingLayer.h; sourceTree = ""; }; + B891A2652BCD1392006CB06E /* LevelPickerLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LevelPickerLayer.cpp; sourceTree = ""; }; + B891A2662BCD1392006CB06E /* LevelPickerLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelPickerLayer.h; sourceTree = ""; }; + B891A2672BCD1392006CB06E /* LevelPickerView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LevelPickerView.cpp; sourceTree = ""; }; + B891A2682BCD1392006CB06E /* LevelPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelPickerView.h; sourceTree = ""; }; + B891A2692BCD1392006CB06E /* SimpleLevelPickerView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLevelPickerView.cpp; sourceTree = ""; }; + B891A26A2BCD1392006CB06E /* SimpleLevelPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLevelPickerView.h; sourceTree = ""; }; + B891A26C2BCD1392006CB06E /* AlertView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AlertView.cpp; sourceTree = ""; }; + B891A26D2BCD1392006CB06E /* AlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlertView.h; sourceTree = ""; }; + B891A26E2BCD1392006CB06E /* AppLinksView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppLinksView.cpp; sourceTree = ""; }; + B891A26F2BCD1392006CB06E /* AppLinksView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppLinksView.h; sourceTree = ""; }; + B891A2702BCD1392006CB06E /* GameLifeIndicatorView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GameLifeIndicatorView.cpp; sourceTree = ""; }; + B891A2712BCD1392006CB06E /* GameLifeIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameLifeIndicatorView.h; sourceTree = ""; }; + B891A2722BCD1392006CB06E /* LevelView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LevelView.cpp; sourceTree = ""; }; + B891A2732BCD1392006CB06E /* LevelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelView.h; sourceTree = ""; }; + B891A2742BCD1392006CB06E /* ParentalGateShowInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentalGateShowInterface.cpp; sourceTree = ""; }; + B891A2752BCD1392006CB06E /* ParentalGateShowInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentalGateShowInterface.h; sourceTree = ""; }; + B891A2762BCD1392006CB06E /* ParentalGateView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentalGateView.cpp; sourceTree = ""; }; + B891A2772BCD1392006CB06E /* ParentalGateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentalGateView.h; sourceTree = ""; }; + B891A2782BCD1392006CB06E /* SettingsLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsLayer.cpp; sourceTree = ""; }; + B891A2792BCD1392006CB06E /* SettingsLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsLayer.h; sourceTree = ""; }; + B891A27A2BCD1392006CB06E /* TOSAcceptPopupView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TOSAcceptPopupView.cpp; sourceTree = ""; }; + B891A27B2BCD1392006CB06E /* TOSAcceptPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOSAcceptPopupView.h; sourceTree = ""; }; + B891A27D2BCD1392006CB06E /* ChangingSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChangingSprite.cpp; sourceTree = ""; }; + B891A27E2BCD1392006CB06E /* ChangingSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChangingSprite.h; sourceTree = ""; }; + B891A27F2BCD1392006CB06E /* ContainerSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContainerSprite.cpp; sourceTree = ""; }; + B891A2802BCD1392006CB06E /* ContainerSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerSprite.h; sourceTree = ""; }; + B891A2812BCD1392006CB06E /* PlainLabel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlainLabel.cpp; sourceTree = ""; }; + B891A2822BCD1392006CB06E /* PlainLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlainLabel.h; sourceTree = ""; }; + B891A2832BCD1392006CB06E /* PlainNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlainNode.cpp; sourceTree = ""; }; + B891A2842BCD1392006CB06E /* PlainNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlainNode.h; sourceTree = ""; }; + B891A2852BCD1392006CB06E /* PlainSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlainSprite.cpp; sourceTree = ""; }; + B891A2862BCD1392006CB06E /* PlainSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlainSprite.h; sourceTree = ""; }; + B891A2872BCD1392006CB06E /* ProgressSliderNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProgressSliderNode.cpp; sourceTree = ""; }; + B891A2882BCD1392006CB06E /* ProgressSliderNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressSliderNode.h; sourceTree = ""; }; + B891A2892BCD1392006CB06E /* SimpleButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleButton.cpp; sourceTree = ""; }; + B891A28A2BCD1392006CB06E /* SimpleButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleButton.h; sourceTree = ""; }; + B891A28B2BCD1392006CB06E /* TouchableSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchableSprite.cpp; sourceTree = ""; }; + B891A28C2BCD1392006CB06E /* TouchableSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchableSprite.h; sourceTree = ""; }; + B891A28D2BCD1392006CB06E /* TwoStateButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TwoStateButton.cpp; sourceTree = ""; }; + B891A28E2BCD1392006CB06E /* TwoStateButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwoStateButton.h; sourceTree = ""; }; + B891A2902BCD1392006CB06E /* MiscConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MiscConfig.h; sourceTree = ""; }; + B891A2912BCD1392006CB06E /* ResourcesConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourcesConfig.cpp; sourceTree = ""; }; + B891A2922BCD1392006CB06E /* ResourcesConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourcesConfig.h; sourceTree = ""; }; + B891A2932BCD1392006CB06E /* Strings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Strings.cpp; sourceTree = ""; }; + B891A2942BCD1392006CB06E /* Strings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strings.h; sourceTree = ""; }; + B891A2952BCD1392006CB06E /* TouchHandlerTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchHandlerTypes.h; sourceTree = ""; }; + B891A2992BCD1392006CB06E /* GameConfigParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GameConfigParser.cpp; sourceTree = ""; }; + B891A29A2BCD1392006CB06E /* GameConfigParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameConfigParser.h; sourceTree = ""; }; + B891A29C2BCD1392006CB06E /* LayoutObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutObject.cpp; sourceTree = ""; }; + B891A29D2BCD1392006CB06E /* LayoutObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutObject.h; sourceTree = ""; }; + B891A29E2BCD1392006CB06E /* LayoutParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutParser.cpp; sourceTree = ""; }; + B891A29F2BCD1392006CB06E /* LayoutParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutParser.h; sourceTree = ""; }; + B891A2A12BCD1392006CB06E /* ActionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionData.cpp; sourceTree = ""; }; + B891A2A22BCD1392006CB06E /* ActionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionData.h; sourceTree = ""; }; + B891A2AD2BCD1392006CB06E /* ScenarioObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScenarioObject.h; sourceTree = ""; }; + B891A2B02BCD1392006CB06E /* SimpleValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleValue.h; sourceTree = ""; }; + B891A2B12BCD1392006CB06E /* TimeIndicatorInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeIndicatorInterface.h; sourceTree = ""; }; + B891A2B52BCD1392006CB06E /* JSONParseUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONParseUtils.cpp; sourceTree = ""; }; + B891A2B62BCD1392006CB06E /* JSONParseUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONParseUtils.h; sourceTree = ""; }; + B891A2B72BCD1392006CB06E /* SimpleValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleValue.h; sourceTree = ""; }; + B891A2B82BCD1392006CB06E /* StaticActionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticActionParser.cpp; sourceTree = ""; }; + B891A2B92BCD1392006CB06E /* StaticActionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticActionParser.h; sourceTree = ""; }; + B891A2BA2BCD1392006CB06E /* ValueStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValueStorage.cpp; sourceTree = ""; }; + B891A2BB2BCD1392006CB06E /* ValueStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueStorage.h; sourceTree = ""; }; + B891A2BD2BCD1392006CB06E /* SubGameScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubGameScene.cpp; sourceTree = ""; }; + B891A2BE2BCD1392006CB06E /* SubGameScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubGameScene.h; sourceTree = ""; }; + B891A2BF2BCD1392006CB06E /* SubGameSceneShoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubGameSceneShoot.cpp; sourceTree = ""; }; + B891A2C02BCD1392006CB06E /* SubGameSceneShoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubGameSceneShoot.h; sourceTree = ""; }; + B891A2C42BCD1392006CB06E /* ParentScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentScene.cpp; sourceTree = ""; }; + B891A2C52BCD1392006CB06E /* ParentScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentScene.h; sourceTree = ""; }; + B891A2C62BCD1392006CB06E /* SceneWithUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SceneWithUtils.cpp; sourceTree = ""; }; + B891A2C72BCD1392006CB06E /* SceneWithUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneWithUtils.h; sourceTree = ""; }; + B891A2C92BCD1392006CB06E /* DrawingUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingUtils.cpp; sourceTree = ""; }; + B891A2CA2BCD1392006CB06E /* DrawingUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingUtils.h; sourceTree = ""; }; + B891A2CB2BCD1392006CB06E /* GeometryUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeometryUtils.cpp; sourceTree = ""; }; + B891A2CC2BCD1392006CB06E /* GeometryUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeometryUtils.h; sourceTree = ""; }; + B891A2CD2BCD1392006CB06E /* MathUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathUtils.cpp; sourceTree = ""; }; + B891A2CE2BCD1392006CB06E /* MathUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathUtils.h; sourceTree = ""; }; + B891A2CF2BCD1392006CB06E /* MiscUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MiscUtils.cpp; sourceTree = ""; }; + B891A2D02BCD1392006CB06E /* MiscUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MiscUtils.h; sourceTree = ""; }; + B891A2D12BCD1392006CB06E /* ResourceUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceUtilities.cpp; sourceTree = ""; }; + B891A2D22BCD1392006CB06E /* ResourceUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceUtilities.h; sourceTree = ""; }; + B891A2D32BCD1392006CB06E /* ScalingUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScalingUtils.cpp; sourceTree = ""; }; + B891A2D42BCD1392006CB06E /* ScalingUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScalingUtils.h; sourceTree = ""; }; + B891A2D52BCD1392006CB06E /* SoundsRepo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SoundsRepo.cpp; sourceTree = ""; }; + B891A2D62BCD1392006CB06E /* SoundsRepo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoundsRepo.h; sourceTree = ""; }; + B891A2D72BCD1392006CB06E /* SoundUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SoundUtils.cpp; sourceTree = ""; }; + B891A2D82BCD1392006CB06E /* SoundUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoundUtils.h; sourceTree = ""; }; + B891A2D92BCD1392006CB06E /* StringUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringUtils.cpp; sourceTree = ""; }; + B891A2DA2BCD1392006CB06E /* StringUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtils.h; sourceTree = ""; }; + B891A3162BCD13AB006CB06E /* ComicSansMSBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ComicSansMSBold.ttf; sourceTree = ""; }; + B891A3172BCD13AB006CB06E /* ComicSansMSRegular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ComicSansMSRegular.ttf; sourceTree = ""; }; + B891A3192BCD13AB006CB06E /* gconfig.gcf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gconfig.gcf; sourceTree = ""; }; + B891A31C2BCD13AB006CB06E /* all_in_trolley.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = all_in_trolley.mp3; sourceTree = ""; }; + B891A31D2BCD13AB006CB06E /* apple.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = apple.mp3; sourceTree = ""; }; + B891A31E2BCD13AB006CB06E /* banana.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = banana.mp3; sourceTree = ""; }; + B891A31F2BCD13AB006CB06E /* cake.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = cake.mp3; sourceTree = ""; }; + B891A3202BCD13AB006CB06E /* chocolate.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = chocolate.mp3; sourceTree = ""; }; + B891A3212BCD13AB006CB06E /* cucumber.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = cucumber.mp3; sourceTree = ""; }; + B891A3222BCD13AB006CB06E /* donut.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = donut.mp3; sourceTree = ""; }; + B891A3232BCD13AB006CB06E /* effect_catapult.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = effect_catapult.mp3; sourceTree = ""; }; + B891A3242BCD13AB006CB06E /* effect_hit.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = effect_hit.mp3; sourceTree = ""; }; + B891A3252BCD13AB006CB06E /* effect_in_trolley.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = effect_in_trolley.mp3; sourceTree = ""; }; + B891A3262BCD13AB006CB06E /* hit_maggie.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = hit_maggie.mp3; sourceTree = ""; }; + B891A3272BCD13AB006CB06E /* hit_steve.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = hit_steve.mp3; sourceTree = ""; }; + B891A3282BCD13AB006CB06E /* icecream.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = icecream.mp3; sourceTree = ""; }; + B891A3292BCD13AB006CB06E /* in_trolley.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = in_trolley.mp3; sourceTree = ""; }; + B891A32A2BCD13AB006CB06E /* not_apple.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_apple.mp3; sourceTree = ""; }; + B891A32B2BCD13AB006CB06E /* not_banana.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_banana.mp3; sourceTree = ""; }; + B891A32C2BCD13AB006CB06E /* not_cake.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_cake.mp3; sourceTree = ""; }; + B891A32D2BCD13AB006CB06E /* not_chocolate.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_chocolate.mp3; sourceTree = ""; }; + B891A32E2BCD13AB006CB06E /* not_cucumber.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_cucumber.mp3; sourceTree = ""; }; + B891A32F2BCD13AB006CB06E /* not_donut.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_donut.mp3; sourceTree = ""; }; + B891A3302BCD13AB006CB06E /* not_icecream.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_icecream.mp3; sourceTree = ""; }; + B891A3312BCD13AB006CB06E /* not_in_trolley.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_in_trolley.mp3; sourceTree = ""; }; + B891A3322BCD13AB006CB06E /* not_tomato.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = not_tomato.mp3; sourceTree = ""; }; + B891A3332BCD13AB006CB06E /* put_it_trolley.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = put_it_trolley.mp3; sourceTree = ""; }; + B891A3342BCD13AB006CB06E /* shop_closed.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = shop_closed.mp3; sourceTree = ""; }; + B891A3352BCD13AB006CB06E /* start.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = start.mp3; sourceTree = ""; }; + B891A3362BCD13AB006CB06E /* tomato.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = tomato.mp3; sourceTree = ""; }; + B891A3372BCD13AB006CB06E /* wrong_3_times.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = wrong_3_times.mp3; sourceTree = ""; }; + B891A3392BCD13AB006CB06E /* g_no.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_no.mp3; sourceTree = ""; }; + B891A33A2BCD13AB006CB06E /* g_oops.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_oops.mp3; sourceTree = ""; }; + B891A33B2BCD13AB006CB06E /* g_uh_oh.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_uh_oh.mp3; sourceTree = ""; }; + B891A33C2BCD13AB006CB06E /* g_well_done.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_well_done.mp3; sourceTree = ""; }; + B891A33D2BCD13AB006CB06E /* g_whoo_hoo.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_whoo_hoo.mp3; sourceTree = ""; }; + B891A33E2BCD13AB006CB06E /* g_yeah.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_yeah.mp3; sourceTree = ""; }; + B891A33F2BCD13AB006CB06E /* maggie_super.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = maggie_super.mp3; sourceTree = ""; }; + B891A3402BCD13AB006CB06E /* maggie_thats_right.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = maggie_thats_right.mp3; sourceTree = ""; }; + B891A3412BCD13AB006CB06E /* maggie_yeah.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = maggie_yeah.mp3; sourceTree = ""; }; + B891A3432BCD13AB006CB06E /* g_pick_level.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = g_pick_level.mp3; sourceTree = ""; }; + B891A3472BCD13AB006CB06E /* app_link_halloween.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = app_link_halloween.png; sourceTree = ""; }; + B891A3482BCD13AB006CB06E /* app_link_toy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = app_link_toy.png; sourceTree = ""; }; + B891A3492BCD13AB006CB06E /* doll_toy_app.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = doll_toy_app.png; sourceTree = ""; }; + B891A34A2BCD13AB006CB06E /* halo_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = halo_icon.png; sourceTree = ""; }; + B891A34B2BCD13AB006CB06E /* steve_maggie.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_maggie.png; sourceTree = ""; }; + B891A34C2BCD13AB006CB06E /* witch_halloween_app.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = witch_halloween_app.png; sourceTree = ""; }; + B891A34E2BCD13AB006CB06E /* button_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_back.png; sourceTree = ""; }; + B891A34F2BCD13AB006CB06E /* button_go.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_go.png; sourceTree = ""; }; + B891A3502BCD13AB006CB06E /* button_green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_green.png; sourceTree = ""; }; + B891A3512BCD13AB006CB06E /* button_grey.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_grey.png; sourceTree = ""; }; + B891A3522BCD13AB006CB06E /* button_orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_orange.png; sourceTree = ""; }; + B891A3532BCD13AB006CB06E /* button_pause.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_pause.png; sourceTree = ""; }; + B891A3542BCD13AB006CB06E /* button_purple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_purple.png; sourceTree = ""; }; + B891A3552BCD13AB006CB06E /* button_red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_red.png; sourceTree = ""; }; + B891A3562BCD13AB006CB06E /* button_repeat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_repeat.png; sourceTree = ""; }; + B891A3572BCD13AB006CB06E /* button_setting.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_setting.png; sourceTree = ""; }; + B891A3582BCD13AB006CB06E /* button_sound_off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_sound_off.png; sourceTree = ""; }; + B891A3592BCD13AB006CB06E /* button_sound_on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_sound_on.png; sourceTree = ""; }; + B891A35A2BCD13AB006CB06E /* button_turquoise.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_turquoise.png; sourceTree = ""; }; + B891A35B2BCD13AB006CB06E /* button_yellow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_yellow.png; sourceTree = ""; }; + B891A35C2BCD13AB006CB06E /* buttonff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonff.png; sourceTree = ""; }; + B891A35D2BCD13AB006CB06E /* dark_green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dark_green.png; sourceTree = ""; }; + B891A35F2BCD13AB006CB06E /* horizontalButtonPanelBackFFPause.obl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = horizontalButtonPanelBackFFPause.obl; sourceTree = ""; }; + B891A3612BCD13AB006CB06E /* level_1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_1.png; sourceTree = ""; }; + B891A3622BCD13AB006CB06E /* level_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_2.png; sourceTree = ""; }; + B891A3632BCD13AB006CB06E /* level_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_3.png; sourceTree = ""; }; + B891A3652BCD13AB006CB06E /* apples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apples.png; sourceTree = ""; }; + B891A3662BCD13AB006CB06E /* baguettes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = baguettes.png; sourceTree = ""; }; + B891A3672BCD13AB006CB06E /* bananas.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bananas.png; sourceTree = ""; }; + B891A3682BCD13AB006CB06E /* cakes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cakes.png; sourceTree = ""; }; + B891A3692BCD13AB006CB06E /* chocolate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate.png; sourceTree = ""; }; + B891A36A2BCD13AB006CB06E /* cucumbers.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumbers.png; sourceTree = ""; }; + B891A36B2BCD13AB006CB06E /* donuts.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donuts.png; sourceTree = ""; }; + B891A36C2BCD13AB006CB06E /* icecream.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream.png; sourceTree = ""; }; + B891A36D2BCD13AB006CB06E /* lettuce.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lettuce.png; sourceTree = ""; }; + B891A36E2BCD13AB006CB06E /* milk.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = milk.png; sourceTree = ""; }; + B891A36F2BCD13AB006CB06E /* orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = orange.png; sourceTree = ""; }; + B891A3702BCD13AB006CB06E /* tomatoes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomatoes.png; sourceTree = ""; }; + B891A3722BCD13AB006CB06E /* apple_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple_splodge.png; sourceTree = ""; }; + B891A3732BCD13AB006CB06E /* apple1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple1.png; sourceTree = ""; }; + B891A3742BCD13AB006CB06E /* apple2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple2.png; sourceTree = ""; }; + B891A3752BCD13AB006CB06E /* baguette.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = baguette.png; sourceTree = ""; }; + B891A3762BCD13AB006CB06E /* banana_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = banana_splodge.png; sourceTree = ""; }; + B891A3772BCD13AB006CB06E /* banana1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = banana1.png; sourceTree = ""; }; + B891A3782BCD13AB006CB06E /* banana2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = banana2.png; sourceTree = ""; }; + B891A3792BCD13AB006CB06E /* cake_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cake_splodge.png; sourceTree = ""; }; + B891A37A2BCD13AB006CB06E /* cake1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cake1.png; sourceTree = ""; }; + B891A37B2BCD13AB006CB06E /* cake2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cake2.png; sourceTree = ""; }; + B891A37C2BCD13AB006CB06E /* chocolate_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate_splodge.png; sourceTree = ""; }; + B891A37D2BCD13AB006CB06E /* chocolate1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate1.png; sourceTree = ""; }; + B891A37E2BCD13AB006CB06E /* chocolate2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate2.png; sourceTree = ""; }; + B891A37F2BCD13AB006CB06E /* cucumber_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumber_splodge.png; sourceTree = ""; }; + B891A3802BCD13AB006CB06E /* cucumber1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumber1.png; sourceTree = ""; }; + B891A3812BCD13AB006CB06E /* cucumber2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumber2.png; sourceTree = ""; }; + B891A3822BCD13AB006CB06E /* donut_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donut_splodge.png; sourceTree = ""; }; + B891A3832BCD13AB006CB06E /* donut1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donut1.png; sourceTree = ""; }; + B891A3842BCD13AB006CB06E /* donut2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donut2.png; sourceTree = ""; }; + B891A3852BCD13AB006CB06E /* icecream_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream_splodge.png; sourceTree = ""; }; + B891A3862BCD13AB006CB06E /* icecream1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream1.png; sourceTree = ""; }; + B891A3872BCD13AB006CB06E /* icecream2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream2.png; sourceTree = ""; }; + B891A3882BCD13AB006CB06E /* lettuce.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lettuce.png; sourceTree = ""; }; + B891A3892BCD13AB006CB06E /* milk.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = milk.png; sourceTree = ""; }; + B891A38A2BCD13AB006CB06E /* orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = orange.png; sourceTree = ""; }; + B891A38B2BCD13AB006CB06E /* tomato_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomato_splodge.png; sourceTree = ""; }; + B891A38C2BCD13AB006CB06E /* tomato1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomato1.png; sourceTree = ""; }; + B891A38D2BCD13AB006CB06E /* tomato2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomato2.png; sourceTree = ""; }; + B891A38F2BCD13AB006CB06E /* cart_back1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cart_back1.png; sourceTree = ""; }; + B891A3902BCD13AB006CB06E /* cart_back2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cart_back2.png; sourceTree = ""; }; + B891A3912BCD13AB006CB06E /* cart_front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cart_front.png; sourceTree = ""; }; + B891A3922BCD13AB006CB06E /* clock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock.png; sourceTree = ""; }; + B891A3932BCD13AB006CB06E /* food_in_cart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = food_in_cart.png; sourceTree = ""; }; + B891A3942BCD13AB006CB06E /* gum.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gum.png; sourceTree = ""; }; + B891A3952BCD13AB006CB06E /* hand_leather.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hand_leather.png; sourceTree = ""; }; + B891A3962BCD13AB006CB06E /* hand_sling.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hand_sling.png; sourceTree = ""; }; + B891A3972BCD13AB006CB06E /* sling.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sling.png; sourceTree = ""; }; + B891A3982BCD13AB006CB06E /* steve_head1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head1.png; sourceTree = ""; }; + B891A3992BCD13AB006CB06E /* steve_head2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head2.png; sourceTree = ""; }; + B891A39A2BCD13AB006CB06E /* steve_head3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head3.png; sourceTree = ""; }; + B891A39B2BCD13AB006CB06E /* steve_head4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head4.png; sourceTree = ""; }; + B891A39C2BCD13AB006CB06E /* steve_head5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head5.png; sourceTree = ""; }; + B891A39D2BCD13AB006CB06E /* wooden_shelf.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wooden_shelf.png; sourceTree = ""; }; + B891A39F2BCD13AB006CB06E /* scene_layout.scl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = scene_layout.scl; sourceTree = ""; }; + B891A3A12BCD13AB006CB06E /* accept_button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = accept_button.png; sourceTree = ""; }; + B891A3A22BCD13AB006CB06E /* accept_popup.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = accept_popup.png; sourceTree = ""; }; + B891A3A42BCD13AB006CB06E /* g_finger.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_finger.png; sourceTree = ""; }; + B891A3A52BCD13AB006CB06E /* g_life_indicator_dead.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_life_indicator_dead.png; sourceTree = ""; }; + B891A3A62BCD13AB006CB06E /* g_life_indicator_ok.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_life_indicator_ok.png; sourceTree = ""; }; + B891A3A72BCD13AB006CB06E /* level_halo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_halo.png; sourceTree = ""; }; + B891A3AA2BCD13AB006CB06E /* app_link_halloween.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = app_link_halloween.png; sourceTree = ""; }; + B891A3AB2BCD13AB006CB06E /* app_link_toy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = app_link_toy.png; sourceTree = ""; }; + B891A3AC2BCD13AB006CB06E /* doll_toy_app.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = doll_toy_app.png; sourceTree = ""; }; + B891A3AD2BCD13AB006CB06E /* halo_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = halo_icon.png; sourceTree = ""; }; + B891A3AE2BCD13AB006CB06E /* steve_maggie.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_maggie.png; sourceTree = ""; }; + B891A3AF2BCD13AB006CB06E /* witch_halloween_app.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = witch_halloween_app.png; sourceTree = ""; }; + B891A3B12BCD13AB006CB06E /* button_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_back.png; sourceTree = ""; }; + B891A3B22BCD13AB006CB06E /* button_go.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_go.png; sourceTree = ""; }; + B891A3B32BCD13AB006CB06E /* button_green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_green.png; sourceTree = ""; }; + B891A3B42BCD13AB006CB06E /* button_grey.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_grey.png; sourceTree = ""; }; + B891A3B52BCD13AB006CB06E /* button_orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_orange.png; sourceTree = ""; }; + B891A3B62BCD13AB006CB06E /* button_pause.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_pause.png; sourceTree = ""; }; + B891A3B72BCD13AB006CB06E /* button_purple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_purple.png; sourceTree = ""; }; + B891A3B82BCD13AB006CB06E /* button_red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_red.png; sourceTree = ""; }; + B891A3B92BCD13AB006CB06E /* button_repeat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_repeat.png; sourceTree = ""; }; + B891A3BA2BCD13AB006CB06E /* button_setting.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_setting.png; sourceTree = ""; }; + B891A3BB2BCD13AB006CB06E /* button_sound_off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_sound_off.png; sourceTree = ""; }; + B891A3BC2BCD13AB006CB06E /* button_sound_on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_sound_on.png; sourceTree = ""; }; + B891A3BD2BCD13AB006CB06E /* button_turquoise.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_turquoise.png; sourceTree = ""; }; + B891A3BE2BCD13AB006CB06E /* button_yellow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button_yellow.png; sourceTree = ""; }; + B891A3BF2BCD13AB006CB06E /* buttonff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttonff.png; sourceTree = ""; }; + B891A3C02BCD13AB006CB06E /* dark_green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dark_green.png; sourceTree = ""; }; + B891A3C22BCD13AB006CB06E /* horizontalButtonPanelBackFFPause.obl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = horizontalButtonPanelBackFFPause.obl; sourceTree = ""; }; + B891A3C42BCD13AB006CB06E /* level_1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_1.png; sourceTree = ""; }; + B891A3C52BCD13AB006CB06E /* level_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_2.png; sourceTree = ""; }; + B891A3C62BCD13AB006CB06E /* level_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_3.png; sourceTree = ""; }; + B891A3C82BCD13AB006CB06E /* apples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apples.png; sourceTree = ""; }; + B891A3C92BCD13AB006CB06E /* baguettes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = baguettes.png; sourceTree = ""; }; + B891A3CA2BCD13AB006CB06E /* bananas.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bananas.png; sourceTree = ""; }; + B891A3CB2BCD13AB006CB06E /* cakes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cakes.png; sourceTree = ""; }; + B891A3CC2BCD13AB006CB06E /* chocolate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate.png; sourceTree = ""; }; + B891A3CD2BCD13AB006CB06E /* cucumbers.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumbers.png; sourceTree = ""; }; + B891A3CE2BCD13AB006CB06E /* donuts.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donuts.png; sourceTree = ""; }; + B891A3CF2BCD13AB006CB06E /* icecream.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream.png; sourceTree = ""; }; + B891A3D02BCD13AB006CB06E /* lettuce.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lettuce.png; sourceTree = ""; }; + B891A3D12BCD13AB006CB06E /* milk.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = milk.png; sourceTree = ""; }; + B891A3D22BCD13AB006CB06E /* orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = orange.png; sourceTree = ""; }; + B891A3D32BCD13AB006CB06E /* tomatoes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomatoes.png; sourceTree = ""; }; + B891A3D52BCD13AB006CB06E /* apple_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple_splodge.png; sourceTree = ""; }; + B891A3D62BCD13AB006CB06E /* apple1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple1.png; sourceTree = ""; }; + B891A3D72BCD13AB006CB06E /* apple2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple2.png; sourceTree = ""; }; + B891A3D82BCD13AB006CB06E /* baguette.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = baguette.png; sourceTree = ""; }; + B891A3D92BCD13AB006CB06E /* banana_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = banana_splodge.png; sourceTree = ""; }; + B891A3DA2BCD13AB006CB06E /* banana1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = banana1.png; sourceTree = ""; }; + B891A3DB2BCD13AB006CB06E /* banana2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = banana2.png; sourceTree = ""; }; + B891A3DC2BCD13AB006CB06E /* cake_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cake_splodge.png; sourceTree = ""; }; + B891A3DD2BCD13AB006CB06E /* cake1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cake1.png; sourceTree = ""; }; + B891A3DE2BCD13AB006CB06E /* cake2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cake2.png; sourceTree = ""; }; + B891A3DF2BCD13AB006CB06E /* chocolate_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate_splodge.png; sourceTree = ""; }; + B891A3E02BCD13AB006CB06E /* chocolate1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate1.png; sourceTree = ""; }; + B891A3E12BCD13AB006CB06E /* chocolate2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chocolate2.png; sourceTree = ""; }; + B891A3E22BCD13AB006CB06E /* cucumber_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumber_splodge.png; sourceTree = ""; }; + B891A3E32BCD13AB006CB06E /* cucumber1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumber1.png; sourceTree = ""; }; + B891A3E42BCD13AB006CB06E /* cucumber2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cucumber2.png; sourceTree = ""; }; + B891A3E52BCD13AB006CB06E /* donut_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donut_splodge.png; sourceTree = ""; }; + B891A3E62BCD13AB006CB06E /* donut1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donut1.png; sourceTree = ""; }; + B891A3E72BCD13AB006CB06E /* donut2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = donut2.png; sourceTree = ""; }; + B891A3E82BCD13AB006CB06E /* icecream_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream_splodge.png; sourceTree = ""; }; + B891A3E92BCD13AB006CB06E /* icecream1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream1.png; sourceTree = ""; }; + B891A3EA2BCD13AB006CB06E /* icecream2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icecream2.png; sourceTree = ""; }; + B891A3EB2BCD13AB006CB06E /* lettuce.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lettuce.png; sourceTree = ""; }; + B891A3EC2BCD13AB006CB06E /* milk.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = milk.png; sourceTree = ""; }; + B891A3ED2BCD13AB006CB06E /* orange.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = orange.png; sourceTree = ""; }; + B891A3EE2BCD13AB006CB06E /* tomato_splodge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomato_splodge.png; sourceTree = ""; }; + B891A3EF2BCD13AB006CB06E /* tomato1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomato1.png; sourceTree = ""; }; + B891A3F02BCD13AB006CB06E /* tomato2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tomato2.png; sourceTree = ""; }; + B891A3F22BCD13AB006CB06E /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; + B891A3F32BCD13AB006CB06E /* cart_back1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cart_back1.png; sourceTree = ""; }; + B891A3F42BCD13AB006CB06E /* cart_back2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cart_back2.png; sourceTree = ""; }; + B891A3F52BCD13AB006CB06E /* cart_front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cart_front.png; sourceTree = ""; }; + B891A3F62BCD13AB006CB06E /* clock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock.png; sourceTree = ""; }; + B891A3F72BCD13AB006CB06E /* food_in_cart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = food_in_cart.png; sourceTree = ""; }; + B891A3F82BCD13AB006CB06E /* gum.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gum.png; sourceTree = ""; }; + B891A3F92BCD13AB006CB06E /* hand_leather.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hand_leather.png; sourceTree = ""; }; + B891A3FA2BCD13AB006CB06E /* hand_sling.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hand_sling.png; sourceTree = ""; }; + B891A3FB2BCD13AB006CB06E /* sling.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sling.png; sourceTree = ""; }; + B891A3FC2BCD13AB006CB06E /* steve_head1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head1.png; sourceTree = ""; }; + B891A3FD2BCD13AB006CB06E /* steve_head2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head2.png; sourceTree = ""; }; + B891A3FE2BCD13AB006CB06E /* steve_head3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head3.png; sourceTree = ""; }; + B891A3FF2BCD13AB006CB06E /* steve_head4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head4.png; sourceTree = ""; }; + B891A4002BCD13AB006CB06E /* steve_head5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = steve_head5.png; sourceTree = ""; }; + B891A4012BCD13AB006CB06E /* well_done_pic.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = well_done_pic.png; sourceTree = ""; }; + B891A4022BCD13AB006CB06E /* wooden_shelf.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wooden_shelf.png; sourceTree = ""; }; + B891A4042BCD13AB006CB06E /* scene_layout.scl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = scene_layout.scl; sourceTree = ""; }; + B891A4062BCD13AB006CB06E /* accept_button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = accept_button.png; sourceTree = ""; }; + B891A4072BCD13AB006CB06E /* accept_popup.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = accept_popup.png; sourceTree = ""; }; + B891A4092BCD13AB006CB06E /* g_finger.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_finger.png; sourceTree = ""; }; + B891A40A2BCD13AB006CB06E /* g_life_indicator_dead.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_life_indicator_dead.png; sourceTree = ""; }; + B891A40B2BCD13AB006CB06E /* g_life_indicator_ok.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_life_indicator_ok.png; sourceTree = ""; }; + B891A40C2BCD13AB006CB06E /* level_halo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = level_halo.png; sourceTree = ""; }; + B891A40F2BCD13AB006CB06E /* .gitkeep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; + D63F3847140160A2204489BA /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + D8C046A1A9C279FDBB5C174E /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + F04D1DAE6591EAD461CBBE9A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FB8AFCB0A8C34B5508A68F45 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C23E992F6BFFE604720B1F08 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F5FCE34FB9E028C20A7850DE /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 340CE8403EC22FE8EE1FA3EF /* Pods */ = { + isa = PBXGroup; + children = ( + F04D1DAE6591EAD461CBBE9A /* Pods-Runner.debug.xcconfig */, + 3563EC8D55A646823FD26A83 /* Pods-Runner.release.xcconfig */, + 2DE9FE013448D0821175591C /* Pods-Runner.profile.xcconfig */, + D63F3847140160A2204489BA /* Pods-RunnerTests.debug.xcconfig */, + D8C046A1A9C279FDBB5C174E /* Pods-RunnerTests.release.xcconfig */, + 48BCA0827DCB98991774F5AC /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */, + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + 340CE8403EC22FE8EE1FA3EF /* Pods */, + E653501EF99460B1BB76C5EE /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + B891A25D2BCD102C006CB06E /* Wowgame */, + 52450AF22A4ED0EC007B3E4B /* Runner.entitlements */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 52450AF02A4C415B007B3E4B /* XSMessageMehtodChannel.swift */, + 525E17192A4BD03900104CDF /* VoiceXSMessageChannel.swift */, + B852C1342BCABB5E00A53FC4 /* GameMessageChannel.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + B852D3EE2BCADF3600A53FC4 /* Products */ = { + isa = PBXGroup; + children = ( + B852D3FF2BCADF3700A53FC4 /* libcocos2d.a */, + B852D4012BCADF3700A53FC4 /* libext_clipper.a */, + B852D4032BCADF3700A53FC4 /* libext_convertUTF.a */, + B852D4052BCADF3700A53FC4 /* libext_edtaa3func.a */, + B852D4072BCADF3700A53FC4 /* libext_md5.a */, + B852D4092BCADF3700A53FC4 /* libext_poly2tri.a */, + B852D40B2BCADF3700A53FC4 /* libext_recast.a */, + B852D40D2BCADF3700A53FC4 /* libext_tinyxml2.a */, + B852D40F2BCADF3700A53FC4 /* libext_unzip.a */, + B852D4112BCADF3700A53FC4 /* libext_xxhash.a */, + B852D4132BCADF3700A53FC4 /* libext_xxtea.a */, + B852D4152BCADF3700A53FC4 /* libexternal.a */, + ); + name = Products; + sourceTree = ""; + }; + B891A25D2BCD102C006CB06E /* Wowgame */ = { + isa = PBXGroup; + children = ( + B891A2DF2BCD1392006CB06E /* Classes */, + B891A4112BCD13AB006CB06E /* Resources */, + ); + path = Wowgame; + sourceTree = ""; + }; + B891A2642BCD1392006CB06E /* Layers */ = { + isa = PBXGroup; + children = ( + B891A2622BCD1392006CB06E /* TouchInterceptingLayer.cpp */, + B891A2632BCD1392006CB06E /* TouchInterceptingLayer.h */, + ); + path = Layers; + sourceTree = ""; + }; + B891A26B2BCD1392006CB06E /* LevelPickerView */ = { + isa = PBXGroup; + children = ( + B891A2652BCD1392006CB06E /* LevelPickerLayer.cpp */, + B891A2662BCD1392006CB06E /* LevelPickerLayer.h */, + B891A2672BCD1392006CB06E /* LevelPickerView.cpp */, + B891A2682BCD1392006CB06E /* LevelPickerView.h */, + B891A2692BCD1392006CB06E /* SimpleLevelPickerView.cpp */, + B891A26A2BCD1392006CB06E /* SimpleLevelPickerView.h */, + ); + path = LevelPickerView; + sourceTree = ""; + }; + B891A27C2BCD1392006CB06E /* CustomViews */ = { + isa = PBXGroup; + children = ( + B891A2642BCD1392006CB06E /* Layers */, + B891A26B2BCD1392006CB06E /* LevelPickerView */, + B891A26C2BCD1392006CB06E /* AlertView.cpp */, + B891A26D2BCD1392006CB06E /* AlertView.h */, + B891A26E2BCD1392006CB06E /* AppLinksView.cpp */, + B891A26F2BCD1392006CB06E /* AppLinksView.h */, + B891A2702BCD1392006CB06E /* GameLifeIndicatorView.cpp */, + B891A2712BCD1392006CB06E /* GameLifeIndicatorView.h */, + B891A2722BCD1392006CB06E /* LevelView.cpp */, + B891A2732BCD1392006CB06E /* LevelView.h */, + B891A2742BCD1392006CB06E /* ParentalGateShowInterface.cpp */, + B891A2752BCD1392006CB06E /* ParentalGateShowInterface.h */, + B891A2762BCD1392006CB06E /* ParentalGateView.cpp */, + B891A2772BCD1392006CB06E /* ParentalGateView.h */, + B891A2782BCD1392006CB06E /* SettingsLayer.cpp */, + B891A2792BCD1392006CB06E /* SettingsLayer.h */, + B891A27A2BCD1392006CB06E /* TOSAcceptPopupView.cpp */, + B891A27B2BCD1392006CB06E /* TOSAcceptPopupView.h */, + ); + path = CustomViews; + sourceTree = ""; + }; + B891A28F2BCD1392006CB06E /* LayoutObjects */ = { + isa = PBXGroup; + children = ( + B891A27D2BCD1392006CB06E /* ChangingSprite.cpp */, + B891A27E2BCD1392006CB06E /* ChangingSprite.h */, + B891A27F2BCD1392006CB06E /* ContainerSprite.cpp */, + B891A2802BCD1392006CB06E /* ContainerSprite.h */, + B891A2812BCD1392006CB06E /* PlainLabel.cpp */, + B891A2822BCD1392006CB06E /* PlainLabel.h */, + B891A2832BCD1392006CB06E /* PlainNode.cpp */, + B891A2842BCD1392006CB06E /* PlainNode.h */, + B891A2852BCD1392006CB06E /* PlainSprite.cpp */, + B891A2862BCD1392006CB06E /* PlainSprite.h */, + B891A2872BCD1392006CB06E /* ProgressSliderNode.cpp */, + B891A2882BCD1392006CB06E /* ProgressSliderNode.h */, + B891A2892BCD1392006CB06E /* SimpleButton.cpp */, + B891A28A2BCD1392006CB06E /* SimpleButton.h */, + B891A28B2BCD1392006CB06E /* TouchableSprite.cpp */, + B891A28C2BCD1392006CB06E /* TouchableSprite.h */, + B891A28D2BCD1392006CB06E /* TwoStateButton.cpp */, + B891A28E2BCD1392006CB06E /* TwoStateButton.h */, + ); + path = LayoutObjects; + sourceTree = ""; + }; + B891A2962BCD1392006CB06E /* Misc */ = { + isa = PBXGroup; + children = ( + B891A2902BCD1392006CB06E /* MiscConfig.h */, + B891A2912BCD1392006CB06E /* ResourcesConfig.cpp */, + B891A2922BCD1392006CB06E /* ResourcesConfig.h */, + B891A2932BCD1392006CB06E /* Strings.cpp */, + B891A2942BCD1392006CB06E /* Strings.h */, + B891A2952BCD1392006CB06E /* TouchHandlerTypes.h */, + ); + path = Misc; + sourceTree = ""; + }; + B891A29B2BCD1392006CB06E /* GameParsing */ = { + isa = PBXGroup; + children = ( + B891A2992BCD1392006CB06E /* GameConfigParser.cpp */, + B891A29A2BCD1392006CB06E /* GameConfigParser.h */, + ); + path = GameParsing; + sourceTree = ""; + }; + B891A2A02BCD1392006CB06E /* LayoutParsing */ = { + isa = PBXGroup; + children = ( + B891A29C2BCD1392006CB06E /* LayoutObject.cpp */, + B891A29D2BCD1392006CB06E /* LayoutObject.h */, + B891A29E2BCD1392006CB06E /* LayoutParser.cpp */, + B891A29F2BCD1392006CB06E /* LayoutParser.h */, + ); + path = LayoutParsing; + sourceTree = ""; + }; + B891A2B42BCD1392006CB06E /* ScenarioParsing */ = { + isa = PBXGroup; + children = ( + B891A2A12BCD1392006CB06E /* ActionData.cpp */, + B891A2A22BCD1392006CB06E /* ActionData.h */, + B891A2AD2BCD1392006CB06E /* ScenarioObject.h */, + B891A2B02BCD1392006CB06E /* SimpleValue.h */, + B891A2B12BCD1392006CB06E /* TimeIndicatorInterface.h */, + ); + path = ScenarioParsing; + sourceTree = ""; + }; + B891A2BC2BCD1392006CB06E /* Parsing */ = { + isa = PBXGroup; + children = ( + B891A29B2BCD1392006CB06E /* GameParsing */, + B891A2A02BCD1392006CB06E /* LayoutParsing */, + B891A2B42BCD1392006CB06E /* ScenarioParsing */, + B891A2B52BCD1392006CB06E /* JSONParseUtils.cpp */, + B891A2B62BCD1392006CB06E /* JSONParseUtils.h */, + B891A2B72BCD1392006CB06E /* SimpleValue.h */, + B891A2B82BCD1392006CB06E /* StaticActionParser.cpp */, + B891A2B92BCD1392006CB06E /* StaticActionParser.h */, + B891A2BA2BCD1392006CB06E /* ValueStorage.cpp */, + B891A2BB2BCD1392006CB06E /* ValueStorage.h */, + ); + path = Parsing; + sourceTree = ""; + }; + B891A2C12BCD1392006CB06E /* SubGameScenes */ = { + isa = PBXGroup; + children = ( + B891A2BD2BCD1392006CB06E /* SubGameScene.cpp */, + B891A2BE2BCD1392006CB06E /* SubGameScene.h */, + B891A2BF2BCD1392006CB06E /* SubGameSceneShoot.cpp */, + B891A2C02BCD1392006CB06E /* SubGameSceneShoot.h */, + ); + path = SubGameScenes; + sourceTree = ""; + }; + B891A2C82BCD1392006CB06E /* Scenes */ = { + isa = PBXGroup; + children = ( + B891A2C12BCD1392006CB06E /* SubGameScenes */, + B891A2C42BCD1392006CB06E /* ParentScene.cpp */, + B891A2C52BCD1392006CB06E /* ParentScene.h */, + B891A2C62BCD1392006CB06E /* SceneWithUtils.cpp */, + B891A2C72BCD1392006CB06E /* SceneWithUtils.h */, + ); + path = Scenes; + sourceTree = ""; + }; + B891A2DB2BCD1392006CB06E /* Utils */ = { + isa = PBXGroup; + children = ( + B891A2C92BCD1392006CB06E /* DrawingUtils.cpp */, + B891A2CA2BCD1392006CB06E /* DrawingUtils.h */, + B891A2CB2BCD1392006CB06E /* GeometryUtils.cpp */, + B891A2CC2BCD1392006CB06E /* GeometryUtils.h */, + B891A2CD2BCD1392006CB06E /* MathUtils.cpp */, + B891A2CE2BCD1392006CB06E /* MathUtils.h */, + B891A2CF2BCD1392006CB06E /* MiscUtils.cpp */, + B891A2D02BCD1392006CB06E /* MiscUtils.h */, + B891A2D12BCD1392006CB06E /* ResourceUtilities.cpp */, + B891A2D22BCD1392006CB06E /* ResourceUtilities.h */, + B891A2D32BCD1392006CB06E /* ScalingUtils.cpp */, + B891A2D42BCD1392006CB06E /* ScalingUtils.h */, + B891A2D52BCD1392006CB06E /* SoundsRepo.cpp */, + B891A2D62BCD1392006CB06E /* SoundsRepo.h */, + B891A2D72BCD1392006CB06E /* SoundUtils.cpp */, + B891A2D82BCD1392006CB06E /* SoundUtils.h */, + B891A2D92BCD1392006CB06E /* StringUtils.cpp */, + B891A2DA2BCD1392006CB06E /* StringUtils.h */, + ); + path = Utils; + sourceTree = ""; + }; + B891A2DF2BCD1392006CB06E /* Classes */ = { + isa = PBXGroup; + children = ( + B891A27C2BCD1392006CB06E /* CustomViews */, + B891A28F2BCD1392006CB06E /* LayoutObjects */, + B891A2962BCD1392006CB06E /* Misc */, + B891A2BC2BCD1392006CB06E /* Parsing */, + B891A2C82BCD1392006CB06E /* Scenes */, + B891A2DB2BCD1392006CB06E /* Utils */, + ); + path = Classes; + sourceTree = ""; + }; + B891A3182BCD13AB006CB06E /* fonts */ = { + isa = PBXGroup; + children = ( + B891A3162BCD13AB006CB06E /* ComicSansMSBold.ttf */, + B891A3172BCD13AB006CB06E /* ComicSansMSRegular.ttf */, + ); + path = fonts; + sourceTree = ""; + }; + B891A31A2BCD13AB006CB06E /* shoot_game */ = { + isa = PBXGroup; + children = ( + B891A3192BCD13AB006CB06E /* gconfig.gcf */, + ); + path = shoot_game; + sourceTree = ""; + }; + B891A31B2BCD13AB006CB06E /* games */ = { + isa = PBXGroup; + children = ( + B891A31A2BCD13AB006CB06E /* shoot_game */, + ); + path = games; + sourceTree = ""; }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2A3DBEAB6142776646A34D9C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2DE9FE013448D0821175591C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 3563EC8D55A646823FD26A83 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 48BCA0827DCB98991774F5AC /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 52450AF02A4C415B007B3E4B /* XSMessageMehtodChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XSMessageMehtodChannel.swift; sourceTree = ""; }; - 52450AF22A4ED0EC007B3E4B /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; - 525E17192A4BD03900104CDF /* VoiceXSMessageChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceXSMessageChannel.swift; sourceTree = ""; }; - 6DEBBC1D861BE053F3ECE0B9 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B852C1342BCABB5E00A53FC4 /* GameMessageChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameMessageChannel.swift; sourceTree = ""; }; - B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_libs.xcodeproj; path = cocosgame/engine/cocos/core/cocos2d_libs.xcodeproj; sourceTree = ""; }; - D63F3847140160A2204489BA /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - D8C046A1A9C279FDBB5C174E /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - F04D1DAE6591EAD461CBBE9A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FB8AFCB0A8C34B5508A68F45 /* Pods_Runner.framework in Frameworks */, + B891A3382BCD13AB006CB06E /* game_shoot */ = { + isa = PBXGroup; + children = ( + B891A31C2BCD13AB006CB06E /* all_in_trolley.mp3 */, + B891A31D2BCD13AB006CB06E /* apple.mp3 */, + B891A31E2BCD13AB006CB06E /* banana.mp3 */, + B891A31F2BCD13AB006CB06E /* cake.mp3 */, + B891A3202BCD13AB006CB06E /* chocolate.mp3 */, + B891A3212BCD13AB006CB06E /* cucumber.mp3 */, + B891A3222BCD13AB006CB06E /* donut.mp3 */, + B891A3232BCD13AB006CB06E /* effect_catapult.mp3 */, + B891A3242BCD13AB006CB06E /* effect_hit.mp3 */, + B891A3252BCD13AB006CB06E /* effect_in_trolley.mp3 */, + B891A3262BCD13AB006CB06E /* hit_maggie.mp3 */, + B891A3272BCD13AB006CB06E /* hit_steve.mp3 */, + B891A3282BCD13AB006CB06E /* icecream.mp3 */, + B891A3292BCD13AB006CB06E /* in_trolley.mp3 */, + B891A32A2BCD13AB006CB06E /* not_apple.mp3 */, + B891A32B2BCD13AB006CB06E /* not_banana.mp3 */, + B891A32C2BCD13AB006CB06E /* not_cake.mp3 */, + B891A32D2BCD13AB006CB06E /* not_chocolate.mp3 */, + B891A32E2BCD13AB006CB06E /* not_cucumber.mp3 */, + B891A32F2BCD13AB006CB06E /* not_donut.mp3 */, + B891A3302BCD13AB006CB06E /* not_icecream.mp3 */, + B891A3312BCD13AB006CB06E /* not_in_trolley.mp3 */, + B891A3322BCD13AB006CB06E /* not_tomato.mp3 */, + B891A3332BCD13AB006CB06E /* put_it_trolley.mp3 */, + B891A3342BCD13AB006CB06E /* shop_closed.mp3 */, + B891A3352BCD13AB006CB06E /* start.mp3 */, + B891A3362BCD13AB006CB06E /* tomato.mp3 */, + B891A3372BCD13AB006CB06E /* wrong_3_times.mp3 */, ); - runOnlyForDeploymentPostprocessing = 0; + path = game_shoot; + sourceTree = ""; }; - C23E992F6BFFE604720B1F08 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F5FCE34FB9E028C20A7850DE /* Pods_RunnerTests.framework in Frameworks */, + B891A3422BCD13AB006CB06E /* games */ = { + isa = PBXGroup; + children = ( + B891A3382BCD13AB006CB06E /* game_shoot */, + B891A3392BCD13AB006CB06E /* g_no.mp3 */, + B891A33A2BCD13AB006CB06E /* g_oops.mp3 */, + B891A33B2BCD13AB006CB06E /* g_uh_oh.mp3 */, + B891A33C2BCD13AB006CB06E /* g_well_done.mp3 */, + B891A33D2BCD13AB006CB06E /* g_whoo_hoo.mp3 */, + B891A33E2BCD13AB006CB06E /* g_yeah.mp3 */, + B891A33F2BCD13AB006CB06E /* maggie_super.mp3 */, + B891A3402BCD13AB006CB06E /* maggie_thats_right.mp3 */, + B891A3412BCD13AB006CB06E /* maggie_yeah.mp3 */, ); - runOnlyForDeploymentPostprocessing = 0; + path = games; + sourceTree = ""; }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 331C8082294A63A400263BE5 /* RunnerTests */ = { + B891A3442BCD13AB006CB06E /* level_picking */ = { isa = PBXGroup; children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, + B891A3432BCD13AB006CB06E /* g_pick_level.mp3 */, ); - path = RunnerTests; + path = level_picking; sourceTree = ""; }; - 340CE8403EC22FE8EE1FA3EF /* Pods */ = { + B891A3452BCD13AB006CB06E /* sounds */ = { isa = PBXGroup; children = ( - F04D1DAE6591EAD461CBBE9A /* Pods-Runner.debug.xcconfig */, - 3563EC8D55A646823FD26A83 /* Pods-Runner.release.xcconfig */, - 2DE9FE013448D0821175591C /* Pods-Runner.profile.xcconfig */, - D63F3847140160A2204489BA /* Pods-RunnerTests.debug.xcconfig */, - D8C046A1A9C279FDBB5C174E /* Pods-RunnerTests.release.xcconfig */, - 48BCA0827DCB98991774F5AC /* Pods-RunnerTests.profile.xcconfig */, + B891A3422BCD13AB006CB06E /* games */, + B891A3442BCD13AB006CB06E /* level_picking */, ); - path = Pods; + path = sounds; sourceTree = ""; }; - 9740EEB11CF90186004384FC /* Flutter */ = { + B891A3462BCD13AB006CB06E /* common */ = { isa = PBXGroup; children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, + B891A31B2BCD13AB006CB06E /* games */, + B891A3452BCD13AB006CB06E /* sounds */, ); - name = Flutter; + path = common; sourceTree = ""; }; - 97C146E51CF9000F007C117D = { + B891A34D2BCD13AB006CB06E /* app_links */ = { isa = PBXGroup; children = ( - B852D3ED2BCADF3600A53FC4 /* cocos2d_libs.xcodeproj */, - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - 331C8082294A63A400263BE5 /* RunnerTests */, - 340CE8403EC22FE8EE1FA3EF /* Pods */, - E653501EF99460B1BB76C5EE /* Frameworks */, + B891A3472BCD13AB006CB06E /* app_link_halloween.png */, + B891A3482BCD13AB006CB06E /* app_link_toy.png */, + B891A3492BCD13AB006CB06E /* doll_toy_app.png */, + B891A34A2BCD13AB006CB06E /* halo_icon.png */, + B891A34B2BCD13AB006CB06E /* steve_maggie.png */, + B891A34C2BCD13AB006CB06E /* witch_halloween_app.png */, ); + path = app_links; sourceTree = ""; }; - 97C146EF1CF9000F007C117D /* Products */ = { + B891A35E2BCD13AB006CB06E /* graphics */ = { isa = PBXGroup; children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + B891A34E2BCD13AB006CB06E /* button_back.png */, + B891A34F2BCD13AB006CB06E /* button_go.png */, + B891A3502BCD13AB006CB06E /* button_green.png */, + B891A3512BCD13AB006CB06E /* button_grey.png */, + B891A3522BCD13AB006CB06E /* button_orange.png */, + B891A3532BCD13AB006CB06E /* button_pause.png */, + B891A3542BCD13AB006CB06E /* button_purple.png */, + B891A3552BCD13AB006CB06E /* button_red.png */, + B891A3562BCD13AB006CB06E /* button_repeat.png */, + B891A3572BCD13AB006CB06E /* button_setting.png */, + B891A3582BCD13AB006CB06E /* button_sound_off.png */, + B891A3592BCD13AB006CB06E /* button_sound_on.png */, + B891A35A2BCD13AB006CB06E /* button_turquoise.png */, + B891A35B2BCD13AB006CB06E /* button_yellow.png */, + B891A35C2BCD13AB006CB06E /* buttonff.png */, + B891A35D2BCD13AB006CB06E /* dark_green.png */, ); - name = Products; + path = graphics; sourceTree = ""; }; - 97C146F01CF9000F007C117D /* Runner */ = { + B891A3602BCD13AB006CB06E /* buttons */ = { isa = PBXGroup; children = ( - 52450AF22A4ED0EC007B3E4B /* Runner.entitlements */, - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 52450AF02A4C415B007B3E4B /* XSMessageMehtodChannel.swift */, - 525E17192A4BD03900104CDF /* VoiceXSMessageChannel.swift */, - B852C1342BCABB5E00A53FC4 /* GameMessageChannel.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + B891A35E2BCD13AB006CB06E /* graphics */, + B891A35F2BCD13AB006CB06E /* horizontalButtonPanelBackFFPause.obl */, ); - path = Runner; + path = buttons; sourceTree = ""; }; - B852D3EE2BCADF3600A53FC4 /* Products */ = { + B891A3642BCD13AB006CB06E /* levels */ = { isa = PBXGroup; children = ( - B852D3FF2BCADF3700A53FC4 /* libcocos2d.a */, - B852D4012BCADF3700A53FC4 /* libext_clipper.a */, - B852D4032BCADF3700A53FC4 /* libext_convertUTF.a */, - B852D4052BCADF3700A53FC4 /* libext_edtaa3func.a */, - B852D4072BCADF3700A53FC4 /* libext_md5.a */, - B852D4092BCADF3700A53FC4 /* libext_poly2tri.a */, - B852D40B2BCADF3700A53FC4 /* libext_recast.a */, - B852D40D2BCADF3700A53FC4 /* libext_tinyxml2.a */, - B852D40F2BCADF3700A53FC4 /* libext_unzip.a */, - B852D4112BCADF3700A53FC4 /* libext_xxhash.a */, - B852D4132BCADF3700A53FC4 /* libext_xxtea.a */, - B852D4152BCADF3700A53FC4 /* libexternal.a */, + B891A3612BCD13AB006CB06E /* level_1.png */, + B891A3622BCD13AB006CB06E /* level_2.png */, + B891A3632BCD13AB006CB06E /* level_3.png */, ); - name = Products; + path = levels; + sourceTree = ""; + }; + B891A3712BCD13AB006CB06E /* shelf_food */ = { + isa = PBXGroup; + children = ( + B891A3652BCD13AB006CB06E /* apples.png */, + B891A3662BCD13AB006CB06E /* baguettes.png */, + B891A3672BCD13AB006CB06E /* bananas.png */, + B891A3682BCD13AB006CB06E /* cakes.png */, + B891A3692BCD13AB006CB06E /* chocolate.png */, + B891A36A2BCD13AB006CB06E /* cucumbers.png */, + B891A36B2BCD13AB006CB06E /* donuts.png */, + B891A36C2BCD13AB006CB06E /* icecream.png */, + B891A36D2BCD13AB006CB06E /* lettuce.png */, + B891A36E2BCD13AB006CB06E /* milk.png */, + B891A36F2BCD13AB006CB06E /* orange.png */, + B891A3702BCD13AB006CB06E /* tomatoes.png */, + ); + path = shelf_food; + sourceTree = ""; + }; + B891A38E2BCD13AB006CB06E /* single_food */ = { + isa = PBXGroup; + children = ( + B891A3722BCD13AB006CB06E /* apple_splodge.png */, + B891A3732BCD13AB006CB06E /* apple1.png */, + B891A3742BCD13AB006CB06E /* apple2.png */, + B891A3752BCD13AB006CB06E /* baguette.png */, + B891A3762BCD13AB006CB06E /* banana_splodge.png */, + B891A3772BCD13AB006CB06E /* banana1.png */, + B891A3782BCD13AB006CB06E /* banana2.png */, + B891A3792BCD13AB006CB06E /* cake_splodge.png */, + B891A37A2BCD13AB006CB06E /* cake1.png */, + B891A37B2BCD13AB006CB06E /* cake2.png */, + B891A37C2BCD13AB006CB06E /* chocolate_splodge.png */, + B891A37D2BCD13AB006CB06E /* chocolate1.png */, + B891A37E2BCD13AB006CB06E /* chocolate2.png */, + B891A37F2BCD13AB006CB06E /* cucumber_splodge.png */, + B891A3802BCD13AB006CB06E /* cucumber1.png */, + B891A3812BCD13AB006CB06E /* cucumber2.png */, + B891A3822BCD13AB006CB06E /* donut_splodge.png */, + B891A3832BCD13AB006CB06E /* donut1.png */, + B891A3842BCD13AB006CB06E /* donut2.png */, + B891A3852BCD13AB006CB06E /* icecream_splodge.png */, + B891A3862BCD13AB006CB06E /* icecream1.png */, + B891A3872BCD13AB006CB06E /* icecream2.png */, + B891A3882BCD13AB006CB06E /* lettuce.png */, + B891A3892BCD13AB006CB06E /* milk.png */, + B891A38A2BCD13AB006CB06E /* orange.png */, + B891A38B2BCD13AB006CB06E /* tomato_splodge.png */, + B891A38C2BCD13AB006CB06E /* tomato1.png */, + B891A38D2BCD13AB006CB06E /* tomato2.png */, + ); + path = single_food; + sourceTree = ""; + }; + B891A39E2BCD13AB006CB06E /* graphics */ = { + isa = PBXGroup; + children = ( + B891A3712BCD13AB006CB06E /* shelf_food */, + B891A38E2BCD13AB006CB06E /* single_food */, + B891A38F2BCD13AB006CB06E /* cart_back1.png */, + B891A3902BCD13AB006CB06E /* cart_back2.png */, + B891A3912BCD13AB006CB06E /* cart_front.png */, + B891A3922BCD13AB006CB06E /* clock.png */, + B891A3932BCD13AB006CB06E /* food_in_cart.png */, + B891A3942BCD13AB006CB06E /* gum.png */, + B891A3952BCD13AB006CB06E /* hand_leather.png */, + B891A3962BCD13AB006CB06E /* hand_sling.png */, + B891A3972BCD13AB006CB06E /* sling.png */, + B891A3982BCD13AB006CB06E /* steve_head1.png */, + B891A3992BCD13AB006CB06E /* steve_head2.png */, + B891A39A2BCD13AB006CB06E /* steve_head3.png */, + B891A39B2BCD13AB006CB06E /* steve_head4.png */, + B891A39C2BCD13AB006CB06E /* steve_head5.png */, + B891A39D2BCD13AB006CB06E /* wooden_shelf.png */, + ); + path = graphics; + sourceTree = ""; + }; + B891A3A02BCD13AB006CB06E /* shoot_game */ = { + isa = PBXGroup; + children = ( + B891A39E2BCD13AB006CB06E /* graphics */, + B891A39F2BCD13AB006CB06E /* scene_layout.scl */, + ); + path = shoot_game; + sourceTree = ""; + }; + B891A3A32BCD13AB006CB06E /* tos_popup */ = { + isa = PBXGroup; + children = ( + B891A3A12BCD13AB006CB06E /* accept_button.png */, + B891A3A22BCD13AB006CB06E /* accept_popup.png */, + ); + path = tos_popup; + sourceTree = ""; + }; + B891A3A82BCD13AB006CB06E /* graphics */ = { + isa = PBXGroup; + children = ( + B891A3642BCD13AB006CB06E /* levels */, + B891A3A02BCD13AB006CB06E /* shoot_game */, + B891A3A32BCD13AB006CB06E /* tos_popup */, + B891A3A42BCD13AB006CB06E /* g_finger.png */, + B891A3A52BCD13AB006CB06E /* g_life_indicator_dead.png */, + B891A3A62BCD13AB006CB06E /* g_life_indicator_ok.png */, + B891A3A72BCD13AB006CB06E /* level_halo.png */, + ); + path = graphics; + sourceTree = ""; + }; + B891A3A92BCD13AB006CB06E /* small */ = { + isa = PBXGroup; + children = ( + B891A34D2BCD13AB006CB06E /* app_links */, + B891A3602BCD13AB006CB06E /* buttons */, + B891A3A82BCD13AB006CB06E /* graphics */, + ); + path = small; + sourceTree = ""; + }; + B891A3B02BCD13AB006CB06E /* app_links */ = { + isa = PBXGroup; + children = ( + B891A3AA2BCD13AB006CB06E /* app_link_halloween.png */, + B891A3AB2BCD13AB006CB06E /* app_link_toy.png */, + B891A3AC2BCD13AB006CB06E /* doll_toy_app.png */, + B891A3AD2BCD13AB006CB06E /* halo_icon.png */, + B891A3AE2BCD13AB006CB06E /* steve_maggie.png */, + B891A3AF2BCD13AB006CB06E /* witch_halloween_app.png */, + ); + path = app_links; + sourceTree = ""; + }; + B891A3C12BCD13AB006CB06E /* graphics */ = { + isa = PBXGroup; + children = ( + B891A3B12BCD13AB006CB06E /* button_back.png */, + B891A3B22BCD13AB006CB06E /* button_go.png */, + B891A3B32BCD13AB006CB06E /* button_green.png */, + B891A3B42BCD13AB006CB06E /* button_grey.png */, + B891A3B52BCD13AB006CB06E /* button_orange.png */, + B891A3B62BCD13AB006CB06E /* button_pause.png */, + B891A3B72BCD13AB006CB06E /* button_purple.png */, + B891A3B82BCD13AB006CB06E /* button_red.png */, + B891A3B92BCD13AB006CB06E /* button_repeat.png */, + B891A3BA2BCD13AB006CB06E /* button_setting.png */, + B891A3BB2BCD13AB006CB06E /* button_sound_off.png */, + B891A3BC2BCD13AB006CB06E /* button_sound_on.png */, + B891A3BD2BCD13AB006CB06E /* button_turquoise.png */, + B891A3BE2BCD13AB006CB06E /* button_yellow.png */, + B891A3BF2BCD13AB006CB06E /* buttonff.png */, + B891A3C02BCD13AB006CB06E /* dark_green.png */, + ); + path = graphics; + sourceTree = ""; + }; + B891A3C32BCD13AB006CB06E /* buttons */ = { + isa = PBXGroup; + children = ( + B891A3C12BCD13AB006CB06E /* graphics */, + B891A3C22BCD13AB006CB06E /* horizontalButtonPanelBackFFPause.obl */, + ); + path = buttons; + sourceTree = ""; + }; + B891A3C72BCD13AB006CB06E /* levels */ = { + isa = PBXGroup; + children = ( + B891A3C42BCD13AB006CB06E /* level_1.png */, + B891A3C52BCD13AB006CB06E /* level_2.png */, + B891A3C62BCD13AB006CB06E /* level_3.png */, + ); + path = levels; + sourceTree = ""; + }; + B891A3D42BCD13AB006CB06E /* shelf_food */ = { + isa = PBXGroup; + children = ( + B891A3C82BCD13AB006CB06E /* apples.png */, + B891A3C92BCD13AB006CB06E /* baguettes.png */, + B891A3CA2BCD13AB006CB06E /* bananas.png */, + B891A3CB2BCD13AB006CB06E /* cakes.png */, + B891A3CC2BCD13AB006CB06E /* chocolate.png */, + B891A3CD2BCD13AB006CB06E /* cucumbers.png */, + B891A3CE2BCD13AB006CB06E /* donuts.png */, + B891A3CF2BCD13AB006CB06E /* icecream.png */, + B891A3D02BCD13AB006CB06E /* lettuce.png */, + B891A3D12BCD13AB006CB06E /* milk.png */, + B891A3D22BCD13AB006CB06E /* orange.png */, + B891A3D32BCD13AB006CB06E /* tomatoes.png */, + ); + path = shelf_food; + sourceTree = ""; + }; + B891A3F12BCD13AB006CB06E /* single_food */ = { + isa = PBXGroup; + children = ( + B891A3D52BCD13AB006CB06E /* apple_splodge.png */, + B891A3D62BCD13AB006CB06E /* apple1.png */, + B891A3D72BCD13AB006CB06E /* apple2.png */, + B891A3D82BCD13AB006CB06E /* baguette.png */, + B891A3D92BCD13AB006CB06E /* banana_splodge.png */, + B891A3DA2BCD13AB006CB06E /* banana1.png */, + B891A3DB2BCD13AB006CB06E /* banana2.png */, + B891A3DC2BCD13AB006CB06E /* cake_splodge.png */, + B891A3DD2BCD13AB006CB06E /* cake1.png */, + B891A3DE2BCD13AB006CB06E /* cake2.png */, + B891A3DF2BCD13AB006CB06E /* chocolate_splodge.png */, + B891A3E02BCD13AB006CB06E /* chocolate1.png */, + B891A3E12BCD13AB006CB06E /* chocolate2.png */, + B891A3E22BCD13AB006CB06E /* cucumber_splodge.png */, + B891A3E32BCD13AB006CB06E /* cucumber1.png */, + B891A3E42BCD13AB006CB06E /* cucumber2.png */, + B891A3E52BCD13AB006CB06E /* donut_splodge.png */, + B891A3E62BCD13AB006CB06E /* donut1.png */, + B891A3E72BCD13AB006CB06E /* donut2.png */, + B891A3E82BCD13AB006CB06E /* icecream_splodge.png */, + B891A3E92BCD13AB006CB06E /* icecream1.png */, + B891A3EA2BCD13AB006CB06E /* icecream2.png */, + B891A3EB2BCD13AB006CB06E /* lettuce.png */, + B891A3EC2BCD13AB006CB06E /* milk.png */, + B891A3ED2BCD13AB006CB06E /* orange.png */, + B891A3EE2BCD13AB006CB06E /* tomato_splodge.png */, + B891A3EF2BCD13AB006CB06E /* tomato1.png */, + B891A3F02BCD13AB006CB06E /* tomato2.png */, + ); + path = single_food; + sourceTree = ""; + }; + B891A4032BCD13AB006CB06E /* graphics */ = { + isa = PBXGroup; + children = ( + B891A3D42BCD13AB006CB06E /* shelf_food */, + B891A3F12BCD13AB006CB06E /* single_food */, + B891A3F22BCD13AB006CB06E /* background.png */, + B891A3F32BCD13AB006CB06E /* cart_back1.png */, + B891A3F42BCD13AB006CB06E /* cart_back2.png */, + B891A3F52BCD13AB006CB06E /* cart_front.png */, + B891A3F62BCD13AB006CB06E /* clock.png */, + B891A3F72BCD13AB006CB06E /* food_in_cart.png */, + B891A3F82BCD13AB006CB06E /* gum.png */, + B891A3F92BCD13AB006CB06E /* hand_leather.png */, + B891A3FA2BCD13AB006CB06E /* hand_sling.png */, + B891A3FB2BCD13AB006CB06E /* sling.png */, + B891A3FC2BCD13AB006CB06E /* steve_head1.png */, + B891A3FD2BCD13AB006CB06E /* steve_head2.png */, + B891A3FE2BCD13AB006CB06E /* steve_head3.png */, + B891A3FF2BCD13AB006CB06E /* steve_head4.png */, + B891A4002BCD13AB006CB06E /* steve_head5.png */, + B891A4012BCD13AB006CB06E /* well_done_pic.png */, + B891A4022BCD13AB006CB06E /* wooden_shelf.png */, + ); + path = graphics; + sourceTree = ""; + }; + B891A4052BCD13AB006CB06E /* shoot_game */ = { + isa = PBXGroup; + children = ( + B891A4032BCD13AB006CB06E /* graphics */, + B891A4042BCD13AB006CB06E /* scene_layout.scl */, + ); + path = shoot_game; + sourceTree = ""; + }; + B891A4082BCD13AB006CB06E /* tos_popup */ = { + isa = PBXGroup; + children = ( + B891A4062BCD13AB006CB06E /* accept_button.png */, + B891A4072BCD13AB006CB06E /* accept_popup.png */, + ); + path = tos_popup; + sourceTree = ""; + }; + B891A40D2BCD13AB006CB06E /* graphics */ = { + isa = PBXGroup; + children = ( + B891A3C72BCD13AB006CB06E /* levels */, + B891A4052BCD13AB006CB06E /* shoot_game */, + B891A4082BCD13AB006CB06E /* tos_popup */, + B891A4092BCD13AB006CB06E /* g_finger.png */, + B891A40A2BCD13AB006CB06E /* g_life_indicator_dead.png */, + B891A40B2BCD13AB006CB06E /* g_life_indicator_ok.png */, + B891A40C2BCD13AB006CB06E /* level_halo.png */, + ); + path = graphics; + sourceTree = ""; + }; + B891A40E2BCD13AB006CB06E /* xlarge */ = { + isa = PBXGroup; + children = ( + B891A3B02BCD13AB006CB06E /* app_links */, + B891A3C32BCD13AB006CB06E /* buttons */, + B891A40D2BCD13AB006CB06E /* graphics */, + ); + path = xlarge; + sourceTree = ""; + }; + B891A4102BCD13AB006CB06E /* res */ = { + isa = PBXGroup; + children = ( + B891A3462BCD13AB006CB06E /* common */, + B891A3A92BCD13AB006CB06E /* small */, + B891A40E2BCD13AB006CB06E /* xlarge */, + B891A40F2BCD13AB006CB06E /* .gitkeep */, + ); + path = res; + sourceTree = ""; + }; + B891A4112BCD13AB006CB06E /* Resources */ = { + isa = PBXGroup; + children = ( + B891A3182BCD13AB006CB06E /* fonts */, + B891A4102BCD13AB006CB06E /* res */, + ); + path = Resources; sourceTree = ""; }; E653501EF99460B1BB76C5EE /* Frameworks */ = { @@ -315,10 +2162,54 @@ 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 7C15D12B84189A796384E28E /* [CP] Embed Pods Frameworks */, 62E27B63BBBA522854453C53 /* [CP] Copy Pods Resources */, + B891A4F12BCD17E2006CB06E /* CopyFiles */, + B891A4F22BCD240A006CB06E /* CopyFiles */, + B891A4F32BCD240C006CB06E /* CopyFiles */, + B891A4F42BCD240D006CB06E /* CopyFiles */, + B891A4F52BCD240E006CB06E /* CopyFiles */, + B891A4F62BCD240F006CB06E /* CopyFiles */, + B891A4F72BCD2410006CB06E /* CopyFiles */, + B891A4F82BCD2411006CB06E /* CopyFiles */, + B891A5062BCD24CE006CB06E /* CopyFiles */, + B891A5072BCD24DF006CB06E /* CopyFiles */, + B891A5082BCD24E0006CB06E /* CopyFiles */, + B891A5092BCD24E1006CB06E /* CopyFiles */, + B891A50A2BCD24E2006CB06E /* CopyFiles */, + B891A50B2BCD24E3006CB06E /* CopyFiles */, + B891A50C2BCD24E4006CB06E /* CopyFiles */, + B891A50D2BCD24E5006CB06E /* CopyFiles */, + B891A50E2BCD24E6006CB06E /* CopyFiles */, + B891A54B2BCD261A006CB06E /* CopyFiles */, + B891A54C2BCD261B006CB06E /* CopyFiles */, + B891A54D2BCD261C006CB06E /* CopyFiles */, + B891A54E2BCD261D006CB06E /* CopyFiles */, + B891A54F2BCD261E006CB06E /* CopyFiles */, + B891A5502BCD261F006CB06E /* CopyFiles */, + B891A5512BCD2620006CB06E /* CopyFiles */, + B891A5522BCD2621006CB06E /* CopyFiles */, + B891A5532BCD2622006CB06E /* CopyFiles */, + B891A5542BCD2623006CB06E /* CopyFiles */, + B891A5552BCD2624006CB06E /* CopyFiles */, + B891A5562BCD2625006CB06E /* CopyFiles */, + B891A5C02BCD27CC006CB06E /* CopyFiles */, + B891A5C12BCD27CD006CB06E /* CopyFiles */, + B891A5C22BCD27CE006CB06E /* CopyFiles */, ); buildRules = ( ); dependencies = ( + B891A2382BCD0799006CB06E /* PBXTargetDependency */, + B891A25C2BCD07AE006CB06E /* PBXTargetDependency */, + B891A24C2BCD07AE006CB06E /* PBXTargetDependency */, + B891A24E2BCD07AE006CB06E /* PBXTargetDependency */, + B891A2502BCD07AE006CB06E /* PBXTargetDependency */, + B891A2522BCD07AE006CB06E /* PBXTargetDependency */, + B891A2542BCD07AE006CB06E /* PBXTargetDependency */, + B891A2562BCD07AE006CB06E /* PBXTargetDependency */, + B891A2582BCD07AE006CB06E /* PBXTargetDependency */, + B891A25A2BCD07AE006CB06E /* PBXTargetDependency */, + B891A24A2BCD07A4006CB06E /* PBXTargetDependency */, + B891A2482BCD07A0006CB06E /* PBXTargetDependency */, ); name = Runner; productName = Runner; @@ -602,11 +2493,54 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B891A3112BCD1392006CB06E /* ScalingUtils.cpp in Sources */, + B891A2F02BCD1392006CB06E /* PlainNode.cpp in Sources */, + B891A3052BCD1392006CB06E /* StaticActionParser.cpp in Sources */, + B891A30C2BCD1392006CB06E /* DrawingUtils.cpp in Sources */, + B891A2E22BCD1392006CB06E /* LevelPickerLayer.cpp in Sources */, 525E171A2A4BD03900104CDF /* VoiceXSMessageChannel.swift in Sources */, + B891A3122BCD1392006CB06E /* SoundsRepo.cpp in Sources */, + B891A2EC2BCD1392006CB06E /* TOSAcceptPopupView.cpp in Sources */, + B891A30A2BCD1392006CB06E /* ParentScene.cpp in Sources */, + B891A30F2BCD1392006CB06E /* MiscUtils.cpp in Sources */, + B891A2F42BCD1392006CB06E /* TouchableSprite.cpp in Sources */, 52450AF12A4C415B007B3E4B /* XSMessageMehtodChannel.swift in Sources */, + B891A2F22BCD1392006CB06E /* ProgressSliderNode.cpp in Sources */, + B891A2ED2BCD1392006CB06E /* ChangingSprite.cpp in Sources */, + B891A2E42BCD1392006CB06E /* SimpleLevelPickerView.cpp in Sources */, + B891A2E72BCD1392006CB06E /* GameLifeIndicatorView.cpp in Sources */, + B891A2E52BCD1392006CB06E /* AlertView.cpp in Sources */, + B891A2F12BCD1392006CB06E /* PlainSprite.cpp in Sources */, + B891A2EB2BCD1392006CB06E /* SettingsLayer.cpp in Sources */, + B891A3042BCD1392006CB06E /* JSONParseUtils.cpp in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + B891A2F72BCD1392006CB06E /* Strings.cpp in Sources */, + B891A30E2BCD1392006CB06E /* MathUtils.cpp in Sources */, + B891A3062BCD1392006CB06E /* ValueStorage.cpp in Sources */, + B891A2F92BCD1392006CB06E /* GameConfigParser.cpp in Sources */, + B891A2F32BCD1392006CB06E /* SimpleButton.cpp in Sources */, + B891A2E62BCD1392006CB06E /* AppLinksView.cpp in Sources */, + B891A3102BCD1392006CB06E /* ResourceUtilities.cpp in Sources */, + B891A2EA2BCD1392006CB06E /* ParentalGateView.cpp in Sources */, + B891A2E32BCD1392006CB06E /* LevelPickerView.cpp in Sources */, + B891A2EF2BCD1392006CB06E /* PlainLabel.cpp in Sources */, + B891A30B2BCD1392006CB06E /* SceneWithUtils.cpp in Sources */, + B891A2FA2BCD1392006CB06E /* LayoutObject.cpp in Sources */, + B891A2E92BCD1392006CB06E /* ParentalGateShowInterface.cpp in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + B891A30D2BCD1392006CB06E /* GeometryUtils.cpp in Sources */, + B891A3072BCD1392006CB06E /* SubGameScene.cpp in Sources */, + B891A2F62BCD1392006CB06E /* ResourcesConfig.cpp in Sources */, + B891A2F52BCD1392006CB06E /* TwoStateButton.cpp in Sources */, + B891A3142BCD1392006CB06E /* StringUtils.cpp in Sources */, B852C1352BCABB5E00A53FC4 /* GameMessageChannel.swift in Sources */, + B891A2E82BCD1392006CB06E /* LevelView.cpp in Sources */, + B891A2FC2BCD1392006CB06E /* ActionData.cpp in Sources */, + B891A2E12BCD1392006CB06E /* TouchInterceptingLayer.cpp in Sources */, + B891A3132BCD1392006CB06E /* SoundUtils.cpp in Sources */, + B891A2EE2BCD1392006CB06E /* ContainerSprite.cpp in Sources */, + B891A3082BCD1392006CB06E /* SubGameSceneShoot.cpp in Sources */, + B891A2FB2BCD1392006CB06E /* LayoutParser.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -618,6 +2552,66 @@ target = 97C146ED1CF9000F007C117D /* Runner */; targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; }; + B891A2382BCD0799006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = cocos2d; + targetProxy = B891A2372BCD0799006CB06E /* PBXContainerItemProxy */; + }; + B891A2482BCD07A0006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_clipper; + targetProxy = B891A2472BCD07A0006CB06E /* PBXContainerItemProxy */; + }; + B891A24A2BCD07A4006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_convertUTF; + targetProxy = B891A2492BCD07A4006CB06E /* PBXContainerItemProxy */; + }; + B891A24C2BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_edtaa3func; + targetProxy = B891A24B2BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A24E2BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_md5; + targetProxy = B891A24D2BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A2502BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_poly2tri; + targetProxy = B891A24F2BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A2522BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_recast; + targetProxy = B891A2512BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A2542BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_tinyxml2; + targetProxy = B891A2532BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A2562BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_unzip; + targetProxy = B891A2552BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A2582BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_xxhash; + targetProxy = B891A2572BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A25A2BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ext_xxtea; + targetProxy = B891A2592BCD07AE006CB06E /* PBXContainerItemProxy */; + }; + B891A25C2BCD07AE006CB06E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = external; + targetProxy = B891A25B2BCD07AE006CB06E /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -706,6 +2700,131 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.2; + OTHER_CFLAGS = ( + "-DNDEBUG", + "'-std=gnu99'", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNDEBUG", + "'-std=c++11'", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + $SRCROOT/cocosgame/lib/Release/libext_tinyxml2.a, + $SRCROOT/cocosgame/lib/Release/libext_xxhash.a, + $SRCROOT/cocosgame/lib/Release/libext_clipper.a, + $SRCROOT/cocosgame/lib/Release/libext_edtaa3func.a, + $SRCROOT/cocosgame/lib/Release/libext_convertUTF.a, + $SRCROOT/cocosgame/lib/Release/libext_recast.a, + $SRCROOT/cocosgame/lib/Release/libext_unzip.a, + $SRCROOT/cocosgame/lib/Release/libext_poly2tri.a, + $SRCROOT/cocosgame/lib/Release/libext_md5.a, + $SRCROOT/cocosgame/lib/Release/libext_xxtea.a, + $SRCROOT/cocosgame/lib/Release/libexternal.a, + $SRCROOT/cocosgame/lib/Release/libcocos2d.a, + $SRCROOT/cocos2d/external/chipmunk/prebuilt/ios/libchipmunk.a, + $SRCROOT/cocos2d/external/freetype2/prebuilt/ios/libfreetype.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libLinearMath.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletCollision.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletMultiThreaded.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libLinearMath.a, + $SRCROOT/cocos2d/external/webp/prebuilt/ios/libwebp.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libMiniCL.a, + $SRCROOT/cocos2d/external/jpeg/prebuilt/ios/libjpeg.a, + $SRCROOT/cocos2d/external/websockets/prebuilt/ios/libwebsockets.a, + $SRCROOT/cocos2d/external/openssl/prebuilt/ios/libssl.a, + $SRCROOT/cocos2d/external/openssl/prebuilt/ios/libcrypto.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletDynamics.a, + $SRCROOT/cocos2d/external/uv/prebuilt/ios/libuv_a.a, + $SRCROOT/cocos2d/external/curl/prebuilt/ios/libcurl.a, + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libglcpp-library.a", + $SRCROOT/cocos2d/external/png/prebuilt/ios/libpng.a, + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libglsl_optimizer.a", + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libmesa.a", + $SRCROOT/cocos2d/external/Box2D/prebuilt/ios/libbox2d.a, + "-framework", + OpenGLES, + "-framework", + CoreMotion, + "-framework", + AVKit, + "-framework", + CoreMedia, + "-framework", + Security, + "-framework", + CoreGraphics, + "-framework", + WebKit, + "-framework", + OpenAL, + "-framework", + AudioToolbox, + "-framework", + GameController, + "-framework", + Metal, + "-framework", + CoreText, + "-framework", + Foundation, + "-l", + iconv, + "$(inherited)", + "-ObjC", + "-l\"c++\"", + "-l\"z\"", + "-framework", + "\"AVFoundation\"", + "-framework", + "\"CoreTelephony\"", + "-framework", + "\"MediaPlayer\"", + "-framework", + "\"QuartzCore\"", + "-framework", + "\"Reachability\"", + "-framework", + "\"SingSound\"", + "-framework", + "\"SystemConfiguration\"", + "-framework", + "\"Toast\"", + "-framework", + "\"audio_session\"", + "-framework", + "\"audioplayers_darwin\"", + "-framework", + "\"connectivity_plus\"", + "-framework", + "\"device_info_plus\"", + "-framework", + "\"flutter_sound\"", + "-framework", + "\"flutter_sound_core\"", + "-framework", + "\"fluttertoast\"", + "-framework", + "\"image_picker_ios\"", + "-framework", + "\"limiting_direction_csx\"", + "-framework", + "\"package_info_plus\"", + "-framework", + "\"path_provider_foundation\"", + "-framework", + "\"permission_handler_apple\"", + "-framework", + "\"shared_preferences_foundation\"", + "-framework", + "\"sqflite\"", + "-framework", + "\"url_launcher_ios\"", + "-framework", + "\"video_player_avfoundation\"", + "-framework", + "\"webview_flutter_wkwebview\"", + ); PRODUCT_BUNDLE_IDENTIFIER = com.kouyuxingqiu.wowenglish; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -714,6 +2833,39 @@ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ( + $SRCROOT/cocos2d, + $SRCROOT/cocos2d/cocos, + $SRCROOT/cocos2d/extensions, + $SRCROOT/cocos2d/cocos/audio/include, + $SRCROOT/cocos2d/cocos/platform, + "$SRCROOT/cocos2d/cocos/editor-support", + $SRCROOT/cocos2d/cocos/base, + $SRCROOT/cocos2d/cocos/platform/ios, + $SRCROOT/cocos2d/external/recast/.., + $SRCROOT/cocos2d/external/tinyxml2/., + $SRCROOT/cocos2d/external/xxhash/., + $SRCROOT/cocos2d/external/xxtea/., + $SRCROOT/cocos2d/external/clipper/., + $SRCROOT/cocos2d/external/edtaa3func/., + $SRCROOT/cocos2d/external/ConvertUTF/., + $SRCROOT/cocos2d/external/poly2tri/.., + $SRCROOT/cocos2d/external/md5/.., + $SRCROOT/cocos2d/external/unzip/., + $SRCROOT/cocos2d/external/Box2D/include, + $SRCROOT/cocos2d/external/chipmunk/include, + $SRCROOT/cocos2d/external/freetype2/include/ios/freetype2, + $SRCROOT/cocos2d/external/bullet/include, + $SRCROOT/cocos2d/external/bullet/include/bullet, + $SRCROOT/cocos2d/external/jpeg/include/ios, + $SRCROOT/cocos2d/external/openssl/include/ios, + $SRCROOT/cocos2d/external/uv/include, + $SRCROOT/cocos2d/external/webp/include/ios, + $SRCROOT/cocos2d/external/websockets/include/ios, + $SRCROOT/cocos2d/external/curl/include/ios, + $SRCROOT/cocos2d/external/png/include/ios, + "$SRCROOT/cocos2d/external/glsl-optimizer/include", + ); VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -885,12 +3037,154 @@ CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = T8P9KW8GWH; ENABLE_BITCODE = NO; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "\"${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift/Reachability.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/Toast/Toast.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/audio_session/audio_session.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/audioplayers_darwin/audioplayers_darwin.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/connectivity_plus/connectivity_plus.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/device_info_plus/device_info_plus.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/flutter_sound/flutter_sound.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/flutter_sound_core/flutter_sound_core.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/fluttertoast/fluttertoast.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/image_picker_ios/image_picker_ios.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/limiting_direction_csx/limiting_direction_csx.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/package_info_plus/package_info_plus.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/path_provider_foundation/path_provider_foundation.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/permission_handler_apple/permission_handler_apple.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/shared_preferences_foundation/shared_preferences_foundation.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/sqflite/sqflite.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/url_launcher_ios/url_launcher_ios.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/video_player_avfoundation/video_player_avfoundation.framework/Headers\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/webview_flutter_wkwebview/webview_flutter_wkwebview.framework/Headers\"", + ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.2; + ONLY_ACTIVE_ARCH = NO; + OTHER_CFLAGS = "'-std=gnu99'"; + OTHER_CPLUSPLUSFLAGS = "'-std=c++11'"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + $SRCROOT/cocosgame/lib/Debug/libext_tinyxml2.a, + $SRCROOT/cocosgame/lib/Debug/libext_xxhash.a, + $SRCROOT/cocosgame/lib/Debug/libext_clipper.a, + $SRCROOT/cocosgame/lib/Debug/libext_edtaa3func.a, + $SRCROOT/cocosgame/lib/Debug/libext_convertUTF.a, + $SRCROOT/cocosgame/lib/Debug/libext_recast.a, + $SRCROOT/cocosgame/lib/Debug/libext_unzip.a, + $SRCROOT/cocosgame/lib/Debug/libext_poly2tri.a, + $SRCROOT/cocosgame/lib/Debug/libext_md5.a, + $SRCROOT/cocosgame/lib/Debug/libext_xxtea.a, + $SRCROOT/cocosgame/lib/Debug/libexternal.a, + $SRCROOT/cocosgame/lib/Debug/libcocos2d.a, + $SRCROOT/cocos2d/external/chipmunk/prebuilt/ios/libchipmunk.a, + $SRCROOT/cocos2d/external/freetype2/prebuilt/ios/libfreetype.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libLinearMath.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletCollision.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletMultiThreaded.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libLinearMath.a, + $SRCROOT/cocos2d/external/webp/prebuilt/ios/libwebp.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libMiniCL.a, + $SRCROOT/cocos2d/external/jpeg/prebuilt/ios/libjpeg.a, + $SRCROOT/cocos2d/external/websockets/prebuilt/ios/libwebsockets.a, + $SRCROOT/cocos2d/external/openssl/prebuilt/ios/libssl.a, + $SRCROOT/cocos2d/external/openssl/prebuilt/ios/libcrypto.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletDynamics.a, + $SRCROOT/cocos2d/external/uv/prebuilt/ios/libuv_a.a, + $SRCROOT/cocos2d/external/curl/prebuilt/ios/libcurl.a, + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libglcpp-library.a", + $SRCROOT/cocos2d/external/png/prebuilt/ios/libpng.a, + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libglsl_optimizer.a", + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libmesa.a", + $SRCROOT/cocos2d/external/Box2D/prebuilt/ios/libbox2d.a, + "-framework", + OpenGLES, + "-framework", + CoreMotion, + "-framework", + AVKit, + "-framework", + CoreMedia, + "-framework", + Security, + "-framework", + CoreGraphics, + "-framework", + WebKit, + "-framework", + OpenAL, + "-framework", + AudioToolbox, + "-framework", + GameController, + "-framework", + Metal, + "-framework", + CoreText, + "-framework", + Foundation, + "-l", + iconv, + "$(inherited)", + "-ObjC", + "-l\"c++\"", + "-l\"z\"", + "-framework", + "\"AVFoundation\"", + "-framework", + "\"CoreTelephony\"", + "-framework", + "\"MediaPlayer\"", + "-framework", + "\"QuartzCore\"", + "-framework", + "\"Reachability\"", + "-framework", + "\"SingSound\"", + "-framework", + "\"SystemConfiguration\"", + "-framework", + "\"Toast\"", + "-framework", + "\"audio_session\"", + "-framework", + "\"audioplayers_darwin\"", + "-framework", + "\"connectivity_plus\"", + "-framework", + "\"device_info_plus\"", + "-framework", + "\"flutter_sound\"", + "-framework", + "\"flutter_sound_core\"", + "-framework", + "\"fluttertoast\"", + "-framework", + "\"image_picker_ios\"", + "-framework", + "\"limiting_direction_csx\"", + "-framework", + "\"package_info_plus\"", + "-framework", + "\"path_provider_foundation\"", + "-framework", + "\"permission_handler_apple\"", + "-framework", + "\"shared_preferences_foundation\"", + "-framework", + "\"sqflite\"", + "-framework", + "\"url_launcher_ios\"", + "-framework", + "\"video_player_avfoundation\"", + "-framework", + "\"webview_flutter_wkwebview\"", + ); PRODUCT_BUNDLE_IDENTIFIER = com.kouyuxingqiu.wowenglish; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -900,6 +3194,39 @@ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ( + $SRCROOT/cocos2d, + $SRCROOT/cocos2d/cocos, + $SRCROOT/cocos2d/extensions, + $SRCROOT/cocos2d/cocos/audio/include, + $SRCROOT/cocos2d/cocos/platform, + "$SRCROOT/cocos2d/cocos/editor-support", + $SRCROOT/cocos2d/cocos/base, + $SRCROOT/cocos2d/cocos/platform/ios, + $SRCROOT/cocos2d/external/recast/.., + $SRCROOT/cocos2d/external/tinyxml2/., + $SRCROOT/cocos2d/external/xxhash/., + $SRCROOT/cocos2d/external/xxtea/., + $SRCROOT/cocos2d/external/clipper/., + $SRCROOT/cocos2d/external/edtaa3func/., + $SRCROOT/cocos2d/external/ConvertUTF/., + $SRCROOT/cocos2d/external/poly2tri/.., + $SRCROOT/cocos2d/external/md5/.., + $SRCROOT/cocos2d/external/unzip/., + $SRCROOT/cocos2d/external/Box2D/include, + $SRCROOT/cocos2d/external/chipmunk/include, + $SRCROOT/cocos2d/external/freetype2/include/ios/freetype2, + $SRCROOT/cocos2d/external/bullet/include, + $SRCROOT/cocos2d/external/bullet/include/bullet, + $SRCROOT/cocos2d/external/jpeg/include/ios, + $SRCROOT/cocos2d/external/openssl/include/ios, + $SRCROOT/cocos2d/external/uv/include, + $SRCROOT/cocos2d/external/webp/include/ios, + $SRCROOT/cocos2d/external/websockets/include/ios, + $SRCROOT/cocos2d/external/curl/include/ios, + $SRCROOT/cocos2d/external/png/include/ios, + "$SRCROOT/cocos2d/external/glsl-optimizer/include", + ); VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -920,6 +3247,131 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.2; + OTHER_CFLAGS = ( + "-DNDEBUG", + "'-std=gnu99'", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNDEBUG", + "'-std=c++11'", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + $SRCROOT/cocosgame/lib/Release/libext_tinyxml2.a, + $SRCROOT/cocosgame/lib/Release/libext_xxhash.a, + $SRCROOT/cocosgame/lib/Release/libext_clipper.a, + $SRCROOT/cocosgame/lib/Release/libext_edtaa3func.a, + $SRCROOT/cocosgame/lib/Release/libext_convertUTF.a, + $SRCROOT/cocosgame/lib/Release/libext_recast.a, + $SRCROOT/cocosgame/lib/Release/libext_unzip.a, + $SRCROOT/cocosgame/lib/Release/libext_poly2tri.a, + $SRCROOT/cocosgame/lib/Release/libext_md5.a, + $SRCROOT/cocosgame/lib/Release/libext_xxtea.a, + $SRCROOT/cocosgame/lib/Release/libexternal.a, + $SRCROOT/cocosgame/lib/Release/libcocos2d.a, + $SRCROOT/cocos2d/external/chipmunk/prebuilt/ios/libchipmunk.a, + $SRCROOT/cocos2d/external/freetype2/prebuilt/ios/libfreetype.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libLinearMath.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletCollision.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletMultiThreaded.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libLinearMath.a, + $SRCROOT/cocos2d/external/webp/prebuilt/ios/libwebp.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libMiniCL.a, + $SRCROOT/cocos2d/external/jpeg/prebuilt/ios/libjpeg.a, + $SRCROOT/cocos2d/external/websockets/prebuilt/ios/libwebsockets.a, + $SRCROOT/cocos2d/external/openssl/prebuilt/ios/libssl.a, + $SRCROOT/cocos2d/external/openssl/prebuilt/ios/libcrypto.a, + $SRCROOT/cocos2d/external/bullet/prebuilt/ios/libBulletDynamics.a, + $SRCROOT/cocos2d/external/uv/prebuilt/ios/libuv_a.a, + $SRCROOT/cocos2d/external/curl/prebuilt/ios/libcurl.a, + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libglcpp-library.a", + $SRCROOT/cocos2d/external/png/prebuilt/ios/libpng.a, + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libglsl_optimizer.a", + "$SRCROOT/cocos2d/external/glsl-optimizer/prebuilt/ios/libmesa.a", + $SRCROOT/cocos2d/external/Box2D/prebuilt/ios/libbox2d.a, + "-framework", + OpenGLES, + "-framework", + CoreMotion, + "-framework", + AVKit, + "-framework", + CoreMedia, + "-framework", + Security, + "-framework", + CoreGraphics, + "-framework", + WebKit, + "-framework", + OpenAL, + "-framework", + AudioToolbox, + "-framework", + GameController, + "-framework", + Metal, + "-framework", + CoreText, + "-framework", + Foundation, + "-l", + iconv, + "$(inherited)", + "-ObjC", + "-l\"c++\"", + "-l\"z\"", + "-framework", + "\"AVFoundation\"", + "-framework", + "\"CoreTelephony\"", + "-framework", + "\"MediaPlayer\"", + "-framework", + "\"QuartzCore\"", + "-framework", + "\"Reachability\"", + "-framework", + "\"SingSound\"", + "-framework", + "\"SystemConfiguration\"", + "-framework", + "\"Toast\"", + "-framework", + "\"audio_session\"", + "-framework", + "\"audioplayers_darwin\"", + "-framework", + "\"connectivity_plus\"", + "-framework", + "\"device_info_plus\"", + "-framework", + "\"flutter_sound\"", + "-framework", + "\"flutter_sound_core\"", + "-framework", + "\"fluttertoast\"", + "-framework", + "\"image_picker_ios\"", + "-framework", + "\"limiting_direction_csx\"", + "-framework", + "\"package_info_plus\"", + "-framework", + "\"path_provider_foundation\"", + "-framework", + "\"permission_handler_apple\"", + "-framework", + "\"shared_preferences_foundation\"", + "-framework", + "\"sqflite\"", + "-framework", + "\"url_launcher_ios\"", + "-framework", + "\"video_player_avfoundation\"", + "-framework", + "\"webview_flutter_wkwebview\"", + ); PRODUCT_BUNDLE_IDENTIFIER = com.kouyuxingqiu.wowenglish; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -928,6 +3380,39 @@ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ( + $SRCROOT/cocos2d, + $SRCROOT/cocos2d/cocos, + $SRCROOT/cocos2d/extensions, + $SRCROOT/cocos2d/cocos/audio/include, + $SRCROOT/cocos2d/cocos/platform, + "$SRCROOT/cocos2d/cocos/editor-support", + $SRCROOT/cocos2d/cocos/base, + $SRCROOT/cocos2d/cocos/platform/ios, + $SRCROOT/cocos2d/external/recast/.., + $SRCROOT/cocos2d/external/tinyxml2/., + $SRCROOT/cocos2d/external/xxhash/., + $SRCROOT/cocos2d/external/xxtea/., + $SRCROOT/cocos2d/external/clipper/., + $SRCROOT/cocos2d/external/edtaa3func/., + $SRCROOT/cocos2d/external/ConvertUTF/., + $SRCROOT/cocos2d/external/poly2tri/.., + $SRCROOT/cocos2d/external/md5/.., + $SRCROOT/cocos2d/external/unzip/., + $SRCROOT/cocos2d/external/Box2D/include, + $SRCROOT/cocos2d/external/chipmunk/include, + $SRCROOT/cocos2d/external/freetype2/include/ios/freetype2, + $SRCROOT/cocos2d/external/bullet/include, + $SRCROOT/cocos2d/external/bullet/include/bullet, + $SRCROOT/cocos2d/external/jpeg/include/ios, + $SRCROOT/cocos2d/external/openssl/include/ios, + $SRCROOT/cocos2d/external/uv/include, + $SRCROOT/cocos2d/external/webp/include/ios, + $SRCROOT/cocos2d/external/websockets/include/ios, + $SRCROOT/cocos2d/external/curl/include/ios, + $SRCROOT/cocos2d/external/png/include/ios, + "$SRCROOT/cocos2d/external/glsl-optimizer/include", + ); VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/ios/Runner/Wowgame/Classes/AndroidUtils_cpp.h b/ios/Runner/Wowgame/Classes/AndroidUtils_cpp.h new file mode 100644 index 0000000..1266c62 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/AndroidUtils_cpp.h @@ -0,0 +1,11 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2020-01-24. +// + +#ifndef PROJ_ANDROID_ANDROIDUTILS_CPP_H +#define PROJ_ANDROID_ANDROIDUTILS_CPP_H + +int androidUtils_osApiVersion(); + + +#endif //PROJ_ANDROID_ANDROIDUTILS_CPP_H diff --git a/ios/Runner/Wowgame/Classes/AppDelegate.cpp b/ios/Runner/Wowgame/Classes/AppDelegate.cpp new file mode 100644 index 0000000..0a10fe7 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/AppDelegate.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "GameConfigParser.h" +#include "ResourcesConfig.h" +#include "MiscUtils.h" +#include "SoundsRepo.h" +#include "ScalingUtils.h" + + #define USE_AUDIO_ENGINE 1 + +#if USE_AUDIO_ENGINE +#include "audio/include/AudioEngine.h" +#endif + +USING_NS_CC; + +static cocos2d::Size designResolutionSize = cocos2d::Size(2732, 2048); +static cocos2d::Size tinyResolutionSize = cocos2d::Size(1366, 1024); + +AppDelegate::AppDelegate() +{ +} + +AppDelegate::~AppDelegate() +{ + AudioEngine::end(); +} + +// if you want a different context, modify the value of glContextAttrs +// it will affect all platforms +void AppDelegate::initGLContextAttrs() +{ + // set OpenGL context attributes: red,green,blue,alpha,depth,stencil,multisamplesCount + GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8, 0}; + + GLView::setGLContextAttrs(glContextAttrs); +} + +// if you want to use the package manager to install more packages, +// don't modify or remove this function +static int register_all_packages() +{ + return 0; //flag for packages manager +} + +bool AppDelegate::applicationDidFinishLaunching() { + + // initialize director + auto director = Director::getInstance(); + auto glview = director->getOpenGLView(); + if(!glview) { + glview = GLViewImpl::create("Steve and Maggie Food App"); + director->setOpenGLView(glview); + } + + // turn on display FPS +// director->setDisplayStats(true); //TODO remove this + + auto searchPaths = cocos2d::FileUtils::getInstance()->getSearchPaths(); +// std::string deviceSpecificFolderName; + +// auto frameSize = glview->getFrameSize(); + // if the frame's height is larger than the height of medium size. +// if (frameSize.height > xlargeResolutionSize.height) +// { +// deviceSpecificFolderName = ResourcesConfig::RES_FOLDER_NAME_XLARGE; +// } +// // if the frame's height is larger than the height of small size. +// else if (frameSize.height > largeResolutionSize.height) +// { +// deviceSpecificFolderName = ResourcesConfig::RES_FOLDER_NAME_XLARGE; //TODO change to large once the resurces are ready +// } +// // if the frame's height is smaller than the height of medium size. +// else +// { +// deviceSpecificFolderName = ResourcesConfig::RES_FOLDER_NAME_MEDIUM; +// } + +// deviceSpecificFolderName = ScalingUtils::isSmallDevice() ? ResourcesConfig::RES_FOLDER_NAME_TINY : ResourcesConfig::RES_FOLDER_NAME_XLARGE;//TODO TEMP + searchPaths.push_back("res"); + if(ScalingUtils::isSmallDevice()){ + searchPaths.push_back("res/" + std::string(ResourcesConfig::RES_FOLDER_NAME_TINY)); + searchPaths.push_back("res/" + std::string(ResourcesConfig::RES_FOLDER_NAME_XLARGE)); + } else { + searchPaths.push_back("res/" + std::string(ResourcesConfig::RES_FOLDER_NAME_XLARGE)); + } + searchPaths.push_back("res/common"); + + cocos2d::FileUtils::getInstance()->setSearchPaths(searchPaths); + + auto screenSizePoints = director->getWinSize(); + + auto scale = ScalingUtils::isSmallDevice() ? MAX(tinyResolutionSize.width / screenSizePoints.width, tinyResolutionSize.height / screenSizePoints.height) : MAX(designResolutionSize.width / screenSizePoints.width, designResolutionSize.height / screenSizePoints.height); + director->setContentScaleFactor(scale); + + register_all_packages(); + +// SoundsRepo::loadSoundsList(); + + srand(time(0)); + + // run + std::string sceneLayoutPath = "graphics/shoot_game/scene_layout.scl"; + GameConfigParser parser("res/common/games/shoot_game/gconfig.gcf"); + auto newScene = parser.createGameScene(45, sceneLayoutPath); + director->runWithScene(newScene); + + return true; +} + +// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked. +void AppDelegate::applicationDidEnterBackground() { + Director::getInstance()->stopAnimation(); + cocos2d::AudioEngine::pauseAll(); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + MiscUtils::closeAppCloseConfirmDialogIfNecessary(); +#endif + auto runningGame = dynamic_cast(cocos2d::Director::getInstance()->getRunningScene()); + if(runningGame){ + runningGame->presentGameResumeLayer(); + } +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() { + Director::getInstance()->startAnimation(); + auto runningGame = dynamic_cast(cocos2d::Director::getInstance()->getRunningScene()); + if(!runningGame->isPaused()){ + cocos2d::AudioEngine::resumeAll(); + } +} diff --git a/ios/Runner/Wowgame/Classes/AppDelegate.h b/ios/Runner/Wowgame/Classes/AppDelegate.h new file mode 100644 index 0000000..fa6cff3 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/AppDelegate.h @@ -0,0 +1,66 @@ +/**************************************************************************** + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "cocos2d.h" + +/** +@brief The cocos2d Application. + +Private inheritance here hides part of interface from Director. +*/ +class AppDelegate : private cocos2d::Application +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + virtual void initGLContextAttrs(); + + /** + @brief Implement Director and Scene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief Called when the application moves to the background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief Called when the application reenters the foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); + +//protected: +}; + +#endif // _APP_DELEGATE_H_ + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/AlertView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/AlertView.cpp new file mode 100644 index 0000000..c1101b7 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/AlertView.cpp @@ -0,0 +1,105 @@ +// +// AlertView.cpp +// Steve and Maggie Halloween +// +// Created by Katarzyna Kalinowska-Górska on 09/10/2019. +// + +#include +#include "AlertView.h" +#include "ScalingUtils.h" +#include "../../cocos2d/cocos/2d/CCActionInterval.h" +#include "../../cocos2d/cocos/2d/CCActionInstant.h" +#include "../../cocos2d/cocos/2d/CCNode.h" +#include "../Utils/MiscUtils.h" + +//AlertView* AlertView::create(std::string message, std::string okText, cocos2d::Color3B okColor, std::function onConfirmCallback,){ +// +// AlertView * view = new (std::nothrow) AlertView(); +// if(view && view->init(message, okText, okColor, onConfirmCallback)) +// { +// view->autorelease(); +// return view; +// } +// CC_SAFE_DELETE(view); +// return nullptr; +//} + +AlertView* AlertView::create(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor, std::function onConfirmCallback,std::function onCancelCallback){ + + AlertView * view = new (std::nothrow) AlertView(); + if(view && view->init(message, okText, cancelText, okColor, cancelColor, onConfirmCallback, onCancelCallback)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool AlertView::init(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor, std::function onConfirmCallback,std::function onCancelCallback){ + + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + if(!cocos2d::LayerColor::initWithColor(cocos2d::Color4B(0,0,0,220), winSize.width, winSize.height)){ + return false; + } + + _onConfirmCallback = onConfirmCallback; + _onCancelCallback = onCancelCallback; + setupAppearance(message, okText, cancelText, okColor, cancelColor); + + return true; +} + +void AlertView::setupAppearance(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor){ + + setCascadeOpacityEnabled(true); +; + auto wholeContainer = cocos2d::Node::create(); + addChild(wholeContainer); + + // // add the instruction label + auto messageLabel = cocos2d::Label::createWithTTF(message, "fonts/ComicSansMSBold.ttf", 90*ScalingUtils::getScaleForFont()); //TODO magic number, hard-coded text + messageLabel->setColor(cocos2d::Color3B(200, 200, 200)); + wholeContainer->addChild(messageLabel); + wholeContainer->setCascadeOpacityEnabled(true); + + cocos2d::MenuItemFont::setFontSize(80*ScalingUtils::getScaleForFont()); //TODO MAGIC NUMBER +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + cocos2d::MenuItemFont::setFontName("ComicSansMS-Bold"); +#else + cocos2d::MenuItemFont::setFontName("fonts/ComicSansMSBold.ttf"); +#endif + auto menuPadding = 140*ScalingUtils::scaleAspectFillToDesignIpadProSize();//TODO magic number + auto menuItemCancel = cocos2d::MenuItemFont::create(cancelText, CC_CALLBACK_1(AlertView::onCancelClicked, this)); + menuItemCancel->setColor(cancelColor); + auto menuItemOK = cocos2d::MenuItemFont::create(okText, CC_CALLBACK_1(AlertView::onOKClicked, this)); +// menuItemOK->setColor(cocos2d::Color3B(200, 100, 100)); + menuItemOK->setColor(okColor); + auto menuCenter = cocos2d::Menu::create(menuItemCancel,menuItemOK, nullptr); + menuCenter->setContentSize(cocos2d::Size(menuItemOK->getBoundingBox().size.width + menuItemCancel->getBoundingBox().size.width + menuPadding, MAX(menuItemOK->getBoundingBox().size.height, menuItemCancel->getBoundingBox().size.height))); + menuCenter->alignItemsHorizontallyWithPadding(menuPadding); + menuCenter->setCascadeOpacityEnabled(true); + + wholeContainer->addChild(menuCenter); + wholeContainer->setContentSize(cocos2d::Size(MAX(menuCenter->getBoundingBox().size.width, messageLabel->getBoundingBox().size.width), menuCenter->getBoundingBox().size.height + menuPadding + messageLabel->getBoundingBox().size.height)); + + menuCenter->setPositionX(wholeContainer->getContentSize().width/2); + menuCenter->setPositionY(messageLabel->getBoundingBox().getMinY() + menuPadding); + messageLabel->setPositionY(wholeContainer->getContentSize().height - messageLabel->getBoundingBox().size.height/2); + messageLabel->setPositionX(wholeContainer->getContentSize().width/2); + + wholeContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + wholeContainer->setPosition(getContentSize().width/2, getContentSize().height/2); +} + +void AlertView::onCancelClicked(cocos2d::Ref* pSender){ + _onCancelCallback(); + runAction(cocos2d::Sequence::create(cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime), cocos2d::CallFunc::create([&](){ + MiscUtils::hideAndRemoveView(this,true); + }), nullptr)); +} + +void AlertView::onOKClicked(cocos2d::Ref* pSender){ + _onConfirmCallback(); +} diff --git a/ios/Runner/Wowgame/Classes/CustomViews/AlertView.h b/ios/Runner/Wowgame/Classes/CustomViews/AlertView.h new file mode 100644 index 0000000..ed17b39 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/AlertView.h @@ -0,0 +1,30 @@ +// +// AlertView.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 09/10/2019. +// + +#ifndef AlertView_h +#define AlertView_h + +#include "cocos2d.h" +#include + +class AlertView : public cocos2d::LayerColor { +public: + static AlertView* create(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor, std::function onConfirmCallback,std::function onCancelCallback); + +protected: + + std::function _onConfirmCallback; + std::function _onCancelCallback; + + bool init(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor, std::function onConfirmCallback,std::function onCancelCallback); + void setupAppearance(std::string message, std::string okText, std::string cancelText, cocos2d::Color3B okColor, cocos2d::Color3B cancelColor); + + void onCancelClicked(cocos2d::Ref* pSender); + void onOKClicked(cocos2d::Ref* pSender); +}; + +#endif /* AlertView_h */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/AppLinksView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/AppLinksView.cpp new file mode 100644 index 0000000..26841bd --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/AppLinksView.cpp @@ -0,0 +1,118 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2019-10-07. +// + +#include "AppLinksView.h" +#include "SimpleButton.h" +#include "ScalingUtils.h" + +AppLinksView* AppLinksView::create(float width, float height, const std::vector& appsData, ParentalGateShowInterface* p_delegate){ + AppLinksView * node = new (std::nothrow) AppLinksView(); + if(node && node->init(width, height, appsData, p_delegate)) + { + node->autorelease(); + return node; + } + CC_SAFE_DELETE(node); + return nullptr; +} + +AppLinksView* AppLinksView::create(const std::vector& appsData, ParentalGateShowInterface* p_delegate){ + AppLinksView * node = new (std::nothrow) AppLinksView(); + if(node && node->init(-1, -1, appsData, p_delegate)) + { + node->autorelease(); + return node; + } + CC_SAFE_DELETE(node); + return nullptr; +} + +bool AppLinksView::init(float width, float height, const std::vector& appsData, ParentalGateShowInterface* p_delegate){ + if(!cocos2d::ui::ScrollView::init()){ + return false; + } + + assert(p_delegate != nullptr); + m_delegate = p_delegate; + + setDirection(cocos2d::ui::ScrollView::Direction::HORIZONTAL); + bool adjustContentSize = width < 0 || height < 0; + + if(!adjustContentSize) { + setContentSize(cocos2d::Size(width, height)); + } + setScrollBarEnabled(false); + + auto scaleF = ScalingUtils::getAdjustedContentScaleFactor(); + static float PaddingX = 20/scaleF; + static float PaddingY = 20/scaleF; +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + static std::string PlayStoreBaseLinkApp = "market://details?id="; + static std::string PlayStoreBaseLinkWeb = "https://play.google.com/store/apps/details?id="; +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + static std::string ITunesBaseLink = "itms-apps://itunes.apple.com/app/"; +#endif + + auto tempX = PaddingX; + + float contentW = 0, contentH = 0; + + for(auto it = appsData.begin(); it != appsData.end(); ++it){ +// m_links.push_back(it->appStoreId); + + auto button = SimpleButton::create(); + auto buttonTexturePath = it->iconFilePath; + button->loadTextures(buttonTexturePath, buttonTexturePath, buttonTexturePath); + addChild(button); + button->setPosition(cocos2d::Point(tempX + button->getBoundingBox().size.width/2, PaddingY + button->getBoundingBox().size.height/2)); + tempX += button->getContentSize().width + PaddingX; + auto haloSprite = cocos2d::Sprite::create("app_links/halo_icon.png"); + haloSprite->setPosition(button->getPosition()); + addChild(haloSprite); + haloSprite->setOpacity(0); + haloSprite->setLocalZOrder(0); + button->setLocalZOrder(1); + + button->setOnTouchBeganCallback([haloSprite, button](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + haloSprite->setScale(button->getScale()); + haloSprite->stopAllActions(); + haloSprite->runAction(cocos2d::FadeIn::create(0.1)); + }); + + button->setOnTouchEndedCallback([&, haloSprite, button, link = it->storeId](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + haloSprite->stopAllActions(); + haloSprite->runAction(cocos2d::FadeOut::create(0.1)); + haloSprite->setScale(button->getScale()); + m_delegate->presentParentalGate([&](){ + m_delegate->hideParentalGate(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + if(!cocos2d::Application::getInstance()->openURL(PlayStoreBaseLinkApp + link)){ + cocos2d::Application::getInstance()->openURL(PlayStoreBaseLinkWeb + link); + } +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + cocos2d::Application::getInstance()->openURL(ITunesBaseLink + link); +#endif + }, [&](){ + m_delegate->hideParentalGate(); + }); + }); + + button->setOnTouchCancelledCallback([haloSprite, button](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + haloSprite->stopAllActions(); + haloSprite->runAction(cocos2d::FadeOut::create(0.1)); + haloSprite->setScale(button->getScale()); + }); + + contentH = haloSprite->getBoundingBox().size.height; + contentW += button->getBoundingBox().size.width*1.4f; + } + + if(adjustContentSize){ + setContentSize(cocos2d::Size(tempX, contentH)); + } + + return true; +} + + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/AppLinksView.h b/ios/Runner/Wowgame/Classes/CustomViews/AppLinksView.h new file mode 100644 index 0000000..1853ee5 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/AppLinksView.h @@ -0,0 +1,34 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2019-10-07. +// + +#ifndef APP_LINKS_VIEW_H +#define APP_LINKS_VIEW_H + +#include "cocos2d.h" +#include "ParentalGateShowInterface.h" +#include "ui/CocosGUI.h" + +class AppLinksView : public cocos2d::ui::ScrollView { + +public: + struct AppLinkData { + AppLinkData(std::string p_iconFilePath, std::string p_storeId) : iconFilePath(p_iconFilePath), storeId(p_storeId) {} + std::string iconFilePath; + std::string storeId; + }; + + static AppLinksView* create(float width, float height, const std::vector& appsData, ParentalGateShowInterface* p_delegate); + static AppLinksView* create(const std::vector& appsData, ParentalGateShowInterface* p_delegate); + + +protected: + std::vector m_halos; + + bool init(float width, float height, const std::vector& appsData, ParentalGateShowInterface* p_delegate); + + ParentalGateShowInterface* m_delegate {nullptr}; +}; + + +#endif //APP_LINKS_VIEW_H diff --git a/ios/Runner/Wowgame/Classes/CustomViews/GameLifeIndicatorView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/GameLifeIndicatorView.cpp new file mode 100644 index 0000000..b928b97 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/GameLifeIndicatorView.cpp @@ -0,0 +1,84 @@ +// +// GameLifeIndicatorView.cpp +// SteveAndMaggieGame-mobile +// +// Created by Katarzyna Kalinowska-Górska on 21/06/2019. +// + +#include +#include "GameLifeIndicatorView.h" + +GameLifeIndicatorView* GameLifeIndicatorView::create(std::string liveImagePath, std::string deadImagePath, int maxLives){ + GameLifeIndicatorView * view = new (std::nothrow) GameLifeIndicatorView(); + if(view && view->init(liveImagePath, deadImagePath, maxLives)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool GameLifeIndicatorView::init(std::string liveImagePath, std::string deadImagePath, int maxLives){ + + if(!cocos2d::Layer::init()){ + return false; + } + + float lifeSpriteWidth = 0; + float lifeSpriteHeight = 0; + + for (int i = 0; i < maxLives; ++i) { + auto lifeItem = new LifeItem(liveImagePath, deadImagePath); + addChild(lifeItem->lifeSprite); + lifeItem->lifeSprite->setPosition((i+0.5+i*PADDING_MULTIPLIER)*lifeItem->lifeSprite->getBoundingBox().size.width, lifeItem->lifeSprite->getBoundingBox().size.height/2); + addChild(lifeItem->deadSprite); + lifeItem->deadSprite->setPosition(lifeItem->lifeSprite->getPosition()); + lives.push_back(lifeItem); + lifeSpriteWidth = lifeItem->lifeSprite->getBoundingBox().size.width; + lifeSpriteHeight = lifeItem->lifeSprite->getBoundingBox().size.height; + } + + setContentSize(cocos2d::Size(maxLives*lifeSpriteWidth*(1+PADDING_MULTIPLIER), lifeSpriteHeight)); + + currentLives = maxLives; + + return true; +} + +GameLifeIndicatorView::~GameLifeIndicatorView(){ + for(auto it = lives.begin(); it != lives.end(); ++it){ + delete *it; + } +} + +int GameLifeIndicatorView::loseLife(){ + if(currentLives > 0){ + --currentLives; + lives[currentLives]->deactivate(true); + } + return currentLives; +} + +int GameLifeIndicatorView::restoreLife(){ + if(currentLives < lives.size()){ + lives[currentLives]->activate(true); + ++currentLives; + } + return currentLives; +} + +void GameLifeIndicatorView::reset(){ + currentLives = (int)lives.size(); + for(auto it = lives.begin(); it != lives.end(); ++it){ + (*it)->activate(false); + } +} + +float GameLifeIndicatorView::getPaddingX(){ + if(lives.size() > 0){ + return PADDING_MULTIPLIER*lives[0]->lifeSprite->getBoundingBox().size.width; + } + return 0; +} + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/GameLifeIndicatorView.h b/ios/Runner/Wowgame/Classes/CustomViews/GameLifeIndicatorView.h new file mode 100644 index 0000000..0a52ed6 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/GameLifeIndicatorView.h @@ -0,0 +1,83 @@ +// +// GameLifeIndicatorView.h +// SteveAndMaggieGame +// +// Created by Katarzyna Kalinowska-Górska on 21/06/2019. +// + +#ifndef GameLifeIndicatorView_h +#define GameLifeIndicatorView_h + +#include +#include "cocos2d.h" +#include "MiscUtils.h" + +#endif /* GameLifeIndicatorView_h */ + +class GameLifeIndicatorView : public cocos2d::Layer { +public: + static GameLifeIndicatorView* create(std::string liveImagePath, std::string deadImagePath, int maxLives); + virtual int loseLife(); //return current number of lives + virtual int restoreLife(); + virtual void reset(); + virtual float getPaddingX(); + +protected: + bool init(std::string liveImagePath, std::string deadImagePath, int maxLives); + static constexpr float PADDING_MULTIPLIER = 0.1f; + + virtual ~GameLifeIndicatorView(); + + class LifeItem { + public: + bool isActive; + cocos2d::Sprite* lifeSprite; + cocos2d::Sprite* deadSprite; + constexpr static const int DEAD_OPACITY = 128; + + LifeItem(std::string liveImagePath, std::string deadImagePath){ + isActive = true; + lifeSprite = cocos2d::Sprite::create(liveImagePath); + lifeSprite->retain(); + deadSprite = cocos2d::Sprite::create(deadImagePath); + deadSprite->retain(); + deadSprite->setOpacity(0); + } + + ~LifeItem(){ + if(deadSprite != nullptr){ + deadSprite->removeFromParent(); + deadSprite->release(); + } + if(lifeSprite != nullptr){ + lifeSprite->removeFromParent(); + lifeSprite->release(); + } + } + + virtual void activate(bool animated){ + isActive = true; + if(animated){ + lifeSprite->runAction(cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime)); + deadSprite->runAction(cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime)); + } else { + lifeSprite->setOpacity(255); + deadSprite->setOpacity(0); + } + } + + virtual void deactivate(bool animated){ + isActive = false; + if(animated){ + lifeSprite->runAction(cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime)); + deadSprite->runAction(cocos2d::FadeTo::create(MiscUtils::StandardAnimationTime, DEAD_OPACITY)); + } else { + lifeSprite->setOpacity(0); + deadSprite->setOpacity(DEAD_OPACITY); + } + } + }; + + std::vector lives; + int currentLives; +}; diff --git a/ios/Runner/Wowgame/Classes/CustomViews/Layers/CustomLayerView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/Layers/CustomLayerView.cpp new file mode 100644 index 0000000..92ba977 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/Layers/CustomLayerView.cpp @@ -0,0 +1,143 @@ +// +// CustomLayerView.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 19.05.2017. +// +// + +#include +#include "CustomLayerView.h" +#include "LayoutParser.h" + +CustomLayerView* CustomLayerView::create(std::string layoutFilePath, std::string scenarioFilePath) +{ + CustomLayerView * view = new (std::nothrow) CustomLayerView(); + if(view && view->init(layoutFilePath, scenarioFilePath)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool CustomLayerView::init(std::string layoutFilePath, std::string scenarioFilePath) +{ + if(!Layer::init()){ + return false; + } + + _layoutFilePath = layoutFilePath; + _layoutLoaded = false; + _loadFromAssets = false; + _widgetTouchEventCallback = [](std::string, cocos2d::ui::Widget::TouchEventType){}; + if(scenarioFilePath != ""){ + auto fileUtils = cocos2d::FileUtils::getInstance(); + if (fileUtils->isFileExist(scenarioFilePath)) { + std::string jsonString = fileUtils->getStringFromFile(scenarioFilePath); + rapidjson::Document doc; + doc.Parse(jsonString.c_str()); + _actionSequenceHandler = new (std::nothrow) ActionSequenceHandler(this, doc); + } + } + + return true; +} + +CustomLayerView::~CustomLayerView() +{ + if(_actionSequenceHandler){ + delete _actionSequenceHandler; + } +} + +void CustomLayerView::onEnter() +{ + cocos2d::Layer::onEnter(); + this->loadLayout(false); + if(_actionSequenceHandler){ + _actionSequenceHandler->runNext(); + } +} + +void CustomLayerView::onExit() +{ + cocos2d::Layer::onExit(); +} + +void CustomLayerView::loadLayout(bool forceLoad) +{ + if(!_layoutLoaded || forceLoad){ + + auto& layoutParser = LayoutParser::getInstance(); + if (_loadFromAssets && cocos2d::FileUtils::getInstance()->isFileExist(this->_layoutFilePath)) { + layoutParser.loadLayoutFromJSONFile(this->_layoutFilePath, this); + } + else if(!_loadFromAssets){ + layoutParser.loadLayoutFromDownloadedJSONFile(this->_layoutFilePath, this); + } + + _layoutLoaded = true; + this->layoutLoaded(); + } +} + +void CustomLayerView::layoutLoaded() +{ + // to override in subclasses if needed +} + +bool CustomLayerView::touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) +{ + _widgetTouchEventCallback(objectName, touchEventType); + +// auto object = _scenarioObjects[objectName]; + +// if(objectName == "backButton" && touchEventType == ccui.Widget.TOUCH_ENDED){ +// +// log("gugugug"); +// } + + //todo add animation to dismiss dialog + // todo make a parser outside + return false; +} + +void CustomLayerView::resetActionSequence() +{ + if(_actionSequenceHandler){ + _actionSequenceHandler->reset(); + } +} + +void CustomLayerView::setWidgetTouchEventCallback(std::function widgetTouchEventCallback) +{ + _widgetTouchEventCallback = widgetTouchEventCallback; +} + +// layout parse delegate +void CustomLayerView::addLayer(cocos2d::Layer* layer) +{ + _layers.push_back(layer); +} + +void CustomLayerView::addObject(std::string objectName, cocos2d::Node* object) +{ + _objects.insert({objectName, object}); +} + +void CustomLayerView::addScenarioObject(std::string objectName, ScenarioObject* object) +{ + _scenarioObjects.insert({objectName, object}); +} + +ScenarioObject* CustomLayerView::getScenarioObjectByName(std::string objectName) +{ + if(_scenarioObjects.find(objectName) != _scenarioObjects.end()){ + return _scenarioObjects[objectName]; + } + return nullptr; +} + + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/Layers/CustomLayerView.h b/ios/Runner/Wowgame/Classes/CustomViews/Layers/CustomLayerView.h new file mode 100644 index 0000000..4114fc1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/Layers/CustomLayerView.h @@ -0,0 +1,54 @@ +// +// CustomLayerView.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 19.05.2017. +// +// + +#ifndef CustomLayerView_h +#define CustomLayerView_h + +#include "ScenarioObject.h" +#include "LayoutParser.h" +#include "ActionSequenceHandler.h" + +class CustomLayerView : public cocos2d::Layer, public LayoutViewInterface, public ScenarioObject +{ + public: + static CustomLayerView* create(std::string layoutFilePath, std::string scenarioFilePath = ""); + virtual bool init(std::string layoutFilePath, std::string scenarioFilePath = ""); + virtual ~CustomLayerView(); + + virtual void onEnter() override; + virtual void onExit() override; + virtual void loadLayout(bool forceLoad); + virtual void layoutLoaded(); + virtual void resetActionSequence(); + + virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override; + + virtual void setWidgetTouchEventCallback(std::function widgetTouchEventCallback); + + //LayoutViewInterface + virtual void addLayer(cocos2d::Layer* layer) override; + virtual void addObject(std::string objectName, cocos2d::Node* object) override; + virtual void addScenarioObject(std::string objectName, ScenarioObject* object) override; + + //ScenarioObject - for ActionSequenceHandler + virtual ScenarioObject* getScenarioObjectByName(std::string name) override; + + protected: + std::string _layoutFilePath; + ActionSequenceHandler* _actionSequenceHandler; + bool _layoutLoaded; + std::vector _layers; + std::map _objects; + std::map _scenarioObjects; + bool _loadFromAssets; + + std::function _widgetTouchEventCallback; +}; + +#endif /* CustomLayerView_h */ + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/Layers/TouchInterceptingLayer.cpp b/ios/Runner/Wowgame/Classes/CustomViews/Layers/TouchInterceptingLayer.cpp new file mode 100644 index 0000000..45d5afd --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/Layers/TouchInterceptingLayer.cpp @@ -0,0 +1,102 @@ +// +// TouchInterceptingLayer.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 12.05.2017. +// +// + +#include "TouchInterceptingLayer.h" + +// create + +TouchInterceptingLayer * TouchInterceptingLayer::create(const cocos2d::Color4B& color, bool sceneGraphPriority) +{ + TouchInterceptingLayer * layer = new (std::nothrow) TouchInterceptingLayer(); + if(layer && layer->initWithColor(color, sceneGraphPriority)) + { + layer->autorelease(); + return layer; + } + CC_SAFE_DELETE(layer); + return nullptr; +} + +// overrides + +bool TouchInterceptingLayer::initWithColor(const cocos2d::Color4B& color, bool sceneGraphPriority) +{ + if(!LayerColor::initWithColor(color)) + { + return false; + } + + _onTouchCallback = nullptr; + this->configureTouchListener(sceneGraphPriority); + + return true; +} + +//void TouchInterceptingLayer::onEnter() +//{ +// cocos2d::LayerColor::onEnter(); +//} + +void TouchInterceptingLayer::configureTouchListener(bool sceneGraphPriority) +{ + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->setSwallowTouches(true); + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(_onTouchCallback){ + _onTouchCallback(touch); + } + + return true; + }; + + touchListener->onTouchMoved = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(_onTouchMovedCallback){ + _onTouchMovedCallback(touch); + } + }; + + touchListener->onTouchEnded = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(_onTouchEndedCallback){ + _onTouchEndedCallback(touch); + } + }; + + if(sceneGraphPriority){ + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); + } else { + _eventDispatcher->addEventListenerWithFixedPriority(touchListener, TouchEventListenerPriority); + } +} + +//setters + +void TouchInterceptingLayer::setOnTouchCallback(const std::function& onTouchCallback) +{ + this->_onTouchCallback = onTouchCallback; +} + +void TouchInterceptingLayer::setOnTouchMovedCallback(const std::function& onTouchCallback) +{ + this->_onTouchMovedCallback = onTouchCallback; +} + +void TouchInterceptingLayer::setOnTouchEndedCallback(const std::function& onTouchCallback) +{ + this->_onTouchEndedCallback = onTouchCallback; +} + +void TouchInterceptingLayer::clearTouchHandlers() +{ + _onTouchCallback = nullptr; + _onTouchMovedCallback = nullptr; + _onTouchEndedCallback = nullptr; +} + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/Layers/TouchInterceptingLayer.h b/ios/Runner/Wowgame/Classes/CustomViews/Layers/TouchInterceptingLayer.h new file mode 100644 index 0000000..f415877 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/Layers/TouchInterceptingLayer.h @@ -0,0 +1,42 @@ +// +// TouchInterceptingLayer.hpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 12.05.2017. +// +// + +#ifndef TouchInterceptingLayer_h +#define TouchInterceptingLayer_h + +#include +#include "cocos2d.h" + +class TouchInterceptingLayer : public cocos2d::LayerColor { + + public: + + static const int TouchEventListenerPriority = -100; + + // create + static TouchInterceptingLayer * create(const cocos2d::Color4B& color, bool sceneGraphPriority = true); + + // init + virtual bool initWithColor(const cocos2d::Color4B& color, bool sceneGraphPriority = true); + virtual void configureTouchListener(bool sceneGraphPriority = true); + + // setters + virtual void setOnTouchCallback(const std::function& onTouchCallback); + virtual void setOnTouchMovedCallback(const std::function& onTouchCallback); + virtual void setOnTouchEndedCallback(const std::function& onTouchCallback); + virtual void clearTouchHandlers(); + + protected: + + std::function _onTouchCallback; + std::function _onTouchMovedCallback; + std::function _onTouchEndedCallback; + +}; + +#endif /* TouchInterceptingLayer_hpp */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerLayer.cpp b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerLayer.cpp new file mode 100644 index 0000000..fd580c1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerLayer.cpp @@ -0,0 +1,77 @@ +// +// LevelPickerLayer.cpp +// HalloweenSpaceInvaders-mobile +// +// Created by Katarzyna Kalinowska-Górska on 03/10/2019. +// + +#include +#include "LevelPickerLayer.h" +#include "ScalingUtils.h" +#include "SimpleButton.h" +#include "MiscUtils.h" + +LevelPickerLayer* LevelPickerLayer::create(float width, float height){ + LevelPickerLayer * view = new (std::nothrow) LevelPickerLayer(); + if(view && view->init(width, height)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool LevelPickerLayer::init(float width, float height){ + if(!cocos2d::LayerColor::initWithColor(cocos2d::Color4B(0,0,0,220), width, height)){ + return false; + } + + setCascadeOpacityEnabled(true); + // add the level picker + std::vector levelImagePaths = { "graphics/levels/level_1.png", "graphics/levels/level_2.png", "graphics/levels/level_3.png" }; + std::vector levelNames = { "EASY", "MEDIUM", "DIFFICULT" }; //TODO HARD CODED + _levelPickerView = LevelPickerView::create(levelImagePaths, levelNames); + addChild(_levelPickerView); + _levelPickerView->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + _levelPickerView->setPosition(width/2, height/2); + _levelPickerView->addOnLevelChangedCallback([&](int pickedLevel){ + MiscUtils::saveLastLevel(pickedLevel); + _onLevelChangedCallback(pickedLevel); + }); + _levelPickerView->selectLevelIndex((int)MiscUtils::lastLevel(), false); + + // add the instruction label + auto instructionLabel = cocos2d::Label::createWithTTF("CHOOSE YOUR LEVEL:", "fonts/ComicSansMSBold.ttf", 120*ScalingUtils::getScaleForFont()); //magic number + addChild(instructionLabel); + auto paddingTop = instructionLabel->getBoundingBox().size.height*1.5f; + instructionLabel->setPosition(width/2, _levelPickerView->getBoundingBox().getMaxY() + paddingTop); + + // add the go button + auto buttonGo = SimpleButton::create(); + auto goButtonTexturePath = "buttons/graphics/dark_green.png"; + buttonGo->loadTextures(goButtonTexturePath, goButtonTexturePath, goButtonTexturePath); + auto buttonBg = cocos2d::Sprite::create("buttons/graphics/button_go.png"); + buttonGo->addChild(buttonBg); + buttonBg->setPosition(cocos2d::Vec2(buttonGo->getContentSize().width/2,buttonGo->getContentSize().height/2)); + addChild(buttonGo); + auto paddingBottom = paddingTop; + buttonGo->setAnchorPoint(cocos2d::Vec2(1, 0.5)); + buttonGo->setPosition(cocos2d::Vec2(_levelPickerView->getBoundingBox().getMaxX(), _levelPickerView->getBoundingBox().getMinY() - paddingBottom)); + buttonGo->setOnTouchEndedCallback([&](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + if(_onGoPressedCallback != nullptr){ + _onGoPressedCallback(); + } + MiscUtils::hideAndRemoveView(this, true); + }); + + return true; +} + +void LevelPickerLayer::addOnGoPressedCallback(std::function onGoPressed){ + _onGoPressedCallback = onGoPressed; +} + +void LevelPickerLayer::setOnLevelChangedCallback(std::function p_onLevelChangedCallback){ + _onLevelChangedCallback = p_onLevelChangedCallback; +} diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerLayer.h b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerLayer.h new file mode 100644 index 0000000..39c4e2c --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerLayer.h @@ -0,0 +1,32 @@ +// +// LevelPickerLayer.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 03/10/2019. +// + +#ifndef LevelPickerLayer_h +#define LevelPickerLayer_h + +#include "cocos2d.h" +#include "LevelPickerView.h" + +class LevelPickerLayer : public cocos2d::LayerColor { + +public: + static LevelPickerLayer* create(float width, float height); + void addOnGoPressedCallback(std::function onGoPressed); + void setOnLevelChangedCallback(std::function p_onLevelChangedCallback); + +protected: + LevelPickerView* _levelPickerView; + std::function _onGoPressedCallback; + std::function _onLevelChangedCallback { [](int){} }; + + bool init(float width, float height); + + + +}; + +#endif /* LevelPickerLayer_h */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerView.cpp new file mode 100644 index 0000000..f790b96 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerView.cpp @@ -0,0 +1,122 @@ +// +// LevelPickerView.cpp +// HalloweenSpaceInvaders-mobile +// +// Created by Katarzyna Kalinowska-Górska on 29/09/2019. +// + +#include +#include "LevelPickerView.h" +#include "GeometryUtils.h" +#include "MiscUtils.h" + +LevelPickerView* LevelPickerView::create(const std::vector& levelImagePaths, const std::vector& levelNames){ + LevelPickerView * view = new (std::nothrow) LevelPickerView(); + if(view && view->init(levelImagePaths, levelNames)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + + +bool LevelPickerView::init(const std::vector& levelImagePaths, const std::vector& levelNames){ + +// assert(levelNames.size() == levelImagePaths.size()); + + if(!cocos2d::Node::init()){ + return false; + } + + setCascadeOpacityEnabled(true); + reloadLevels(levelImagePaths, levelNames); + + _onLevelChanged = nullptr; + prepareTouchHandlers(); + + return true; +} + +void LevelPickerView::reloadLevels(const std::vector& levelImagePaths, const std::vector& levelNames){ + for(auto oldLevelView : levelViews){ + oldLevelView->removeFromParent(); + } + levelViews.clear(); + float maxHeight = 0; + float sumWidth = 0; + + for(int i = 0; i < levelImagePaths.size(); ++i){ + auto newLevelView = levelNames.size() == levelImagePaths.size() ? LevelView::create(levelImagePaths[i], levelNames[i]) : LevelView::create(levelImagePaths[i]); + addChild(newLevelView); + levelViews.emplace_back(newLevelView); + sumWidth += newLevelView->getBoundingBox().size.width; + maxHeight = MAX(newLevelView->getBoundingBox().size.height, maxHeight); + } + + auto padding = sumWidth/levelImagePaths.size()/3; + auto contentSize = cocos2d::Size(sumWidth+padding*3, maxHeight); + + setContentSize(contentSize); + + for(int i = 0; i < levelViews.size(); ++i){ + auto levelView = levelViews[i]; + levelView->setPosition(levelView->getBoundingBox().size.width/2 + padding*(4*i+0.5), contentSize.height/2); + } + + _selectedLevelIndex = 0; + levelViews[_selectedLevelIndex]->setChosen(true, false); +} + +void LevelPickerView::selectLevelIndex(int index, bool animated){ + if(_selectedLevelIndex != index){ + if(animated){ + levelViews[_selectedLevelIndex]->setChosen(false, true); + levelViews[index]->setChosen(true, true); + } else { + levelViews[_selectedLevelIndex]->setChosen(false, false); + levelViews[index]->setChosen(true, false); + } + _selectedLevelIndex = index; + } +} + +int LevelPickerView::getPickedLevelIndex(){ + return _selectedLevelIndex; +} + +void LevelPickerView::addOnLevelChangedCallback(std::function onLevelChanged){ + _onLevelChanged = onLevelChanged; +} + +void LevelPickerView::prepareTouchHandlers() +{ + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + return MiscUtils::isNodeVisible(this) && GeometryUtils::getBoundingBoxToWorld(this).containsPoint(touch->getLocation()); + }; + touchListener->onTouchEnded = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + for(int i = 0; i < levelViews.size(); ++i){ + if(GeometryUtils::getBoundingBoxToWorld(levelViews[i]).containsPoint(touch->getLocation())){ + selectLevelIndex(i, true); + if(_onLevelChanged != nullptr){ + _onLevelChanged(i); + } + break; + } + } + }; + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); +} + +void LevelPickerView::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + setAnchorPoint(cocos2d::Vec2(0.5,0.5)); + this->loadCommonPropertiesFromJSON(jsonValue); +} + + + + + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerView.h b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerView.h new file mode 100644 index 0000000..f056273 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/LevelPickerView.h @@ -0,0 +1,36 @@ +// +// LevelPickerView.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 29/09/2019. +// + +#ifndef LevelPickerView_h +#define LevelPickerView_h + +#include "cocos2d.h" +#include "LevelView.h" +#include +#include +#include "LayoutObject.h" + +class LevelPickerView : public cocos2d::Node, public LayoutObject { + +public: + static LevelPickerView* create(const std::vector& levelImagePaths, const std::vector& levelNames); + void selectLevelIndex(int index, bool animated = true); + int getPickedLevelIndex(); + void addOnLevelChangedCallback(std::function onLevelChanged); + void reloadLevels(const std::vector& levelImagePaths, const std::vector& levelNames); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + +protected: + int _selectedLevelIndex; + std::vector levelViews; + std::function _onLevelChanged; + bool init(const std::vector& levelImagePaths, const std::vector& levelNames); + void prepareTouchHandlers(); +}; + +#endif /* LevelPickerView_h */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/SimpleLevelPickerView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/SimpleLevelPickerView.cpp new file mode 100644 index 0000000..677e065 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/SimpleLevelPickerView.cpp @@ -0,0 +1,107 @@ +// +// SimpleLevelPickerView.cpp +// HalloweenSpaceInvaders-mobile +// +// Created by Katarzyna Kalinowska-Górska on 01/10/2019. +// + +#include +#include "SimpleLevelPickerView.h" +#include "MiscUtils.h" +#include "GeometryUtils.h" + +SimpleLevelPickerView* SimpleLevelPickerView::create(std::vector levelImagePaths){ + SimpleLevelPickerView * view = new (std::nothrow) SimpleLevelPickerView(); + if(view && view->init(levelImagePaths)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool SimpleLevelPickerView::init(std::vector levelImagePaths){ + if(!cocos2d::Node::init()){ + return false; + } + + for(auto levelImagePath : levelImagePaths){ + auto newLevelView = LevelView::create(levelImagePath); + addChild(newLevelView); + levelViews.emplace_back(newLevelView); + newLevelView->setCascadeOpacityEnabled(true); + newLevelView->setOpacity(0); + auto contentSize = getContentSize(); + contentSize = cocos2d::Size(MAX(contentSize.width, newLevelView->getBoundingBox().size.width), MAX(contentSize.height, newLevelView->getBoundingBox().size.height)); + setContentSize(contentSize); + } + + for(auto levelView : levelViews){ + levelView->setPosition(getContentSize().width/2, getContentSize().height/2); + } + + _selectedLevelIndex = 0; + levelViews[_selectedLevelIndex]->setOpacity(255); + levelViews[_selectedLevelIndex]->setChosen(true, false); + + _onLevelChanged = nullptr; + prepareTouchHandlers(); + + return true; +} + +void SimpleLevelPickerView::selectLevelIndex(int index, bool animated){ + if(_selectedLevelIndex != index){ + if(animated){ + levelViews[_selectedLevelIndex]->runAction(cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime)); + levelViews[_selectedLevelIndex]->setChosen(false, true); + levelViews[index]->runAction(cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime)); + levelViews[index]->setChosen(true, true); + } else { + levelViews[_selectedLevelIndex]->setOpacity(0); + levelViews[_selectedLevelIndex]->setChosen(false, false); + levelViews[index]->setOpacity(255); + levelViews[index]->setChosen(true, false); + } + _selectedLevelIndex = index; + } +} + +int SimpleLevelPickerView::getPickedLevelIndex(){ + return _selectedLevelIndex; +} + +void SimpleLevelPickerView::addOnLevelChangedCallback(std::function onLevelChanged){ + _onLevelChanged = onLevelChanged; +} + +void SimpleLevelPickerView::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + setAnchorPoint(cocos2d::Vec2(0.5,0.5)); + this->loadCommonPropertiesFromJSON(jsonValue); +} + +void SimpleLevelPickerView::prepareTouchHandlers() +{ + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + return GeometryUtils::getBoundingBoxToWorld(this).containsPoint(touch->getLocation()); +// if(getBoundingBox().containsPoint(touch->getLocation())){ +// return true; +// } +// return false; + }; + touchListener->onTouchEnded = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(GeometryUtils::getBoundingBoxToWorld(this).containsPoint(touch->getLocation())){ + selectLevelIndex((_selectedLevelIndex+1)%levelViews.size(), true); + if(_onLevelChanged != nullptr){ + _onLevelChanged(_selectedLevelIndex); + } + } + }; + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); +} + + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/SimpleLevelPickerView.h b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/SimpleLevelPickerView.h new file mode 100644 index 0000000..1d0b835 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelPickerView/SimpleLevelPickerView.h @@ -0,0 +1,36 @@ +// +// SimpleLevelPickerView.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 01/10/2019. +// + +#ifndef SimpleLevelPickerView_h +#define SimpleLevelPickerView_h + +#include "cocos2d.h" +#include "LevelView.h" +#include "LayoutObject.h" + +class SimpleLevelPickerView : public cocos2d::Node, public LayoutObject { + +public: + static SimpleLevelPickerView* create(std::vector levelImagePaths); + void selectLevelIndex(int index, bool animated); + int getPickedLevelIndex(); + void addOnLevelChangedCallback(std::function onLevelChanged); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + +protected: + int _selectedLevelIndex; + std::vector levelViews; + std::function _onLevelChanged; + + bool init(std::vector levelImagePaths); + virtual void prepareTouchHandlers(); + +}; + + +#endif /* SimpleLevelPickerView_h */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/LevelView.cpp new file mode 100644 index 0000000..830e699 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelView.cpp @@ -0,0 +1,205 @@ +// +// LevelView.cpp +// HalloweenSpaceInvaders-mobile +// +// Created by Katarzyna Kalinowska-Górska on 27/09/2019. +// + +#include "LevelView.h" +#include +#include +#include "ScalingUtils.h" +#include "MathUtils.h" +#include "MiscUtils.h" + +static const float InactivePicScale = 0.8f; +static const int InactivePicOpacity = 100; +static const int FloatActionTag = 10; + +LevelView* LevelView::create(std::string levelImagePath){ + LevelView * view = new (std::nothrow) LevelView(); + if(view && view->init(levelImagePath)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +LevelView* LevelView::create(std::string levelImagePath, std::string levelName){ + LevelView * view = new (std::nothrow) LevelView(); + if(view && view->init(levelImagePath, levelName)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool LevelView::init(std::string levelImagePath){ + if(!cocos2d::Node::init()){ + return false; + } + + _bgNode = cocos2d::Sprite::create("graphics/level_halo.png"); + _pic = cocos2d::Sprite::create(levelImagePath); + + addChild(_bgNode); + addChild(_pic); + + setContentSize(_pic->getBoundingBox().size); + + auto contentWidth = getContentSize().width; + auto contentHeight = getContentSize().height; + _bgNode->setPosition(contentWidth/2, contentHeight/2); + _pic->setPosition(contentWidth/2, contentHeight/2); + + setAnchorPoint(cocos2d::Vec2(0.5,0.5)); + + _isChosen = true; + setChosen(false, false); + + return true; +} + +bool LevelView::init(std::string levelImagePath, std::string levelName){ + if(!init(levelImagePath)){ + return false; + } + + _label = cocos2d::Label::createWithTTF(levelName, "fonts/ComicSansMSBold.ttf", 100*ScalingUtils::getScaleForFont()); //magic number + addChild(_label); + float padding = 50*ScalingUtils::scaleAspectFillToDesignIpadProSize(); //TODO magic number + setContentSize(cocos2d::Size(getContentSize().width, getContentSize().height+padding+_label->getBoundingBox().size.height)); + _pic->setPosition(getContentSize().width/2, getContentSize().height - _pic->getBoundingBox().size.height/2 - padding); + _bgNode->setPosition(_pic->getPosition()); + _label->setPosition(_pic->getPositionX(), _pic->getBoundingBox().getMinY() - padding - _label->getBoundingBox().size.height/2); + +// auto bg = cocos2d::LayerColor::create(cocos2d::Color4B(100,100,255, 255)); +// bg->setContentSize(getContentSize()); +// addChild(bg); +// bg->_setLocalZOrder(-10); + + _isChosen = true; + setChosen(false, false); + + return true; +} + +void LevelView::setChosen(bool chosen, bool animated){ + static cocos2d::Color3B FontColorChosen = cocos2d::Color3B(255, 255, 255); + static cocos2d::Color3B FontColorDimmed = cocos2d::Color3B(128, 128, 128); + static float FontScaleChosen = 1.f; + static float FontScaleSmaller = 0.9f; + + if(chosen != _isChosen){ + _bgNode->stopAllActions(); + auto newBgNodeOpacity = 255.f; + auto newPicScale = 1.f; + auto newPicOpacity = 255; + if(!chosen){ + newBgNodeOpacity = 0; + newPicScale = InactivePicScale; + newPicOpacity = InactivePicOpacity; + } + + if(animated){ +// _bgNode->runAction(cocos2d::FadeTo::create(MiscUtils::StandardAnimationTime, newBgNodeOpacity)); + _pic->runAction(cocos2d::Spawn::create(cocos2d::ScaleTo::create(MiscUtils::StandardAnimationTime, newPicScale), + cocos2d::FadeTo::create(MiscUtils::StandardAnimationTime, newPicOpacity), nullptr)); + _bgNode->runAction(cocos2d::FadeTo::create(MiscUtils::StandardAnimationTime, newBgNodeOpacity)); + if(_label != nullptr){ + _label->runAction(cocos2d::TintTo::create(MiscUtils::StandardAnimationTime, (chosen? FontColorChosen : FontColorDimmed))); + _label->runAction(cocos2d::ScaleTo::create(MiscUtils::StandardAnimationTime, (chosen? FontScaleChosen : FontScaleSmaller))); + } + + } else { + _bgNode->setOpacity(newBgNodeOpacity); + _pic->setScale(newPicScale, newPicScale); + _pic->setOpacity(newPicOpacity); + if(_label != nullptr){ + _label->setColor(chosen? FontColorChosen : FontColorDimmed); + _label->setScale(chosen ? FontScaleChosen : FontScaleSmaller); + } + } + _isChosen = chosen; + } +} + +void LevelView::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + this->loadCommonPropertiesFromJSON(jsonValue); + if(jsonValue.HasMember("opacity")){ + auto opacity = jsonValue["opacity"].GetInt(); + _pic->setOpacity(opacity); + } +} + +void LevelView::startFloating(){ + _isFloating = true; + _circleMidPoint = getPosition(); + _floatDirection = 1; + doFloat(true); +} + +void LevelView::stopFloating(){ + if(_isFloating){ + _isFloating = false; + stopActionByTag(FloatActionTag); + } +} + +void LevelView::doFloat(bool start){ + float radiusX = getContentSize().height/100; + float radiusY = getContentSize().height/16; + float newX = _circleMidPoint.x + MathUtils::getRandom(-radiusX, radiusX); + float newY = _circleMidPoint.y + radiusY*_floatDirection; + auto animationTime = start ? 0.8 : 1.6f; + auto floatAction = cocos2d::Sequence::create(cocos2d::EaseInOut::create(cocos2d::MoveTo::create(animationTime, cocos2d::Vec2(newX, newY)), 2), cocos2d::CallFunc::create([&](){ + doFloat(); + }), nullptr); + floatAction->setTag(FloatActionTag); + runAction(floatAction); + _floatDirection *= -1; +} + +void LevelView::flash(){ + auto halfDuration = MiscUtils::StandardAnimationTime*2; + if(_bgNode != nullptr){ + auto flashAction = cocos2d::Sequence::create(cocos2d::EaseInOut::create(cocos2d::FadeIn::create(halfDuration),2), + cocos2d::EaseInOut::create(cocos2d::FadeOut::create(halfDuration),2),nullptr); + _bgNode->runAction(flashAction); + } + if(_pic != nullptr){ + auto lastOpacity = _pic->getOpacity(); + _pic->runAction(cocos2d::Sequence::create(cocos2d::EaseInOut::create(cocos2d::FadeIn::create(halfDuration), 2), + cocos2d::EaseInOut::create(cocos2d::FadeTo::create(halfDuration, lastOpacity), 2), nullptr)); + } +} + +void LevelView::changePicture(std::string newPicturePath){ + auto oldOpacity = _pic->getOpacity(); + _pic->removeFromParent(); + _pic = cocos2d::Sprite::create(newPicturePath); + addChild(_pic); + setContentSize(_pic->getBoundingBox().size); + + auto contentWidth = getContentSize().width; + auto contentHeight = getContentSize().height; + _bgNode->setPosition(contentWidth/2, contentHeight/2); + _pic->setPosition(contentWidth/2, contentHeight/2); + + if(_label != nullptr){ + float padding = 50*ScalingUtils::scaleAspectFillToDesignIpadProSize(); //TODO magic number + setContentSize(cocos2d::Size(getContentSize().width, getContentSize().height+padding+_label->getBoundingBox().size.height)); + _pic->setPosition(getContentSize().width/2, getContentSize().height - _pic->getBoundingBox().size.height/2 - padding); + _bgNode->setPosition(_pic->getPosition()); + _label->setPosition(_pic->getPositionX(), _pic->getBoundingBox().getMinY() - padding - _label->getBoundingBox().size.height/2); + } + + setChosen(_isChosen, false); + _pic->setOpacity(oldOpacity); + +} diff --git a/ios/Runner/Wowgame/Classes/CustomViews/LevelView.h b/ios/Runner/Wowgame/Classes/CustomViews/LevelView.h new file mode 100644 index 0000000..6c99591 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/LevelView.h @@ -0,0 +1,44 @@ +// +// LevelView.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 27/09/2019. +// + +#ifndef LevelView_h +#define LevelView_h + +#include "cocos2d.h" +#include +#include "LayoutObject.h" + +class LevelView : public cocos2d::Node, public LayoutObject { + +public: + static LevelView* create(std::string levelImagePath); + static LevelView* create(std::string levelImagePath, std::string levelName); + void setChosen(bool chosen, bool animated = true); + void changePicture(std::string newPicturePath); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + + void startFloating(); + void stopFloating(); + virtual void doFloat(bool start = false); + void flash(); + +protected: + bool _isChosen; + bool _isFloating; + int _floatDirection; + cocos2d::Point _circleMidPoint; + cocos2d::Sprite* _bgNode; + cocos2d::Sprite* _pic; + cocos2d::Label* _label; + + bool init(std::string levelImagePath); + bool init(std::string levelImagePath, std::string levelName); +}; + + +#endif /* LevelView_h */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateShowInterface.cpp b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateShowInterface.cpp new file mode 100644 index 0000000..8fbcbed --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateShowInterface.cpp @@ -0,0 +1,54 @@ +// +// ParentalGateShowInterface.cpp +// Steve and Maggie Halloween +// +// Created by Katarzyna Kalinowska-Górska on 14/10/2019. +// + +#include "ParentalGateShowInterface.h" +#include "MiscUtils.h" +#include "ParentalGateView.h" + +static int ParentalGateViewTag = 90; + +void ParentalGateShowInterface::presentParentalGate(std::function onSuccessCallback, std::function onFailureCallback){ + _isPresentingParentalGate = true; + auto screenSize = cocos2d::Director::getInstance()->getWinSize(); + auto parentalGate = ParentalGateView::create(screenSize.width, screenSize.height, onSuccessCallback, onFailureCallback); + parentalGate->setTag(ParentalGateViewTag); + PGSI_addChild(parentalGate); + parentalGate->setLocalZOrder(1000); + + parentalGate->setPosition(cocos2d::Vec2(0, 0)); + parentalGate->setCascadeOpacityEnabled(true); + + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->setSwallowTouches(true); + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + return true; + }; + PGSI_getEventDispatcher()->addEventListenerWithSceneGraphPriority(touchListener, parentalGate); + // #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + // auto keyboardListener = cocos2d::EventListenerKeyboard::create(); + // keyboardListener->onKeyReleased = [&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event){ + // if(keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK){ + // hideParentalGate(); + // } + // }; + // _eventDispatcher->addEventListenerWithSceneGraphPriority(keyboardListener, parentalGate); + // #endif + + parentalGate->stopAllActions(); + parentalGate->setOpacity(0); + parentalGate->runAction(cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime)); +} + +void ParentalGateShowInterface::hideParentalGate(){ + _isPresentingParentalGate = false; + auto parentalGate = PGSI_getChildByTag(ParentalGateViewTag); + if(parentalGate != nullptr){ + parentalGate->stopAllActions(); + PGSI_getEventDispatcher()->removeEventListenersForTarget(parentalGate); + MiscUtils::hideAndRemoveView(parentalGate, true); + } +} diff --git a/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateShowInterface.h b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateShowInterface.h new file mode 100644 index 0000000..626f472 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateShowInterface.h @@ -0,0 +1,47 @@ +// +// ParentalGateShowInterface.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 14/10/2019. +// + +#ifndef ParentalGateShowInterface_h +#define ParentalGateShowInterface_h + +#include "ParentalGateView.h" +#include "cocos2d.h" + +class ParentalGateShowInterface { + +public: + virtual ~ParentalGateShowInterface(){} + bool isShowingParentalGate(){return _isPresentingParentalGate;}; + virtual void presentParentalGate(std::function onSuccessCallback, std::function onFailureCallback); + virtual void hideParentalGate(); + virtual void PGSI_addChild(cocos2d::Node* n) { + auto selfNode = dynamic_cast(this); + if(selfNode != nullptr){ + selfNode->addChild(n); + } + } + virtual cocos2d::Node* PGSI_getChildByTag(int t) { + auto selfNode = dynamic_cast(this); + if(selfNode != nullptr){ + return selfNode->getChildByTag(t); + } + return nullptr; + } + virtual cocos2d::EventDispatcher* PGSI_getEventDispatcher(){ + auto selfNode = dynamic_cast(this); + if(selfNode != nullptr){ + return selfNode->getEventDispatcher(); + } + return nullptr; + } + +protected: + bool _isPresentingParentalGate; + +}; + +#endif /* ParentalGateShowInterface_h */ diff --git a/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateView.cpp new file mode 100644 index 0000000..93fcac1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateView.cpp @@ -0,0 +1,190 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2019-10-07. +// + +#include "ParentalGateView.h" +#include "ScalingUtils.h" +#include "SimpleButton.h" +#include "MathUtils.h" + +const std::vector ParentalGateView::KKTextDigit::DigitNames = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; + +ParentalGateView* ParentalGateView::create(float width, float height, std::function onSuccessCallback,std::function onFailureCallback){ + ParentalGateView * view = new (std::nothrow) ParentalGateView(); + if(view && view->init(width, height, onSuccessCallback, onFailureCallback)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool ParentalGateView::init(float width, float height, std::function onSuccessCallback,std::function onFailureCallback){ + + if(!cocos2d::LayerColor::initWithColor(cocos2d::Color4B(40, 40, 70, 240), width, height)){ + return false; + } + + _onSuccessCallback = onSuccessCallback; + _onFailureCallback = onFailureCallback; + setupAppearance(); + setupLogic(); + setCascadeOpacityEnabled(true); + + return true; +} + +void ParentalGateView::setupAppearance(){ + + auto wholeContainer = cocos2d::Node::create(); + addChild(wholeContainer); + wholeContainer->setCascadeOpacityEnabled(true); + + // // add the instruction label + auto instructionLabel1 = cocos2d::Label::createWithTTF("Are you a parent?", "fonts/ComicSansMSBold.ttf", 120*ScalingUtils::getScaleForFont()); //TODO magic number, hard-coded text + instructionLabel1->setColor(cocos2d::Color3B(200, 200, 200)); + auto instructionLabel2 = cocos2d::Label::createWithTTF("To continue, tap:", "fonts/ComicSansMSRegular.ttf", 100*ScalingUtils::getScaleForFont()); //TODO magic number, hard-coded text + instructionLabel2->setColor(cocos2d::Color3B(200, 200, 200)); + digitsLabel = cocos2d::Label::createWithTTF("seven, seven, seven", "fonts/ComicSansMSBold.ttf", 110*ScalingUtils::getScaleForFont()); + digitsLabel->setColor(cocos2d::Color3B(160, 130, 160)); + wholeContainer->addChild(instructionLabel1); + wholeContainer->addChild(instructionLabel2); + wholeContainer->addChild(digitsLabel); + + auto buttonPadding = 20*ScalingUtils::scaleAspectFillToDesignIpadProSize(); + float digitButtonSide = 0; + auto buttonContainer = cocos2d::Node::create(); + buttonContainer->setCascadeOpacityEnabled(true); + for(int i = 1; i <= 9; ++i){ + auto digitButton = SimpleButton::create(); + auto digitButtonBgTexturePath = randomButtonBgImagePath(); + digitButton->loadTextures(digitButtonBgTexturePath, digitButtonBgTexturePath, digitButtonBgTexturePath); + digitButton->setCascadeOpacityEnabled(true); + auto label = cocos2d::Label::createWithTTF(std::to_string(i), "fonts/ComicSansMSBold.ttf", 110*ScalingUtils::getScaleForFont()); + label->setColor(cocos2d::Color3B(0, 0, 0)); + label->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + label->setPosition(cocos2d::Vec2(digitButton->getBoundingBox().size.width/2, digitButton->getBoundingBox().size.height/2)); + digitButton->addChild(label); + buttonContainer->addChild(digitButton); + auto iMult = (i-1)%3+1; + digitButton->setPositionX(buttonPadding*iMult + digitButton->getBoundingBox().size.width*(iMult-0.5)); + auto yMult = 1; + if(i > 6) yMult = 3; + else if(i > 3) yMult = 2; + yMult = 4 - yMult; + digitButton->setPositionY(buttonPadding*yMult + digitButton->getBoundingBox().size.height*(yMult-0.5)); + digitButtonSide = MAX(digitButtonSide, MAX(digitButton->getBoundingBox().size.width, digitButton->getBoundingBox().size.height)); + digitButton->objectName = KKTextDigit::DigitNames[i]; + digitButton->setOnTouchEndedCallback([&](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + digitButtonPressed(name); + }); + } + + auto buttonContainerSide = 3*digitButtonSide+5*buttonPadding; + buttonContainer->setContentSize(cocos2d::Size(buttonContainerSide, buttonContainerSide)); + wholeContainer->addChild(buttonContainer); + +// auto nevermindButton = SimpleButton::create(); +// auto nevermindLabel = cocos2d::Label::createWithTTF("Never mind", "fonts/ComicSansMSRegular.ttf", 110*ScalingUtils::getScaleForFont()); //TODO magic number, hard-coded text +// nevermindLabel->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); +// nevermindButton->addChild(nevermindLabel); +//// nevermindButton->loadText +// nevermindButton->setContentSize(nevermindLabel->getContentSize()); +// nevermindLabel->setPosition(nevermindButton->getContentSize().width/2, nevermindButton->getContentSize().height/2); +// wholeContainer->addChild(nevermindButton); + + auto wholeWidth = MAX(buttonContainer->getContentSize().width, instructionLabel1->getBoundingBox().size.width); + auto wholeHeight = buttonContainer->getContentSize().height + instructionLabel1->getBoundingBox().size.height + instructionLabel2->getBoundingBox().size.height + digitsLabel->getBoundingBox().size.height;// + nevermindButton->getBoundingBox().size.height; + wholeContainer->setContentSize(cocos2d::Size(wholeWidth, wholeHeight)); + wholeContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + wholeContainer->setPosition(getContentSize().width/2, getContentSize().height/2); + + buttonContainer->setAnchorPoint(cocos2d::Vec2(0.5,0)); + buttonContainer->setPositionX(wholeWidth/2); + buttonContainer->setPositionY(0);//nevermindButton->getBoundingBox().size.height); + + instructionLabel1->setPosition(wholeWidth/2, wholeHeight - instructionLabel1->getBoundingBox().size.height/2); + instructionLabel2->setPosition(wholeWidth/2, instructionLabel1->getBoundingBox().getMinY() - instructionLabel2->getBoundingBox().size.height/2); + digitsLabel->setPosition(wholeWidth/2, instructionLabel2->getBoundingBox().getMinY() - digitsLabel->getBoundingBox().size.height/2); + +// nevermindButton->setAnchorPoint(cocos2d::Vec2(1, 0)); +// nevermindButton->setPosition(cocos2d::Vec2(wholeWidth, 0)); + +} + +void ParentalGateView::setupLogic(){ + correctDigitSequence = generateTextDigits(3); + currentIndex = 0; + updateDigitsLabel(); +} + +std::vector ParentalGateView::generateTextDigits(int digitsCount){ + std::vector digits; + for(int i = 0; i < digitsCount; ++i){ + auto newDigit = KKTextDigit(MathUtils::getRandomInt(1, 9)); + digits.push_back(newDigit); + } + return digits; +} + +void ParentalGateView::updateDigitsLabel(){ + std::string digitString = ""; + for(int i = currentIndex; i < correctDigitSequence.size(); ++i){ + digitString += correctDigitSequence[i].text; + if(i < correctDigitSequence.size()-1){ + digitString += ", "; + } + } + digitsLabel->setString(digitString); +} + +std::string ParentalGateView::randomButtonBgImagePath(){ + auto index = MathUtils::getRandomInt(1, 16); + switch (index%4) { + case 1: + return "buttons/graphics/button_yellow.png"; + break; + case 2: + return "buttons/graphics/button_orange.png"; + break; + case 3: + return "buttons/graphics/button_grey.png"; + break; + default: + return "buttons/graphics/button_purple.png"; + break; + } +} + +void ParentalGateView::digitButtonPressed(std::string digitName){ + if(currentIndex < 0 || currentIndex >= correctDigitSequence.size()){ + return; + } + + if(digitName == correctDigitSequence[currentIndex].text){ + if(currentIndex == correctDigitSequence.size()-1){ + currentIndex = -1; + _onSuccessCallback(); + } else { + ++currentIndex; + updateDigitsLabel(); + } + } else { + currentIndex = -1; + _onFailureCallback(); + } +} + +//private func scaleSelfToHeight() { +// let screenHeight = UIScreen.main.bounds.height +// if(screenHeight < windowHeightConstraint.constant){ +// let scale : CGFloat = screenHeight / windowHeightConstraint.constant; +// WOWScalingUtils.scaleAllDistances(inView: self.view, withScale: scale) +// WOWScalingUtils.scaleFonts(inView: self.view, withScale: scale) +// } else { +// WOWScalingUtils.ultimateScaleAllToIpadProDesign(inView: self.view) +// } +//} +// +//} diff --git a/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateView.h b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateView.h new file mode 100644 index 0000000..288395b --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/ParentalGateView.h @@ -0,0 +1,48 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2019-10-07. +// + +#ifndef PROJ_ANDROID_PARENTALGATEVIEW_H +#define PROJ_ANDROID_PARENTALGATEVIEW_H + +#include "cocos2d.h" +#include + +class ParentalGateView : public cocos2d::LayerColor { +public: + static ParentalGateView* create(float width, float height, std::function onSuccessCallback,std::function onFailureCallback); + virtual ~ParentalGateView(){} + +protected: + + struct KKTextDigit { + static const std::vector DigitNames; + int digit; + const char* text; + + KKTextDigit(int pDigit) { + assert(pDigit >= 0 && pDigit <= 9); + digit = pDigit; + text = DigitNames[digit]; + } + }; + + + std::function _onSuccessCallback; + std::function _onFailureCallback; + cocos2d::Label* digitsLabel; + std::vector correctDigitSequence; + int currentIndex; + + bool init(float width, float height, std::function onSuccessCallback,std::function onFailureCallback); + void setupAppearance(); + void setupLogic(); + std::vector generateTextDigits(int digitsCount); + std::string randomButtonBgImagePath(); + void highlightTextDigit(int atIndex); + void digitButtonPressed(std::string digitName); + void updateDigitsLabel(); +}; + + +#endif //PROJ_ANDROID_PARENTALGATEVIEW_H diff --git a/ios/Runner/Wowgame/Classes/CustomViews/SettingsLayer.cpp b/ios/Runner/Wowgame/Classes/CustomViews/SettingsLayer.cpp new file mode 100644 index 0000000..e82a04b --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/SettingsLayer.cpp @@ -0,0 +1,180 @@ +// +// SettingsLayer.cpp +// Steve and Maggie Halloween +// +// Created by Katarzyna Kalinowska-Górska on 06/10/2019. +// + +#include +#include "SettingsLayer.h" +#include "MiscUtils.h" +#include "ScalingUtils.h" +#include "Strings.h" +#include "SimpleButton.h" + +SettingsLayer* SettingsLayer::create(float width, float height, std::function onLevelPickedCallback){ + SettingsLayer * view = new (std::nothrow) SettingsLayer(); + if(view && view->init(width, height, onLevelPickedCallback)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool SettingsLayer::init(float width, float height, std::function onLevelPickedCallback){ + + if(!cocos2d::LayerColor::initWithColor(cocos2d::Color4B(0,0,0,230), width, height)){ + return false; + } + + _isPresentingParentalGate = false; + _onLevelPicked = onLevelPickedCallback; + + auto wholeContainer = cocos2d::Node::create(); + addChild(wholeContainer); + + auto upperStuffContainer = cocos2d::Node::create(); + wholeContainer->addChild(upperStuffContainer); + + auto paddingTop = 50*ScalingUtils::scaleAspectFillToDesignIpadProSize(); + + std::vector levelImagePaths = { "graphics/levels/level_1.png", "graphics/levels/level_2.png", "graphics/levels/level_3.png" }; + _levelPickerView = LevelPickerView::create(levelImagePaths, std::vector()); + upperStuffContainer->addChild(_levelPickerView); + _levelPickerView->addOnLevelChangedCallback([&](int pickedLevel){ + MiscUtils::saveLastLevel(pickedLevel); + _onLevelPicked(pickedLevel); + }); + _levelPickerView->selectLevelIndex((int)MiscUtils::lastLevel(), false); + + upperStuffContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + upperStuffContainer->setContentSize(_levelPickerView->getContentSize()); +// upperStuffContainer->setContentSize(cocos2d::Size(instructionLabel->getBoundingBox().size.width + lpPaddingLeft + _levelPickerView->getBoundingBox().size.width, _levelPickerView->getBoundingBox().size.height)); + upperStuffContainer->setPosition(width/2, height/2 + paddingTop); + + _levelPickerView->setAnchorPoint(cocos2d::Vec2(1, 0.5)); + _levelPickerView->setPosition(upperStuffContainer->getContentSize().width, upperStuffContainer->getContentSize().height/2); +// instructionLabel->setAnchorPoint(cocos2d::Vec2(0, 0.5)); +// instructionLabel->setPosition(0, _levelPickerView->getBoundingBox().getMidY()); + + auto lowerStuffContainer = cocos2d::Node::create(); + wholeContainer->addChild(lowerStuffContainer); + + auto menuItemColor = cocos2d::Color3B(140, 140, 140); + cocos2d::MenuItemFont::setFontSize(120*ScalingUtils::getScaleForFont()); //TODO MAGIC NUMBER +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + auto paddingBottom = 20*ScalingUtils::scaleAspectFillToDesignIpadProSize(); //TODO padding is a magicnumber scaling! + cocos2d::MenuItemFont::setFontName("ComicSansMS-Bold"); +#else + auto paddingBottom = 70*ScalingUtils::scaleAspectFillToDesignIpadProSize(); //TODO padding is a magicnumber scaling! + cocos2d::MenuItemFont::setFontName("fonts/ComicSansMSBold.ttf"); +#endif + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + setupAppLinksView(cocos2d::Point(getContentSize().width/2, upperStuffContainer->getBoundingBox().getMinY() - paddingBottom - paddingTop)); + wholeContainer->addChild(m_appLinksView); //TODO messy messy + auto leftAppLinkSprite = cocos2d::Sprite::create("app_links/witch_halloween_app.png"); + leftAppLinkSprite->setAnchorPoint(cocos2d::Vec2(1,1)); + leftAppLinkSprite->setPosition(cocos2d::Vec2(m_appLinksView->getBoundingBox().getMinX(), m_appLinksView->getBoundingBox().getMaxY())); + auto rightAppLinkSprite = cocos2d::Sprite::create("app_links/doll_toy_app.png"); + rightAppLinkSprite->setAnchorPoint(cocos2d::Vec2(0,0)); + rightAppLinkSprite->setPosition(cocos2d::Vec2(m_appLinksView->getBoundingBox().getMaxX(), m_appLinksView->getBoundingBox().getMinY())); + wholeContainer->addChild(leftAppLinkSprite); + wholeContainer->addChild(rightAppLinkSprite); +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + auto webLinkButton = SimpleButton::create(); + wholeContainer->addChild(webLinkButton); + auto buttonTexturePath = "app_links/steve_maggie.png"; + webLinkButton->loadTextures(buttonTexturePath, buttonTexturePath, buttonTexturePath); + webLinkButton->setPosition(cocos2d::Point(getContentSize().width/2, upperStuffContainer->getBoundingBox().getMinY() - paddingTop*3 - webLinkButton->getBoundingBox().size.height/2)); + webLinkButton->setOnTouchEndedCallback([&, webLinkButton](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + presentParentalGate([&](){ + hideParentalGate(); + cocos2d::Application::getInstance()->openURL("https://www.steveandmaggie.com"); //TODO hardcoded + }, [&](){ + hideParentalGate(); + }); + }); +#endif + + auto menuPadding = 30*ScalingUtils::scaleAspectFillToDesignIpadProSize();//TODO magic number + + auto menuItemAbout = cocos2d::MenuItemFont::create("Terms of Use", CC_CALLBACK_1(SettingsLayer::aboutMenuButtonTapped, this)); + auto menuItemPrivacyPolicy = cocos2d::MenuItemFont::create("Privacy Policy", CC_CALLBACK_1(SettingsLayer::privacyPolicyMenuButtonTapped, this)); + + auto menuCenter = cocos2d::Menu::create(menuItemAbout,menuItemPrivacyPolicy, NULL); + menuCenter->setContentSize(cocos2d::Size(MAX(menuItemAbout->getBoundingBox().size.width, menuItemPrivacyPolicy->getBoundingBox().size.width), menuItemAbout->getBoundingBox().size.height + menuItemPrivacyPolicy->getBoundingBox().size.height + 3*menuPadding)); + menuCenter->setColor(menuItemColor); + menuCenter->alignItemsVerticallyWithPadding(menuPadding); + lowerStuffContainer->addChild(menuCenter);//addChild(menuContainer, 3); + + lowerStuffContainer->setContentSize(cocos2d::Size(menuCenter->getContentSize().width, menuCenter->getBoundingBox().size.height)); + lowerStuffContainer->setAnchorPoint(cocos2d::Vec2(0.5, 1)); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + lowerStuffContainer->setPosition(getContentSize().width/2, m_appLinksView->getBoundingBox().getMinY() - paddingBottom); +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + lowerStuffContainer->setPosition(getContentSize().width/2, webLinkButton->getBoundingBox().getMinY() - paddingBottom); +#endif + + menuCenter->setPosition(lowerStuffContainer->getContentSize().width/2, lowerStuffContainer->getContentSize().height/2); + + wholeContainer->setContentSize(cocos2d::Size(getContentSize().width, upperStuffContainer->getContentSize().height + lowerStuffContainer->getContentSize().height + paddingBottom + paddingTop)); + wholeContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + wholeContainer->setPosition(width/2, height/2); + + wholeContainer->setCascadeOpacityEnabled(true); + upperStuffContainer->setCascadeOpacityEnabled(true); + lowerStuffContainer->setCascadeOpacityEnabled(true); + + return true; +} + +void SettingsLayer::prepareForShowing(){ + _levelPickerView->selectLevelIndex((int)(MiscUtils::lastLevel()), false); +} + +void SettingsLayer::aboutMenuButtonTapped(cocos2d::Ref* pSender){ + presentParentalGate([&](){ + hideParentalGate(); +// cocos2d::Application::getInstance()->openURL(Strings::LINK_TERMS_OF_SERVICE); + cocos2d::Application::getInstance()->openURL("https://www.wattsenglish.com/steve-and-maggie-halloween/terms-of-use.html"); + }, [&](){ + hideParentalGate(); + }); +} + +void SettingsLayer::privacyPolicyMenuButtonTapped(cocos2d::Ref* pSender){ + presentParentalGate([&](){ + hideParentalGate(); +// cocos2d::Application::getInstance()->openURL(Strings::LINK_PRIVACY_POLICY); + cocos2d::Application::getInstance()->openURL("https://www.wattsenglish.com/steve-and-maggie-halloween/principles-of-personal-data-processing.html"); + }, [&](){ + hideParentalGate(); + }); +} + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +void SettingsLayer::setupAppLinksView(const cocos2d::Point& position){ + // TODO remove hard-code and add loading from a settings json file maybe + auto contentScaleF = ScalingUtils::getAdjustedContentScaleFactor(); +//#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +// static std::vector apps { +// {"app_links/app_link_halloween.png", "com.wattsenglish.halloweengameapp"}, +// {"app_links/app_link_toy.png", "com.wattsenglish.toyapp"} +// }; + + static std::vector apps { + {"app_links/app_link_halloween.png", "id1482385753"}, + {"app_links/app_link_toy.png", "id1496563219"} + }; + + m_appLinksView = AppLinksView::create(apps, this); + m_appLinksView->setAnchorPoint(cocos2d::Vec2(0.5, 1)); + m_appLinksView->setPosition(position); +} +#endif + + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/SettingsLayer.h b/ios/Runner/Wowgame/Classes/CustomViews/SettingsLayer.h new file mode 100644 index 0000000..26ae166 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/SettingsLayer.h @@ -0,0 +1,40 @@ +// +// SettingsLayer.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 06/10/2019. +// + +#ifndef SettingsLayer_h +#define SettingsLayer_h + +#include "cocos2d.h" +#include "LevelPickerView.h" +#include "ParentalGateShowInterface.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#include "AppLinksView.h" +#endif + +class SettingsLayer : public cocos2d::LayerColor, public ParentalGateShowInterface { + +public: + static SettingsLayer* create(float width, float height, std::function onLevelPickedCallback); + void prepareForShowing(); + +protected: + LevelPickerView* _levelPickerView; + std::function _onLevelPicked; + + bool init(float width, float height, std::function onLevelPickedCallback); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + AppLinksView* m_appLinksView; + void setupAppLinksView(const cocos2d::Point& position); +#endif + + virtual void aboutMenuButtonTapped(cocos2d::Ref* pSender); + virtual void privacyPolicyMenuButtonTapped(cocos2d::Ref* pSender); +}; + +#endif /* SettingsLayer_h */ + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/TOSAcceptPopupView.cpp b/ios/Runner/Wowgame/Classes/CustomViews/TOSAcceptPopupView.cpp new file mode 100644 index 0000000..7dbfcc0 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/TOSAcceptPopupView.cpp @@ -0,0 +1,102 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2019-10-14. +// + +#include "TOSAcceptPopupView.h" +#include "TouchInterceptingLayer.h" +#include "SimpleButton.h" +#include "ScalingUtils.h" +#include "ParentalGateView.h" +#include "MiscUtils.h" +#include "Strings.h" +#include + +TOSAcceptPopupView * TOSAcceptPopupView::create(std::function onAcceptCallback){ + TOSAcceptPopupView * view = new (std::nothrow) TOSAcceptPopupView(); + + if(view && view->init(onAcceptCallback)) + { + view->autorelease(); + return view; + } + CC_SAFE_DELETE(view); + return nullptr; +} + +bool TOSAcceptPopupView::init(std::function onAcceptCallback){ + if(!cocos2d::LayerColor::initWithColor(cocos2d::Color4B(0, 0, 0, 220))){ + return false; + } + + _onAcceptCallback = onAcceptCallback; + setupAppearance(); + + return true; +} + +void TOSAcceptPopupView::setupAppearance(){ + auto popup = cocos2d::Sprite::create("graphics/tos_popup/accept_popup.png"); //TODO hard-coded stirng + auto wholeSize = cocos2d::Director::getInstance()->getWinSize(); + setContentSize(wholeSize); + addChild(popup); + popup->setPosition(cocos2d::Vec2(wholeSize.width/2, wholeSize.height/2)); + + auto menuItemColor = cocos2d::Color3B(40, 80, 160); + cocos2d::MenuItemFont::setFontSize(120*ScalingUtils::getScaleForFont()); //TODO MAGIC NUMBER +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + cocos2d::MenuItemFont::setFontName("ComicSansMS-Bold"); +#else + cocos2d::MenuItemFont::setFontName("fonts/ComicSansMSBold.ttf"); +#endif + +// auto paddingBottom = 40*ScalingUtils::scaleAspectFillToDesignIpadProSize(); + auto menuPadding = 40*ScalingUtils::scaleAspectFillToDesignIpadProSize();//TODO magic number + auto menuItemAbout = cocos2d::MenuItemFont::create("Terms of Use", CC_CALLBACK_1(TOSAcceptPopupView::aboutMenuButtonTapped, this)); + auto menuItemPrivacyPolicy = cocos2d::MenuItemFont::create("Privacy Policy", CC_CALLBACK_1(TOSAcceptPopupView::privacyPolicyMenuButtonTapped, this)); + auto menuCenter = cocos2d::Menu::create(menuItemAbout,menuItemPrivacyPolicy, NULL); + menuCenter->setContentSize(cocos2d::Size(MAX(menuItemAbout->getBoundingBox().size.width, menuItemPrivacyPolicy->getBoundingBox().size.width), menuItemAbout->getBoundingBox().size.height + menuItemPrivacyPolicy->getBoundingBox().size.height + 3*menuPadding)); + menuCenter->setColor(menuItemColor); + menuCenter->alignItemsVerticallyWithPadding(menuPadding); + addChild(menuCenter); + auto menuPaddingLEft = 60*ScalingUtils::scaleAspectFillToDesignIpadProSize();//TODO magic number; //mod for food app menu + menuCenter->setPosition(wholeSize.width/2 + menuPaddingLEft, wholeSize.height/2); + + auto buttonAccept = SimpleButton::create(); + auto acceptButtonTexturePath = "graphics/tos_popup/accept_button.png"; + buttonAccept->loadTextures(acceptButtonTexturePath, acceptButtonTexturePath, acceptButtonTexturePath); + addChild(buttonAccept); + buttonAccept->setAnchorPoint(cocos2d::Vec2(0.5, 1)); + buttonAccept->cocos2d::Node::setPosition(wholeSize.width/2+menuPaddingLEft, menuCenter->getPositionY() - menuCenter->getContentSize().height/2 - menuPadding); + buttonAccept->setOnTouchEndedCallback([&](std::string name, cocos2d::ui::Widget::TouchEventType eventType){ + _onAcceptCallback(); + MiscUtils::hideAndRemoveView(this, true); +// presentParentalGate([&](){ +// hideParentalGate(); +// _onAcceptCallback(); +// MiscUtils::hideAndRemoveView(this, true); +// }, [&](){ +// hideParentalGate(); +// }); + }); +} + +void TOSAcceptPopupView::aboutMenuButtonTapped(cocos2d::Ref* pSender){ + presentParentalGate([&](){ + hideParentalGate(); + //cocos2d::Application::getInstance()->openURL(Strings::LINK_TERMS_OF_SERVICE); + cocos2d::Application::getInstance()->openURL("https://www.wattsenglish.com/steve-and-maggie-halloween/terms-of-use.html"); + }, [&](){ + hideParentalGate(); + }); +} + +void TOSAcceptPopupView::privacyPolicyMenuButtonTapped(cocos2d::Ref* pSender){ + presentParentalGate([&](){ + hideParentalGate(); + cocos2d::Application::getInstance()->openURL("https://www.wattsenglish.com/steve-and-maggie-halloween/principles-of-personal-data-processing.html"); +// cocos2d::Application::getInstance()->openURL(Strings::LINK_PRIVACY_POLICY); + }, [&](){ + hideParentalGate(); + }); +} + diff --git a/ios/Runner/Wowgame/Classes/CustomViews/TOSAcceptPopupView.h b/ios/Runner/Wowgame/Classes/CustomViews/TOSAcceptPopupView.h new file mode 100644 index 0000000..2263e20 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/CustomViews/TOSAcceptPopupView.h @@ -0,0 +1,27 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2019-10-14. +// + +#ifndef PROJ_ANDROID_TOSACCEPTPOPUPVIEW_H +#define PROJ_ANDROID_TOSACCEPTPOPUPVIEW_H + +#include "cocos2d.h" +//#include "TouchInterceptingLayer.h" +#include "ParentalGateShowInterface.h" + +class TOSAcceptPopupView : public cocos2d::LayerColor, public ParentalGateShowInterface { + +public: + static TOSAcceptPopupView * create(std::function onAcceptCallback);; + +protected: + std::function _onAcceptCallback; + + virtual bool init(std::function onAcceptCallback); + virtual void setupAppearance(); + virtual void aboutMenuButtonTapped(cocos2d::Ref* pSender); + virtual void privacyPolicyMenuButtonTapped(cocos2d::Ref* pSender); +}; + + +#endif //PROJ_ANDROID_TOSACCEPTPOPUPVIEW_H diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/ChangingSprite.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/ChangingSprite.cpp new file mode 100644 index 0000000..6d9ec4b --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/ChangingSprite.cpp @@ -0,0 +1,73 @@ +// +// ChangingSprite.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "ChangingSprite.h" + +ChangingSprite* ChangingSprite::createWithSpritePaths(std::string firstSpritePath, std::string secondSpritePath) +{ + ChangingSprite * sprite = new (std::nothrow) ChangingSprite(); + if(sprite && sprite->initWithSpritePaths(firstSpritePath, secondSpritePath)) + { + sprite->autorelease(); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + +bool ChangingSprite::initWithSpritePaths(std::string firstSpritePath, std::string secondSpritePath) +{ + if(!PlainNode::init()){ + return false; + } + + this->_firstSpritePath = firstSpritePath; + this->_secondSpritePath = secondSpritePath; + + this->_firstSprite = cocos2d::Sprite::create(this->_firstSpritePath); + this->_secondSprite = cocos2d::Sprite::create(this->_secondSpritePath); + + return true; +} + +void ChangingSprite::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + width = this->_firstSprite->getBoundingBox().size.width; + height = this->_firstSprite->getBoundingBox().size.height; +} + +void ChangingSprite::onEnter() +{ + PlainNode::onEnter(); + this->addChild(this->_firstSprite); + this->addChild(this->_secondSprite); + + auto firstSpriteWidth = this->_firstSprite->getBoundingBox().size.width; + auto firstSpriteHeight = this->_firstSprite->getBoundingBox().size.height; + + auto size = cocos2d::Size(firstSpriteWidth, firstSpriteHeight); + this->setContentSize(size); + + this->_firstSprite->setPosition(cocos2d::Point(firstSpriteWidth/2, firstSpriteHeight/2)); + this->_secondSprite->setPosition(this->_firstSprite->getPosition()); + + this->_secondSprite->setOpacity(0); +} + +void ChangingSprite::switchSprites() +{ + if(this->_secondSprite->getOpacity() == 0){ + this->_firstSprite->setOpacity(0); + this->_secondSprite->setOpacity(255); + } else { + this->_firstSprite->setOpacity(255); + this->_secondSprite->setOpacity(0); + } +} + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/ChangingSprite.h b/ios/Runner/Wowgame/Classes/LayoutObjects/ChangingSprite.h new file mode 100644 index 0000000..05b856f --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/ChangingSprite.h @@ -0,0 +1,33 @@ +// +// ChangingSprite.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef ChangingSprite_h +#define ChangingSprite_h + +#include "PlainNode.h" + +class ChangingSprite : public PlainNode +{ + public: + + static ChangingSprite* createWithSpritePaths(std::string firstSpritePath, std::string secondSpritePath); + virtual bool initWithSpritePaths(std::string firstSpritePath, std::string secondSpritePath); + virtual void onEnter() override; + + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + + virtual void switchSprites(); + + protected: + std::string _firstSpritePath; + std::string _secondSpritePath; + cocos2d::Sprite* _firstSprite; + cocos2d::Sprite* _secondSprite; +}; + +#endif /* ChangingSprite_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/ContainerSprite.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/ContainerSprite.cpp new file mode 100644 index 0000000..18a39ef --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/ContainerSprite.cpp @@ -0,0 +1,71 @@ +// +// ContainerSprite.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "ContainerSprite.h" + +ContainerSprite* ContainerSprite::createWithContainerSpritePath(std::string containerSpritePath) +{ + ContainerSprite * sprite = new (std::nothrow) ContainerSprite(); + if(sprite && sprite->initWithContainerSpritePath(containerSpritePath)) + { + sprite->autorelease(); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + +bool ContainerSprite::initWithContainerSpritePath(std::string containerSpritePath) +{ + if(!PlainNode::init()){ + return false; + } + + this->_containerSpritePath = containerSpritePath; + this->_containerSprite = cocos2d::Sprite::create(this->_containerSpritePath); + this->addChild(this->_containerSprite); + this->setContentSize(_containerSprite->getBoundingBox().size); + + _containerSprite->setPosition(cocos2d::Point(_containerSprite->getBoundingBox().size.width/2, _containerSprite->getBoundingBox().size.height/2)); + + return true; +} + +void ContainerSprite::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + width = this->_containerSprite->getBoundingBox().size.width; + height = this->_containerSprite->getBoundingBox().size.height; +} + +//void ContainerSprite::onEnter() +//{ +// PlainNode::onEnter(); +//} + +void ContainerSprite::addContentNode(cocos2d::Node* contentNode) +{ + if(_contentNode != nullptr){ + _contentNode->removeFromParent(); + } + _contentNode = contentNode; + if(_contentNode != nullptr){ + _contentNode->retain(); + _contentNode->removeFromParent(); + addChild(_contentNode); + _contentNode->release(); + //TODO absolutely get rid of the magic numbers!!!! 0.8, 2/3 + _contentNode->setScale(MIN(_containerSprite->getBoundingBox().size.width/_contentNode->getBoundingBox().size.width, _containerSprite->getBoundingBox().size.height/_contentNode->getBoundingBox().size.height)*0.8f); + + _contentNode->setPosition(cocos2d::Point(_containerSprite->getBoundingBox().size.width/2, _containerSprite->getBoundingBox().size.height*2/3)); + reorderChild(_contentNode, 0); + reorderChild(_containerSprite, 1); + + } +} + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/ContainerSprite.h b/ios/Runner/Wowgame/Classes/LayoutObjects/ContainerSprite.h new file mode 100644 index 0000000..8445cf2 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/ContainerSprite.h @@ -0,0 +1,33 @@ +// +// ContainerSprite.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef ContainerSprite_h +#define ContainerSprite_h + +#include "PlainNode.h" + +class ContainerSprite : public PlainNode +{ + public: + + static ContainerSprite* createWithContainerSpritePath(std::string containerSpritePath); + virtual bool initWithContainerSpritePath(std::string containerSpritePath); +// virtual void onEnter() override; + + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + + virtual void addContentNode(cocos2d::Node* contentNode); + bool hasContent() { return _contentNode != nullptr; } + + protected: + std::string _containerSpritePath; + cocos2d::Sprite* _containerSprite; + cocos2d::Node* _contentNode; +}; + +#endif /* ContainerSprite_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/PlainLabel.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainLabel.cpp new file mode 100644 index 0000000..0b0ee96 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainLabel.cpp @@ -0,0 +1,139 @@ +// +// PlainLabel.cpp +// WattsenglishToyApp-mobile +// +// Created by Katarzyna Kalinowska-Górska on 19/11/2019. +// + +#include +#include "PlainLabel.h" +#include "ScalingUtils.h" +#include "JSONParseUtils.h" + +PlainLabel* PlainLabel::create(const std::string& text, const std::string fontPath, int fontBaseSize) +{ + PlainLabel * label = new (std::nothrow) PlainLabel(); + if(label && label->init(text, fontPath, fontBaseSize)) + { + label->autorelease(); + return label; + } + CC_SAFE_DELETE(label); + return nullptr; +} + +bool PlainLabel::init(const std::string& text, const std::string fontPath, int fontBaseSize){ + if(!cocos2d::Label::initWithTTF(text, fontPath, fontBaseSize*ScalingUtils::getScaleForFont())){ //120 + return false; + } + return true; +} + +void PlainLabel::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + this->loadCommonPropertiesFromJSON(jsonValue); + if(JSONParseUtils::hasMemberColor3B(jsonValue, "colour")){ + setColor(JSONParseUtils::getColor3B(jsonValue["colour"])); + } +} + +void PlainLabel::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + width = this->getBoundingBox().size.width; + height = this->getBoundingBox().size.height; +// width = this->getContentSize().width; +// height = this->getContentSize().height; +} + +void PlainLabel::setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) +{ + if(propertyName == "opacity"){ + auto value = newValue.GetInt(); + this->setOpacity(value); + } +} + +void PlainLabel::callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback) +{ + LayoutObject::callFunctionByName(methodName, arguments, parseDelegate); +// auto scale = 1/cocos2d::Director::getInstance()->getContentScaleFactor(); + +// if(methodName == "setVisible"){ +// if((*arguments).IsArray()){ +// this->setVisible((*arguments).GetArray()[0].GetBool()); +// } +// } +// else if(methodName == "setFlippedX"){ +// if((*arguments).IsArray()){ +// this->setFlippedX((*arguments).GetArray()[0].GetBool()); +// } +// } +// else if(methodName == "setFlippedY"){ +// if((*arguments).IsArray()){ +// this->setFlippedY((*arguments).GetArray()[0].GetBool()); +// } +// } +// else if (methodName == "setScale"){ +// if((*arguments).IsArray()){ +// this->setScale((*arguments).GetArray()[0].GetFloat(), (*arguments).GetArray()[0].GetFloat()); +// } +// } +// else if(methodName == "setOpacity"){ +// if((*arguments).IsArray()){ +// this->setOpacity((*arguments).GetArray()[0].GetInt()); +// } +// } +// else if(methodName == "setPositionX"){ +// if((*arguments).IsArray()){ +// this->setPositionX((*arguments).GetArray()[0].GetFloat()*scale); +// } +// } +// else if(methodName == "setPositionY"){ +// if((*arguments).IsArray()){ +// this->setPositionY((*arguments).GetArray()[0].GetFloat()*scale); +// } +// } +// else if(methodName == "setPosition"){ +// if((*arguments).IsArray()){ +// auto point = JSONParseUtils::getPoint((*arguments).GetArray()[0]); +// MathUtils::multiplyPoint(point, scale); +// this->setPosition(point); +// } +// } +// else if(methodName == "setTextureRect"){ +// if((*arguments).IsArray()){ +// auto newRect = JSONParseUtils::getRect((*arguments).GetArray()[0]); +// MathUtils::multiplyRectPosition(newRect, scale); +// this->setTextureRect(newRect); +// } +// } +// else if(methodName == "setContentSize"){ +// if((*arguments).IsArray()){ +// this->setContentSize(JSONParseUtils::getSize((*arguments).GetArray()[0])); +// } +// } +// else if(methodName == "setRotation"){ +// if((*arguments).IsArray()){ +// this->setRotation(((*arguments).GetArray()[0]).GetFloat()); +// } +// } +// else if(methodName == "clipSprite"){ +// if((*arguments).IsArray()){ +// auto by = JSONParseUtils::getPoint((*arguments)[0]); +// auto prevTextureRect = this->getTextureRect(); +// this->setTextureRect(cocos2d::Rect(prevTextureRect.origin.x - by.x, prevTextureRect.origin.y - by.y, prevTextureRect.size.width, prevTextureRect.size.height)); +// } +// } +// else if(methodName == "stopAnimations"){ +// this->stopAllActions(); +// } +// else if(methodName == "setPicture"){ +// if((*arguments).IsArray()){ +// std::string imagePath = ((*arguments).GetArray()[0]).GetString(); +// auto texture = cocos2d::Director::getInstance()->getTextureCache()->addImage(imagePath); +// this->setTexture(texture); +// this->setTextureRect(cocos2d::Rect(cocos2d::Point::ZERO, texture->getContentSize())); +// } +// } +} + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/PlainLabel.h b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainLabel.h new file mode 100644 index 0000000..06f1f32 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainLabel.h @@ -0,0 +1,31 @@ +// +// PlainLabel.h +// WattsenglishToyApp +// +// Created by Katarzyna Kalinowska-Górska on 19/11/2019. +// + +#ifndef PlainLabel_h +#define PlainLabel_h + +#include "cocos2d.h" +#include "LayoutObject.h" + +class PlainLabel : public cocos2d::Label, public LayoutObject +{ + public: + + static PlainLabel* create(const std::string& text, const std::string fontPath, int fontBaseSize); + + virtual bool init(const std::string& text, const std::string fontPath, int fontBaseSize); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + + // ScenarioObject + + virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) override; + virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}) override; +}; + +#endif /* PlainLabel_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/PlainNode.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainNode.cpp new file mode 100644 index 0000000..e1a76c0 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainNode.cpp @@ -0,0 +1,54 @@ +// +// PlainNode.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "PlainNode.h" +#include "JSONParseUtils.h" +#include "ScalingUtils.h" + +PlainNode* PlainNode::create() +{ + PlainNode * node = new (std::nothrow) PlainNode(); + if(node && node->init()) + { + node->autorelease(); + return node; + } + CC_SAFE_DELETE(node); + return nullptr; +} + +PlainNode* PlainNode::createWithColour(cocos2d::Color4B color){ + auto node = create(); + if(node != nullptr){ + node->_backgroundLayer = cocos2d::LayerColor::create(color); + node->_backgroundLayer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + node->_backgroundLayer->setContentSize(node->getContentSize()); + node->_backgroundLayer->setPosition(cocos2d::Vec2(node->getContentSize().width/2, node->getContentSize().height/2)); + node->addChild(node->_backgroundLayer); + } + return node; +} + +void PlainNode::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + this->setAnchorPoint(cocos2d::Point(0.5, 0.5)); + this->loadCommonPropertiesFromJSON(jsonValue); + if(JSONParseUtils::hasMemberBool(jsonValue, "adjustContentSizeForSmallDevices") && ScalingUtils::isSmallDevice()){ + auto scale = ScalingUtils::getScaleForSmallDevice(); + setContentSize(this->getContentSize()*scale);//,this->getContentSize().height*scale); + } +} + +void PlainNode::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + width = this->getContentSize().width; + height = this->getContentSize().height; +} + + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/PlainNode.h b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainNode.h new file mode 100644 index 0000000..709c79f --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainNode.h @@ -0,0 +1,39 @@ +// +// PlainNode.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef PlainNode_h +#define PlainNode_h + +#include "cocos2d.h" +#include "LayoutObject.h" +#include "LayoutParser.h" + +class PlainNode : public cocos2d::Node, public LayoutObject +{ + public: + + static PlainNode* create(); + static PlainNode* createWithColour(cocos2d::Color4B color); +// virtual bool init() override; + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + + virtual void setContentSize(const cocos2d::Size& contentSize) override { + cocos2d::Node::setContentSize(contentSize); + if(_backgroundLayer != nullptr){ + _backgroundLayer->setContentSize(contentSize); + _backgroundLayer->setPosition(cocos2d::Vec2(contentSize.width/2, contentSize.height/2)); + } + } + +protected: + cocos2d::LayerColor* _backgroundLayer; +}; + +#endif /* PlainNode_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/PlainSprite.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainSprite.cpp new file mode 100644 index 0000000..c1f3f6d --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainSprite.cpp @@ -0,0 +1,178 @@ +// +// PlainSprite.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "PlainSprite.h" +#include "JSONParseUtils.h" +#include "cocos2d.h" +#include "MathUtils.h" +#include "ScalingUtils.h" + +PlainSprite* PlainSprite::createWithTexture(cocos2d::Texture2D* texture) +{ + PlainSprite * sprite = new (std::nothrow) PlainSprite(); + if(sprite && sprite->initWithTexture(texture)) + { + sprite->autorelease(); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + + +PlainSprite* PlainSprite::createWithSpritePath(std::string spritePath) +{ + PlainSprite * sprite = new (std::nothrow) PlainSprite(); + if(sprite && sprite->initWithFile(spritePath)) + { + sprite->autorelease(); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + +void PlainSprite::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + this->loadCommonPropertiesFromJSON(jsonValue); + + if(jsonValue.HasMember("flippedX")){ + const auto& flippedXJSON = jsonValue["flippedX"]; + this->setFlippedX(flippedXJSON.GetBool()); + } + + if(jsonValue.HasMember("flippedY")){ + const auto& flippedYJSON = jsonValue["flippedY"]; + this->setFlippedY(flippedYJSON.GetBool()); + } + + if(jsonValue.HasMember("color")){ + const auto& color = jsonValue["color"]; + float r = color["r"].GetFloat(); + float g = color["g"].GetFloat(); + float b = color["b"].GetFloat(); + this->setColor(cocos2d::Color3B(r,g,b)); + } + +} + +void PlainSprite::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + width = this->getBoundingBox().size.width; + height = this->getBoundingBox().size.height; +// width = this->getContentSize().width; +// height = this->getContentSize().height; +} + +void PlainSprite::setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) +{ + if(propertyName == "opacity"){ + auto value = newValue.GetInt(); + this->setOpacity(value); + } + else if(propertyName == "rotation"){ + auto value = newValue.GetFloat(); + this->setRotation(value); + } +} + +void PlainSprite::callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback) +{ + auto scale = 1/ScalingUtils::getAdjustedContentScaleFactor(); + + if(methodName == "setVisible"){ + if((*arguments).IsArray()){ + this->setVisible((*arguments).GetArray()[0].GetBool()); + } + } + else if(methodName == "setFlippedX"){ + if((*arguments).IsArray()){ + this->setFlippedX((*arguments).GetArray()[0].GetBool()); + } + } + else if(methodName == "setFlippedY"){ + if((*arguments).IsArray()){ + this->setFlippedY((*arguments).GetArray()[0].GetBool()); + } + } + else if (methodName == "setScale"){ + if((*arguments).IsArray()){ + this->setScale((*arguments).GetArray()[0].GetFloat(), (*arguments).GetArray()[0].GetFloat()); + } + } + else if(methodName == "setOpacity"){ + if((*arguments).IsArray()){ + this->setOpacity((*arguments).GetArray()[0].GetInt()); + } + } + else if(methodName == "setPositionX"){ + if((*arguments).IsArray()){ + this->setPositionX((*arguments).GetArray()[0].GetFloat()*scale); + } + } + else if(methodName == "setPositionY"){ + if((*arguments).IsArray()){ + this->setPositionY((*arguments).GetArray()[0].GetFloat()*scale); + } + } + else if(methodName == "setPosition"){ + if((*arguments).IsArray()){ + auto point = JSONParseUtils::getPoint((*arguments).GetArray()[0]); + MathUtils::multiplyPoint(point, scale); + this->setPosition(point); + } + } + else if(methodName == "resetPosition"){ + this->setPosition(originalPosition); + } +// else if(methodName == "setPositionFromCenter"){ +// if((*arguments).IsArray()){ +// auto point = JSONParseUtils::getPoint((*arguments).GetArray()[0]); +// MathUtils::multiplyPoint(point, scale); +// auto parentSize = getParent()->getBoundingBox().size; +// this->setPosition(point.x + parentSize.width/2, point.y + parentSize.height/2); +// } +// } + else if(methodName == "setTextureRect"){ + if((*arguments).IsArray()){ + auto newRect = JSONParseUtils::getRect((*arguments).GetArray()[0]); + MathUtils::multiplyRectPosition(newRect, scale); + this->setTextureRect(newRect); + } + } + else if(methodName == "setContentSize"){ + if((*arguments).IsArray()){ + this->setContentSize(JSONParseUtils::getSize((*arguments).GetArray()[0])); + } + } + else if(methodName == "setRotation"){ + if((*arguments).IsArray()){ + this->setRotation(((*arguments).GetArray()[0]).GetFloat()); + } + } + else if(methodName == "clipSprite"){ + if((*arguments).IsArray()){ + auto by = JSONParseUtils::getPoint((*arguments)[0]); + auto prevTextureRect = this->getTextureRect(); + this->setTextureRect(cocos2d::Rect(prevTextureRect.origin.x - by.x, prevTextureRect.origin.y - by.y, prevTextureRect.size.width, prevTextureRect.size.height)); + } + } + else if(methodName == "stopAnimations"){ + this->stopAllActions(); + } + else if(methodName == "setPicture"){ + if((*arguments).IsArray()){ + std::string imagePath = ((*arguments).GetArray()[0]).GetString(); + auto texture = cocos2d::Director::getInstance()->getTextureCache()->addImage(imagePath); + this->setTexture(texture); + this->setTextureRect(cocos2d::Rect(cocos2d::Point::ZERO, texture->getContentSize())); + } + } +} + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/PlainSprite.h b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainSprite.h new file mode 100644 index 0000000..34ea864 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/PlainSprite.h @@ -0,0 +1,31 @@ +// +// PlainSprite.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef PlainSprite_h +#define PlainSprite_h + +#include "LayoutObject.h" +#include "LayoutParser.h" + +class PlainSprite : public cocos2d::Sprite, public LayoutObject +{ + public: + + static PlainSprite* createWithSpritePath(std::string spritePath); + static PlainSprite* createWithTexture(cocos2d::Texture2D* texture); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + + // ScenarioObject + + virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) override; + virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}) override; +}; + +#endif /* PlainSprite_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/ProgressSliderNode.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/ProgressSliderNode.cpp new file mode 100644 index 0000000..122d314 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/ProgressSliderNode.cpp @@ -0,0 +1,144 @@ +// +// TimeSliderNode.cpp +// WattsenglishToyApp-mobile +// +// Created by Katarzyna Kalinowska-Górska on 27/12/2019. +// + +#include "ProgressSliderNode.h" + + +ProgressSliderNode* ProgressSliderNode::create(const std::string& sliderImageFilePath, const std::string& thumbImageFilePath, float minVal, float maxVal, ProgressSliderNodeOrientation p_orientation) +{ + ProgressSliderNode * node = new (std::nothrow) ProgressSliderNode(); + if(node && node->init(sliderImageFilePath, thumbImageFilePath, minVal, maxVal, p_orientation)) + { + node->autorelease(); + return node; + } + CC_SAFE_DELETE(node); + return nullptr; +} + +bool ProgressSliderNode::init(const std::string& sliderImageFilePath, const std::string& thumbImageFilePath, float minVal, float maxVal, ProgressSliderNodeOrientation p_orientation){ + if(!cocos2d::Node::init()){ + return false; + } + + m_orientation = p_orientation; + + if(sliderImageFilePath != ""){ + _sliderSprite = cocos2d::Sprite::create(sliderImageFilePath); + addChild(_sliderSprite); + _sliderSprite->setPosition(cocos2d::Vec2(_sliderSprite->getContentSize().width/2, _sliderSprite->getContentSize().height/2)); + setContentSize(_sliderSprite->getBoundingBox().size); + } + _thumbSprite = cocos2d::Sprite::create(thumbImageFilePath); + addChild(_thumbSprite); + adjustThumbSpritePosition(); + + setCascadeOpacityEnabled(true); + + _minValue = minVal; + _maxValue = maxVal; + _currentValue = minVal; + + return true; +} + +void ProgressSliderNode::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + this->loadCommonPropertiesFromJSON(jsonValue); + if(JSONParseUtils::hasMemberColor3B(jsonValue, "colour")){ + setColor(JSONParseUtils::getColor3B(jsonValue["colour"])); + } +} + +void ProgressSliderNode::setContentSize(const cocos2d::Size& contentSize){ + cocos2d::Node::setContentSize(contentSize); + adjustThumbSpritePosition(); +} + +void ProgressSliderNode::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + if(_sliderSprite != nullptr){ + width = _sliderSprite->getBoundingBox().size.width; + height = _sliderSprite->getBoundingBox().size.height; + } else { + width = this->getContentSize().width; + height = this->getContentSize().height; + } +} + +void ProgressSliderNode::adjustThumbSpritePosition(){ + if(m_orientation == ProgressSliderNodeOrientationVertical){ + _thumbSprite->setPosition(cocos2d::Vec2(getContentSize().width/2, _thumbSprite->getContentSize().height/2)); + } else { + _thumbSprite->setPosition(cocos2d::Vec2(_thumbSprite->getContentSize().width/2, getContentSize().height/2)); + } + updateProgressUI(_currentValue); +} + +void ProgressSliderNode::setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) +{ + if(propertyName == "opacity"){ + auto value = newValue.GetInt(); + this->setOpacity(value); + } +} + +void ProgressSliderNode::callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback) +{ + LayoutObject::callFunctionByName(methodName, arguments, parseDelegate); +} + +void ProgressSliderNode::setProgressFrac(float progressFrac) { + float progress = progressFrac*_maxValue; + setProgress(progress); +} + +void ProgressSliderNode::setProgress(float progress) { + float newValue = MIN((MAX(progress, _minValue)),_maxValue); + _currentValue = newValue; + updateProgressUI(newValue); +} + +void ProgressSliderNode::updateProgressUI(float value, bool animated){ +// 0 - _minValue +// contentSize().width - thumbWidht/2 - _maxValue + + float newThumbPosition; + if(m_orientation == ProgressSliderNodeOrientationVertical){ + newThumbPosition = (getContentSize().height - _thumbSprite->getContentSize().height/2)*value/(_maxValue-_minValue) - _thumbSprite->getContentSize().height/2; + _thumbSprite->setPositionY(newThumbPosition); + } else { + newThumbPosition = (getContentSize().width - _thumbSprite->getContentSize().width/2)*value/(_maxValue-_minValue) + _thumbSprite->getContentSize().width/2; + _thumbSprite->setPositionX(newThumbPosition); + } + + +} + +void ProgressSliderNode::startTimeAnimation(float timeDuration){ + cocos2d::Point finalPoint; + if(m_orientation == ProgressSliderNodeOrientationVertical){ + finalPoint = cocos2d::Point(_thumbSprite->getPositionX(), getContentSize().height + _thumbSprite->getContentSize().height/2); + } else { + finalPoint = cocos2d::Point(getContentSize().width - _thumbSprite->getContentSize().width/2, _thumbSprite->getPositionY()); + } + + _thumbSprite->runAction(cocos2d::MoveTo::create(timeDuration, finalPoint)); +// _thumbSprite->runAction(cocos2d::RepeatForever::create(cocos2d::RotateBy::create(timeDuration/(getContentSize().width-_thumbSprite->getContentSize().width - _thumbSprite->getPositionX())*(_thumbSprite->getContentSize().width*3.14), 360))); +} + +void ProgressSliderNode::pauseTimeAnimation(){ + _thumbSprite->pause(); +} + +void ProgressSliderNode::resumeTimeAnimation(){ + _thumbSprite->resume(); +} + +void ProgressSliderNode::stopTimeAnimation(){ + _thumbSprite->stopAllActions(); +} diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/ProgressSliderNode.h b/ios/Runner/Wowgame/Classes/LayoutObjects/ProgressSliderNode.h new file mode 100644 index 0000000..b01bfd1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/ProgressSliderNode.h @@ -0,0 +1,62 @@ +// +// TimeSliderNode.h +// WattsenglishToyApp +// +// Created by Katarzyna Kalinowska-Górska on 27/12/2019. +// + +#ifndef ProgressSliderNode_h +#define ProgressSliderNode_h + +#include "cocos2d.h" +#include "LayoutObject.h" +#include "TimeIndicatorInterface.h" + +using ProgressSliderNodeOrientation = int; +static constexpr ProgressSliderNodeOrientation ProgressSliderNodeOrientationHorizontal {0}; +static constexpr ProgressSliderNodeOrientation ProgressSliderNodeOrientationVertical {1}; + +class ProgressSliderNode : public cocos2d::Node, public LayoutObject, public TimeIndicatorInterface +{ + public: + + static ProgressSliderNode* create(const std::string& sliderImageFilePath, const std::string& thumbImageFilePath, float minVal, float maxVal, ProgressSliderNodeOrientation p_orientation); + + virtual bool init(const std::string& sliderImageFilePath, const std::string& thumbImageFilePath, float minVal, float maxVal, ProgressSliderNodeOrientation p_orientations); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + + // ScenarioObject + + virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) override; + virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}) override; + + // slider's own methods + + virtual void setProgressFrac(float progressFrac) override; + virtual void setProgress(float progress) override; + virtual float currentProgress() { return _currentValue;}; + virtual void startTimeAnimation(float timeDuration) override; + virtual void pauseTimeAnimation() override; + virtual void resumeTimeAnimation() override; + virtual void pause() override { pauseTimeAnimation(); } + virtual void resume() override { resumeTimeAnimation(); } + virtual void stopTimeAnimation() override; + virtual void setContentSize(const cocos2d::Size& contentSize) override; + + +protected: + cocos2d::Sprite* _sliderSprite; + cocos2d::Sprite* _thumbSprite; + + float _minValue; + float _maxValue; + float _currentValue; + ProgressSliderNodeOrientation m_orientation { ProgressSliderNodeOrientationHorizontal }; + + virtual void updateProgressUI(float value, bool animated = true); + void adjustThumbSpritePosition(); +}; + +#endif /* TimeSliderNode_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/SimpleButton.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/SimpleButton.cpp new file mode 100644 index 0000000..ab60902 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/SimpleButton.cpp @@ -0,0 +1,213 @@ +// +// SimpleButton.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "SimpleButton.h" +#include "JSONParseUtils.h" +#include "ValueStorage.h" +#include "GeometryUtils.h" +#include "MiscConfig.h" +#include "ScalingUtils.h" +#include "StaticActionParser.h" + +SimpleButton* SimpleButton::create() +{ + SimpleButton * button = new (std::nothrow) SimpleButton(); + if(button && button->init()) + { + button->autorelease(); + return button; + } + CC_SAFE_DELETE(button); + return nullptr; +} + +bool SimpleButton::init() +{ + if(!cocos2d::ui::Button::init()){ + return false; + } + + _originalScale = 1; + _adjustScaleOnPress = true; + _touchBeganCallback = [](std::string objectName, cocos2d::ui::Widget::TouchEventType){}; + _touchEndedCallback = [](std::string objectName,cocos2d::ui::Widget::TouchEventType){}; + _touchCancelledCallback = [](std::string objectName,cocos2d::ui::Widget::TouchEventType){}; + _buttonOwnTouchBehaviour.onTouchBegan = [](){}; + _buttonOwnTouchBehaviour.onTouchEnded = [](){}; + _buttonOwnTouchBehaviour.onTouchCancelled = [](){}; + _cascadeOpacityEnabled = true; + + this->configureTouchListeners(); + + setScale(_originalScale); + + return true; +} + +void SimpleButton::loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + this->loadCommonPropertiesFromJSON(jsonValue); + + if(jsonValue.HasMember("imagePath")){ + std::string imagePath = jsonValue["imagePath"].GetString(); + if(JSONParseUtils::checkMemberBool(jsonValue, "useAlternativePath", true)) + { + imagePath = altResFolder + imagePath; + } else { + imagePath = resFolder + imagePath; + } + + this->loadTextures(imagePath, imagePath, imagePath); + } + + if(JSONParseUtils::hasMemberFloat(jsonValue, "scale")){ + _originalScale = jsonValue["scale"].GetFloat(); + } + + if(ScalingUtils::isSmallDevice()){ + if(ScalingUtils::isElementTooSmallForSmallDevice(getContentSize().width) || (JSONParseUtils::hasMemberBool(jsonValue, "scaleUpForSmallDevices") && jsonValue["scaleUpForSmallDevices"].GetBool() == true)){ + _originalScale *= ScalingUtils::getScaleForSmallDevice(); + setScale(_originalScale); + } + } + + if(JSONParseUtils::hasMemberPoint(jsonValue, "anchorPoint")){ + this->setAnchorPoint(JSONParseUtils::getMemberPoint(jsonValue, "anchorPoint")); + } + + if(JSONParseUtils::hasMemberBool(jsonValue, "adjustScaleOnPress")){ + _adjustScaleOnPress = jsonValue["adjustScaleOnPress"].GetBool(); + } + + if(JSONParseUtils::hasMemberObject(jsonValue, "buttonActionData")){ + + const auto& buttonActionData = jsonValue["buttonActionData"]; + + static int containerNumber = 0; + std::string Container = "SimpleButtonContainer" + std::to_string((containerNumber++)%100); + + if(JSONParseUtils::hasMemberObject(buttonActionData, "onTouchBegan")){ + + const auto& onTouchBeganJson = buttonActionData["onTouchBegan"]; + + auto key = ValueStorage::getInstance().storeValue(onTouchBeganJson, Container); + + _buttonOwnTouchBehaviour.onTouchBegan = std::bind([&](std::string storedValueKey, std::string container) { + + auto storedOnTouchBeganJson = ValueStorage::getInstance().getStoredValue(storedValueKey, container); + StaticActionParser::parseStaticAction(*storedOnTouchBeganJson); + }, key, Container); + + } + + if(JSONParseUtils::hasMemberObject(buttonActionData, "onTouchEnded")){ + + const auto& onTouchEndedJson = buttonActionData["onTouchEnded"]; + auto key = ValueStorage::getInstance().storeValue(onTouchEndedJson, Container); + + _buttonOwnTouchBehaviour.onTouchEnded = std::bind([&](std::string storedValueKey, std::string container) { + StaticActionParser::parseStaticAction(*ValueStorage::getInstance().getStoredValue(storedValueKey, container)); + }, key, Container); + + } + + //TODO onTouchCancelled, if required + } +} + +void SimpleButton::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + auto size = this->getNormalTextureSize(); + width = size.width*_originalScale; + height = size.height*_originalScale; +} + +bool SimpleButton::isWidget() +{ + return true; +} + +void SimpleButton::setOnTouchBeganCallback(std::function callback) +{ + _touchBeganCallback = callback; +} + +void SimpleButton::setOnTouchEndedCallback(std::function callback) +{ + _touchEndedCallback = callback; +} + +void SimpleButton::setOnTouchCancelledCallback(std::function callback) +{ + _touchCancelledCallback = callback; +} + +void SimpleButton::setOriginalScale(float scale) +{ + _originalScale = scale; +} + +float SimpleButton::getOriginalScale() +{ + return _originalScale; +} + +void SimpleButton::imitateTouchDown() +{ + if (_adjustScaleOnPress) + { + this->setScale(MiscConfig::HighlightedButtonScale*_originalScale); + } +} + +void SimpleButton::imitateTouchUp() +{ + if (_adjustScaleOnPress) + { + this->setScale(_originalScale); + } +} + +void SimpleButton::configureTouchListeners() +{ + Widget::ccWidgetTouchCallback touchListener = [&](Ref* button,Widget::TouchEventType touchEventType){ + + auto simpleButton = dynamic_cast(button); + + if(touchEventType == Widget::TouchEventType::BEGAN){ + + if (_adjustScaleOnPress) { + simpleButton->setScale(MiscConfig::HighlightedButtonScale*_originalScale); + } + simpleButton->_buttonOwnTouchBehaviour.onTouchBegan(); + simpleButton->_touchBeganCallback(simpleButton->objectName, cocos2d::ui::Widget::TouchEventType::BEGAN); + + } + + else if(touchEventType == Widget::TouchEventType::ENDED){ + if (_adjustScaleOnPress) { + simpleButton->setScale(_originalScale); + } + simpleButton->_buttonOwnTouchBehaviour.onTouchEnded(); + simpleButton->_touchEndedCallback(simpleButton->objectName, cocos2d::ui::Widget::TouchEventType::ENDED); + } + + else if(touchEventType == Widget::TouchEventType::CANCELED){ + if (_adjustScaleOnPress) { + simpleButton->setScale(_originalScale); + } + simpleButton->_buttonOwnTouchBehaviour.onTouchCancelled(); + simpleButton->_touchCancelledCallback(simpleButton->objectName, cocos2d::ui::Widget::TouchEventType::CANCELED); + } + + }; + + this->addTouchEventListener(touchListener); +} + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/SimpleButton.h b/ios/Runner/Wowgame/Classes/LayoutObjects/SimpleButton.h new file mode 100644 index 0000000..a77d16c --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/SimpleButton.h @@ -0,0 +1,55 @@ +// +// SimpleButton.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef SimpleButton_h +#define SimpleButton_h + +#include "LayoutObject.h" +#include "ui/CocosGUI.h" + +class SimpleButton : public cocos2d::ui::Button, public LayoutObject +{ + public: + + struct ButtonActionData { + std::function onTouchBegan; + std::function onTouchEnded; + std::function onTouchCancelled; + }; + + static SimpleButton* create(); + + virtual bool init() override; + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override; + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) override; + virtual bool isWidget() override; + + virtual void setOnTouchBeganCallback(std::function callback) override; + virtual void setOnTouchEndedCallback(std::function callback) override; + virtual void setOnTouchCancelledCallback(std::function callback) override; + + virtual void setOriginalScale(float scale); + virtual float getOriginalScale(); + + virtual void imitateTouchDown(); + virtual void imitateTouchUp(); + + protected: + + float _originalScale; + bool _adjustScaleOnPress; + std::function _touchBeganCallback; + std::function _touchEndedCallback; + std::function _touchCancelledCallback; + ButtonActionData _buttonOwnTouchBehaviour; + + virtual void configureTouchListeners(); +}; + +#endif /* SimpleButton_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/TouchableSprite.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/TouchableSprite.cpp new file mode 100644 index 0000000..96b2d2f --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/TouchableSprite.cpp @@ -0,0 +1,56 @@ +// +// TouchableSprite.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "cocos2d.h" +#include "TouchableSprite.h" +#include "GeometryUtils.h" + +TouchableSprite* TouchableSprite::createWithFile(const std::string& filename) +{ + TouchableSprite * sprite = new (std::nothrow) TouchableSprite(); + if(sprite && sprite->initWithFile(filename)) + { + sprite->autorelease(); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + + bool TouchableSprite::initWithFile(const std::string& filename) + { + if(!cocos2d::Sprite::initWithFile(filename)){ + return false; + } + + this->interactionEnabled = true; + this->touchBeganCallback = [](TouchableSprite* sprite){}; + + this->configureTouchHandlers(); + + return true; + } + + void TouchableSprite::configureTouchHandlers() + { + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(interactionEnabled && GeometryUtils::getBoundingBoxToWorld(this).containsPoint(touch->getLocation())){ + + this->touchBeganCallback(this); + return true; + } + + return false; + }; + + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); + } + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/TouchableSprite.h b/ios/Runner/Wowgame/Classes/LayoutObjects/TouchableSprite.h new file mode 100644 index 0000000..37f0058 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/TouchableSprite.h @@ -0,0 +1,28 @@ +// +// TouchableSprite.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef TouchableSprite_h +#define TouchableSprite_h + +#include "PlainSprite.h" + +class TouchableSprite : public PlainSprite +{ + public: + + static TouchableSprite* createWithFile(const std::string& filename); + virtual bool initWithFile(const std::string& filename) override; + + bool interactionEnabled; + std::function touchBeganCallback; + + protected: + virtual void configureTouchHandlers(); +}; + +#endif /* TouchableSprite_h */ diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/TwoStateButton.cpp b/ios/Runner/Wowgame/Classes/LayoutObjects/TwoStateButton.cpp new file mode 100644 index 0000000..0cd82ba --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/TwoStateButton.cpp @@ -0,0 +1,150 @@ +// +// TwoStateButton.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 25.06.2017. +// +// + +#include +#include "TwoStateButton.h" +#include "PlainSprite.h" +#include "MiscConfig.h" + +TwoStateButton* TwoStateButton::create(const std::string& inactiveImagePath, const std::string& activeImagePath) +{ + TwoStateButton * button = new (std::nothrow) TwoStateButton(); + if(button && button->init(inactiveImagePath, activeImagePath)) + { + button->autorelease(); + return button; + } + CC_SAFE_DELETE(button); + return nullptr; +} + +bool TwoStateButton::init(const std::string& inactiveImagePath, const std::string& activeImagePath) +{ + if(!SimpleButton::init()){ + return false; + } + + _inactiveBgImagePath = inactiveImagePath; + _activeBgImagePath = activeImagePath; + _activeSprite = nullptr; + _inactiveSprite = nullptr; + + _active = false; + _onStateChangedCallback = [](bool){}; + this->loadTextureNormal(inactiveImagePath); + + return true; +} + +//void TwoStateButton::onEnter() +//{ +// SimpleButton::onEnter(); +// this->adjustTextures(); +//} + +void TwoStateButton::setActive(bool active) +{ + _active = active; + this->adjustTextures(); +}; + +void TwoStateButton::addChild(cocos2d::Node* child){ + SimpleButton::addChild(child); + auto childAsLayoutNode = dynamic_cast(child); + if(childAsLayoutNode){ + if(childAsLayoutNode->objectName == "inactiveImage"){ + _inactiveSprite = dynamic_cast(child); + } else if(childAsLayoutNode->objectName == "activeImage"){ + _activeSprite = dynamic_cast(child); + } + } +} + +void TwoStateButton::configureTouchListeners() +{ + Widget::ccWidgetTouchCallback touchListener = [&](Ref* button,Widget::TouchEventType touchEventType){ + + if(touchEventType == Widget::TouchEventType::BEGAN){ + + this->setScale(MiscConfig::HighlightedButtonScale*_originalScale); + this->_buttonOwnTouchBehaviour.onTouchBegan(); + this->_touchBeganCallback(this->objectName, cocos2d::ui::Widget::TouchEventType::BEGAN); + + } + + else if(touchEventType == Widget::TouchEventType::ENDED){ + this->setScale(_originalScale); + + bool newActive = this->switchStates(); + this->adjustTextures(); + this->_onStateChangedCallback(newActive); + + this->_buttonOwnTouchBehaviour.onTouchEnded(); + this->_touchEndedCallback(this->objectName, cocos2d::ui::Widget::TouchEventType::ENDED); + } + + else if(touchEventType == Widget::TouchEventType::CANCELED){ + this->setScale(_originalScale); + this->adjustTextures(); + this->_buttonOwnTouchBehaviour.onTouchCancelled(); + this->_touchCancelledCallback(this->objectName, cocos2d::ui::Widget::TouchEventType::CANCELED); + } + + };; + + this->addTouchEventListener(touchListener); +} + +void TwoStateButton::adjustTextures() +{ + if(_active){ + this->loadTextureNormal(_activeBgImagePath); + this->loadTexturePressed(_activeBgImagePath); + if(this->_activeSprite){ + this->_activeSprite->setVisible(true); + } + if(this->_inactiveSprite){ + this->_inactiveSprite->setVisible(false); + } + } else { + this->loadTextureNormal(_inactiveBgImagePath); + this->loadTexturePressed(_inactiveBgImagePath); + if(this->_activeSprite){ + this->_activeSprite->setVisible(false); + } + if(this->_inactiveSprite){ + this->_inactiveSprite->setVisible(true); + } + } +} + +//void TwoStateButton::configureSpritesIfNeeded(){ +// if(!_activeSprite && !_inactiveSprite){ +// auto children = this->getChildren(); +// for(const auto& child : children){ +// auto childAsLayoutNode = dynamic_cast(child); +// if(childAsLayoutNode){ +// if(childAsLayoutNode->objectName == "inactiveImage"){ +// _inactiveSprite = dynamic_cast(child); +// } else if(childAsLayoutNode->objectName == "activeImage"){ +// _activeSprite = dynamic_cast(child); +// } +// } +// } +// } +//} + +//void TwoStateButton::adjustScale() +//{ +// if(_active){ +// +// } else { +// +// } +//} + diff --git a/ios/Runner/Wowgame/Classes/LayoutObjects/TwoStateButton.h b/ios/Runner/Wowgame/Classes/LayoutObjects/TwoStateButton.h new file mode 100644 index 0000000..e7310a1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/LayoutObjects/TwoStateButton.h @@ -0,0 +1,49 @@ +// +// TwoStateButton.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 25.06.2017. +// +// + +#ifndef TwoStateButton_h +#define TwoStateButton_h + +#include "SimpleButton.h" + +class TwoStateButton : public SimpleButton +{ + public: + static TwoStateButton* create(const std::string& inactiveImagePath, const std::string& activeImagePath); + bool init(const std::string& inactiveImagePath, const std::string& activeImagePath); +// virtual void onEnter() override; + + bool isActive() { + return _active; + }; + void setActive(bool active); + + void setOnStateChangedCallback(std::function onStateChangedCallback){ + _onStateChangedCallback = onStateChangedCallback; + }; + + bool switchStates(){ + _active = !_active; + return _active; + }; + + void addChild(cocos2d::Node* child) override; + + protected: + bool _active; + std::function _onStateChangedCallback; + std::string _inactiveBgImagePath; + std::string _activeBgImagePath; + cocos2d::Sprite* _activeSprite; + cocos2d::Sprite* _inactiveSprite; + + void configureTouchListeners() override; + void adjustTextures(); +}; + +#endif /* TwoStateButton_h */ diff --git a/ios/Runner/Wowgame/Classes/Misc/MiscConfig.h b/ios/Runner/Wowgame/Classes/Misc/MiscConfig.h new file mode 100644 index 0000000..68e9594 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Misc/MiscConfig.h @@ -0,0 +1,17 @@ +// +// MiscConfig.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 26.09.2017. +// +// + +#ifndef MiscConfig_h +#define MiscConfig_h + +namespace MiscConfig { + const float HighlightedButtonScale = 0.95; +} + + +#endif /* MiscConfig_h */ diff --git a/ios/Runner/Wowgame/Classes/Misc/ResourcesConfig.cpp b/ios/Runner/Wowgame/Classes/Misc/ResourcesConfig.cpp new file mode 100644 index 0000000..ca7f3db --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Misc/ResourcesConfig.cpp @@ -0,0 +1,23 @@ +// +// ResourcesConfig.cpp +// HalloweenSpaceInvaders-mobile +// +// Created by Katarzyna Kalinowska-Górska on 04/09/2019. +// + +#include +#include "ResourcesConfig.h" + +namespace ResourcesConfig { + + const char* RES_FOLDER_NAME_XLARGE = "xlarge"; + const char* RES_FOLDER_NAME_TINY = "small"; + + const std::string LEVEL_BABY_IMAGE_PATH = "graphics/levels/level_1.png"; + const std::string LEVEL_TEEN_IMAGE_PATH = "graphics/levels/level_2.png"; + const std::string LEVEL_ADULT_IMAGE_PATH = "graphics/levels/level_3.png"; + +// const std::string INTRO_1_SOUND_FILE_PATH = "sounds/g_speech/g_intro.mp3"; +// const std::string PICK_LEVEL_SOUND_FILE_PATH = "sounds/g_speech/g_pick_level.mp3"; +// const std::string INTRO_2_SOUND_FILE_PATH = "sounds/g_speech/g_intro2.mp3"; +} diff --git a/ios/Runner/Wowgame/Classes/Misc/ResourcesConfig.h b/ios/Runner/Wowgame/Classes/Misc/ResourcesConfig.h new file mode 100644 index 0000000..172703b --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Misc/ResourcesConfig.h @@ -0,0 +1,36 @@ +// +// ResourcesConfig.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 04/09/2019. +// + +#ifndef ResourcesConfig_h +#define ResourcesConfig_h + +#include + +namespace ResourcesConfig { + + extern const char* RES_FOLDER_NAME_XLARGE; +extern const char* RES_FOLDER_NAME_TINY; + + extern const std::string LEVEL_BABY_IMAGE_PATH; + extern const std::string LEVEL_TEEN_IMAGE_PATH; + extern const std::string LEVEL_ADULT_IMAGE_PATH; + + static std::string picturePathForLevel(int level){ + switch (level){ + case 0: return LEVEL_BABY_IMAGE_PATH; + case 1: return LEVEL_TEEN_IMAGE_PATH; + case 2: return LEVEL_ADULT_IMAGE_PATH; + default: return LEVEL_TEEN_IMAGE_PATH; + } + } + +// extern const std::string INTRO_1_SOUND_FILE_PATH; +// extern const std::string PICK_LEVEL_SOUND_FILE_PATH; +// extern const std::string INTRO_2_SOUND_FILE_PATH; +} + +#endif /* ResourcesConfig_h */ diff --git a/ios/Runner/Wowgame/Classes/Misc/Strings.cpp b/ios/Runner/Wowgame/Classes/Misc/Strings.cpp new file mode 100644 index 0000000..82d6bd3 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Misc/Strings.cpp @@ -0,0 +1,17 @@ +// +// Strings.cpp +// Steve and Maggie Halloween +// +// Created by Katarzyna Kalinowska-Górska on 06/10/2019. +// + +#include +#include "Strings.h" + +namespace Strings { + + const char* LINK_TERMS_OF_SERVICE = "https://www.wattsenglish.com/steve-and-maggie-halloween/terms-of-use.html"; + const char* LINK_PRIVACY_POLICY = "https://www.wattsenglish.com/steve-and-maggie-halloween/principles-of-personal-data-processing.html"; +// const char* LINK_ABOUT_WE = "https://www.wowenglish.com"; +} + diff --git a/ios/Runner/Wowgame/Classes/Misc/Strings.h b/ios/Runner/Wowgame/Classes/Misc/Strings.h new file mode 100644 index 0000000..c368a0c --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Misc/Strings.h @@ -0,0 +1,19 @@ +// +// Strings.h +// HalloweenSpaceInvaders +// +// Created by Katarzyna Kalinowska-Górska on 06/10/2019. +// + +#ifndef Strings_h +#define Strings_h + +namespace Strings { + + extern const char* LINK_TERMS_OF_SERVICE; + extern const char* LINK_PRIVACY_POLICY; +// extern const char* LINK_ABOUT_WE; + +}; + +#endif /* Strings_h */ diff --git a/ios/Runner/Wowgame/Classes/Misc/TouchHandlerTypes.h b/ios/Runner/Wowgame/Classes/Misc/TouchHandlerTypes.h new file mode 100644 index 0000000..c1574d8 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Misc/TouchHandlerTypes.h @@ -0,0 +1,23 @@ +// +// TouchHandlerTypes.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 26.05.2017. +// +// + +#ifndef TouchHandlerTypes_h +#define TouchHandlerTypes_h + +#include +#include "cocos2d.h" + +typedef enum TouchHandlerType { + TOUCHES_BEGAN = 0, + TOUCHES_MOVED = 1, + TOUCHES_ENDED = 2 +} TouchHandlerType; + +typedef std::function TouchHandlerFunction; + +#endif /* TouchHandlerTypes_h */ diff --git a/ios/Runner/Wowgame/Classes/NativeAndroid/AndroidUtils_cpp.cpp b/ios/Runner/Wowgame/Classes/NativeAndroid/AndroidUtils_cpp.cpp new file mode 100644 index 0000000..e42d0dc --- /dev/null +++ b/ios/Runner/Wowgame/Classes/NativeAndroid/AndroidUtils_cpp.cpp @@ -0,0 +1,20 @@ +// +// Created by Katarzyna Kalinowska-Górska on 2020-01-21. +// + +//void VideoPlayer::setFileName(const std::string& fileName) +//{ +// _videoURL = FileUtils::getInstance()->fullPathForFilename(fileName); +// _videoSource = VideoPlayer::Source::FILENAME; +// JniHelper::callStaticVoidMethod(videoHelperClassName, "setVideoUrl", _videoPlayOerIndex, +// (int)Source::FILENAME,_videoURL); +//} + +#include "AndroidUtils_cpp.h" +#include "../../cocos2d/cocos/platform/android/jni/JniHelper.h" + +int androidUtils_osApiVersion() { + return cocos2d::JniHelper::callStaticIntMethod("org.cocos2dx.cpp.AndroidUtils", "osApiVersion"); +} + + diff --git a/ios/Runner/Wowgame/Classes/Parsing/GameParsing/GameConfigParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/GameParsing/GameConfigParser.cpp new file mode 100644 index 0000000..9a9ecb5 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/GameParsing/GameConfigParser.cpp @@ -0,0 +1,104 @@ +// +// GameConfigParser.cpp +// SteveAndMaggieGame-mobile +// +// Created by Katarzyna Kalinowska-Górska on 07/05/2019. +// + +#include "cocos2d.h" +#include "GameConfigParser.h" +#include "JSONParseUtils.h" +#include "SubGameSceneShoot.h" +#include "ScalingUtils.h" +#include "SoundsRepo.h" + +GameConfigParser::GameConfigParser(std::string configFilePath){ + _configJson = new rapidjson::Document(); + auto jsonString = cocos2d::FileUtils::getInstance()->getStringFromFile(configFilePath); + _configJson->Parse(jsonString.c_str()); +} + +GameConfigParser::~GameConfigParser(){ + delete _configJson; +} + +SubGameScene* GameConfigParser::createGameScene(int gameId,std::string layoutFilePath){ + return createGameScene(gameId, parseGameType(), layoutFilePath); +} + +std::string GameConfigParser::parseGameType(){ + if(JSONParseUtils::hasMemberString(*_configJson, "game_type")){ + return (*_configJson)["game_type"].GetString(); + } + return ""; +} + +SubGameScene* GameConfigParser::createGameScene(int gameId, std::string gameType, std::string layoutFilePath){ + //TODO add if exists everyewhere + SoundsRepo::soundsFolder = (JSONParseUtils::hasMemberString(*_configJson, "sounds_path")) ? + (*_configJson)["sounds_path"].GetString() : ""; +// parseSoundInfoFile(SoundsRepo::soundsFolder, SoundsRepo::soundsFolder + "sounds_info.si", SoundsRepo::soundDurations); + + auto gamePropertiesJson = (*_configJson)["game_properties"].GetObject(); + + if (gameType == "shoot"){ + return SubGameSceneShoot::create(gameId, layoutFilePath, [&](SubGameSceneShoot::GameConfig& gameConfig){ + + gameConfig.lives = gamePropertiesJson["lives"].GetInt(); + auto itemsJson = gamePropertiesJson["itemInfo"].GetArray(); + for(int i = 0; i < itemsJson.Size(); ++i){ + SubGameSceneShoot::SItem item; + item.itemId = itemsJson[i]["itemId"].GetInt(); +// itemsJson[i]["shelfIndex"].GetInt(); + item.picFilePaths = JSONParseUtils::parseStringArray(itemsJson[i]["pictures"]); + item.groupPictureNodeName = itemsJson[i]["groupNodeName"].GetString(); + + if(itemsJson[i].HasMember("splodgePicture")){ + item.splodgePicFilePath = itemsJson[i]["splodgePicture"].GetString(); + } + +// std::string soundsfolder = gamePropertiesJson["sounds_path"].GetString(); + if(itemsJson[i].HasMember("soundRequest")){ + item.soundRequest = SoundsRepo::soundsFolder + itemsJson[i]["soundRequest"].GetString(); + SoundsRepo::preloadSoundEffect(item.soundRequest); + } + + if(itemsJson[i].HasMember("soundNo")){ + item.soundNo = SoundsRepo::soundsFolder + itemsJson[i]["soundNo"].GetString(); + SoundsRepo::preloadSoundEffect(item.soundNo); + } + + if(itemsJson[i].HasMember("soundYes")){ + item.soundConf = SoundsRepo::soundsFolder + itemsJson[i]["soundYes"].GetString(); + SoundsRepo::preloadSoundEffect(item.soundConf); + } + /// + + gameConfig.shelfItems[item.itemId] = item; + } + + gameConfig.trolleyRect = ScalingUtils::getInstance().configureRect(JSONParseUtils::getRect(gamePropertiesJson["trolleySubRect"])); + gameConfig.maggieRect = ScalingUtils::getInstance().configureRect(JSONParseUtils::getRect(gamePropertiesJson["maggieSubRect"])); + gameConfig.steveRect = ScalingUtils::getInstance().configureRect(JSONParseUtils::getRect(gamePropertiesJson["steveSubRect"])); + auto levelConfigs = gamePropertiesJson["level_info"].GetArray(); + for(const auto& levelJson : levelConfigs){ + SubGameSceneShoot::LevelConfig levelConfig; + levelConfig.levelTime = levelJson["levelTime"].GetFloat(); + levelConfig.trolleyTime = levelJson["trolleyTime"].GetFloat(); + gameConfig.levelConfigs.push_back(levelConfig); + } + + gameConfig.trolleyItemPoints = JSONParseUtils::parsePointArray(gamePropertiesJson["trolleyItemPoints"]); + for(int i = 0; i < gameConfig.trolleyItemPoints.size(); ++i){ + gameConfig.trolleyItemPoints.at(i) = ScalingUtils::getInstance().configurePoint(gameConfig.trolleyItemPoints.at(i)); + } + + SoundsRepo::preloadAllShootGameSounds(); + }); + } + + return nullptr; +} + + + diff --git a/ios/Runner/Wowgame/Classes/Parsing/GameParsing/GameConfigParser.h b/ios/Runner/Wowgame/Classes/Parsing/GameParsing/GameConfigParser.h new file mode 100644 index 0000000..840b30f --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/GameParsing/GameConfigParser.h @@ -0,0 +1,31 @@ +// +// GameConfigParser.h +// SteveAndMaggieGame +// +// Created by Katarzyna Kalinowska-Górska on 07/05/2019. +// + +#ifndef GameConfigParser_h +#define GameConfigParser_h + +#include +#include "SubGameScene.h" +#include "json/document.h" + +class GameConfigParser : public SubGameScene::GameCreator { + +public: + + GameConfigParser(std::string configFilePath); + virtual ~GameConfigParser(); + virtual SubGameScene* createGameScene(int gameId, std::string layoutFilePath) override; + +protected: + + rapidjson::Document* _configJson; + + virtual std::string parseGameType(); + virtual SubGameScene* createGameScene(int gameId, std::string gameType, std::string layoutFilePath); +}; + +#endif /* GameConfigParser_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/JSONParseUtils.cpp b/ios/Runner/Wowgame/Classes/Parsing/JSONParseUtils.cpp new file mode 100644 index 0000000..7b0b6b7 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/JSONParseUtils.cpp @@ -0,0 +1,345 @@ +// +// JSONParseUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 19.05.2017. +// +// + +#include +#include "JSONParseUtils.h" + +std::string JSONParseUtils::loadJSONFromFile(const std::string& jsonFilePath) +{ + std::string fullPath = cocos2d::FileUtils::getInstance()->fullPathForFilename(jsonFilePath); + return cocos2d::FileUtils::getInstance()->getStringFromFile(fullPath); +} + +bool JSONParseUtils::hasMemberBool(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && json[memberName].IsBool(); +} + +bool JSONParseUtils::hasMemberInt(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && json[memberName].IsInt(); +} + +bool JSONParseUtils::hasMemberFloat(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && (json[memberName].IsFloat() || json[memberName].IsInt()); +} + +bool JSONParseUtils::hasMemberString(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && json[memberName].IsString(); +} + +bool JSONParseUtils::hasMemberArray(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && json[memberName].IsArray(); +} + +bool JSONParseUtils::hasMemberObject(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && json[memberName].IsObject(); +} + +bool JSONParseUtils::hasMemberPoint(const Value& json, const char* memberName) +{ + return json.IsObject() && json.HasMember(memberName) && JSONParseUtils::isPoint(json[memberName]); +} + +cocos2d::Point JSONParseUtils::getMemberPoint(const Value& json, const char* memberName) +{ + return JSONParseUtils::getPoint(json[memberName]); +} + +bool JSONParseUtils::isPoint(const Value& json) +{ + return JSONParseUtils::hasMemberFloat(json, "x") && JSONParseUtils::hasMemberFloat(json, "y"); +} + +cocos2d::Point JSONParseUtils::getPoint(const Value& json) +{ + auto x = json["x"].GetFloat(); + auto y = json["y"].GetFloat(); + return cocos2d::Point(x,y); +} + +bool JSONParseUtils::hasMemberSize(const Value& json, const char* memberName) +{ + return json.HasMember(memberName) && JSONParseUtils::isSize(json[memberName]); +} + +cocos2d::Point JSONParseUtils::getMemberSize(const Value& json, const char* memberName) +{ + return JSONParseUtils::getSize(json[memberName]); +} + +bool JSONParseUtils::isSize(const Value& json) +{ + return json.IsObject() && ((JSONParseUtils::hasMemberFloat(json, "w") && JSONParseUtils::hasMemberFloat(json, "h")) || (JSONParseUtils::hasMemberFloat(json, "width") && JSONParseUtils::hasMemberFloat(json, "height"))); +} + +cocos2d::Size JSONParseUtils::getSize(const Value& json) +{ + auto w = -1, h = -1; + if(JSONParseUtils::hasMemberFloat(json, "w")){ + w = json["w"].GetFloat(); + h = json["h"].GetFloat(); + } + else { + w = json["width"].GetFloat(); + h = json["height"].GetFloat(); + } + + return cocos2d::Size(w,h); +} + +bool JSONParseUtils::hasMemberRect(const Value& json, const char* memberName) +{ + return json.HasMember(memberName) && JSONParseUtils::isRect(json[memberName]); +} + +cocos2d::Rect JSONParseUtils::getMemberRect(const Value& json, const char* memberName) +{ + return JSONParseUtils::getRect(json[memberName]); +} + +bool JSONParseUtils::isRect(const Value& json) +{ + return json.IsObject() && JSONParseUtils::hasMemberFloat(json, "x") && JSONParseUtils::hasMemberFloat(json, "y") && JSONParseUtils::hasMemberFloat(json, "w") && JSONParseUtils::hasMemberFloat(json, "h"); +} + +cocos2d::Rect JSONParseUtils::getRect(const Value& json) +{ + auto x = json["x"].GetFloat(); + auto y = json["y"].GetFloat(); + auto w = json["w"].GetFloat(); + auto h = json["h"].GetFloat(); + return cocos2d::Rect(x,y,w,h); +} + +bool JSONParseUtils::hasMemberColor3B(const Value& json, const char* memberName) +{ + return json.HasMember(memberName) && JSONParseUtils::isColor3B(json[memberName]); +} + +cocos2d::Color3B JSONParseUtils::getMemberColor3B(const Value& json, const char* memberName) +{ + return JSONParseUtils::getColor3B(json[memberName]); +} + +bool JSONParseUtils::isColor3B(const Value& json) +{ + return json.IsObject() && JSONParseUtils::hasMemberInt(json, "r") && JSONParseUtils::hasMemberInt(json, "g") && JSONParseUtils::hasMemberInt(json, "b"); +} + +cocos2d::Color3B JSONParseUtils::getColor3B(const Value& json) +{ + auto r = json["r"].GetInt(); + auto g = json["g"].GetInt(); + auto b = json["b"].GetInt(); + return cocos2d::Color3B(r,g,b); +} + +bool JSONParseUtils::hasMemberColor4F(const Value& json, const char* memberName) +{ + return json.HasMember(memberName) && JSONParseUtils::isColor4F(json[memberName]); +} + +cocos2d::Color4F JSONParseUtils::getMemberColor4F(const Value& json, const char* memberName) +{ + return JSONParseUtils::getColor4F(json[memberName]); +} + +bool JSONParseUtils::isColor4F(const Value& json) +{ + return json.IsObject() && JSONParseUtils::hasMemberFloat(json, "r") && JSONParseUtils::hasMemberFloat(json, "g") && JSONParseUtils::hasMemberFloat(json, "b") && JSONParseUtils::hasMemberFloat(json, "a"); +} + +cocos2d::Color4F JSONParseUtils::getColor4F(const Value& json) +{ + auto r = json["r"].GetFloat(); + auto g = json["g"].GetFloat(); + auto b = json["b"].GetFloat(); + auto a = json["a"].GetFloat(); + return cocos2d::Color4F(r,g,b,a); +} + +bool JSONParseUtils::checkMemberBool(const Value& json, const char* memberName, bool boolValue) +{ + return JSONParseUtils::hasMemberBool(json, memberName) && json[memberName].GetBool() == boolValue; +} + +bool JSONParseUtils::checkMemberInt(const Value& json, const char* memberName, int intValue) +{ + return JSONParseUtils::hasMemberInt(json, memberName) && json[memberName].GetInt() == intValue; +} + +bool JSONParseUtils::checkMemberFloat(const Value& json, const char* memberName, float floatValue) +{ + return JSONParseUtils::hasMemberInt(json, memberName) && json[memberName].GetFloat() == floatValue; +} + +bool JSONParseUtils::checkMemberString(const Value& json, const char* memberName, std::string expectedValue) +{ + return JSONParseUtils::hasMemberString(json, memberName) && expectedValue == json[memberName].GetString(); +} + +std::vector JSONParseUtils::parseStringArray(const Value& json) +{ + std::vector values; + + if(json.IsArray()){ + for(const auto& value : json.GetArray()){ + if(value.IsString()){ + values.push_back(value.GetString()); + } + } + } + else if(json.IsString()){ + values.push_back(json.GetString()); + } + + return values; +} + +std::vector JSONParseUtils::parseFloatArray(const Value& json) +{ + std::vector values; + + if(json.IsArray()){ + for(const auto& value : json.GetArray()){ + if(value.IsFloat() || value.IsInt()){ + values.push_back(value.GetFloat()); + } + } + } + else if(json.IsFloat() || json.IsInt()){ + values.push_back(json.GetFloat()); + } + + return values; +} + +std::vector JSONParseUtils::parseIntArray(const Value& json) +{ + std::vector values; + + if(json.IsArray()){ + for(const auto& value : json.GetArray()){ + if(value.IsInt()){ + values.push_back(value.GetInt()); + } + } + } + else if(json.IsInt()){ + values.push_back(json.GetInt()); + } + + return values; +} + +std::vector JSONParseUtils::parsePointArray(const Value& json) +{ + std::vector values; + + if(json.IsArray()){ + for(const auto& value : json.GetArray()){ + if(JSONParseUtils::isPoint(value)){ + values.push_back(JSONParseUtils::getPoint(value)); + } + } + } + else if(JSONParseUtils::isPoint(json)){ + values.push_back(JSONParseUtils::getPoint(json)); + } + + return values; +} + +std::vector JSONParseUtils::parseSizeArray(const Value& json) +{ + std::vector values; + + if(json.IsArray()){ + for(const auto& value : json.GetArray()){ + if(JSONParseUtils::isSize(value)){ + values.push_back(JSONParseUtils::getSize(value)); + } + } + } + else if(JSONParseUtils::isSize(json)){ + values.push_back(JSONParseUtils::getSize(json)); + } + + return values; +} + +std::vector JSONParseUtils::parseRectArray(const Value& json) +{ + std::vector values; + + if(json.IsArray()){ + for(const auto& value : json.GetArray()){ + if(JSONParseUtils::isRect(value)){ + values.push_back(JSONParseUtils::getRect(value)); + } + } + } + else if(JSONParseUtils::isRect(json)){ + values.push_back(JSONParseUtils::getRect(json)); + } + + return values; +} + +std::vector JSONParseUtils::parseMemberStringArray(const Value& json, const char* memberName) +{ + if(JSONParseUtils::hasMemberArray(json, memberName)){ + return JSONParseUtils::parseStringArray(json[memberName]); + } + + return std::vector(); +} + +std::vector JSONParseUtils::parseMemberFloatArray(const Value& json, const char* memberName) +{ + if(JSONParseUtils::hasMemberArray(json, memberName)){ + return JSONParseUtils::parseFloatArray(json[memberName]); + } + + return std::vector(); +} + +std::vector JSONParseUtils::parseMemberIntArray(const Value& json, const char* memberName) +{ + if(JSONParseUtils::hasMemberArray(json, memberName)){ + return JSONParseUtils::parseIntArray(json[memberName]); + } + + return std::vector(); +} + +std::vector JSONParseUtils::parseMemberPointArray(const Value& json, const char* memberName) +{ + if(JSONParseUtils::hasMemberArray(json, memberName)){ + return JSONParseUtils::parsePointArray(json[memberName]); + } + + return std::vector(); +} + +//std::vector JSONParseUtils::parseValueArray(const Value& json, rapidjson::CrtAllocator* allocator){ +// std::vector vec; +// auto array = json.GetArray(); +// for(int i = 0; i < array.Size(); ++i){ +// const rapidjson::Value* action = &array[i]; +// rapidjson::Value* actionCopy = new rapidjson::Value(); +// actionCopy->CopyFrom(action, allocator); +// vec.push_back(actionCopy); +// } +// return vec; +//} diff --git a/ios/Runner/Wowgame/Classes/Parsing/JSONParseUtils.h b/ios/Runner/Wowgame/Classes/Parsing/JSONParseUtils.h new file mode 100644 index 0000000..2050502 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/JSONParseUtils.h @@ -0,0 +1,83 @@ +// +// JSONParseUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 19.05.2017. +// +// + +#ifndef JSONParseUtils_h +#define JSONParseUtils_h + +#include "json/document.h" +#include +#include +#include "cocos2d.h" + +using namespace rapidjson; + +class JSONParseUtils +{ +public: + + static std::string loadJSONFromFile(const std::string& jsonFilePath); + + static bool hasMemberBool(const Value& json, const char* memberName); + static bool hasMemberInt(const Value& json, const char* memberName); + static bool hasMemberFloat(const Value& json, const char* memberName); + static bool hasMemberString(const Value& json, const char* memberName); + static bool hasMemberArray(const Value& json, const char* memberName); + static bool hasMemberObject(const Value& json, const char* memberName); + + + static bool hasMemberPoint(const Value& json, const char* memberName); + static cocos2d::Point getMemberPoint(const Value& json, const char* memberName); + + static bool isPoint(const Value& json); + static cocos2d::Point getPoint(const Value& json); + + static bool hasMemberSize(const Value& json, const char* memberName); + static cocos2d::Point getMemberSize(const Value& json, const char* memberName); + + static bool isSize(const Value& json); + static cocos2d::Size getSize(const Value& json); + + static bool hasMemberRect(const Value& json, const char* memberName); + static cocos2d::Rect getMemberRect(const Value& json, const char* memberName); + + static bool isRect(const Value& json); + static cocos2d::Rect getRect(const Value& json); + + static bool hasMemberColor3B(const Value& json, const char* memberName); + static cocos2d::Color3B getMemberColor3B(const Value& json, const char* memberName); + + static bool isColor3B(const Value& json); + static cocos2d::Color3B getColor3B(const Value& json); + + static bool hasMemberColor4F(const Value& json, const char* memberName); + static cocos2d::Color4F getMemberColor4F(const Value& json, const char* memberName); + + static bool isColor4F(const Value& json); + static cocos2d::Color4F getColor4F(const Value& json); + + + static bool checkMemberBool(const Value& json, const char* memberName, bool expectedValue); + static bool checkMemberFloat(const Value& json, const char* memberName, float expectedValue); + static bool checkMemberInt(const Value& json, const char* memberName, int expectedValue); + static bool checkMemberString(const Value& json, const char* memberName, std::string expectedValue); + +// static std::vector parseValueArray(const Value& json, rapidjson::CrtAllocator* allocator); + static std::vector parseStringArray(const Value& json); + static std::vector parseFloatArray(const Value& json); + static std::vector parseIntArray(const Value& json); + static std::vector parsePointArray(const Value& json); + static std::vector parseSizeArray(const Value& json); + static std::vector parseRectArray(const Value& json); + + static std::vector parseMemberStringArray(const Value& json, const char* memberName); + static std::vector parseMemberFloatArray(const Value& json, const char* memberName); + static std::vector parseMemberIntArray(const Value& json, const char* memberName); + static std::vector parseMemberPointArray(const Value& json, const char* memberName); +}; + +#endif /* JSONParseUtils_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutObject.cpp b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutObject.cpp new file mode 100644 index 0000000..cb61b47 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutObject.cpp @@ -0,0 +1,134 @@ +// +// LayoutObject.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include + +#include "LayoutObject.h" +#include "ScalingUtils.h" +#include "JSONParseUtils.h" +#include "ScenarioObject.h" +#include "LayoutParser.h" +//#include "SpriteAnimator.h" + +LayoutObject::~LayoutObject() +{ + //bad bad bad design +// SpriteAnimator::cleanUpAnimationData(dynamic_cast(this)); +} + +void LayoutObject::loadCommonPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene, const std::string resFolder, const std::string altResFolder) +{ + if(jsonValue.HasMember("type")){ + const auto& classNameJSON = jsonValue["type"]; + this->className = classNameJSON.GetString(); + } else { + this->className = ""; + } + + if(jsonValue.HasMember("name")){ + const auto& objectNameJSON = jsonValue["name"]; + this->objectName = objectNameJSON.GetString(); + } else { + this->objectName = ""; + } + + cocos2d::Node* thisAsNode = dynamic_cast(this); + + if(jsonValue.HasMember("scale")){ + const auto& scaleJSON = jsonValue["scale"]; + if(scaleJSON.IsFloat() || scaleJSON.IsInt()){ + thisAsNode->setScale(scaleJSON.GetFloat()); + } + } + + if(jsonValue.HasMember("rotation")){ + const auto& rotationJSON = jsonValue["rotation"]; + if(rotationJSON.IsFloat() || rotationJSON.IsInt()){ + thisAsNode->setRotation(rotationJSON.GetFloat()); + } + } + + if(jsonValue.HasMember("hidden")){ + const auto& hiddenJSON = jsonValue["hidden"]; + if(hiddenJSON.IsBool()){ + thisAsNode->setVisible(!hiddenJSON.GetBool()); + } + } + + if(JSONParseUtils::checkMemberBool(jsonValue, "visible", false)){ + thisAsNode->setVisible(false); + } + + if(jsonValue.HasMember("anchorPoint")){ + const auto& anchorPointJSON = jsonValue["anchorPoint"]; + float x = anchorPointJSON["x"].GetFloat(); + float y = anchorPointJSON["y"].GetFloat(); + thisAsNode->setAnchorPoint(cocos2d::Point(x, y)); + } + + if(jsonValue.HasMember("width") && jsonValue.HasMember("height")){ + float width = jsonValue["width"].GetFloat(); + float height = jsonValue["height"].GetFloat(); + width = ScalingUtils::configureNodeDimension(width); + height = ScalingUtils::configureNodeDimension(height); + thisAsNode->setContentSize(cocos2d::Size(width, height)); + } + + if(JSONParseUtils::hasMemberArray(jsonValue, "animations")){ + + auto thisAsScenarioObject = dynamic_cast(this); + if(thisAsScenarioObject){ + for(const auto& animationData : jsonValue["animations"].GetArray()){ + std::string animationId = animationData["animationId"].GetString(); + thisAsScenarioObject->insertAnimationWithId(animationId, animationData); + } + } + } +} + +void LayoutObject::prepareSize(const rapidjson::Value& jsonValue, float& width, float& height) +{ + width = 0; + height = 0; +} + +float LayoutObject::animate(rapidjson::Value* animationData){ + + if(!animationData){ + return 0; + } + + cocos2d::Action* animationAction = NULL; + float animationTime = 0; + + std::string animationType = (*animationData)["animationType"].GetString(); + if(animationType == "frameAnimation"){ + + animationTime = 0.2; + if(JSONParseUtils::hasMemberFloat(*animationData, "animationDuration")){ + animationTime = (*animationData)["animationDuration"].GetFloat(); + } + + auto animation = cocos2d::Animation::create(); + auto animationFramesPaths = JSONParseUtils::parseStringArray((*animationData)["animationImagePaths"]); + + for(int i = 0; i < animationFramesPaths.size(); ++i){ + animation->addSpriteFrameWithFile(animationFramesPaths[i]); + } + + animation->setDelayPerUnit(animationTime/animationFramesPaths.size()); + animationAction = cocos2d::Animate::create(animation); + } + +// if(animationAction){ +// animationAction->setTag(MapObjectAnimationTag); +// this->runAction(animationAction); +// } + + return animationTime; +} diff --git a/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutObject.h b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutObject.h new file mode 100644 index 0000000..99dd241 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutObject.h @@ -0,0 +1,74 @@ +// +// LayoutObject.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 16.05.2017. +// +// + +#ifndef LayoutObject_h +#define LayoutObject_h + +#include "json/document.h" +#include "ui/CocosGUI.h" +#include "ScenarioObject.h" +#include "JSONParseUtils.h" + +class LayoutViewInterface; + +class LayoutObject : public ScenarioObject +{ + public: + + std::string className; + std::string objectName; + cocos2d::Point originalPosition; + + virtual ~LayoutObject(); + + virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") = 0; + + virtual void loadCommonPropertiesFromJSON(const rapidjson::Value& jsonValue, LayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = ""); + + virtual void prepareSize(const rapidjson::Value& jsonValue, float& width, float& height); + + virtual bool isWidget() + { + return false; + }; + + // for widgets + + virtual void setOnTouchBeganCallback(std::function callback){}; + virtual void setOnTouchEndedCallback(std::function callback){}; + virtual void setOnTouchCancelledCallback(std::function callback){}; + + // ScenarioObject + virtual std::string getObjectName(){ + return objectName; + }; + + virtual std::string getClassName(){ + return className; + }; + + virtual std::string getPropertyAsString(std::string propertyName = ""){ + if(propertyName == "objectName"){ + return objectName; + } + return "NULL"; + }; + + virtual void animate(){ + if(_activationAnimation != nullptr){ + animate(_activationAnimation); + } + } + +protected: + rapidjson::Value* _activationAnimation; + + virtual float animate(rapidjson::Value* animationData); +}; + +#endif /* LayoutObject_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutParser.cpp new file mode 100644 index 0000000..b7ffc29 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutParser.cpp @@ -0,0 +1,491 @@ +// +// LayoutParser.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 16.05.2017. +// +// + +#include +#include "LayoutParser.h" +#include "LayoutObject.h" +#include "ScalingUtils.h" + +#include "StringUtils.h" +#include "JSONParseUtils.h" + +#include "PlainNode.h" +#include "PlainSprite.h" +#include "SimpleButton.h" +#include "LevelPickerView.h" +#include "TwoStateButton.h" +#include "ResourceUtilities.h" +#include "ChangingSprite.h" +#include "PlainLabel.h" +#include "ContainerSprite.h" +#include "ProgressSliderNode.h" + +class LayoutObjectMapper +{ + public: + LayoutObject* createObjectFromClassName(std::string className, const rapidjson::Value& nodeData, std::string resFolder, std::string altResFolder) + { + LayoutObject* newObject = NULL; //TODO TUTAJ BRAC POD UWAGE ADDITIONANODE DATA moze wziac layoutparsera convenient metode + + std::string resourcesPath = resFolder; + if(JSONParseUtils::checkMemberBool(nodeData, "useAlternativePath", true)) + { + resourcesPath = altResFolder; + } + +// resourcesPath = ResourceUtilities::getInstance().getFullPathForDownloadedFile(resourcesPath); //TODO moze to gdzies wyrzucic jednak albo chociaz dac parameter czy to robic? + + if(className == "PlainNode"){ + newObject = PlainNode::create(); + } else if(className == "ColourLayer"){ + auto colour = JSONParseUtils::getColor3B(nodeData["colour"]); + cocos2d::Color4B col = cocos2d::Color4B(colour,255); + newObject = PlainNode::createWithColour(col); + } else if(className == "Label"){ + const std::string& text = nodeData["text"].GetString(); + const std::string& fontPath = nodeData["fontPath"].GetString(); + int fontSize = nodeData["baseFontSize"].GetInt(); + newObject = PlainLabel::create(text, fontPath, fontSize); + } + else if(className == "ChangingSprite") + { + std::string filePath1 = resourcesPath + nodeData["imagePath1"].GetString(); + std::string filePath2 = resourcesPath + nodeData["imagePath2"].GetString(); + newObject = ChangingSprite::createWithSpritePaths(filePath1, filePath2); + } + else if(className == "ContainerSprite") + { + std::string filePath = resourcesPath + nodeData["imagePath"].GetString(); + newObject = ContainerSprite::createWithContainerSpritePath(filePath); + } +// else if(className == "ColourableSprite"){ +// +// std::string filePath1 = resourcesPath + nodeData["imagePath1"].GetString(); +// std::string filePath2 = resourcesPath + nodeData["imagePath2"].GetString(); +// newObject = ColourableSprite::createWithSpritePaths(filePath1, filePath2); +// } + else if(className == "PlainSprite"){ + std::string filePath = resourcesPath + nodeData["imagePath"].GetString(); + newObject = PlainSprite::createWithSpritePath(filePath); + } + else if(className == "SimpleButton"){ + newObject = SimpleButton::create(); + } else if (className == "LevelView"){ + auto levelImagePath = nodeData["levelImagePath"].GetString(); + std::string levelName = nodeData.HasMember("levelName") ? nodeData["levelName"].GetString() : ""; + auto path = resourcesPath + levelImagePath; + newObject = levelName.empty() ? LevelView::create(path) : LevelView::create(path, levelName); + } + else if (className == "LevelPickerView"){ + auto levelImagePaths = JSONParseUtils::parseStringArray(nodeData["levelImagePaths"]); + auto levelNames = nodeData.HasMember("levelNames") ? JSONParseUtils::parseStringArray(nodeData["levelNames"]) : std::vector(); + for(auto& path : levelImagePaths){ + path = resourcesPath + path; + } + newObject = LevelPickerView::create(levelImagePaths, levelNames); + } + else if(className == "TwoStateButton"){ + std::string inactiveImagePath = resourcesPath + nodeData["inactiveImagePath"].GetString(); + std::string activeImagePath = resourcesPath + nodeData["activeImagePath"].GetString(); + newObject = TwoStateButton::create(inactiveImagePath, activeImagePath); + } + else if(className == "ProgressSliderNode"){ + std::string bgFileName = nodeData["bgImagePath"].GetString(); + std::string bgFilePath = bgFileName == "" ? bgFileName : resourcesPath + bgFileName; + std::string thumbFilePath = resourcesPath + nodeData["thumbImagePath"].GetString(); + int min = nodeData["min"].GetInt(); + int max = nodeData["max"].GetInt(); + std::string orientation = nodeData["orientation"].GetString(); + int orientationInt = orientation == "vertical" ? ProgressSliderNodeOrientationVertical : ProgressSliderNodeOrientationHorizontal; + newObject = ProgressSliderNode::create(bgFilePath, thumbFilePath, min, max, orientationInt); + } + else if(className == "RepeatSprite"){ + std::string filePath = resourcesPath + nodeData["imagePath"].GetString(); + auto texture = cocos2d::Director::getInstance()->getTextureCache()->addImage(filePath); + newObject = PlainSprite::createWithTexture(texture); + cocos2d::Texture2D::TexParams params; + params.sAddressMode = cocos2d::backend::SamplerAddressMode::REPEAT; //GL_REPEAT; + params.tAddressMode = cocos2d::backend::SamplerAddressMode::REPEAT; + dynamic_cast(newObject)->getTexture()->setTexParameters(params); +// newObject->setContentSize(_shelf->getBoundingBox().size); + } + else // create a plain sprite + { + std::string filePath = resourcesPath + nodeData["imagePath"].GetString(); + newObject = PlainSprite::createWithSpritePath(filePath); + } + + + return newObject; + } +}; + +void LayoutParser::loadLayoutFromJSONFile(const std::string& jsonFilePath, LayoutViewInterface* scene) +{ + std::string jsonString = JSONParseUtils::loadJSONFromFile(jsonFilePath); + return this->loadLayoutFromJSONString(jsonString, scene); +} + +void LayoutParser::loadLayoutFromDownloadedJSONFile(const std::string& jsonFilePath, LayoutViewInterface* scene) +{ +// std::string downloadedFilePath = ResourceUtilities::getInstance().getFullPathForDownloadedFile(jsonFilePath, true); + std::string jsonString = cocos2d::FileUtils::getInstance()->getStringFromFile(jsonFilePath); //this->loadJSONFromFile(downloadedFilePath + jsonFilePath); + return this->loadLayoutFromJSONString(jsonString, scene); +} + +void LayoutParser::loadLayoutFromJSONString(const std::string& jsonString, LayoutViewInterface* scene) //TODO: invalid layout file will cause a crash, will have to fix it!!! +{ + rapidjson::Document document; + document.Parse(jsonString.c_str()); + this->_parsedDocument = &document; + _savedBgStretchScale = 1.f; + + if(document.HasMember("backgroundMusicPath")){ + std::string bgMusicFilePath = document["backgroundMusicPath"].GetString(); + bgMusicFilePath = ResourceUtilities::getInstance().getFullPathForDownloadedFile(bgMusicFilePath, false); + scene->setupBackgroundMusic(bgMusicFilePath); + } + + const auto& sceneLayoutJSON = document["sceneLayout"]; + const auto& layersJSON = sceneLayoutJSON["layers"].GetArray(); + + for(const auto& layerJSON : layersJSON) + { + std::string objectLayoutsFolder = ""; + std::string resFolder = ""; + std::string altResFolder = ""; + + if(document.HasMember("resFolder")){ + + const auto& resFolderJSON = document["resFolder"]; + + if(resFolderJSON.HasMember("objectLayoutsPath")){ + objectLayoutsFolder = resFolderJSON["objectLayoutsPath"].GetString(); + } + + if(resFolderJSON.HasMember("path")){ + resFolder = resFolderJSON["path"].GetString(); + } + + if(resFolderJSON.HasMember("alternativePath")){ + altResFolder = resFolderJSON["alternativePath"].GetString(); + } + } + + cocos2d::Layer* newLayer = NULL; + + if(layerJSON.HasMember("color")){ + + const auto& color = layerJSON["color"]; + auto colorR = color["r"].GetInt(); + auto colorG = color["g"].GetInt(); + auto colorB = color["b"].GetInt(); + auto colorA = color["a"].GetInt(); + newLayer = cocos2d::LayerColor::create(cocos2d::Color4B(colorR, colorG, colorB, colorA)); + + } else { + + newLayer = cocos2d::Layer::create(); + + } + + auto sceneAsNode = dynamic_cast(scene); + sceneAsNode->addChild(newLayer); + scene->addLayer(newLayer); + + if(layerJSON.HasMember("name") && layerJSON["name"].IsString()){ + auto layerName = std::string(layerJSON["name"].GetString()); + scene->addObject(layerName, newLayer); + } + +// std::string objectLayoutsFolder = ""; +// std::string resFolder = ""; +// std::string altResFolder = ""; +// +// if(document.HasMember("resFolder")){ +// +// const auto& resFolderJSON = document["resFolder"]; +// +// if(resFolderJSON.HasMember("objectLayoutsPath")){ +// objectLayoutsFolder = resFolderJSON["objectLayoutsPath"].GetString(); +// } +// +// if(resFolderJSON.HasMember("path")){ +// resFolder = resFolderJSON["path"].GetString(); +// } +// +// if(resFolderJSON.HasMember("alternativePath")){ +// altResFolder = resFolderJSON["alternativePath"].GetString(); +// } +// } + + resFolder = ResourceUtilities::getInstance().getFullPathForDownloadedFile(resFolder); + altResFolder = ResourceUtilities::getInstance().getFullPathForDownloadedFile(altResFolder); + + rapidjson::Value layerJSONCopy(layerJSON, this->_parsedDocument->GetAllocator()); + this->parseChildObjects(scene, layerJSONCopy, newLayer, objectLayoutsFolder, resFolder, altResFolder, true); + } + + this->_parsedDocument = NULL; +} + +void LayoutParser::parseChildObjects(LayoutViewInterface* scene, rapidjson::Value& nodeData, cocos2d::Node* createdNode, std::string objectLayoutsFolder, std::string resFolder, std::string altResFolder, bool isTopLayer) +{ + if(nodeData.HasMember("objects")){ + auto objects = nodeData["objects"].GetArray(); + for(const auto& objectJSON : objects){ + rapidjson::Value objectJSONCopy(objectJSON, this->_parsedDocument->GetAllocator()); + auto newObject = this->parseObject(scene, objectJSONCopy, createdNode, objectLayoutsFolder, resFolder, altResFolder, isTopLayer); + if(newObject != NULL){ + this->parseChildObjects(scene, objectJSONCopy, newObject, objectLayoutsFolder, resFolder, altResFolder, false); + } + } + } +} + +cocos2d::Node* LayoutParser::parseObject(LayoutViewInterface* scene, rapidjson::Value& nodeData, cocos2d::Node* parentNode, std::string objectLayoutsFolder, std::string resFolder, std::string altResFolder, bool isTopLayer) +{ + //todo memory leaks? + cocos2d::Node* newObject = NULL; + float newObjectWidth, newObjectHeight; + + if(nodeData.HasMember("loadObjectFromFile")){ + std::string objectDataPath = objectLayoutsFolder + nodeData["loadObjectFromFile"].GetString(); + objectDataPath = ResourceUtilities::getInstance().getFullPathForDownloadedFile(objectDataPath, true); + std::string jsonString = JSONParseUtils::loadJSONFromFile(objectDataPath); + + if(jsonString != ""){ + rapidjson::Document additionalObjectJSON; + additionalObjectJSON.Parse(jsonString.c_str()); + const auto& additionalObjectJsonData = additionalObjectJSON["object"]; + + auto& allocator = this->_parsedDocument->GetAllocator(); + + for (rapidjson::Value::ConstMemberIterator itr = additionalObjectJsonData.MemberBegin(); itr != additionalObjectJsonData.MemberEnd(); ++itr) + { + const char* memberName = itr->name.GetString(); + const rapidjson::Value& memberValue = itr->value; + nodeData.AddMember(rapidjson::Value(memberName, allocator).Move(), rapidjson::Value(memberValue, allocator).Move(), allocator); + } + } + } + + LayoutObjectMapper mapper; + + std::string type = "PlainSprite"; + auto typeValue = this->getValueForKey("type", nodeData); + if(typeValue != NULL){ + type = typeValue->GetString(); + } + + auto newObjectAsLayoutObject = mapper.createObjectFromClassName(type, nodeData, resFolder, altResFolder); + + if(newObjectAsLayoutObject == NULL){ + return NULL; + } + + newObjectAsLayoutObject->loadPropertiesFromJSON(nodeData, scene, resFolder, altResFolder); + newObjectAsLayoutObject->prepareSize(nodeData, newObjectWidth, newObjectHeight); + newObject = dynamic_cast(newObjectAsLayoutObject); + + if(newObjectAsLayoutObject->isWidget()){ + newObjectAsLayoutObject->setOnTouchBeganCallback(CC_CALLBACK_2(LayoutViewInterface::touchHandlerForWidget, scene)); + newObjectAsLayoutObject->setOnTouchEndedCallback(CC_CALLBACK_2(LayoutViewInterface::touchHandlerForWidget, scene)); + newObjectAsLayoutObject->setOnTouchCancelledCallback(CC_CALLBACK_2(LayoutViewInterface::touchHandlerForWidget, scene)); + } + +// float objectScale = 1; +// auto scaleFromJSON = this->getValueForKey("scale", nodeData, additionalObjectJsonData); +// if(scaleFromJSON != NULL){ +// objectScale = scaleFromJSON->GetFloat(); +// } + + std::string objectName = this->getValueForKey("name", nodeData)->GetString(); +// scene->_objects.insert({objectName, newObject}); + scene->addObject(objectName, newObject); + + // object placement; maybe put into a separate function +// auto ignoreScalingJSON = this->getValueForKey("ignore_scaling", nodeData); +// bool ignoreScaling = false; +// if(ignoreScalingJSON != NULL){ +// ignoreScaling = ignoreScalingJSON->GetBool(); //TODO ignore scaling is int +// } + + float scaleToDesignSize = 1/ScalingUtils::getAdjustedContentScaleFactor(); + + float additionalPaddingW = isTopLayer /*&& !ignoreScaling */? ScalingUtils::getInstance().getScaledScreenSurplusWidth()*scaleToDesignSize / 2 : 0; + float additionalPaddingH = isTopLayer /*&& !ignoreScaling */? ScalingUtils::getInstance().getScaledScreenSurplusHeight()*scaleToDesignSize / 2 : 0; + +// float scaleToDesignSize = ScalingUtils::scaleAspectFillToDesignIpadProSize(); + auto objectScale = scaleToDesignSize;//scale;//(ignoreScaling ? 1 : scale)/scaleToDesignSize; + + auto scaleAsBackground = this->getValueForKey("scaleAsBackgroundStretch", nodeData); + if(scaleAsBackground != nullptr && scaleAsBackground->GetBool() == true){ +// objectScale = cocos2d::Director::getInstance()->getContentScaleFactor() / _savedBgStretchScale; + newObject->setScale(_savedBgStretchScale); + objectScale = scaleToDesignSize*_savedBgStretchScale; + } + + //TODO THIS IS NOT OK THAT WE HAVE THE SAME THING HERE AND IN THE SIMPLEBUTTON OBJECTS, FIX + if(ScalingUtils::isSmallDevice()){ + if((ScalingUtils::isElementTooSmallForSmallDevice(newObjectWidth) && (type == "TwoStateButton" || type == "SimpleButton")) || (JSONParseUtils::hasMemberBool(nodeData, "scaleUpForSmallDevices") && nodeData["scaleUpForSmallDevices"].GetBool() == true)){ + objectScale *= ScalingUtils::getScaleForSmallDevice(); + } + } + +// if(ScalingUtils::isSmallDevice() && (type == "TwoStateButton" || type == "SimpleButton")){//TODO ugly, should probably be somewhere in the simplebutton class or somewhere +// objectScale = objectScale * ScalingUtils::getScaleForSmallDevice(); +// } + +// if(ScalingUtils::isSmallDevice() && ScalingUtils::isElementTooSmallForSmallDevice(newObject->getBoundingBox().size.width)){// && (type == "TwoStateButton" || type == "SimpleButton")){//TODO ugly, should probably be somewhere in the simplebutton class or somewhere +// objectScale = objectScale * ScalingUtils::getScaleForSmallDevice(); +// } + + float objectXPos = 0, objectYPos = 0; + bool skipPlacement = false; + + auto parentNodeWidth = parentNode->getContentSize().width; + auto parentNodeHeight = parentNode->getContentSize().height; + + auto layoutMode = this->getValueForKey("layoutMode", nodeData); + std::string fillParentMode = "fillParent"; //TODO enum + if(layoutMode != NULL && fillParentMode == layoutMode->GetString()){ + objectXPos = parentNodeWidth / 2; //TODO override getContentSize() everywhere + objectYPos = parentNodeHeight / 2; + newObject->setContentSize(cocos2d::Size(parentNodeWidth, parentNodeHeight)); + skipPlacement = true; + } + + if(!skipPlacement){ + + const auto& xPosJSON = this->getValueForKey("centerXPos", nodeData); + std::string xPlacementMode = this->getValueForKey("value", *xPosJSON)->GetString(); + if(xPlacementMode == "center"){ + objectXPos = parentNodeWidth/2; + } else if(xPlacementMode == "left"){ + objectXPos = newObjectWidth/2 + additionalPaddingW; + } else if(xPlacementMode == "right"){ + objectXPos = parentNodeWidth - newObjectWidth/2 - additionalPaddingW; + } else if(xPlacementMode.find("divide_w") != std::string::npos){ //object needs an 0.5 anchor point + auto tokens = StringUtils::splitString(xPlacementMode, ' '); + float padding = 0; + float width = atof(tokens[1].c_str())*ScalingUtils::widthScale(); + float place = atof(tokens[3].c_str()); + if(xPlacementMode.find("padding") != std::string::npos){ + padding = atof(tokens[5].c_str())*objectScale; + } + objectXPos = width*(place-1+0.5)+place*padding; + } else if(xPlacementMode.find("divide") != std::string::npos){ //object needs an 0.5 anchor point + auto tokens = StringUtils::splitString(xPlacementMode, ' '); + float divide = atof(tokens[1].c_str()); + if(xPlacementMode.find("place") != std::string::npos){ + float place = atof(tokens[3].c_str()); + objectXPos = parentNodeWidth*place/divide; + } + } + + auto xPadding = this->getValueForKey("padding", *xPosJSON); + if(xPadding != NULL){ + objectXPos += xPadding->GetFloat()*objectScale; + } + + const auto& yPosJSON = this->getValueForKey("centerYPos", nodeData); + std::string yPlacementMode = this->getValueForKey("value", *yPosJSON)->GetString(); + if(yPlacementMode == "center"){ + objectYPos = parentNodeHeight/2; + } else if(yPlacementMode == "bottom"){ + objectYPos = newObjectHeight/2 + additionalPaddingH; + } else if(yPlacementMode == "top"){ + objectYPos = parentNodeHeight - newObjectHeight/2 - additionalPaddingH; + } else if(yPlacementMode.find("divide_h") != std::string::npos){ //object needs an 0.5 anchor point + auto tokens = StringUtils::splitString(yPlacementMode, ' '); + float padding = 0; + float height = atof(tokens[1].c_str())*ScalingUtils::heightScale(); + float place = atof(tokens[3].c_str()); + if(yPlacementMode.find("padding") != std::string::npos){ + padding = atof(tokens[5].c_str())*objectScale; + } + objectYPos = height*(place-1+0.5)+place*padding; + } + else if(yPlacementMode.find("divide") != std::string::npos){ + auto tokens = StringUtils::splitString(yPlacementMode, ' '); + float divide = atof(tokens[1].c_str()); + float place = atof(tokens[3].c_str()); + objectYPos = parentNodeHeight*place/divide; + } + + auto yPadding = this->getValueForKey("padding", *yPosJSON); + if(yPadding != NULL){ + objectYPos += yPadding->GetFloat()*objectScale; + } + + } + +// newObject->setScale(objectScale); + newObject->setPosition(objectXPos, objectYPos); + newObjectAsLayoutObject->originalPosition = newObject->getPosition(); + + auto stretchMode = this->getValueForKey("stretchMode", nodeData); + std::string aspectFill = "aspectFill"; + std::string aspectFit = "aspectFit"; + std::string scaleToFill = "scaleToFill"; + if(stretchMode != NULL){ + float stretchScale = 1.f; + if(aspectFill == stretchMode->GetString()){ + stretchScale = ScalingUtils::imageAspectFillGetScale(cocos2d::Size(newObjectWidth, newObjectHeight), cocos2d::Size(parentNodeWidth, parentNodeHeight)); +// newObject->setScale(stretchScale); + if(JSONParseUtils::hasMemberFloat(nodeData, "thresholdAspectRatio")){ + auto threshold = nodeData["thresholdAspectRatio"].GetFloat(); + if(ScalingUtils::getDeviceAspectRatio() > threshold){ + auto adjustedParentWidth = parentNodeHeight*threshold; + stretchScale = ScalingUtils::imageAspectFillGetScale(cocos2d::Size(newObjectWidth, newObjectHeight), cocos2d::Size(adjustedParentWidth, parentNodeHeight)); + } + } + newObject->setContentSize(cocos2d::Size(newObjectWidth*stretchScale, newObjectHeight*stretchScale)); + } + else if(aspectFit == stretchMode->GetString()){ + stretchScale = ScalingUtils::imageAspectFitGetScale(cocos2d::Size(newObjectWidth, newObjectHeight), cocos2d::Size(parentNodeWidth, parentNodeHeight)); + newObject->setContentSize(cocos2d::Size(newObjectWidth*stretchScale, newObjectHeight*stretchScale)); + // newObject->setScale(stretchScale); + } + else if(scaleToFill == stretchMode->GetString()){ + stretchScale = parentNodeWidth/newObjectWidth; + newObject->setContentSize(cocos2d::Size(parentNodeWidth, parentNodeHeight)); +// newObject->setScaleX(parentNodeWidth/newObjectWidth); +// newObject->setScaleY(parentNodeHeight/newObjectHeight); + } + if(objectName == "background"){ + _savedBgStretchScale = stretchScale; + } + } + + auto depthJSON = this->getValueForKey("depth", nodeData); + if(depthJSON != NULL){ + float depth = depthJSON->GetInt(); + parentNode->addChild(newObject, depth); + } else { + parentNode->addChild(newObject); + } + + auto opacityJSON = this->getValueForKey("opacity", nodeData); + if (opacityJSON != NULL) { + int opacity = opacityJSON->GetInt(); + newObject->setOpacity(opacity); + } + + return newObject; +} + +const rapidjson::Value* LayoutParser::getValueForKey(std::string key, const rapidjson::Value& mainNodeData) +{ + if(mainNodeData.HasMember(key.c_str())){ + return &mainNodeData[key.c_str()]; + } + + return NULL; +} diff --git a/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutParser.h b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutParser.h new file mode 100644 index 0000000..1b0daab --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/LayoutParsing/LayoutParser.h @@ -0,0 +1,66 @@ +// +// LayoutParser.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 16.05.2017. +// +// + +#ifndef LayoutParser_h +#define LayoutParser_h + +#include "json/document.h" +#include "LayoutObject.h" +#include "ScenarioObject.h" + +class LayoutViewInterface +{ + public: + virtual void addLayer(cocos2d::Layer*){ + } + virtual void addObject(std::string objectName, cocos2d::Node* object){ + } + virtual void addScenarioObject(std::string objectName, ScenarioObject* object){ + } + virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType){ + return false; + } + virtual void setupBackgroundMusic(std::string backgroundMusicPath){ + } + virtual ScenarioObject* getObjectByName(std::string objectName){ + return NULL; + } +}; + +class LayoutParser +{ + public: + + static LayoutParser& getInstance() + { + static LayoutParser instance; + return instance; + } + + void loadLayoutFromJSONFile(const std::string& jsonFilePath, LayoutViewInterface* scene); + void loadLayoutFromDownloadedJSONFile(const std::string& jsonFilePath, LayoutViewInterface* scene); + void loadLayoutFromJSONString(const std::string& jsonString, LayoutViewInterface* scene); + + private: + LayoutParser() + { + _parsedDocument = NULL; + } + + CC_DISALLOW_COPY_AND_ASSIGN(LayoutParser); + + rapidjson::Document* _parsedDocument; + float _savedBgStretchScale; + + void parseChildObjects(LayoutViewInterface* scene, rapidjson::Value& nodeData, cocos2d::Node* createdNode, std::string objectLayoutsFolder = "", std::string resFolder = "", std::string altResFolder = "", bool isTopLayer = false); + cocos2d::Node* parseObject(LayoutViewInterface* scene, rapidjson::Value& nodeData, cocos2d::Node* parentNode, std::string objectLayoutsFolder = "", std::string resFolder = "", std::string altResFolder = "", bool isTopLayer = false); + const rapidjson::Value* getValueForKey(std::string key, const rapidjson::Value& mainNodeData); + +}; + +#endif /* LayoutParser_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionData.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionData.cpp new file mode 100644 index 0000000..5e391e7 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionData.cpp @@ -0,0 +1,11 @@ +// +// ActionData.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 23.05.2017. +// +// + +#include +//#include "ActionData.h" + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionData.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionData.h new file mode 100644 index 0000000..e5f40f6 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionData.h @@ -0,0 +1,33 @@ +// +// ActionData.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 23.05.2017. +// +// + +#ifndef ActionData_h +#define ActionData_h + +#include +#include +#include +#include "json/document.h" + +class ActionData +{ + public: + static const std::string ACTION_TYPE_SET_PROPERTY; + + ActionData(std::string actionType){ + this->actionType = actionType; + } + + std::string actionType; + std::vector objectNames; + rapidjson::Value* actionJSON; +}; + + + +#endif /* ActionData_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionParser.cpp new file mode 100644 index 0000000..7766b52 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionParser.cpp @@ -0,0 +1,549 @@ +// +// ActionParser.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 26.05.2017. +// +// + +#include +#include "ActionParser.h" +#include "JSONParseUtils.h" +#include "MathUtils.h" +#include "StringUtils.h" +#include "SimpleValue.h" +#include "SimpleActionParser.h" +#include "BlockingActionParser.h" +#include "ValueStorage.h" + +// main parse function + +cocos2d::Action* ActionParser::parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Action* parsedAction = NULL; + + if(!JSONParseUtils::hasMemberString(jsonActionObject, "actionType")){ + + cocos2d::log("ActionParser: parseJSONAction: jsonActionObject is not an action"); + + } else if(parseDelegate == NULL){ + + cocos2d::log("ActionParser: parseJSONAction: parseDelegate must not be null"); + + } else { + + if(!JSONParseUtils::hasMemberString(jsonActionObject, "condition") || this->checkCondition(jsonActionObject["condition"].GetString(), parseDelegate)){ + +// cocos2d::log("ActionParser: parsing action of type %s",jsonActionObject["actionType"].GetString()); + + parsedAction = RepeatedActionScheduler::getInstance().scheduleActionIfNeeded(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + + if(!parsedAction){ + + std::string actionType = jsonActionObject["actionType"].GetString(); + + if(actionType == "conditionalAction"){ + parsedAction = this->parseConditionalAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "sequence"){ + parsedAction = this->parseSequenceAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "spawn"){ + parsedAction = this->parseSpawnAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "loop"){ + parsedAction = this->parseLoopAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "randomAction"){ + parsedAction = this->parseRandomAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + } + + if(!parsedAction){ + parsedAction = SimpleActionParser::getInstance().parseJSONAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + + if(!parsedAction){ + parsedAction = BlockingActionParser::getInstance().parseJSONAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + + if(!parsedAction){ + cocos2d::log("ActionParser: parseJSONAction: no support for this actionType. (Or runInstantly flag set)"); + } + + } else if(notifyDelegateWhenFinished){ + + auto key = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + parsedAction = cocos2d::CallFunc::create(std::bind([&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + pParseDelegate->actionFinished(*ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName())); + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }, key, parseDelegate)); + } + } + + if(parsedAction != nullptr && JSONParseUtils::hasMemberInt(jsonActionObject, "actionTag")){ + parsedAction->setTag(jsonActionObject["actionTag"].GetInt()); + } + + return parsedAction; +} + +void ActionParser::cleanUp(ActionParseDelegate* delegate) +{ + ValueStorage::getInstance().clearStoredData(delegate->getValueStorageContainerName()); +} + +// functions for parsing differenct actions + +// "actionType" = "conditionalAction" +// "conditionType" ["switch"] +// "switchParameter" [string] - the name of the object on which to switch +// "cases" [array of strings] - cases for the switch parameters +// "actions" [array of action objects] - actions to perform for different cases + +cocos2d::Action* ActionParser::parseConditionalAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + std::function actionFunction = std::bind([&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + cocos2d::Action* returnedAction = NULL; + + if(JSONParseUtils::checkMemberString(*storedJsonActionObject, "conditionType", "switch")) + { + auto switchParameterString = (*storedJsonActionObject)["switchParameter"].GetString(); + auto tokens = StringUtils::splitString(switchParameterString, '.'); + auto propertyNameToken = tokens[tokens.size()-1]; + auto objectNameString = tokens[0]; + for(int i = 1; i < tokens.size()-1; ++i){ + objectNameString = objectNameString + "." + tokens[i]; + } + auto switchParameterObject = this->parseObject(objectNameString, pParseDelegate)->getPropertyAsString(propertyNameToken); + + auto cases = (*storedJsonActionObject)["cases"].GetArray(); + auto actions = (*storedJsonActionObject)["actions"].GetArray(); + + for(int k = 0; k < cases.Size(); ++k){ + + if(switchParameterObject == cases[k].GetString()){ + returnedAction = this->parseJSONAction(actions[k], pParseDelegate, pNotifyDelegate); + break; + } + } + } + + if(returnedAction == NULL){ + + cocos2d::log("ActionParser: parseConditionalAction invalid parameters"); + + if(pNotifyDelegate){ + pParseDelegate->actionFinished(*storedJsonActionObject); + } + + } else { + pParseDelegate->runAction(returnedAction); + + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + }, storedValueKey, parseDelegate, notifyDelegateWhenFinished); + + return cocos2d::CallFunc::create(actionFunction); +} + +cocos2d::Action* ActionParser::parseRandomAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Action* parsedAction = NULL; + + if(JSONParseUtils::hasMemberArray(jsonActionObject, "actions")){ + + rapidjson::Value actionsCopy; + actionsCopy.CopyFrom(jsonActionObject, _valueStorage->GetAllocator()); //TODO: will memory be freed when actionsCopy goes out of scope? + auto actions = actionsCopy["actions"].GetArray(); + + do { + auto randIndex = MathUtils::getRandomInt(0,actions.Size()-1); + const auto& pickedAction = actions[randIndex]; + + if(JSONParseUtils::hasMemberString(pickedAction, "randomActionCondition")){ + if(ActionParser::getInstance().checkCondition(pickedAction["randomActionCondition"].GetString(), parseDelegate)){ + parsedAction = this->parseJSONAction(pickedAction, parseDelegate, notifyDelegateWhenFinished); + } else { + actions.Erase(actions.begin() + randIndex); + } + } + } while(!parsedAction && actions.Size() > 0); + + } + + return parsedAction; +} + + +// "actionType" = "sequence" +// "actions" [array of action objects] + +cocos2d::Action* ActionParser::parseSequenceAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Vector actionsForSeq; + + if(JSONParseUtils::hasMemberArray(jsonActionObject, "actions")){ + + const auto& actions = jsonActionObject["actions"]; + + for(SizeType i = 0; i < actions.Size(); ++i){ + auto parsedAction = this->parseJSONAction(actions[i], parseDelegate, false); + if(parsedAction){ + auto parsedFiniteAction = dynamic_cast(parsedAction); + if(parsedFiniteAction){ + actionsForSeq.pushBack(parsedFiniteAction); + } + } + } + } + + if(notifyDelegateWhenFinished){ + auto key = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + auto sequenceFinishedAction = cocos2d::CallFunc::create(std::bind([&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + pParseDelegate->actionFinished(*ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName())); + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }, key, parseDelegate)); + + actionsForSeq.pushBack(sequenceFinishedAction); + } + + return cocos2d::Sequence::create(actionsForSeq); +} + + +// "actionType" = "spawn" +// "actions" [array of action objects] + + +cocos2d::Action* ActionParser::parseSpawnAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Vector actionsForSpawn; + + if(JSONParseUtils::hasMemberArray(jsonActionObject, "actions")){ + + const auto& actions = jsonActionObject["actions"]; + + for(SizeType i = 0; i < actions.Size(); ++i){ + auto parsedAction = this->parseJSONAction(actions[i], parseDelegate, false); + if(parsedAction){ + auto parsedFiniteAction = dynamic_cast(parsedAction); + if(parsedFiniteAction){ + actionsForSpawn.pushBack(parsedFiniteAction); + } + } + } + } + + if(notifyDelegateWhenFinished){ + + auto key = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto spawnFinishedAction = cocos2d::CallFunc::create(std::bind([&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + pParseDelegate->actionFinished(*ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName())); + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }, key, parseDelegate)); + + actionsForSpawn.pushBack(spawnFinishedAction); + } + + return cocos2d::Spawn::create(actionsForSpawn); +} + +//todo maybe not everything to parsedelegate, but to scenario parser, e.g. these loops +cocos2d::Action* ActionParser::parseLoopAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + int existingLoopCounter = -1; + if(JSONParseUtils::hasMemberString(jsonActionObject, "loopId")){ + + auto loopId = jsonActionObject["loopId"].GetString(); + existingLoopCounter = parseDelegate->getLoopActionCounter(loopId); + if(existingLoopCounter == -1){ + existingLoopCounter = parseDelegate->addNewLoopActionCounter(loopId, jsonActionObject["timesRepeated"].GetInt()); + } else { + existingLoopCounter = parseDelegate->decrementLoopActionCounter(loopId); + if(existingLoopCounter == 0){ + parseDelegate->deleteLoopActionCounter(loopId); + existingLoopCounter = -1; + } + } + } + + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + std::function actionFunction = std::bind([&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, int pExistingLoopCounter){ + if(pExistingLoopCounter != -1){ + auto pStoredValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + pParseDelegate->setLastActionIndex((*pStoredValue)["jumpActionIndex"].GetInt() - 1); + } + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }, storedValueKey, parseDelegate, existingLoopCounter); + + return this->embedFunctionInAction(actionFunction, jsonActionObject, parseDelegate, notifyDelegateWhenFinished); +} + +// helper functions + +cocos2d::Action* ActionParser::embedFunctionInAction(std::function actionFunction, const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Action* parsedAction = NULL; + + auto functionKey = ValueStorage::getInstance().storeFunction(actionFunction, parseDelegate->getValueStorageContainerName()); + auto valueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + std::function callback = [&](std::string pFunctionKey, std::string pValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + ValueStorage::getInstance().runStoredFunction(pFunctionKey, pParseDelegate->getValueStorageContainerName()); + + if(pNotifyDelegate){ + pParseDelegate->actionFinished(*ValueStorage::getInstance().getStoredValue(pValueKey, pParseDelegate->getValueStorageContainerName())); + } + + ValueStorage::getInstance().removeStoredValue(pValueKey, pParseDelegate->getValueStorageContainerName()); + ValueStorage::getInstance().removeStoredFunction(pFunctionKey, pParseDelegate->getValueStorageContainerName()); + }; + + std::function boundCallback = std::bind(callback, functionKey, valueKey, parseDelegate, notifyDelegateWhenFinished); + + parsedAction = cocos2d::CallFunc::create(boundCallback); + return parsedAction; +} + +// possible conditions +// "true" | "false" +// "objectProperty propertyName == value", e.g. "objectProperty autofilled == 0" -> default object, i.e. parentScene, will be chosen +// "objectProperty(object) propertyName == value", e.g. "objectProperty(bigCar) colouringEnabled == 1" + +// conditions can be joint by simple "ands" && or conditions can be joint by simple "ors" || NEVER TOGETHER -- NOT SUPPORTED!!!! + //TODO join these two possibilities!! brackets will be needed + +bool ActionParser::checkCondition(std::string condition, ActionParseDelegate* parseDelegate) +{ + if(condition == "" || condition == "true"){ + return true; + } + + if(condition == "false"){ + return false; + } + + auto andConditions = StringUtils::splitString(condition, " && "); + auto orConditions = StringUtils::splitString(condition, " || "); + + auto arrayToParse = andConditions.size() > orConditions.size() ? andConditions : orConditions; + + for(int i = 0; i < arrayToParse.size(); ++i){ + + auto tokens = StringUtils::splitString(arrayToParse[i], " "); + bool result = false; + + if(tokens[0].find("objectProperty") != std::string::npos){ + + cocos2d::Node* object = NULL; + + if(tokens[0] == "objectProperty"){ + + object = dynamic_cast(parseDelegate->getDefaultObjectForConditionCheck()); + + } else { + auto substrBegin = tokens[0].find("(")+1; + auto substrEnd = tokens[0].find(")"); + auto objectName = tokens[0].substr(substrBegin, substrEnd - substrBegin); + object = dynamic_cast(parseDelegate->getObjectByName(objectName)); + } + + if(object != NULL){ + + auto scenarioObject = dynamic_cast(object); + + auto propertyName = tokens[1]; + std::string leftSide = scenarioObject->getPropertyAsString(propertyName); + + auto rightSide = tokens[3]; + auto operatorString = tokens[2]; + + result = this->checkExpression(leftSide, rightSide, operatorString); + } + + } else if(tokens[0].find("currentLoopCountdownIndex") != std::string::npos){ + + auto substrBegin = tokens[0].find("(")+1; + auto substrEnd = tokens[0].find(")"); + auto loopId = tokens[0].substr(substrBegin, substrEnd - substrBegin); + std::string loopCountDownIndex = std::to_string(parseDelegate->getLoopActionCounter(loopId)); + + auto rightSide = tokens[2]; + auto operatorString = tokens[1]; + + result = this->checkExpression(loopCountDownIndex, rightSide, operatorString); + + } else if(tokens[0].find("objectInScreenBounds") != std::string::npos){ + auto substrBegin = tokens[0].find("(")+1; + auto substrEnd = tokens[0].find(")"); + auto objectName = tokens[0].substr(substrBegin, substrEnd - substrBegin); + auto object = dynamic_cast(parseDelegate->getObjectByName(objectName)); + auto objectBB = GeometryUtils::getBoundingBoxToWorld(object); + auto screenBounds = cocos2d::Rect(cocos2d::Point(0,0), cocos2d::Director::getInstance()->getVisibleSize()); + result = screenBounds.containsPoint(cocos2d::Point(objectBB.getMinX(), objectBB.getMinY())) && screenBounds.containsPoint(cocos2d::Point(objectBB.getMaxX(), objectBB.getMaxY())); + + } else if(tokens[0].find("objectXInScreenBounds") != std::string::npos){ + auto substrBegin = tokens[0].find("(")+1; + auto substrEnd = tokens[0].find(")"); + auto objectName = tokens[0].substr(substrBegin, substrEnd - substrBegin); + auto object = dynamic_cast(parseDelegate->getObjectByName(objectName)); + auto objectBB = GeometryUtils::getBoundingBoxToWorld(object); + auto screenBounds = cocos2d::Rect(cocos2d::Point(0,0), cocos2d::Director::getInstance()->getVisibleSize()); + result = screenBounds.containsPoint(cocos2d::Point(objectBB.getMinX(), 0)) && screenBounds.containsPoint(cocos2d::Point(objectBB.getMaxX(), 0)); + } + + if(result == true){ + if(arrayToParse == andConditions){ + continue; + } else { + return true; + } + } else { + if(arrayToParse == andConditions){ + return false; + } else { + continue; + } + } + } + + if(arrayToParse == andConditions){ + return true; + } else { + return false; + } + +} + +bool ActionParser::checkExpression(std::string leftValue, std::string rightValue, std::string operatorString) +{ +// log("checking expr: "+leftValue + operator + rightValue); + std::transform(leftValue.begin(), leftValue.end(), leftValue.begin(), ::toupper); + std::transform(rightValue.begin(), rightValue.end(), rightValue.begin(), ::toupper); + + if(operatorString == "=="){ + return leftValue == rightValue; + } else if(operatorString == "!="){ + return leftValue != rightValue; + } else if(operatorString == "<"){ + return leftValue < rightValue; + } else if(operatorString == "<="){ + return leftValue <= rightValue; + } else if(operatorString == ">"){ + return leftValue > rightValue; + } else if(operatorString == ">="){ + return leftValue >= rightValue; + } + + return false; +} + +ScenarioObject* ActionParser::parseObject(std::string objectName, ActionParseDelegate* parseDelegate) +{ + auto tokens = StringUtils::splitString(objectName, '.'); + std::string firstObjectName = tokens[0]; + ScenarioObject* object = parseDelegate->getObjectByName(firstObjectName); + int k = 1; + while(k < tokens.size() && object != NULL){ + object = object->getScenarioObjectByName(tokens[k]); + ++k; + } + + return object; +} + +std::vector ActionParser::parseObjects(const rapidjson::Value& objectJsonArray, ActionParseDelegate* parseDelegate) +{ + std::vector objects; + + for(const auto& objectName : objectJsonArray.GetArray()){ + if(objectName.IsString()){ + objects.push_back(this->parseObject(objectName.GetString(), parseDelegate)); + } + } + + return objects; +} + +std::vector ActionParser::parseObjectOrObjects(const rapidjson::Value& jsonObject, std::string objectKey, std::string objectsKey, ActionParseDelegate* parseDelegate) +{ + std::vector objects; + if(JSONParseUtils::hasMemberString(jsonObject, objectKey.c_str())){ + + objects.push_back(this->parseObject(jsonObject[objectKey.c_str()].GetString(), parseDelegate)); + + } else if(JSONParseUtils::hasMemberArray(jsonObject, objectsKey.c_str())){ + + objects = this->parseObjects(jsonObject[objectsKey.c_str()], parseDelegate); + + } + + return objects; +} + +std::vector ActionParser::prepareObjectsForAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate) +{ + std::vector objects = this->parseObjectOrObjects(jsonActionObject, "objectName", "objectNames", parseDelegate); + + if(objects.size() == 0){ + auto object = parseDelegate->getDefaultObjectForAction(jsonActionObject["actionType"].GetString()); + objects.push_back(dynamic_cast(object)); + } + + return objects; +} + +void ActionParser::parseAndRunAction(const rapidjson::Value& action, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto parsedAction = this->parseJSONAction(action, parseDelegate, notifyDelegateWhenFinished); + if(parsedAction){ + parseDelegate->runAction(parsedAction); + } else { + cocos2d::log("ActionParser::parseAndRunAction: ACTION NULL!"); + } +} + +void ActionParser::parseAndRunActions(const rapidjson::Value& actionsArray, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto array = actionsArray.GetArray(); + for(SizeType i = 0; i < array.Size(); ++i){ + this->parseAndRunAction(array[i], parseDelegate, notifyDelegateWhenFinished); + } +} + +bool ActionParser::checkLateCondition(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate) +{ + if(JSONParseUtils::hasMemberString(jsonActionObject, "lateCondition")){ + if(ActionParser::getInstance().checkCondition(jsonActionObject["lateCondition"].GetString(), parseDelegate) == false){ + return false; + } + } + + return true; +} + +std::vector ActionParser::convertToNodeArray(std::vector objects){ + std::vector nodes; + for(auto object : objects){ + auto objAsNode = dynamic_cast(object); + if(objAsNode){ + nodes.push_back(objAsNode); + } + } + return nodes; +} + +cocos2d::Node* ActionParser::convertToNode(ScenarioObject* object){ + return dynamic_cast(object); +} diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionParser.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionParser.h new file mode 100644 index 0000000..25f3cab --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionParser.h @@ -0,0 +1,106 @@ +// +// ActionParser.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 26.05.2017. +// +// + +#ifndef ActionParser_h +#define ActionParser_h + +#include +#include "cocos2d.h" +#include "json/document.h" +#include "TouchHandlerTypes.h" +#include "ScenarioObject.h" +#include "RepeatedActionScheduler.h" +#include "SimpleValue.h" + +class ActionParseDelegate { + + public: + virtual ScenarioObject* getObjectByName(std::string objectName) = 0; + virtual ScenarioObject* getDefaultObjectForAction(std::string actionType) = 0; + virtual ScenarioObject* getDefaultObjectForConditionCheck() = 0; + virtual void addNewObject(std::string objectName, ScenarioObject* newObject) = 0; + virtual std::string getDefaultSoundsPath() = 0; + virtual std::string getAlternativeSoundsPath() = 0; + virtual std::string getValueStorageContainerName() = 0; + virtual void runAction(cocos2d::Action* action) = 0; + virtual void actionFinished(const rapidjson::Value& jsonActionObject) = 0; + virtual void runInstantly(std::function actionFunction) = 0; + virtual void runCompletingAction(cocos2d::Action* action) = 0; + virtual void cancelAllCompletingActions() = 0; + virtual void schedule(std::function callback, std::string key, float delay) = 0; + virtual void scheduleOnce(std::function callback, float delay, std::string key) = 0; + virtual void unschedule(std::string key) = 0; + virtual void newTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType) = 0; + virtual void removeTouchHandler(std::string key, TouchHandlerType touchType) = 0; + virtual long long getLastScreenTouchTime() = 0; + virtual int getLoopActionCounter(std::string loopId) = 0; + virtual int addNewLoopActionCounter(std::string loopId, int timesRepeated) = 0; + virtual int decrementLoopActionCounter(std::string loopId) = 0; + virtual void deleteLoopActionCounter(std::string loopId) = 0; + virtual void setLastActionIndex(int index) = 0; + virtual unsigned int removeStoredSoundId(std::string soundPath) = 0; + virtual void storeSoundId(std::string soundPath, unsigned int newSoundId) = 0; +}; + +class ActionParser { + + public: + + //TODO: actually this DEFINITELY should not be a singleton + static ActionParser& getInstance() + { + static ActionParser instance; + return instance; + }; + + ActionParser(){ + _valueStorage = new (std::nothrow) rapidjson::Document(); + }; + + ~ActionParser(){ + if(_valueStorage){ + delete _valueStorage; + } + } + + cocos2d::Action* parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished = true); + void cleanUp(ActionParseDelegate* delegate); + + static std::vector convertToNodeArray(std::vector objects); + static cocos2d::Node* convertToNode(ScenarioObject* object); + + ScenarioObject* parseObject(std::string objectName, ActionParseDelegate* parseDelegate); + std::vector parseObjects(const rapidjson::Value& objectJsonArray, ActionParseDelegate* parseDelegate); + std::vector parseObjectOrObjects(const rapidjson::Value& jsonObject, std::string objectKey, std::string objectsKey, ActionParseDelegate* parseDelegate); + + friend class SimpleActionParser; + friend class BlockingActionParser; + friend class DynamicObjectMapper; + friend class RepeatedActionScheduler; + + protected: + + rapidjson::Document* _valueStorage; + + + cocos2d::Action* parseConditionalAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseRandomAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseSequenceAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseSpawnAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseLoopAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* embedFunctionInAction(std::function actionFunction, const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + bool checkCondition(std::string condition, ActionParseDelegate* parseDelegate); + bool checkExpression(std::string leftValue, std::string rightValue, std::string operatorString); + std::vector prepareObjectsForAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate); + void parseAndRunActions(const rapidjson::Value& actionsArray, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + void parseAndRunAction(const rapidjson::Value& action, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + bool checkLateCondition(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate); +}; + +#endif /* ActionParser_h */ + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionSequenceHandler.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionSequenceHandler.cpp new file mode 100644 index 0000000..c2efa0f --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionSequenceHandler.cpp @@ -0,0 +1,220 @@ +// +// ActionSequenceHandler.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 29.06.2017. +// +// + +#include +#include "ActionSequenceHandler.h" +#include "ResourceUtilities.h" +#include "ValueStorage.h" + +ActionSequenceHandler::ActionSequenceHandler(ScenarioObject* containerNode, const rapidjson::Value& actionsArray) +{ + _containerNode = containerNode; + _JSONDataStorage = new (std::nothrow) rapidjson::Document(); + _actions = new (std::nothrow) rapidjson::Value(); + _actions->CopyFrom(actionsArray, _JSONDataStorage->GetAllocator()); + + static int valueStorageKeyNumber = 0; + valueStorageKeyNumber = (valueStorageKeyNumber + 1)%100; + _valueStorageContainerName = "ActionSequenceHandlerValues" + std::to_string(valueStorageKeyNumber); + _lastActionIndex = -1; + _onLastActionFinished = [](){}; + _currentAction = nullptr; +} + +ActionSequenceHandler::~ActionSequenceHandler() +{ + delete _JSONDataStorage; + delete _actions; +} + +void ActionSequenceHandler::runNext() +{ + auto i = _lastActionIndex+1; + auto actionsArray = _actions->GetArray(); + + if(i >= actionsArray.Size()){ + return; + } + + const auto& currentAction = actionsArray[i]; + + auto parsedAction = ActionParser::getInstance().parseJSONAction(currentAction, this); + + _lastActionIndex = i; + + if(parsedAction){ + this->runAction(parsedAction); + } else { + this->actionFinished(currentAction); + } + + _currentAction = parsedAction; +} + +void ActionSequenceHandler::reset() +{ + _lastActionIndex = -1; + _currentAction = nullptr; +} + +void ActionSequenceHandler::stop() +{ + if(_currentAction){ + auto containerNode = dynamic_cast(_containerNode); + if(containerNode){ + containerNode->stopAction(_currentAction); + } + } + ActionParser::getInstance().cleanUp(this); + this->reset(); +} + +// methods for parseDelegate + +ScenarioObject* ActionSequenceHandler::getObjectByName (std::string objectName) +{ + return _containerNode->getScenarioObjectByName(objectName); +} + +ScenarioObject* ActionSequenceHandler::getDefaultObjectForAction(std::string actionType) +{ + return dynamic_cast(_containerNode); +} + +ScenarioObject* ActionSequenceHandler::getDefaultObjectForConditionCheck() +{ + return dynamic_cast(_containerNode); +} + +void ActionSequenceHandler::addNewObject(std::string objectName, ScenarioObject* newObject) +{ + // do nothing +} + +std::string ActionSequenceHandler::getDefaultSoundsPath() +{ + return ResourceUtilities::getInstance().getDownloadedResourcesPath(false); +} + +std::string ActionSequenceHandler::getAlternativeSoundsPath() +{ + return ResourceUtilities::getInstance().getDownloadedResourcesPath(false); +} + +std::string ActionSequenceHandler::getValueStorageContainerName() +{ + return _valueStorageContainerName; +} + +void ActionSequenceHandler::runAction(cocos2d::Action* action) +{ + auto containerNode = dynamic_cast(_containerNode); + if(containerNode){ + containerNode->runAction(action); + } +} + +void ActionSequenceHandler::actionFinished(const rapidjson::Value& jsonActionObject) +{ + if(_lastActionIndex < _actions->GetArray().Size() - 1){ + this->runNext(); + } else { + _onLastActionFinished(); + ActionParser::getInstance().cleanUp(this); + } +} + +void ActionSequenceHandler::runInstantly(std::function actionFunction) +{ + actionFunction(); +} + +void ActionSequenceHandler::runCompletingAction(cocos2d::Action* action) +{ + // do nothing +} + +void ActionSequenceHandler::cancelAllCompletingActions() +{ + // do nothing +} + +void ActionSequenceHandler::schedule(std::function callback, std::string key, float delay) +{ + auto containerNode = dynamic_cast(_containerNode); + if(containerNode){ + containerNode->schedule(callback, delay, key); + } +} + +void ActionSequenceHandler::scheduleOnce(const std::function callback, float delay, std::string key) +{ + auto containerNode = dynamic_cast(_containerNode); + if(containerNode){ + containerNode->scheduleOnce(callback, delay, key); + } +} + +void ActionSequenceHandler::unschedule(std::string key) +{ + auto containerNode = dynamic_cast(_containerNode); + if(containerNode){ + containerNode->unschedule(key); + } +} + +void ActionSequenceHandler::newTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType) +{ + // do nothing +} + +void ActionSequenceHandler::removeTouchHandler(std::string key, TouchHandlerType touchHandlerType) +{ + // do nothing +} + +long long ActionSequenceHandler::getLastScreenTouchTime() +{ + return 0; +} + +int ActionSequenceHandler::getLoopActionCounter(std::string loopId) +{ + return 0; +} + +int ActionSequenceHandler::addNewLoopActionCounter(std::string loopId, int timesRepeated) +{ + return 0; +} + +int ActionSequenceHandler::decrementLoopActionCounter(std::string loopId) +{ + return 0; +} + +void ActionSequenceHandler::deleteLoopActionCounter(std::string loopId) +{ + // do nothing +} + +void ActionSequenceHandler::setLastActionIndex(int index) +{ + _lastActionIndex = index; +} + +void ActionSequenceHandler::storeSoundId(std::string soundPath, unsigned int newSoundId) +{ + // do nothing +} + +unsigned int ActionSequenceHandler::removeStoredSoundId(std::string soundPath) +{ + return -1; +} + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionSequenceHandler.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionSequenceHandler.h new file mode 100644 index 0000000..255412e --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ActionSequenceHandler.h @@ -0,0 +1,65 @@ +// +// ActionSequenceHandler.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 29.06.2017. +// +// + +#ifndef ActionSequenceHandler_h +#define ActionSequenceHandler_h + +#include "ActionParser.h" +#include "json/document.h" +#include "ScenarioObject.h" + +class ActionSequenceHandler : public ActionParseDelegate +{ + public: + + ActionSequenceHandler(ScenarioObject* containerNode, const rapidjson::Value& actionsArray); + virtual ~ActionSequenceHandler(); + + virtual void runNext(); + virtual void reset(); + virtual void stop(); + + // action parse delegate + virtual ScenarioObject* getObjectByName(std::string objectName); + virtual ScenarioObject* getDefaultObjectForAction(std::string actionType); + virtual ScenarioObject* getDefaultObjectForConditionCheck(); + virtual void addNewObject(std::string objectName, ScenarioObject* newObject); + virtual std::string getDefaultSoundsPath(); + virtual std::string getAlternativeSoundsPath(); + virtual std::string getValueStorageContainerName(); + virtual void runAction(cocos2d::Action* action); + virtual void actionFinished(const rapidjson::Value& jsonActionObject); + virtual void runInstantly(std::function actionFunction); + virtual void runCompletingAction(cocos2d::Action* action); + virtual void cancelAllCompletingActions(); + virtual void schedule(std::function callback, std::string key, float delay); + virtual void scheduleOnce(std::function callback, float delay, std::string key); + virtual void unschedule(std::string key); + virtual void newTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType); + virtual void removeTouchHandler(std::string key, TouchHandlerType touchType); + virtual long long getLastScreenTouchTime(); + virtual int getLoopActionCounter(std::string loopId); + virtual int addNewLoopActionCounter(std::string loopId, int timesRepeated); + virtual int decrementLoopActionCounter(std::string loopId); + virtual void deleteLoopActionCounter(std::string loopId); + virtual void setLastActionIndex(int index); + virtual unsigned int removeStoredSoundId(std::string soundPath); + virtual void storeSoundId(std::string soundPath, unsigned int newSoundId); + + protected: + + std::string _valueStorageContainerName; + ScenarioObject* _containerNode; + rapidjson::Document* _JSONDataStorage; + rapidjson::Value* _actions; + int _lastActionIndex; + cocos2d::Action* _currentAction; + std::function _onLastActionFinished; +}; + +#endif /* ActionSequenceHandler_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/BlockingActionParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/BlockingActionParser.cpp new file mode 100644 index 0000000..43c3fed --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/BlockingActionParser.cpp @@ -0,0 +1,657 @@ +// +// BlockingActionParser.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 31.05.2017. +// +// + +#include +#include "BlockingActionParser.h" +#include "JSONParseUtils.h" +#include "TouchHandlerTypes.h" +#include "GeometryUtils.h" +#include "DragAndDropHandler.h" +#include "SimpleValue.h" +#include "ChangingSprite.h" +#include "LayoutObject.h" +#include "SimpleValue.h" +#include "MathUtils.h" +#include "ValueStorage.h" +#include "PaletteNode.h" +#include "ContainerSprite.h" +#include "SoundsRepo.h" + +// main parse function + +cocos2d::Action* BlockingActionParser::parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Action* parsedAction = NULL; + auto blocking = JSONParseUtils::checkMemberBool(jsonActionObject, "dontBlock", true); + + if(!blocking){ + notifyDelegateWhenFinished = true; + } + +// log("BlockingActionParser: parsing action of type "+jsonActionObject.actionType); + + if(JSONParseUtils::hasMemberString(jsonActionObject, "actionType")){ + std::string actionType = jsonActionObject["actionType"].GetString(); + + if(actionType == "callFunctionWithBlocking"){ + parsedAction = this->parseCallFunctionWithBlockingAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "waitForTouch"){ + parsedAction = this->parseWaitForTouchAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "waitForPaletteComponent"){ + parsedAction = this->parseWaitForPaletteComponentAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "waitForObjectUnlock"){ + parsedAction = this->parseWaitForObjectUnlockAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "waitForDragAndDrop"){ + parsedAction = this->parseWaitForDragAndDropAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + } + + return parsedAction; +} + + // the function's last parameter has to be the callback +cocos2d::Action* BlockingActionParser::parseCallFunctionWithBlockingAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + auto storedValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedValue, pParseDelegate) == false){ + return; + } + + auto object = ActionParser::getInstance().prepareObjectsForAction(*storedValue, pParseDelegate)[0]; + + auto callback = [&](std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate, bool p2NotifyDelegate){ + + auto storedValue2 = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + + if(p2NotifyDelegate){ + p2ParseDelegate->actionFinished(*storedValue2); + } + + ValueStorage::getInstance().removeStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + }; + + const rapidjson::Value* params = NULL; + if(JSONParseUtils::hasMemberArray(*storedValue, "parameters")){ + params = &((*storedValue)["parameters"]); + } + + object->callFunctionByName((*storedValue)["functionName"].GetString(), params, pParseDelegate, std::bind(callback, pStoredValueKey, pParseDelegate, pNotifyDelegate)); + }; + + return ActionParser::getInstance().embedFunctionInAction(std::bind(actionFunction, storedValueKey, parseDelegate, notifyDelegateWhenFinished), jsonActionObject, parseDelegate, false); +} + +// functions for parsing differenct actions + +cocos2d::Action* BlockingActionParser::parseWaitForTouchAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + static const std::string TouchHandlerFunctionKey = "WaitForTouchActionTouchesBeganHandler"; + + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + auto storedValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + TouchHandlerFunction newTouchBeganHandler = std::bind([&](cocos2d::Touch* touch, cocos2d::Event* event, std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate, bool p2NotifyDelegate){ + + auto storedValue2 = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + + auto objectsToTouch = ActionParser::getInstance().parseObjectOrObjects(*storedValue2, "rightObjectName", "rightObjectNames", p2ParseDelegate); + auto wrongObjects = ActionParser::getInstance().parseObjectOrObjects(*storedValue2, "wrongObjectName", "wrongObjectNames", p2ParseDelegate); + + int touchedObjectsCount = 0; + + static std::string SubContainer = "WaitForTouchActionTouchedFlags"; //TODO: container name from the delegate + + for(int i = 0; i < objectsToTouch.size(); ++i){ + + auto objectToTouch = objectsToTouch[i]; + auto objAsNode = dynamic_cast(objectToTouch); + + auto touchedPtr = ValueStorage::getInstance().getStoredSimpleValue(SubContainer+objectToTouch->getObjectName(), p2ParseDelegate->getValueStorageContainerName()); + if(!touchedPtr){ + SimpleValue temp{false}; + touchedPtr = &temp; + ValueStorage::getInstance().storeSimpleValueWithKey(touchedPtr, SubContainer+objectToTouch->getObjectName(), p2ParseDelegate->getValueStorageContainerName()); + } + + if(!touchedPtr->getBoolValue() && GeometryUtils::getBoundingBoxToWorld(objAsNode).containsPoint(touch->getLocation())){ + + if(JSONParseUtils::hasMemberArray(*storedValue2, "rightActions")){ + ActionParser::getInstance().parseAndRunActions((*storedValue2)["rightActions"], p2ParseDelegate, false); + } + + if(JSONParseUtils::hasMemberArray(*storedValue2, "rightActionsForObjects")){ + ActionParser::getInstance().parseAndRunActions((*storedValue2)["rightActionsForObjects"].GetArray()[i], p2ParseDelegate, false); + } + + touchedPtr->setBoolValue(true); + + if(++touchedObjectsCount == objectsToTouch.size()){ + + if(JSONParseUtils::checkMemberBool(*storedValue2, "dontBlock", false)){ + p2ParseDelegate->removeTouchHandler(TouchHandlerFunctionKey, TOUCHES_BEGAN); + p2ParseDelegate->cancelAllCompletingActions(); + + if(p2NotifyDelegate){ + p2ParseDelegate->actionFinished(*storedValue2); + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ValueStorage::getInstance().clearStoredData(p2ParseDelegate->getValueStorageContainerName()); + + } else { + //to enable picking the objects again + touchedObjectsCount = 0; + for(auto object : objectsToTouch){ + SimpleValue* touchedPtr2 = ValueStorage::getInstance().getStoredSimpleValue(SubContainer + object->getObjectName(), p2ParseDelegate->getValueStorageContainerName()); + if(touchedPtr2){ + touchedPtr2->setBoolValue(false); + } else { + SimpleValue temp2{false}; + ValueStorage::getInstance().storeSimpleValueWithKey(&temp2, SubContainer + objectToTouch->getObjectName(), p2ParseDelegate->getValueStorageContainerName()); + } + } + } + } + + return true; + } + } + + if(JSONParseUtils::hasMemberArray(*storedValue2, "wrongActions")){ + + for(auto wrongObject : wrongObjects){ + + auto objAsNode = dynamic_cast(wrongObject); + + if(GeometryUtils::getBoundingBoxToWorld(objAsNode).containsPoint(touch->getLocation())){ + ActionParser::getInstance().parseAndRunActions((*storedValue2)["wrongActions"], p2ParseDelegate, false); + break; + } + } + } + + return false; + }, std::placeholders::_1, std::placeholders::_2, pStoredValueKey, pParseDelegate, pNotifyDelegate); + + pParseDelegate->newTouchHandler(TouchHandlerFunctionKey, newTouchBeganHandler, TOUCHES_BEGAN); + this->runCompletingActions(*storedValue, pParseDelegate); + }; + + auto notify = JSONParseUtils::checkMemberBool(jsonActionObject, "dontBlock", true); + return ActionParser::getInstance().embedFunctionInAction(std::bind(actionFunction, storedValueKey, parseDelegate, notifyDelegateWhenFinished), jsonActionObject, parseDelegate, notify); //todo there is some ambiguity here... dont notify now or later? will have to solve it somehow +} + +cocos2d::Action* BlockingActionParser::parseWaitForPaletteComponentAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + auto storedValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + auto objectsToTouch = ActionParser::getInstance().parseObjectOrObjects(*storedValue, "rightObjectName", "rightObjectNames", pParseDelegate); + auto paletteNode = dynamic_cast(dynamic_cast(objectsToTouch[0])->getParent()); + + std::function callback = std::bind([&](PaletteNode * pPaletteNode, PaletteComponentSprite * paletteComponentSprite, bool chosen, bool pressed, std::string pStoredValueKey2, ActionParseDelegate* pParseDelegate2, bool pNotifyDelegate2){ + + if(pressed){ + + bool wasRightObject = false; + + auto storedValue2 = ValueStorage::getInstance().getStoredValue(pStoredValueKey2, pParseDelegate2->getValueStorageContainerName()); + auto rightObjects = ActionParser::getInstance().parseObjectOrObjects(*storedValue2, "rightObjectName", "rightObjectNames", pParseDelegate2); + + for(ScenarioObject* rightObject : rightObjects){ + PaletteComponentSprite* rightPaletteComponentSprite = dynamic_cast(rightObject); + if(paletteComponentSprite->objectName == rightPaletteComponentSprite->objectName){ + + if(JSONParseUtils::hasMemberArray(*storedValue2, "rightActions")){ + ActionParser::getInstance().parseAndRunActions((*storedValue2)["rightActions"], pParseDelegate2, false); + } + + wasRightObject = true; + + if(JSONParseUtils::checkMemberBool(*storedValue2, "dontBlock", false)){ + + pPaletteNode->setOnPaletteStateChangedCallback([](PaletteNode*, PaletteComponentSprite*, bool, bool){}); + pParseDelegate2->cancelAllCompletingActions(); + + if(pNotifyDelegate2){ + pParseDelegate2->actionFinished(*storedValue2); + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey2, pParseDelegate2->getValueStorageContainerName()); + + } + + break; + } + + } + + if(!wasRightObject && JSONParseUtils::hasMemberArray(*storedValue2, "wrongActions")){ + + auto wrongObjects = ActionParser::getInstance().parseObjectOrObjects(*storedValue2, "wrongObjectName", "wrongObjectNames", pParseDelegate2); + + for(auto wrongObject : wrongObjects){ + + auto wrongPaletteComponentSprite = dynamic_cast(wrongObject); + + if(paletteComponentSprite->objectName == wrongPaletteComponentSprite->objectName){ + ActionParser::getInstance().parseAndRunActions((*storedValue2)["wrongActions"], pParseDelegate2, false); + break; + } + } + } + } + + }, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4,pStoredValueKey, pParseDelegate, pNotifyDelegate); + + paletteNode->setOnPaletteStateChangedCallback(callback); + + this->runCompletingActions(*storedValue, pParseDelegate); + }; + + auto notify = JSONParseUtils::checkMemberBool(jsonActionObject, "dontBlock", true); + return ActionParser::getInstance().embedFunctionInAction(std::bind(actionFunction, storedValueKey, parseDelegate, notifyDelegateWhenFinished), jsonActionObject, parseDelegate, notify); //todo there is some ambiguity here... dont notify now or later? will have to solve it somehow +} + + + +cocos2d::Action* BlockingActionParser::parseWaitForDragAndDropAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + auto pJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + auto objectsToDrag = ActionParser::getInstance().parseObjectOrObjects(*pJsonActionObject, "draggedObjectName", "draggedObjectNames", pParseDelegate); + + auto extendPercent = 0; + if(JSONParseUtils::hasMemberFloat(*pJsonActionObject, "draggedObjectGrabAreaExtendByPercent")){ + extendPercent = (*pJsonActionObject)["draggedObjectGrabAreaExtendByPercent"].GetFloat(); + } + auto objectsToDragExtendPercentValues = std::vector(objectsToDrag.size(), extendPercent); + + std::vector wrongDraggedObjects = ActionParser::getInstance().parseObjectOrObjects(*pJsonActionObject, "wrongDraggedObjectName", "wrongDraggedObjectNames", pParseDelegate); + + ScenarioObject* destObject = nullptr; + std::vector wrongDstObjects; + + int indexForConditionedCompletingActions = 0; + + if(JSONParseUtils::hasMemberObject(*pJsonActionObject, "randomDestinationObjectNameFrom")){ + auto detailsObject = (*pJsonActionObject)["randomDestinationObjectNameFrom"].GetObject(); + auto allDstObjects = ActionParser::getInstance().parseObjects(detailsObject["namesList"], pParseDelegate); + int index = -1; + while(destObject == nullptr){ + index = MathUtils::getRandomInt(0, allDstObjects.size()-1); + if(!dynamic_cast(allDstObjects[index])->hasContent()){//TODO parse the condition first + destObject = allDstObjects[index]; + break; + } + } + for(int i = 0; i < index; ++i){ + wrongDstObjects.push_back(allDstObjects[i]); + } + for(int i = index+1; i < allDstObjects.size(); ++i){ + wrongDstObjects.push_back(allDstObjects[i]); + } + + auto destObjSoundPath = JSONParseUtils::parseStringArray(detailsObject["correspSoundsList"])[index]; + SoundsRepo::playSound(pParseDelegate->getDefaultSoundsPath() + destObjSoundPath); + + if(JSONParseUtils::hasMemberBool(detailsObject, "determineConditionedCompletingActions")){// && //detailsObject["determineConditionedCompletingActions"].GetBool() == true){ + indexForConditionedCompletingActions = index; + } + + } else { + destObject = ActionParser::getInstance().parseObject((*pJsonActionObject)["destinationObjectName"].GetString(), pParseDelegate); + wrongDstObjects = ActionParser::getInstance().parseObjectOrObjects(*pJsonActionObject, "wrongDestinationObjectName", "wrongDestinationObjectNames", pParseDelegate); + } + + auto dndHandler = new DragAndDropHandler(ActionParser::convertToNodeArray(objectsToDrag), ActionParser::convertToNode(destObject), ActionParser::convertToNodeArray(wrongDraggedObjects), ActionParser::convertToNodeArray(wrongDstObjects)); + dndHandler->setObjectToDragExtendPercentValues(objectsToDragExtendPercentValues); + + if(JSONParseUtils::checkMemberBool(*pJsonActionObject, "moreAccurateDestinationCheck", true)){ + dndHandler->setAccurateDestinationCheck(true); + } else if(JSONParseUtils::checkMemberBool(*pJsonActionObject, "fingerOnlyDestinationCheck", true)){ + dndHandler->setFingerOnlyDestinationCheck(true); + } + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "startDraggingCorrectObjectActions")){ + dndHandler->_startDraggingCorrectObjectCallback = std::bind([&](cocos2d::Node* object, std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["startDraggingCorrectObjectActions"], p2ParseDelegate, false); + }, std::placeholders::_1, pStoredValueKey, pParseDelegate); + } + +// if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "startDraggingConcreteObjectCallbacks")){ +// +// auto allCallbacks = (*pJsonActionObject)["startDraggingConcreteObjectCallbacks"].GetArray(); +// +// for(int i = 0; i < allCallbacks.Size(); ++i){ +// +// std::string objectName = allCallbacks[i]["objectName"].GetString(); +// auto callback = std::bind([&](cocos2d::Node* wrongDraggedObject,std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ +// auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); +// ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["actions"], p2ParseDelegate, false); +// }, std::placeholders::_1, pStoredValueKey, pParseDelegate); +// dndHandler->_startDraggingConcreteObjectCallbacks.insert({objectName, callback}); +// } +// } + + std::function successCallback = std::bind([&](std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["rightActions"], p2ParseDelegate, false); + },pStoredValueKey, pParseDelegate); + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "rightActions")){ + dndHandler->_successCallback = std::bind([&](cocos2d::Node* destinationObject, cocos2d::Node* rightObject, std::function pSuccessCallback){ + if(rightObject){ + pSuccessCallback(); + } + }, std::placeholders::_1, std::placeholders::_2, successCallback); + } + + auto newTBH = dndHandler->prepareTouchBeganHandler(); + auto newTMH = dndHandler->prepareTouchMovedHandler(); + auto newTEH = dndHandler->prepareTouchEndedHandler(); + + static const std::string tbhKey = "dragNDropHandlerTBH"; + static const std::string tmhKey = "dragNDropHandlerTMH"; + static const std::string tehKey = "dragNDropHandlerTEH"; + + pParseDelegate->newTouchHandler(tbhKey, newTBH, TOUCHES_BEGAN); + pParseDelegate->newTouchHandler(tmhKey, newTMH, TOUCHES_MOVED); + pParseDelegate->newTouchHandler(tehKey, newTEH, TOUCHES_ENDED); + + std::function finalSuccessCallback = std::bind([&](cocos2d::Node* destinationObject, cocos2d::Node* rightObject, std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate, bool p2NotifyDelegate, DragAndDropHandler* pDndHandler){ + + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + + p2ParseDelegate->removeTouchHandler(tbhKey, TOUCHES_BEGAN); + p2ParseDelegate->removeTouchHandler(tmhKey, TOUCHES_MOVED); //TODO what about static strings? it's probably ok... + p2ParseDelegate->removeTouchHandler(tehKey, TOUCHES_ENDED); + + p2ParseDelegate->cancelAllCompletingActions(); + if(p2NotifyDelegate){ + p2ParseDelegate->actionFinished(*p2JsonActionObject); + } + delete pDndHandler; + ValueStorage::getInstance().removeStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + + }, std::placeholders::_1, std::placeholders::_2, pStoredValueKey, pParseDelegate, pNotifyDelegate, dndHandler); + + if(JSONParseUtils::checkMemberBool(*pJsonActionObject, "requireFullDestinationColourIn", true)){ + + dndHandler->_allowMultipleDrag = true; + auto dstObjAsColourableSprite = dynamic_cast(destObject); + std::function callbackToStore = std::bind(finalSuccessCallback, nullptr, nullptr); + auto storedCallbackKey = ValueStorage::getInstance().storeFunction(callbackToStore, pParseDelegate->getValueStorageContainerName()); + + dstObjAsColourableSprite->_autofillCallback = std::bind([&](DragAndDropHandler* pDndHandler, std::string pStoredCallbackKey, ActionParseDelegate* p2ParseDelegate){ + pDndHandler->draggedObjectMoveBack(false); + ValueStorage::getInstance().runAndRemoveStoredFunction(pStoredCallbackKey, p2ParseDelegate->getValueStorageContainerName()); + }, dndHandler, storedCallbackKey, pParseDelegate); + + } else { + dndHandler->_finalSuccessCallback = finalSuccessCallback; + } + + if(JSONParseUtils::checkMemberBool(*pJsonActionObject, "wrongDraggedObjectAllowDrag", true)){ + dndHandler->_allowDraggingWrongObjects = true; + } + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "wrongDraggedObjectActions")){ + + auto wrongObjectCallback = std::bind([&](cocos2d::Node* wrongDraggedObject,std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["wrongDraggedObjectActions"], p2ParseDelegate, false); + }, std::placeholders::_1, pStoredValueKey, pParseDelegate); + + if(dndHandler->_allowDraggingWrongObjects){ + dndHandler->_draggedWrongObjectCallback = wrongObjectCallback; + } else { + dndHandler->_startDraggingWrongObjectCallback = wrongObjectCallback; + } + } + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "wrongDestinationObjectActions")){ + dndHandler->_wrongDestinationObjectCallback = std::bind([&](cocos2d::Node* wrongDestObject,std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["wrongDestinationObjectActions"], p2ParseDelegate, false); + }, std::placeholders::_1, pStoredValueKey, pParseDelegate); + } + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "draggedObjectEnterCorrectDestinationActions")){ + dndHandler->_draggedObjectEnterCorrectDestinationCallback = std::bind([&](cocos2d::Node* draggedObject, cocos2d::Node* destinationObject,std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["draggedObjectEnterCorrectDestinationActions"], p2ParseDelegate, false); + }, std::placeholders::_1, std::placeholders::_2, pStoredValueKey, pParseDelegate); + } + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "draggedObjectEnterWrongDestinationActions")){ + dndHandler->_draggedObjectEnterWrongDestinationCallback = std::bind([&](cocos2d::Node* draggedObject, cocos2d::Node* destinationObject,std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["draggedObjectEnterWrongDestinationActions"], p2ParseDelegate, false); + }, std::placeholders::_1, std::placeholders::_2, pStoredValueKey, pParseDelegate); + } + + if(JSONParseUtils::hasMemberArray(*pJsonActionObject, "dropTooSoonActions")){ + dndHandler->_dropTooSoonCallback = std::bind([&](std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + ActionParser::getInstance().parseAndRunActions((*p2JsonActionObject)["dropTooSoonActions"], p2ParseDelegate, false); + }, pStoredValueKey, pParseDelegate); + } + + auto destObjectAsLayoutObject = dynamic_cast(destObject); + if(destObjectAsLayoutObject->className == "ChangingSprite"){ + + dndHandler->_objectDragNDropSuccessBehaviour = [&](cocos2d::Node* destinationObject, cocos2d::Node* draggedObject, cocos2d::Point startingObjectPosition){ + + draggedObject->setOpacity(0); + dynamic_cast(destinationObject)->switchSprites(); + }; + + } else if(destObjectAsLayoutObject->className == "ContainerSprite"){ + + dndHandler->_objectDragNDropSuccessBehaviour = [&](cocos2d::Node* destinationObject, cocos2d::Node* draggedObject, cocos2d::Point startingObjectPosition){ + dynamic_cast(destinationObject)->addContentNode(draggedObject); + }; + + } else if(destObjectAsLayoutObject->className == "ColourableSprite"){ + + if(JSONParseUtils::checkMemberBool(*pJsonActionObject, "requireFullDestinationColourIn", true)){ + + dndHandler->_objectDragNDropSuccessBehaviour = [&](cocos2d::Node* destinationObject, cocos2d::Node* draggedObject, cocos2d::Point startingObjectPosition){ + dynamic_cast(destinationObject)->_colouringEnabled = false; + }; + + } else { + + dndHandler->_objectDragNDropSuccessBehaviour = std::bind([&](cocos2d::Node* destinationObject, cocos2d::Node* draggedObject, cocos2d::Point startingObjectPosition, std::function pSuccessCallback){ + + auto dstColSprite = dynamic_cast(destinationObject); + dstColSprite->_autofillCallback = pSuccessCallback; + dstColSprite->startAutofillAnimation(); + draggedObject->runAction(cocos2d::MoveTo::create(0.2, startingObjectPosition)); + }, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, successCallback); + } + + } else { + + dndHandler->_objectDragNDropSuccessBehaviour = std::bind([&](cocos2d::Node* destinationObject, cocos2d::Node* draggedObject, cocos2d::Point startingObjectPosition, std::string p2ValueStorageKey, ActionParseDelegate* p2ParseDelegate){ + + auto p2JsonActionObject = ValueStorage::getInstance().getStoredValue(p2ValueStorageKey, p2ParseDelegate->getValueStorageContainerName()); + + if(JSONParseUtils::checkMemberBool(*p2JsonActionObject, "draggedObjectShouldDisappear", true)){ + draggedObject->setOpacity(0); + } else { + + cocos2d::Point draggedObjectFinalPosition = cocos2d::Point(-1, -1); + if(JSONParseUtils::hasMemberPoint(*p2JsonActionObject, "draggedObjectFinalPosition")){ + + draggedObjectFinalPosition = JSONParseUtils::getMemberPoint(*p2JsonActionObject, "draggedObjectFinalPosition"); + + } else if(JSONParseUtils::hasMemberString(*p2JsonActionObject, "draggedObjectFinalPosition")){ + + auto positionValue = ActionParser::getInstance().parseObject((*p2JsonActionObject)["draggedObjectFinalPosition"].GetString(), p2ParseDelegate); + auto castPositionValue = dynamic_cast(positionValue); + draggedObjectFinalPosition = castPositionValue->getPointValue(); + } + + if(draggedObjectFinalPosition.x != -1){ + draggedObject->runAction(cocos2d::MoveTo::create(0.2, draggedObjectFinalPosition)); + } + } + }, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, pStoredValueKey, pParseDelegate); + } + + this->runCompletingActions(*pJsonActionObject, pParseDelegate, indexForConditionedCompletingActions); + }; + + auto notify = JSONParseUtils::checkMemberBool(jsonActionObject, "dontBlock", true); + return ActionParser::getInstance().embedFunctionInAction(std::bind(actionFunction, storedValueKey, parseDelegate, notifyDelegateWhenFinished), jsonActionObject, parseDelegate, notify); +} + +cocos2d::Action* BlockingActionParser::parseWaitForObjectUnlockAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ +// if(jsonActionObject.objectName == null){ +// log("BlockingActionParser: parseWaitForObjectUnlockAction: objectName must not be null."); +// return null; +// } + + auto unlockingObject = parseDelegate->getObjectByName(jsonActionObject["objectName"].GetString()); + +// if(unlockingObject == null){ +// log("BlockingActionParser: parseWaitForObjectUnlockAction: no object with given objectName. Unlocking object must not be null."); +// return null; +// } + + std::function actionFunction = [&](){}; + auto className = unlockingObject->getClassName(); + + if(className == "ColourableSprite"){ + actionFunction = this->parseWaitForObjectUnlockActionFunction_ColourableSprite(dynamic_cast(unlockingObject), jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } +// else { +// log("BlockingActionParser: parseWaitForObjectUnlockAction: cannot determine object type. Unlocking object must have the classNAme specified."); + +// } + + auto notify = JSONParseUtils::checkMemberBool(jsonActionObject, "dontBlock", true); + return ActionParser::getInstance().embedFunctionInAction(actionFunction, jsonActionObject, parseDelegate, notify); +} + +std::function BlockingActionParser::parseWaitForObjectUnlockActionFunction_ColourableSprite(ColourableSprite* unlockingObject, const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate, ColourableSprite* pUnlockingObject){ + + auto storedValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + auto newTouchBeganHandler = std::bind([&](cocos2d::Touch* touch, cocos2d::Event* event, std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate, ColourableSprite* p2UnlockingObject){ + + auto storedValue2 = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + + if(!GeometryUtils::getBoundingBoxToWorld(p2UnlockingObject).containsPoint(touch->getLocation())){ + + if(JSONParseUtils::hasMemberArray(*storedValue2, "wrongActions")){ + + auto wrongObjects = ActionParser::getInstance().parseObjectOrObjects(*storedValue2, "wrongObjectName", "wrongObjectNames", p2ParseDelegate); + auto wrongNodes = ActionParser::getInstance().convertToNodeArray(wrongObjects); + + for(int j = 0; j < wrongNodes.size(); ++j){ + + if(GeometryUtils::getBoundingBoxToWorld(wrongNodes[j]).containsPoint(touch->getLocation())){ + ActionParser::getInstance().parseAndRunActions((*storedValue2)["wrongActions"], p2ParseDelegate, false); + break; + } + } + } + + } else if(JSONParseUtils::hasMemberArray(*storedValue2, "rightActions")) { + + ActionParser::getInstance().parseAndRunActions((*storedValue2)["rightActions"], p2ParseDelegate, false); + + } + + return false; + }, std::placeholders::_1, std::placeholders::_2, pStoredValueKey, pParseDelegate, pUnlockingObject); + + static const std::string nthKey = "waitForColourableSpriteTBH"; + pParseDelegate->newTouchHandler(nthKey, newTouchBeganHandler, TOUCHES_BEGAN); + + pUnlockingObject->_autofillCallback = std::bind([&](std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate, bool p2NotifyDelegate){ + + auto storedValue2 = ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + + p2ParseDelegate->removeTouchHandler(nthKey, TOUCHES_BEGAN); //TODO what about nth key? + + p2ParseDelegate->cancelAllCompletingActions(); + if(p2NotifyDelegate){ + p2ParseDelegate->actionFinished(*storedValue2); + } + ValueStorage::getInstance().removeStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); + }, pStoredValueKey, pParseDelegate, pNotifyDelegate); + + this->runCompletingActions(*storedValue, pParseDelegate); + }; + + return std::bind(actionFunction, storedValueKey, parseDelegate, notifyDelegateWhenFinished, unlockingObject); +} + +// helper functions + +//TODO descriptions + +void BlockingActionParser::runCompletingActions(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, int indexForConditionedActions) +{ + if(JSONParseUtils::hasMemberArray(jsonActionObject, "completingActions")){ + + auto randomTagBase = MathUtils::getRandomInt(0,10000); + const auto& array = jsonActionObject["completingActions"]; + + for(int i = 0; i < array.Size(); ++i){ + auto action = ActionParser::getInstance().parseJSONAction(array[i], parseDelegate, false); + if(action){ + action->setTag(randomTagBase+i); + parseDelegate->runCompletingAction(action); + } + } + + } else if(JSONParseUtils::hasMemberArray(jsonActionObject, "conditionedCompletingActions")){ + + auto randomTagBase = MathUtils::getRandomInt(0,10000); + const auto& array = jsonActionObject["conditionedCompletingActions"].GetArray()[indexForConditionedActions]; + + for(int i = 0; i < array.Size(); ++i){ + auto action = ActionParser::getInstance().parseJSONAction(array[i], parseDelegate, false); + if(action){ + action->setTag(randomTagBase+i); + parseDelegate->runCompletingAction(action); + } + } + } + +} diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/BlockingActionParser.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/BlockingActionParser.h new file mode 100644 index 0000000..120cdd8 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/BlockingActionParser.h @@ -0,0 +1,40 @@ +// +// BlockingActionParser.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 31.05.2017. +// +// + +#ifndef BlockingActionParser_h +#define BlockingActionParser_h + +#include "ActionParser.h" +#include "ColourableSprite.h" + +class BlockingActionParser +{ + public: + + static BlockingActionParser& getInstance() + { + static BlockingActionParser instance; + return instance; + }; + + cocos2d::Action* parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished = true); + + protected: + cocos2d::Action* parseCallFunctionWithBlockingAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseWaitForTouchAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseWaitForPaletteComponentAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseWaitForDragAndDropAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseWaitForObjectUnlockAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + + std::function parseWaitForObjectUnlockActionFunction_ColourableSprite(ColourableSprite* unlockingObject, const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + + void runCompletingActions(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, int indexForConditionedActions = 0); +}; + + +#endif /* BlockingActionParser_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/RepeatedActionScheduler.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/RepeatedActionScheduler.cpp new file mode 100644 index 0000000..e853fb5 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/RepeatedActionScheduler.cpp @@ -0,0 +1,109 @@ +// +// RepeatedActionScheduler.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 27.05.2017. +// +// + +#include +#include "RepeatedActionScheduler.h" +#include "ActionParser.h" +#include "JSONParseUtils.h" +#include "MiscUtils.h" +#include "ValueStorage.h" + +void RepeatedActionScheduler::clearAllScheduledActions(ActionParseDelegate* parseDelegate) +{ + for(auto pair : _scheduledActionsData){ + parseDelegate->unschedule(pair.second.callbackKey); + ValueStorage::getInstance().removeStoredValue(pair.second.storedValueKey, parseDelegate->getValueStorageContainerName()); + } + + _scheduledActionsData.clear(); + _waitingFunctions.clear(); +} + +//todo write all the stuff we can put to the repeated saction e.g. stpCondition (??) +cocos2d::Action* RepeatedActionScheduler::scheduleActionIfNeeded(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished){ + + // if given action is a repeated action and it is not already scheduled + if(this->isActionValidRepeatedAction(jsonActionObject)){ + + std::string actionTag = jsonActionObject["repeatActionTag"].GetString(); + if(_scheduledActionsData.find(actionTag) == _scheduledActionsData.end()){ + + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto repeatedFunction = [&](float dt, std::string pStoredValueKey, ActionParseDelegate* pParseDelegate, bool pNotifyDelegate){ + + auto& actionParser = ActionParser::getInstance(); + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + std::string stopCondition; + if(JSONParseUtils::hasMemberBool(*storedJsonActionObject, "stopCondition")){ + stopCondition = MiscUtils::boolToString((*storedJsonActionObject)["stopCondition"].GetBool()); + } else { + stopCondition = (*storedJsonActionObject)["stopCondition"].GetString(); + } + + std::string repeatActionTag = (*storedJsonActionObject)["repeatActionTag"].GetString(); + + if(actionParser.checkCondition(stopCondition, pParseDelegate) == true){ + pParseDelegate->unschedule(repeatActionTag); + _scheduledActionsData.erase(repeatActionTag); + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + } else { + + auto repeatIntervalSeconds = (*storedJsonActionObject)["repeatIntervalSeconds"].GetFloat(); + auto repeatTimeSinceUserInteraction = (*storedJsonActionObject)["repeatTimeSinceUserInteraction"].GetFloat(); + + auto now = cocos2d::utils::getTimeInMilliseconds(); + auto timeSinceLastRun = _scheduledActionsData[repeatActionTag].lastTimeRun == -1 ? repeatIntervalSeconds + 1 : (now - _scheduledActionsData[repeatActionTag].lastTimeRun)/1000; + + auto lastTouchTime = pParseDelegate->getLastScreenTouchTime(); + auto timeSinceLastUserTouch = lastTouchTime == -1 ? repeatIntervalSeconds + 1 : (now - lastTouchTime)/1000.0; + + if(_scheduledActionsData.find(repeatActionTag) != _scheduledActionsData.end() && (timeSinceLastRun >= repeatIntervalSeconds && timeSinceLastUserTouch >= repeatTimeSinceUserInteraction)){ + + actionParser.parseAndRunAction(*storedJsonActionObject, pParseDelegate, pNotifyDelegate); + + if(_scheduledActionsData.find(repeatActionTag) != _scheduledActionsData.end()){ + _scheduledActionsData[repeatActionTag].lastTimeRun = now; + } + + } + } + }; + + std::function boundRepeatedFunction = std::bind(repeatedFunction, std::placeholders::_1, storedValueKey, parseDelegate, notifyDelegateWhenFinished); + + _waitingFunctions.insert({actionTag, boundRepeatedFunction}); + + auto actionFunction = [&](std::string pStoredValueKey, std::string pActionTag, ActionParseDelegate* pParseDelegate){ +// log("scheduling repeated funciton"); + ScheduledActionsData data; + data.lastTimeRun = -1; + data.callbackKey = pActionTag; + data.storedValueKey = pStoredValueKey; + _scheduledActionsData[pActionTag] = data; + if(_waitingFunctions.find(pActionTag) != _waitingFunctions.end()){ + auto pRepeatedFunction = _waitingFunctions.at(pActionTag); + pParseDelegate->schedule(pRepeatedFunction, pActionTag, 1); + _waitingFunctions.erase(pActionTag); + } + }; + + return ActionParser::getInstance().embedFunctionInAction(std::bind(actionFunction, storedValueKey, actionTag, parseDelegate), jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + + } + } + + return NULL; +} + +bool RepeatedActionScheduler::isActionValidRepeatedAction(const rapidjson::Value& jsonActionObject) +{ //todo maybe introduce such method to all parsed actions + return JSONParseUtils::checkMemberBool(jsonActionObject, "repeat", true) && JSONParseUtils::hasMemberFloat(jsonActionObject, "repeatIntervalSeconds") && JSONParseUtils::hasMemberString(jsonActionObject, "repeatActionTag"); +} diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/RepeatedActionScheduler.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/RepeatedActionScheduler.h new file mode 100644 index 0000000..e7ea6bf --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/RepeatedActionScheduler.h @@ -0,0 +1,47 @@ +// +// RepeatedActionScheduler.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 27.05.2017. +// +// + +#ifndef RepeatedActionScheduler_h +#define RepeatedActionScheduler_h + +#include "json/document.h" +#include +#include +#include "cocos2d.h" + + +class ActionParseDelegate; + +class RepeatedActionScheduler +{ + public: + + struct ScheduledActionsData + { + std::string callbackKey; + std::string storedValueKey; + long long lastTimeRun; + }; + + static RepeatedActionScheduler& getInstance() + { + static RepeatedActionScheduler instance; + return instance; + }; + + void clearAllScheduledActions(ActionParseDelegate* parseDelegate); + cocos2d::Action* scheduleActionIfNeeded(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + bool isActionValidRepeatedAction(const rapidjson::Value& jsonActionObject); + + protected: + + std::map _scheduledActionsData; + std::map> _waitingFunctions; +}; + +#endif /* RepeatedActionScheduler_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioHandler.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioHandler.cpp new file mode 100644 index 0000000..df3745f --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioHandler.cpp @@ -0,0 +1,718 @@ +// +// ScenarioHandler.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 23.05.2017. +// +// + +#include +#include "ScenarioHandler.h" +#include "SoundsRepo.h" +#include "JSONParseUtils.h" +#include "ActionParser.h" +#include "ParentScene.h" +#include "RepeatedActionScheduler.h" +#include "MathUtils.h" +#include "ResourceUtilities.h" +#include "ValueStorage.h" +#include "TimeIndicatorInterface.h" + +const std::string ScenarioHandler::DEMO_STATE_UNINITIALIZED = "UNINITIALIZED"; +const std::string ScenarioHandler::DEMO_STATE_PLAYING = "PLAYING"; +const std::string ScenarioHandler::DEMO_STATE_FINISHED = "FINISHED"; +const std::string ScenarioHandler::DEMO_STATE_NEVER_PLAYED = "NEVER_PLAYED"; + +ScenarioHandler::ScenarioHandler(ParentScene* scene) +{ + _scene = scene; + _soundsResFolder = ""; + _altSoundsResFolder = ""; + _cachedJSONData = NULL; + _cachedJSONString = ""; + static int valueStorageKeyNumber = 0; + valueStorageKeyNumber = (valueStorageKeyNumber + 1)%100; + _valueStorageContainerName = "ScenarioHandlerValues" + std::to_string(valueStorageKeyNumber); + _shouldSkipLayoutReloadOnFastForward = false; + this->clearSetup(); +} + +ScenarioHandler::~ScenarioHandler() +{ + this->end(); +} + +void ScenarioHandler::clearSetup() +{ + _scene->clearTouchHandlers(); + _scene->resetLastUserTouchTimes(); + + _lastActionIndex = -1; + _currentCompletingActionTags.clear(); + + _scenarioPaused = false; + _scenarioBarred = false; + _scenarioFinished = false; + + _predefinedActions.clear(); + _loopActionCounters.clear(); + _storedSoundIds.clear(); + + _demoState = DEMO_STATE_UNINITIALIZED; + + this->clearAllScheduledActions(); + + for(auto pair : _predefinedActions){ + delete pair.second; + } + _predefinedActions.clear(); + + for(auto action : _actionsSequence){ + delete action; + } + _actionsSequence.clear(); + + //TODO --> cleanup +} + +void ScenarioHandler::end() //TODO: clear steup? +{ + this->clearSetup(); + + if(_cachedJSONData){ + delete _cachedJSONData; + _cachedJSONData = nullptr; + } + + _cachedJSONString = ""; +} + +void ScenarioHandler::loadScenarioFromJSONString(std::string jsonString, bool skipDemoActions) +{ + _cachedJSONString = jsonString; + rapidjson::Document doc; + doc.Parse(jsonString.c_str()); + + this->loadScenarioFromJSONObject(doc, skipDemoActions); +} +// handling scenario and actions + +void ScenarioHandler::loadScenarioFromJSONObject(const rapidjson::Value& jsonObject, bool skipDemoActions, bool isReplay) +{ + rapidjson::Document* copy = new rapidjson::Document(); //in case we pass _cachedJSONData as jsonObject + copy->CopyFrom(jsonObject, copy->GetAllocator()); + + if(_cachedJSONData){ + delete _cachedJSONData; + } + _cachedJSONData = copy; + + for(auto pair : _predefinedActions){ + delete pair.second; + } + _predefinedActions.clear(); + + _soundsResFolder = (*_cachedJSONData)["soundResFolder"]["path"].GetString(); + _soundsResFolder = ResourceUtilities::getInstance().getFullPathForDownloadedFile(_soundsResFolder, false); + _altSoundsResFolder = ""; + if(JSONParseUtils::hasMemberString(((*_cachedJSONData)["soundResFolder"]), "alternativePath")){ + _altSoundsResFolder = (*_cachedJSONData)["soundResFolder"]["alternativePath"].GetString(); + _altSoundsResFolder = ResourceUtilities::getInstance().getFullPathForDownloadedFile(_altSoundsResFolder, false); + } + + if(JSONParseUtils::hasMemberObject((*_cachedJSONData), "predefinedActions")){ + const auto& predefinedActionsData = (*_cachedJSONData)["predefinedActions"]; + for(const auto& pair : predefinedActionsData.GetObject()){ + rapidjson::Value* val = new rapidjson::Value(); + val->CopyFrom(pair.value, _cachedJSONData->GetAllocator()); //!!!TODO crashes? should crash on using predefined aciton probably? + std::string name = pair.name.GetString(); + _predefinedActions.insert({name, val}); + } + } + + for(auto action : _actionsSequence){ + delete action; + } + _actionsSequence.clear(); + int nDemoActions = 0; + + auto actionsArrayJSON = (*_cachedJSONData)["actions"].GetArray(); + + for(int i = 0; i < actionsArrayJSON.Size(); ++i){ + + if(JSONParseUtils::checkMemberBool(actionsArrayJSON[i], "demoAction", true)){ + ++nDemoActions; + if(skipDemoActions){ + continue; + } + } else if(!skipDemoActions && JSONParseUtils::checkMemberBool(actionsArrayJSON[i], "doNotPlayAfterDemo", true)){ + continue; + } else if(!isReplay && JSONParseUtils::checkMemberBool(actionsArrayJSON[i],"onReplayOnly", true)){ + continue; + } + + if(actionsArrayJSON[i]["actionType"] == "randomizedOrderActionSets"){ + + auto& actionSets = actionsArrayJSON[i]["actionSets"]; + std::vector actionSetsVector; +// for(const auto& actionSet : actionSets.GetArray()){ +// actionSetsVector.push_back(&actionSet); +// } +// MathUtils::shuffleArray(actionSetsVector); // crashes randomly when this is run. Probably because of the behaviour of the copy constructor of rapidjson::Value objects. + + std::vector shuffleHelperArray; // an int array, on the other hand, can be shuffled + shuffleHelperArray.reserve(actionSets.Size()); + for(int i = 0; i < actionSets.Size(); ++i){ + shuffleHelperArray.push_back(i); + } + MathUtils::shuffleArray(shuffleHelperArray); + + auto actionSetsArray = actionSets.GetArray(); + for(int i = 0; i < shuffleHelperArray.size(); ++i){ + int j = shuffleHelperArray[i]; + actionSetsVector.push_back(&actionSetsArray[j]); + } + + for(int j = 0; j < actionSetsVector.size(); ++j){ + auto actions = actionSetsVector[j]->GetArray(); + + for(int k = 0; k < actions.Size(); ++k){ + this->prepareAction(&actions[k]); + } + } + + } else { + this->prepareAction(&actionsArrayJSON[i]); + } + } + + if(nDemoActions == 0){ + _scene->disableFastForwardButton(); + } + + this->trimActions(_actionsSequence); + this->mergeSequences(_actionsSequence); + + this->preloadSoundEffects(_actionsSequence); +} + +void ScenarioHandler::prepareAction(const rapidjson::Value* action) +{ + std::string actionType = (*action)["actionType"].GetString(); + if(actionType == "callPredefinedAction"){ + + rapidjson::Value* predefinedAction = new rapidjson::Value(); + predefinedAction->CopyFrom(*_predefinedActions[(*action)["actionId"].GetString()], _cachedJSONData->GetAllocator()); + _actionsSequence.push_back(predefinedAction); + + } else if(actionType == "callRandomPredefinedAction"){ + + auto actionIdsJSON = (*action)["actionIds"].GetArray(); + auto randIndex = MathUtils::getRandomInt(0,actionIdsJSON.Size() - 1); + rapidjson::Value* predefinedAction = new rapidjson::Value(); + predefinedAction->CopyFrom(*_predefinedActions[actionIdsJSON[randIndex].GetString()], _cachedJSONData->GetAllocator()); + _actionsSequence.push_back(predefinedAction); + + } else { + + rapidjson::Value* actionCopy = new rapidjson::Value(); + actionCopy->CopyFrom(*action, _cachedJSONData->GetAllocator()); + _actionsSequence.push_back(actionCopy); + } +}; + +void ScenarioHandler::trimActions(std::vector& actions) +{ + int i = 0; + std::vector actionsToTrim; + + while(i < actions.size()){ + if(JSONParseUtils::hasMemberInt(*actions[i], "trimPreviousActions")){ + auto trimBy = (*actions[i])["trimPreviousActions"].GetInt(); + for(int j = MAX(0, i - trimBy); j < i; ++j){ + if(std::find(actionsToTrim.begin(), actionsToTrim.end(), j) == actionsToTrim.end()){ + actionsToTrim.push_back(j); + } + } + } + ++i; + } + + for(int k = (int)actionsToTrim.size()-1; k >= 0; --k){ + actions.erase(actions.begin() + actionsToTrim[k], actions.begin() + actionsToTrim[k] + 1); + } +} + +void ScenarioHandler::mergeSequences(std::vector& actions) +{ + int i = (int)actions.size()-1; + while(i > 0){ + + if(JSONParseUtils::checkMemberString(*actions[i], "actionType", "sequence") && JSONParseUtils::checkMemberString(*actions[i-1], "actionType", "sequence")){ + if(JSONParseUtils::checkMemberInt(*actions[i], "trimPreviousSequence", 1)){ + actions.erase(actions.begin() + i - 1, actions.begin() + i); + } else { //TODO powinno dzialac ale jak nie to to tez trzeba odkomentowac i poprawic +// rapidjson::Value newVal; +// newVal.CopyFrom(*actions[i-1], _cachedJSONData->GetAllocator()); +// actions[i-1] = &newVal; +// auto arr = (*actions[i])["actions"].GetArray(); +// for(int j = 0; j < arr.Size(); ++j){ +// arr.PushBack((*actions[i])["actions"].GetArray()[j]); +// } +// +// actions.erase(actions.begin() + i, actions.begin() + i + 1); + } + } + --i; + } +} + +void ScenarioHandler::reloadScenario(bool skipDemo, bool isReplay) +{ + if(_cachedJSONData){ +// if(_cachedJSONString != ""){ +// this->loadScenarioFromJSONString(_cachedJSONString, skipDemo); + this->loadScenarioFromJSONObject(*_cachedJSONData, skipDemo, isReplay); + } +} + +// scenario + +void ScenarioHandler::runScenario() +{ + if(_scenarioPaused){ + return; + } + + if(_scenarioFinished || (_lastActionIndex >= (int)_actionsSequence.size()-1)){ + ActionParser::getInstance().cleanUp(this); + return; + } + + auto i = _lastActionIndex+1; + auto currentAction = _actionsSequence[i]; + +// std::string actionType = (*currentAction)["actionType"].GetString(); +// if(actionType == "wait"){ +// if(i < _actionsSequence.size()-1){ +// auto nextAction = _actionsSequence[i+1]; +// if(JSONParseUtils::hasMemberBool(*nextAction, "ignoreWaitBefore") && (*nextAction)["ignoreWaitBefore"].GetBool() == true){ +// // skip action +// _lastActionIndex = i; +// if(i >= _actionsSequence.size()-1){ +// _scenarioFinished = true; +// } +// this->runScenario(); +// } +// } +// } + +// log("action index: "+i+" action type: "+currentAction.actionType); + + auto parsedAction = ActionParser::getInstance().parseJSONAction(*currentAction, this); + + _lastActionIndex = i; + + if(i >= _actionsSequence.size()-1){ + _scenarioFinished = true; + } + + if(parsedAction == NULL){ + this->runScenario(); + } else { + this->runAction(parsedAction); + } +} + +void ScenarioHandler::pauseScenario() +{ + _scenarioPaused = true; +} + +void ScenarioHandler::resumeScenario() +{ + _scenarioPaused = false; +} + +void ScenarioHandler::resetScenario(bool skipDemo, bool reloadLayout) +{ + this->pauseScenario(); + this->stopAllActions(); + this->clearAllScheduledActions(); + _scene->unscheduleAllCallbacks(); + SoundsRepo::stopAllSounds(); + + ActionParser::getInstance().cleanUp(this); + + this->clearSetup(); + if(reloadLayout){ + _scene->reloadLayoutClean(); + } +// _scene->removeAllChildren(); //change all references to scene to more liberal i.e. e.g. here leave these concrete lines to the scene and just put "onResetScenario" or something +// _scene->loadLayout(true); //TODO memory leaks? + + if(skipDemo){ + _scene->disableFastForwardButton(); + } else { + skipDemo = _scene->_alwaysSkipDemo; + } + + this->reloadScenario(skipDemo, skipDemo && reloadLayout); // we hit replay if we skip the demo and do not reload layuot. TODO: make it more flexible. the detcetion, that is./ maybe 3rd param in the resetScenario func. + this->runScenario(); +} + +// sound + +void ScenarioHandler::preloadSoundEffects(std::vector actions) +{ + for (auto actionObject : actions) { + this->preloadSoundEffects(*actionObject); + } +} + +void ScenarioHandler::preloadSoundEffects(const rapidjson::Value& actionObject) +{ + if(actionObject.IsObject()){ + if(JSONParseUtils::hasMemberArray(actionObject, "actions")){ + for(const auto& value : actionObject["actions"].GetArray()){ + this->preloadSoundEffects(value); + } + } + + else if(JSONParseUtils::checkMemberString(actionObject, "actionType", "playSound") && JSONParseUtils::checkMemberInt(actionObject, "needsPreload", 1)){ + if(JSONParseUtils::hasMemberString(actionObject, "sound")){ + auto soundFilename = actionObject["sound"].GetString(); + auto soundPath = JSONParseUtils::checkMemberBool(actionObject, "useAlternativePath", true) ? _altSoundsResFolder + soundFilename : _soundsResFolder + soundFilename; + SoundsRepo::preloadSoundEffect(soundPath); +// CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(soundPath.c_str()); + } + } + } +} + +void ScenarioHandler::stopAllSoundEffects() +{ + SoundsRepo::stopAllSounds(); +// CocosDenshion::SimpleAudioEngine::getInstance()->stopAllEffects(); +} + + //debug +//void ScenarioHandler::jumpToLastAction : function(){ +// +// this.lastActionIndex = this.actionsSequence.length - 2; +// this.runScenario(); +// +// }, + + +// ActionParseDelegate + +ScenarioObject* ScenarioHandler::getObjectByName (std::string objectName) +{ + return _scene->getObjectByName(objectName); +} + +ScenarioObject* ScenarioHandler::getDefaultObjectForAction(std::string actionType) +{ + return _scene; +} + +ScenarioObject* ScenarioHandler::getDefaultObjectForConditionCheck() +{ + return _scene; +} + +void ScenarioHandler::addNewObject(std::string objectName, ScenarioObject* newObject) +{ + _scene->addNewObject(objectName, newObject); +} + +std::string ScenarioHandler::getDefaultSoundsPath() +{ + return _soundsResFolder; +} + +std::string ScenarioHandler::getAlternativeSoundsPath() +{ + return _altSoundsResFolder; +} + +std::string ScenarioHandler::getValueStorageContainerName() +{ + return _valueStorageContainerName; +} + +void ScenarioHandler::runAction(cocos2d::Action* action) +{ + _scene->runAction(action); +} + +void ScenarioHandler::actionFinished(const rapidjson::Value& jsonActionObject) +{ + this->runScenario(); +} + +void ScenarioHandler::runInstantly(std::function actionFunction) +{ + actionFunction(); +} + +void ScenarioHandler::runCompletingAction(cocos2d::Action* action) +{ + _currentCompletingActionTags.push_back(action->getTag()); + _scene->runAction(action); +} + +void ScenarioHandler::cancelAllCompletingActions() +{ + for(const auto& actionTag : _currentCompletingActionTags){ + _scene->stopActionByTag(actionTag); + } + + _currentCompletingActionTags.clear(); +} + +void ScenarioHandler::schedule(std::function callback, std::string key, float delay) +{ + _scene->schedule(callback, delay, key); +} + +void ScenarioHandler::scheduleOnce(const std::function callback, float delay, std::string key) +{ + _scene->scheduleOnce(callback, delay, key); +} + +void ScenarioHandler::unschedule(std::string key) +{ + _scene->unschedule(key); +} + +void ScenarioHandler::newTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType) +{ + _scene->addTouchHandler(key, touchHandler, touchType); +} + +void ScenarioHandler::removeTouchHandler(std::string key, TouchHandlerType touchHandlerType) +{ + _scene->removeTouchHandler(key, touchHandlerType); +} + +long long ScenarioHandler::getLastScreenTouchTime() +{ + return _scene->getLastScreenTouchTime(); +} + +int ScenarioHandler::getLoopActionCounter(std::string loopId) +{ + if(_loopActionCounters.find(loopId) == _loopActionCounters.end()){ + return -1; + } + return _loopActionCounters[loopId]; +} + +int ScenarioHandler::addNewLoopActionCounter(std::string loopId, int timesRepeated) +{ + _loopActionCounters[loopId] = timesRepeated; + return _loopActionCounters[loopId]; +} + +int ScenarioHandler::decrementLoopActionCounter(std::string loopId) +{ + _loopActionCounters[loopId] = _loopActionCounters[loopId] - 1; + return _loopActionCounters[loopId]; +} + +void ScenarioHandler::deleteLoopActionCounter(std::string loopId) +{ + _loopActionCounters.erase(loopId); +} + +void ScenarioHandler::setLastActionIndex(int index) +{ + _lastActionIndex = index; +} + +void ScenarioHandler::storeSoundId(std::string soundPath, unsigned int newSoundId) +{ + _storedSoundIds[soundPath] = newSoundId; +} + +unsigned int ScenarioHandler::removeStoredSoundId(std::string soundPath) +{ + if(_storedSoundIds.find(soundPath) != _storedSoundIds.end()){ + auto soundId = _storedSoundIds[soundPath]; + _storedSoundIds.erase(soundPath); + return soundId; + } + + return -1; +} + +//addiitonal convenience methods + +void ScenarioHandler::stopAllActions() +{ + _scene->stopAllActions(); +} + +void ScenarioHandler::clearAllScheduledActions() +{ + RepeatedActionScheduler::getInstance().clearAllScheduledActions(this); +} + +// ScenarioObject + +// ScenarioObject + +void ScenarioHandler::setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) +{ + if (propertyName == "demoState") { + auto value = newValue.GetString(); + if(DEMO_STATE_PLAYING == value){ + _demoState = DEMO_STATE_PLAYING; + } + else if(DEMO_STATE_FINISHED == value){ + _demoState = DEMO_STATE_FINISHED; + } + else if(DEMO_STATE_UNINITIALIZED == value){ + _demoState = DEMO_STATE_UNINITIALIZED; + } + else if(DEMO_STATE_NEVER_PLAYED == value){ + _demoState = DEMO_STATE_NEVER_PLAYED; + } + } else if(propertyName == "shouldSkipLayoutReloadOnFastForward"){ + _shouldSkipLayoutReloadOnFastForward = newValue.GetBool(); + } +} + +void ScenarioHandler::callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback) +{ + if(methodName == "clearAllScheduledActions"){ + this->clearAllScheduledActions(); + } else if(methodName == "stopActionByTag"){ + if((*arguments).IsArray()) { + const auto ¶ms = (*arguments).GetArray(); + const auto &tag = params[0].GetInt(); + _scene->stopActionByTag(tag); + } + } else if(methodName == "dismiss"){ + cocos2d::Director::getInstance()->popScene(); + } else if(methodName == "startTimer"){ + if((*arguments).IsArray()){ + const auto& params = (*arguments).GetArray(); + const auto& totalTime = params[0].GetFloat(); + const auto& step = params[1].GetFloat(); + const auto& actionsOnProgressStep = &(params[2]); //params[1];//.GetArray(); + const auto& actionsOnTimeUp = &(params[3]); + const auto& finishScenarioOnTimeUp = params[4].GetBool(); + const auto& timeIndicatorName = params[5].GetString(); + startTimer(totalTime, step, actionsOnProgressStep, actionsOnTimeUp, finishScenarioOnTimeUp, timeIndicatorName); + } + } else if(methodName == "stopTimer"){ + stopTimer(); + } else if(methodName == "pauseTimer"){ + pauseTimer(); + } else if(methodName == "resumeTimer"){ + resumeTimer(); + } + +} + +void ScenarioHandler::startTimer(float pTimeToFinish, float step, const rapidjson::Value* actionsOnProgressStep, const rapidjson::Value* actionsOnTimeUp, bool finishScenarioAfterTimeUp, std::string timeIndicatorObjectName){ + + _timerRunning = true; + _timerStep = step; + _totalTimerTime = pTimeToFinish; + _timePassed = 0; + _timeSlider = dynamic_cast(_scene->getObjectByName(timeIndicatorObjectName)); + if (_timeSlider != nullptr) { + _timeSlider->setProgress(0); + _timeSlider->startTimeAnimation(pTimeToFinish); + } + + _actionsOnTimerUp.clear(); + auto array = actionsOnTimeUp->GetArray(); + for(int i = 0; i < array.Size(); ++i){ + const rapidjson::Value& action = array[i]; + rapidjson::Value* actionCopy = new rapidjson::Value(); + actionCopy->CopyFrom(action, _cachedJSONData->GetAllocator()); + _actionsOnTimerUp.push_back(actionCopy); + } + + this->schedule([&](float timeElapsed){ + + _timePassed += timeElapsed; +// if (_timeSlider != nullptr) { +// _timeSlider->setProgressFrac(_timePassed / _totalTimerTime); +// } + + if(_timePassed >= _totalTimerTime){ + stopTimer(); + pauseScenario(); + stopAllActions(); + clearAllScheduledActions(); + _scene->unscheduleAllCallbacks(); //TODO: this doesn't work here. We still have one waitingFunction trying to be scheduled after this in the RepeatedActionScheduler!!! + SoundsRepo::stopAllSounds(); +// if (finishScenarioAfterTimeUp) { + clearSetup(); +// } + simpleCopyActionsToMainSequence(_actionsOnTimerUp); + runScenario(); + } /*else { + //TODO execute on timer progress actions + }*/ + + + }, "timerStep", step); +} + +void ScenarioHandler::stopTimer(){ + if (_timeSlider != nullptr) { + _timeSlider->stopTimeAnimation(); + } + _timerRunning = false; + unschedule("timerStep"); + +//// if(timeout){ +// simpleCopyActionsToMainSequence(_actionsOnTimerUp); +//// } /*else { +// simpleCopyActionsToMainSequence(_actionsOnTimerStopped); +// }*/ +} + +void ScenarioHandler::pauseTimer(){ + _timerRunning = false; + if (_timeSlider != nullptr) { + _timeSlider->stopTimeAnimation(); + } + unschedule("timerStep"); +} + +void ScenarioHandler::resumeTimer(){ + if(_timerRunning) return; + + if (_timeSlider != nullptr) { + _timeSlider->startTimeAnimation(_totalTimerTime - _timePassed); + } + + this->schedule([&](float timeElapsed){ + + _timePassed += timeElapsed; + if(_timePassed >= _totalTimerTime){ + stopTimer(); + clearSetup(); + simpleCopyActionsToMainSequence(_actionsOnTimerUp); + runScenario(); + } + + }, "timerStep", _timerStep); +} + +void ScenarioHandler::simpleCopyActionsToMainSequence(std::vector actions){ + for(int i = 0; i < actions.size(); ++i){ + this->prepareAction(actions[i]); + } +} + + + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioHandler.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioHandler.h new file mode 100644 index 0000000..71855e6 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioHandler.h @@ -0,0 +1,133 @@ +// +// ScenarioHandler.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 23.05.2017. +// +// + +#ifndef ScenarioHandler_h +#define ScenarioHandler_h + +#include "json/document.h" +#include "LayoutObject.h" +//#include "ScenarioObject.h" +#include "ActionParser.h" +#include "TimeIndicatorInterface.h" + +class ParentScene; + +class ScenarioHandler : public ScenarioObject, public ActionParseDelegate +{ + public: + + static const std::string DEMO_STATE_UNINITIALIZED; + static const std::string DEMO_STATE_PLAYING; + static const std::string DEMO_STATE_FINISHED; + static const std::string DEMO_STATE_NEVER_PLAYED; + + ScenarioHandler(ParentScene* scene); + virtual ~ScenarioHandler(); + + virtual void end(); + virtual void loadScenarioFromJSONString(std::string jsonString, bool skipDemoActions); + virtual void loadScenarioFromJSONObject(const rapidjson::Value& jsonObject, bool skipDemoActions, bool isReplay = false); + virtual void reloadScenario(bool skipDemo, bool isReplay); + virtual void runScenario(); + virtual void pauseScenario(); + virtual void resumeScenario(); + virtual void resetScenario(bool skipDemo, bool reloadLayout = true); + + virtual std::string getDemoState(){ return _demoState; }; + virtual void stopAllActions(); + + // sounds + + void preloadSoundEffects(std::vector actions); + void preloadSoundEffects(const rapidjson::Value& action); + void stopAllSoundEffects(); + + // timer + void startTimer(float pTimeToFinish, float step, const rapidjson::Value* actionsOnProgressStep, const rapidjson::Value* actionsOnTimeUp, bool finishScenarioAfterTimeUp, std::string timeIndicatorObjectName); + void stopTimer(); + void pauseTimer(); + void resumeTimer(); + + + // ActionParseDelegate + virtual ScenarioObject* getObjectByName(std::string objectName) override; + virtual ScenarioObject* getDefaultObjectForAction(std::string actionType) override; + virtual ScenarioObject* getDefaultObjectForConditionCheck() override; + virtual void addNewObject(std::string objectName, ScenarioObject* newObject) override; + virtual std::string getDefaultSoundsPath() override; + virtual std::string getAlternativeSoundsPath() override; + virtual std::string getValueStorageContainerName() override; + virtual void runAction(cocos2d::Action* action) override; + virtual void actionFinished(const rapidjson::Value& jsonActionObject) override; + virtual void runInstantly(std::function actionFunction) override; + virtual void runCompletingAction(cocos2d::Action* action) override; + virtual void cancelAllCompletingActions() override; + virtual void schedule(std::function callback, std::string key, float delay) override; + virtual void scheduleOnce(std::function callback, float delay, std::string key) override; + virtual void unschedule(std::string key) override; + virtual void newTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType) override; + virtual void removeTouchHandler(std::string key, TouchHandlerType touchType) override; + virtual long long getLastScreenTouchTime() override; + virtual int getLoopActionCounter(std::string loopId) override; + virtual int addNewLoopActionCounter(std::string loopId, int timesRepeated) override; + virtual int decrementLoopActionCounter(std::string loopId) override; + virtual void deleteLoopActionCounter(std::string loopId) override; + virtual void setLastActionIndex(int index) override; + virtual unsigned int removeStoredSoundId(std::string soundPath) override; + virtual void storeSoundId(std::string soundPath, unsigned int newSoundId) override; + + // ScenarioObject + virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) override; + virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}) override; + + virtual bool shouldSkipLayoutReloadOnFastForward(){return _shouldSkipLayoutReloadOnFastForward; } + + protected: + + ParentScene* _scene; + + std::string _soundsResFolder; + std::string _altSoundsResFolder; + + bool _shouldSkipLayoutReloadOnFastForward; + + std::string _valueStorageContainerName; + std::string _cachedJSONString; + rapidjson::Document* _cachedJSONData; + std::vector _actionsSequence; + std::map _predefinedActions; + std::map _loopActionCounters; + int _lastActionIndex; + std::vector _currentCompletingActionTags; + +// rapidjson::Value* _onTimerCountdownAction; + std::vector _actionsOnTimerUp; + + bool _scenarioPaused; + bool _scenarioBarred; + bool _scenarioFinished; + bool _timerRunning; + float _timerStep; + float _timePassed; + float _totalTimerTime; + TimeIndicatorInterface* _timeSlider; + + std::string _demoState; + std::map _storedSoundIds; + + virtual void clearSetup(); + virtual void clearAllScheduledActions(); + + virtual void prepareAction(const rapidjson::Value* action); + virtual void trimActions(std::vector& actions); + virtual void mergeSequences(std::vector& actions); + void simpleCopyActionsToMainSequence(std::vector actions); +}; + +#endif /* ScenarioHandler_h */ + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioObject.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioObject.h new file mode 100644 index 0000000..23dc81a --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/ScenarioObject.h @@ -0,0 +1,114 @@ +// +// ScenarioObject.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 24.05.2017. +// +// + +#ifndef ScenarioObject_h +#define ScenarioObject_h + +#include +#include "ActionData.h" +#include "json/document.h" +#include + +class ActionParseDelegate; + +// weird, because the whole parser has been translated from JavaScript + +class ScenarioObject +{ + public: + + std::string scenarioObjectName; + std::string scenarioObjectClassName; + + ScenarioObject(){ + _customData = NULL; + _jsonValueStorage = NULL; + scenarioObjectName = ""; + scenarioObjectClassName = ""; + }; + + virtual ~ScenarioObject(){ + if(_jsonValueStorage){ + delete _jsonValueStorage; + } + for(auto pair : _animations){ + delete pair.second; + } + + + + }; + +// virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate){ +// // do nothing +// }; + + virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}){ + // do nothing + callback(); + }; + + virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) { + // do nothing + }; + + virtual std::string getPropertyAsString(std::string propertyName = ""){ + if(propertyName == "objectName"){ + return scenarioObjectName; + } + return "NULL"; + }; + + virtual ScenarioObject* getScenarioObjectByName(std::string objectName){ + return NULL; + }; + + virtual void insertAnimationWithId(std::string animationId, const rapidjson::Value& animationData){ + + if(_animations.find(animationId) == _animations.end()){ + rapidjson::Value* animationDataCopy = new rapidjson::Value(); + animationDataCopy->CopyFrom(animationData, this->getJsonStorage()->GetAllocator()); + _animations.insert({animationId, animationDataCopy}); + } + }; + + virtual const rapidjson::Value* getAnimationById(std::string animationId){ + return _animations[animationId]; + }; + + virtual void setCustomData(void* data){ + _customData = data; + }; + + virtual void* getCustomData(){ + return _customData; + }; + + virtual std::string getObjectName(){ + return scenarioObjectName; + }; + + virtual std::string getClassName(){ + return scenarioObjectClassName; + }; + + protected: + rapidjson::Document* _jsonValueStorage; + std::map _animations; + void* _customData; + + rapidjson::Document* getJsonStorage(){ + if(!_jsonValueStorage){ + _jsonValueStorage = new rapidjson::Document(); + } + return _jsonValueStorage; + }; + +}; + +#endif /* ScenarioObject_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleActionParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleActionParser.cpp new file mode 100644 index 0000000..6ff68ef --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleActionParser.cpp @@ -0,0 +1,570 @@ +// +// SimpleActionParser.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 31.05.2017. +// +// + +#include +#include "SimpleActionParser.h" +#include "JSONParseUtils.h" +#include "SoundsRepo.h" +#include "SoundUtils.h" +//#include "DragAndDropHandler.h" +#include "SpriteAnimator.h" +#include "SceneWithUtils.h" +#include "ValueStorage.h" +//#include "UserDefaultsKeys.h" +#include "MathUtils.h" + + +class DynamicObjectMapper +{ + public: + ScenarioObject* createObjectFromClassName(std::string className, const rapidjson::Value& objectData, ActionParseDelegate* parseDelegate) + { + ScenarioObject* object = NULL; + + /*else if(className == "DragAndDropHandler"){ + + const auto& params = objectData["parameters"].GetArray(); + +// DragAndDropHandler::DragAndDropHandler(std::vector objectsToDrag, cocos2d::Node* destinationObject, std::vector wrongDraggedObjects, std::vector wrongDestinationObjects) + object = new DragAndDropHandler(); + + } */ + + return object; + } +}; + +// main parse function + +cocos2d::Action* SimpleActionParser::parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Action* parsedAction = NULL; +// log("SimpleActionParser: parsing action of type "+jsonActionObject.actionType); + + if(JSONParseUtils::hasMemberString(jsonActionObject, "actionType")){ + + std::string actionType = jsonActionObject["actionType"].GetString(); + if(actionType == "wait"){ + parsedAction = this->parseWaitAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "createObject"){ + parsedAction = this->parseCreateObjectAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "setProperty"){ + parsedAction = this->parseSetPropertyAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "callFunction"){ + parsedAction = this->parseCallFunctionAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "playSound"){ + parsedAction = this->parsePlaySoundAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "playRandomSound"){ + parsedAction = this->parsePlayRandomSoundAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "reorderInParent"){ + parsedAction = this->parseReorderInParentAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "animateObjects"){ + parsedAction = this->parseAnimateObjectsAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "animateObjectByAnimationId"){ + parsedAction = this->parseAnimateObjectByAnimationIdAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "stopAnimations"){ + parsedAction = this->parseStopAnimationsAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "dismissCurrentDialog"){ + parsedAction = this->parseDismissCurrentDialogAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } else if(actionType == "randomSwitchItemPositions"){ + parsedAction = this->parseRandomObjectSwapAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + } + + return parsedAction; +} + +// functions for parsing differenct actions + +/* + common properties: + "actionType" + "condition" +*/ + +/* + "actionType" = "wait" + "seconds" [float] +*/ + +cocos2d::Action* SimpleActionParser::parseWaitAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + if(JSONParseUtils::hasMemberFloat(jsonActionObject, "seconds")){ + + float seconds = jsonActionObject["seconds"].GetFloat(); + + if(notifyDelegateWhenFinished){ + + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [](float pSeconds, std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + static int keyModifier = 0; + static int modulus = 100; + static std::string keyBase = "waitAction"; + std::string key = keyBase + std::to_string((++keyModifier)%modulus); + + pParseDelegate->scheduleOnce(std::bind([](float, std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + + p2ParseDelegate->actionFinished(*ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName())); + ValueStorage::getInstance().removeStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); // if the callback is unscheduled, this will not be called. However, when the scene changes, the ValueStorage is always cleared. + + }, std::placeholders::_1, pStoredValueKey, pParseDelegate), pSeconds, key); + }; + + return cocos2d::CallFunc::create(std::bind(actionFunction, seconds, storedValueKey, parseDelegate)); + } + + return cocos2d::DelayTime::create(seconds); + } + + return nullptr; +} + +/* + "actionType" = "createObject" + "objectClass" [string] + "objectName" [string] + "parameters" [array of arbitrary things for the constructor or nothing; see parseParameters()] +*/ + +cocos2d::Action* SimpleActionParser::parseCreateObjectAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedJsonActionObject, pParseDelegate)){ + + if(JSONParseUtils::hasMemberString(*storedJsonActionObject, "objectClass") && JSONParseUtils::hasMemberString(*storedJsonActionObject, "objectName")){ + DynamicObjectMapper mapper; + auto newObject = mapper.createObjectFromClassName((*storedJsonActionObject)["objectClass"].GetString(), *storedJsonActionObject, pParseDelegate); + pParseDelegate->addNewObject((*storedJsonActionObject)["objectName"].GetString(), newObject); + } + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storedValueKey, parseDelegate)); +} + +/* + "actionType" = "setProperty" + "objectName" [string] | "objectNames" [array of strings] | nothing + "propertyName" [string] + "value" [anything] +*/ + +cocos2d::Action* SimpleActionParser::parseSetPropertyAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + std::function callback = [&](std::string pStoredValueKey, ActionParseDelegate* pActionParseDelegate, bool pNotifyDelegate){ + + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pActionParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedJsonActionObject, pActionParseDelegate)){ + + auto objects = ActionParser::getInstance().prepareObjectsForAction(*storedJsonActionObject, pActionParseDelegate); + + for(auto object : objects){ + object->setProperty((*storedJsonActionObject)["propertyName"].GetString(), (*storedJsonActionObject)["value"], pActionParseDelegate); + } + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pActionParseDelegate->getValueStorageContainerName()); + }; + + auto actionFunction = std::bind(callback, storedValueKey, parseDelegate, notifyDelegateWhenFinished); + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, actionFunction); +} + + /* + "actionType" = "callFunction" + "objectName" [string] | "objectNames" [array of strings] | nothing + "functionName" [string] + "parameters" [array of arbitrary things or nothing; see parseParameters()] + */ + +cocos2d::Action* SimpleActionParser::parseCallFunctionAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto key = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto restoredValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*restoredValue, pParseDelegate)){ + + auto objects = ActionParser::getInstance().prepareObjectsForAction(*restoredValue, pParseDelegate); + + const rapidjson::Value* params = NULL; + if(JSONParseUtils::hasMemberArray(*restoredValue, "parameters")){ + params = &((*restoredValue)["parameters"]); + } + + for(auto object : objects){ + object->callFunctionByName((*restoredValue)["functionName"].GetString(), params, pParseDelegate); + } + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, key, parseDelegate)); +} + + /* + "actionType" = "playSound" + "sound" [string] + "useAlternativePath" [boolean] + "loop" [boolean] + "keepPreviousSounds" [boolean] + */ + +cocos2d::Action* SimpleActionParser::parsePlaySoundAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storageKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStorageKey, ActionParseDelegate* pParseDelegate){ + + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStorageKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedJsonActionObject, pParseDelegate)){ + + if(!JSONParseUtils::hasMemberString(*storedJsonActionObject, "sound")){ + return; + } + + std::string sound = (*storedJsonActionObject)["sound"].GetString(); + + auto soundPath = JSONParseUtils::checkMemberBool(*storedJsonActionObject, "useAlternativePath", true) ? pParseDelegate->getAlternativeSoundsPath() +sound : pParseDelegate->getDefaultSoundsPath() + sound; +// auto loop = JSONParseUtils::hasMemberBool(*storedJsonActionObject, "loop") && (*storedJsonActionObject)["loop"].GetBool() == true ? true : false; + + if(!JSONParseUtils::hasMemberBool(*storedJsonActionObject, "keepPreviousSounds") || JSONParseUtils::checkMemberBool(*storedJsonActionObject, "keepPreviousSounds", false)){ +// CocosDenshion::SimpleAudioEngine::getInstance()->stopAllEffects(); + SoundsRepo::stopAllSounds(); + } + + bool cancelSameSound = JSONParseUtils::checkMemberBool(*storedJsonActionObject, "cancelSameSound", true); + if(cancelSameSound){ + auto soundId = pParseDelegate->removeStoredSoundId(soundPath); + if(soundId != -1){ + SoundsRepo::stopSoundById(soundId); +// CocosDenshion::SimpleAudioEngine::getInstance()->stopEffect(soundId); + } + } + + unsigned int newSoundId = SoundsRepo::playSound(soundPath.c_str()); //TODO loop //CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(soundPath.c_str(), loop); + if(cancelSameSound){ + pParseDelegate->storeSoundId(soundPath, newSoundId); + } + } + + ValueStorage::getInstance().removeStoredValue(pStorageKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storageKey, parseDelegate)); +} + + /* + "actionType" = "playRandomSound" + "sounds" [array of strings] + "useAlternativePath" [boolean] + "keepPreviousSounds" [boolean] + */ + +cocos2d::Action* SimpleActionParser::parsePlayRandomSoundAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto storedActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedActionObject, pParseDelegate)){ + + auto soundFolder = JSONParseUtils::checkMemberBool(*storedActionObject, "useAlternativePath", true) ? pParseDelegate->getAlternativeSoundsPath() : pParseDelegate->getDefaultSoundsPath(); + auto stopEffects = !JSONParseUtils::hasMemberBool(*storedActionObject, "keepPreviousSounds") || JSONParseUtils::checkMemberBool(*storedActionObject, "keepPreviousSounds", false) ? true : false; + + if(JSONParseUtils::hasMemberArray(*storedActionObject, "sounds")){ + std::vector sounds; + for(const auto& sound : (*storedActionObject)["sounds"].GetArray()){ + sounds.push_back(sound.GetString()); + } + SoundUtils::playRandomSound(soundFolder, sounds, stopEffects); + } + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storedValueKey, parseDelegate)); + } + + /* + "actionType" = "reorderInParent" + "objectName" [string] + "newDepth" [number] + */ + +cocos2d::Action* SimpleActionParser::parseReorderInParentAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto storedActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedActionObject, pParseDelegate)){ + + if(JSONParseUtils::hasMemberString(*storedActionObject, "objectName") && JSONParseUtils::hasMemberInt(*storedActionObject, "newDepth")){ + auto object = pParseDelegate->getObjectByName((*storedActionObject)["objectName"].GetString()); + auto objectNode = dynamic_cast(object); + if(objectNode){ + objectNode->getParent()->reorderChild(objectNode, (*storedActionObject)["newDepth"].GetInt()); + } + } + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storedValueKey, parseDelegate)); +} + + /* + "actionType" = "animateObjects" + "objectName" [string] | "objectNames" [array of strings] + "animationName" [string] + "parameters" [array of arbitrary things or nothing; see parseParameters()] + "animationConditions" [array of conditions for different sprites in the array] + */ + +cocos2d::Action* SimpleActionParser::parseAnimateObjectsAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) //todo put all into the acton function for late parse +{ + auto objects = ActionParser::getInstance().prepareObjectsForAction(jsonActionObject, parseDelegate); + + if(JSONParseUtils::hasMemberArray(jsonActionObject, "animationConditions")){ + const auto& conditionsArray = jsonActionObject["animationConditions"].GetArray(); + if(conditionsArray.Size() >= objects.size()){ + + for(int i = (int)objects.size()-1; i >= 0; --i){ + + if(conditionsArray[i].IsString() && ActionParser::getInstance().checkCondition(conditionsArray[i].GetString(), parseDelegate) == false){ + objects.erase(objects.begin() + i, objects.begin() + i + 1); + } + } + } + } + + std::vector nodes; + for(auto object : objects){ + auto objAsNode = dynamic_cast(object); + nodes.push_back(objAsNode); + } + + auto storageKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::vector pNodes, std::string pStorageKey, ActionParseDelegate* pParseDelegate){ + + auto storedJsonObject = ValueStorage::getInstance().getStoredValue(pStorageKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedJsonObject, pParseDelegate)){ + + std::string animationName = (*storedJsonObject)["animationName"].GetString(); + const rapidjson::Value* params = nullptr; + if(JSONParseUtils::hasMemberArray(*storedJsonObject, "parameters")){ + params = &((*storedJsonObject)["parameters"]); + } + + SpriteAnimator::runAnimationForName(animationName, pNodes, params); + } + + ValueStorage::getInstance().removeStoredValue(pStorageKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, nodes, storageKey, parseDelegate)); +} + + /* + "actionType" = "animateObjectByAnimationId" + "objectName" [string] + "animationId" [string] + The object should have the animation with given "animationId" specified in its "animations" field in the layout file. + */ + +cocos2d::Action* SimpleActionParser::parseAnimateObjectByAnimationIdAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + auto objects = ActionParser::getInstance().prepareObjectsForAction(*storedJsonActionObject, pParseDelegate); + auto animationObject = objects[0]->getAnimationById((*storedJsonActionObject)["animationId"].GetString()); //TODO sprobowac wywalic poza lambde + + if(ActionParser::getInstance().checkLateCondition(*storedJsonActionObject, pParseDelegate)){ + + std::string animationName = (*animationObject)["animationName"].GetString(); + const rapidjson::Value* params = NULL; + if(JSONParseUtils::hasMemberArray((*animationObject), "parameters")){ + params = &((*animationObject)["parameters"]); + } + + SpriteAnimator::runAnimationForName(animationName, {dynamic_cast(objects[0])}, params); + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + auto boundActionFunction = std::bind(actionFunction, storedValueKey, parseDelegate); + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, boundActionFunction); +} + + /* + "actionType" = "stopAnimations" + "objectName" [string] | "objectNames" [array of strings] + */ + +cocos2d::Action* SimpleActionParser::parseStopAnimationsAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(ActionParser::getInstance().checkLateCondition(*storedJsonActionObject, pParseDelegate)){ + auto objects = ActionParser::getInstance().prepareObjectsForAction(*storedJsonActionObject, pParseDelegate); + + for(int i = 0; i < objects.size(); ++i){ + dynamic_cast(objects[i])->stopAllActions(); + } + } + + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storedValueKey, parseDelegate)); +} + +cocos2d::Action* SimpleActionParser::parseDismissCurrentDialogAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + return cocos2d::CallFunc::create([](){ + auto currentScene = dynamic_cast(cocos2d::Director::getInstance()->getRunningScene()); + currentScene->dismissCurrentDialog(); + }); +} + +cocos2d::Action* SimpleActionParser::finalizeParseActionWithActionFunction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished, std::function preparedActionFunction) +{ + if(JSONParseUtils::checkMemberBool(jsonActionObject, "instantAction", true)){ + parseDelegate->runInstantly(preparedActionFunction); + return NULL; + } else { + return ActionParser::getInstance().embedFunctionInAction(preparedActionFunction, jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } +} + +cocos2d::Action* SimpleActionParser::parseRandomObjectSwapAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished){ + // "objectGroups" : + // [ + // {"t_doll1" : ["t_robot2", "t_robot4", "t_bear1", "t_bear3", "t_bear4", "blueBoat", "ballSpots", "ballStripy"]}, + // {"t_doll2" : ["t_robot2", "t_robot4", "t_bear1", "t_bear3", "t_bear4", "blueBoat", "ballSpots", "ballStripy"]}, + // {"t_doll3" : ["t_bear1", "t_bear3", "dinoRed", "dinoGreen"]}, + // {"t_auto3" : ["t_bear2", "lego3"]}, + // {"t_doll4" : ["t_robot2", "t_robot4", "t_bear1", "t_bear3", "t_bear4", "blueBoat", "ballSpots", "ballStripy", "t_auto1", "t_auto4", "t_train1", "t_train2", "t_train3", "t_train4", "t_bear2"]}, + // {"t_auto1" : ["t_train1", "t_train2", "t_train3", "t_train4", "t_doll4", "t_bear2", "ballStripy"]}, + // {"t_auto2" : ["dinoRed", "dinoGreen", "lego3", "blueBoat", "t_bear2", "t_bear4"]}, + // {"t_auto4" : ["t_train1", "t_train2", "t_train3", "t_train4", "t_doll4", "t_bear2", "ballStripy"]}, + // {"t_train1" : ["t_auto1", "t_auto4", "t_doll4", "t_bear2", "ballStripy"]}, + // {"t_train2" : ["t_auto1", "t_auto4", "t_doll4", "t_bear2", "ballStripy"]}, + // {"t_train3" : ["t_auto1", "t_auto4", "t_doll4", "t_bear2", "ballStripy"]}, + // {"t_train4" : ["t_auto1", "t_auto4", "t_doll4", "t_bear2", "ballStripy"]}, + // {"t_bear1" : ["t_robot2", "t_robot4", "t_doll1", "t_doll2", "t_doll4", "blueBoat", "ballSpots", "ballStripy", "t_doll3", "dinoRed", "dinoGreen"]}, + // {"t_bear2" : ["dinoRed", "dinoGreen", "lego3", "blueBoat", "t_auto2", "t_auto3", "t_train1", "t_train2", "t_train3", "t_train4", "t_doll4", "ballStripy"]}, + // {"t_bear3" : ["t_robot2", "t_robot4", "t_doll1", "t_doll2", "t_doll4", "blueBoat", "ballSpots", "ballStripy", "t_doll3", "dinoRed", "dinoGreen"]}, + // {"t_bear4" : ["dinoRed", "dinoGreen", "lego3", "blueBoat", "t_auto2", "t_robot2", "t_robot4", "t_doll1", "t_doll2", "t_doll4", "ballSpots", "ballStripy"]} + // ] + + //TODO add probability of swap, maybe different for different levels + + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto actionJson = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + + if(JSONParseUtils::hasMemberArray(*actionJson, "objectGroups")){ + auto objectGroups = (*actionJson)["objectGroups"].GetArray(); + auto swapProbability = (*actionJson)["swapProbability"].GetFloat(); + // std::map> objectMap; + std::vector usedObjects; //keep info which objects are already swapped, not to swap them again + + for(int i = 0; i < objectGroups.Size(); ++i){ + + // first throw dice to see if we should swap at all + auto randomFloat = MathUtils::getRandom(0, 1); + if(randomFloat > swapProbability){ + continue; + } + + std::string mainObjectName = objectGroups[i].MemberBegin()->name.GetString(); + if(std::find(usedObjects.begin(), usedObjects.end(), mainObjectName) != usedObjects.end()) { +// printf("already swapped %s! skipping\n", mainObjectName.c_str()); + continue; // object already swapped, move on + } + auto availableObjects = JSONParseUtils::parseStringArray(objectGroups[i].MemberBegin()->value); + for(int i = (int)availableObjects.size()-1; i >= 0; --i){ + if(std::find(usedObjects.begin(), usedObjects.end(), availableObjects[i]) != usedObjects.end()){ + availableObjects.erase(availableObjects.begin()+i); + } + } + if(availableObjects.size() == 0){ +// printf("nothing to swap %s with! skipping\n", mainObjectName.c_str()); + continue; //nothing to swap with + } + auto objectToSwapWith = MathUtils::getRandomElement(availableObjects); + auto object1 = dynamic_cast(parseDelegate->getObjectByName(mainObjectName)); + auto object2 = dynamic_cast(parseDelegate->getObjectByName(objectToSwapWith)); + auto tempPos = object1->getPosition(); + auto tempZOrder = object1->getZOrder(); + object1->setPosition(object2->getPosition()); + object1->setZOrder(object2->getZOrder()); + object2->setPosition(tempPos); + object2->setZOrder(tempZOrder); + usedObjects.push_back(mainObjectName); + usedObjects.push_back(objectToSwapWith); +// printf("swapping %s with %s\n", mainObjectName.c_str(), objectToSwapWith.c_str()); + } + } + ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + }; + + return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storedValueKey, parseDelegate)); +} + + + + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleActionParser.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleActionParser.h new file mode 100644 index 0000000..8352628 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleActionParser.h @@ -0,0 +1,43 @@ +// +// SimpleActionParser.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 31.05.2017. +// +// + +#ifndef SimpleActionParser_h +#define SimpleActionParser_h + +#include "ActionParser.h" + +class SimpleActionParser +{ + public: + + static SimpleActionParser& getInstance() + { + static SimpleActionParser instance; + return instance; + }; + + cocos2d::Action* parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished = true); + + protected: + cocos2d::Action* parseWaitAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseCreateObjectAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseSetPropertyAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseCallFunctionAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parsePlaySoundAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parsePlayRandomSoundAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseReorderInParentAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseAnimateObjectsAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseAnimateObjectByAnimationIdAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseStopAnimationsAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseDismissCurrentDialogAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseRandomObjectSwapAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* finalizeParseActionWithActionFunction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished, std::function preparedActionFunction); +}; + +#endif /* SimpleActionParser_h */ + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleValue.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleValue.h new file mode 100644 index 0000000..5999f5a --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/SimpleValue.h @@ -0,0 +1,83 @@ +// +// SimpleValue.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 01.06.2017. +// +// + +#ifndef SimpleValue_h +#define SimpleValue_h + +#include "ScenarioObject.h" +#include "cocos2d.h" +#include +#include + +//TODO getType +class SimpleValue : public ScenarioObject, public cocos2d::Ref +{ + public: + + SimpleValue(const SimpleValue& val){ + _stringValue = val._stringValue; + _numberValue = val._numberValue; + _boolValue = val._boolValue; + _pointValue = val._pointValue; + }; + + SimpleValue(std::string stringValue) { + _stringValue = stringValue; + }; + + SimpleValue(float number){ + _numberValue = number; + }; + + SimpleValue(bool boolValue){ + _boolValue = boolValue; + }; + + SimpleValue(cocos2d::Point point){ + _pointValue = point; + }; + + virtual std::string getPropertyAsString(std::string propertyName = ""){ + if(propertyName == ""){ + return _stringValue; + } + return "NULL"; + }; + + float getNumberValue(){ + return _numberValue; + } + + bool getBoolValue(){ + return _boolValue; + } + + cocos2d::Point getPointValue(){ + return _pointValue; + } + + std::string getStringValue(){ + return _stringValue; + } + + void setBoolValue(bool pBoolValue){ + _boolValue = pBoolValue; + } + + void setNumberValue(float pNumberValue){ + _numberValue = pNumberValue; + } + + protected: + std::string _stringValue; + float _numberValue; + cocos2d::Point _pointValue; + bool _boolValue; +}; + +#endif /* SimpleString_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimeIndicatorInterface.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimeIndicatorInterface.h new file mode 100644 index 0000000..3458ad1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimeIndicatorInterface.h @@ -0,0 +1,21 @@ +// +// TimeIndicatorInterface.h +// WattsenglishToyApp +// +// Created by Katarzyna Kalinowska-Górska on 28/12/2019. +// + +#ifndef TimeIndicatorInterface_h +#define TimeIndicatorInterface_h + +class TimeIndicatorInterface { +public: + virtual void setProgressFrac(float progressFrac) = 0; + virtual void setProgress(float progress) = 0; + virtual void startTimeAnimation(float timeDuration) = 0; + virtual void pauseTimeAnimation() = 0; + virtual void resumeTimeAnimation() = 0; + virtual void stopTimeAnimation() = 0; +}; + +#endif /* TimeIndicatorInterface_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimerActionParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimerActionParser.cpp new file mode 100644 index 0000000..d6208a4 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimerActionParser.cpp @@ -0,0 +1,121 @@ +// +// TimerActionParser.cpp +// WattsenglishToyApp-mobile +// +// Created by Katarzyna Kalinowska-Górska on 28/12/2019. +// + +#include +#include "TimerActionParser.h" +#include "JSONParseUtils.h" +#include "ValueStorage.h" + +// main parse function + +cocos2d::Action* TimerActionParser::parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + cocos2d::Action* parsedAction = NULL; + if(JSONParseUtils::hasMemberString(jsonActionObject, "actionType")){ + + std::string actionType = jsonActionObject["actionType"].GetString(); + if(actionType == "startTimer"){ + parsedAction = this->parseStartTimerAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + else if(actionType == "stopTimer"){ + parsedAction = this->parseStopTimerAction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished); + } + } + + return parsedAction; +} + +// functions for parsing differenct actions + +/* + "actionType" = "startTimer" + "seconds" [float] + "onProgressActions" : [], + "onTimeUpActions" : [], + "finishScenarioAfterTimeUp" : true, + "timeIndicatorObject" : "timeSlider" //needs to conform to the TimeIndicatorInterface +*/ + +cocos2d::Action* TimerActionParser::parseStartTimerAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ + if(JSONParseUtils::hasMemberFloat(jsonActionObject, "seconds")){ + + float seconds = jsonActionObject["seconds"].GetFloat(); + + if(notifyDelegateWhenFinished){ + + auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); + + auto actionFunction = [](float pSeconds, std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ + + auto storedValue = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); + ScenarioObject* sliderObject = ActionParser::getInstance().parseObject("timeIndicatorObject", pParseDelegate); + + if(sliderObject != nullptr){ + //TODO + } + + + static int keyModifier = 0; + static int modulus = 100; + static std::string keyBase = "startTimerAction"; + std::string key = keyBase + std::to_string((++keyModifier)%modulus); + + + +// auto action = ActionParser::getInstance().parseJSONAction(array[i], parseDelegate, false); + + pParseDelegate->scheduleOnce(std::bind([](float, std::string p2StoredValueKey, ActionParseDelegate* p2ParseDelegate){ + + p2ParseDelegate->actionFinished(*ValueStorage::getInstance().getStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName())); + ValueStorage::getInstance().removeStoredValue(p2StoredValueKey, p2ParseDelegate->getValueStorageContainerName()); // if the callback is unscheduled, this will not be called. However, when the scene changes, the ValueStorage is always cleared. + + }, std::placeholders::_1, pStoredValueKey, pParseDelegate), pSeconds, key); + }; + + return cocos2d::CallFunc::create(std::bind(actionFunction, seconds, storedValueKey, parseDelegate)); + } + + return cocos2d::DelayTime::create(seconds); + } + + return nullptr; +} + +/* + "actionType" = "stopTimer" +*/ + +cocos2d::Action* TimerActionParser::parseStopTimerAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished) +{ +// auto storedValueKey = ValueStorage::getInstance().storeValue(jsonActionObject, parseDelegate->getValueStorageContainerName()); +// +// auto actionFunction = [&](std::string pStoredValueKey, ActionParseDelegate* pParseDelegate){ +// +// auto storedJsonActionObject = ValueStorage::getInstance().getStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); +// +// if(ActionParser::getInstance().checkLateCondition(*storedJsonActionObject, pParseDelegate)){ +// +// if(JSONParseUtils::hasMemberString(*storedJsonActionObject, "objectClass") && JSONParseUtils::hasMemberString(*storedJsonActionObject, "objectName")){ +// DynamicObjectMapper mapper; +// auto newObject = mapper.createObjectFromClassName((*storedJsonActionObject)["objectClass"].GetString(), *storedJsonActionObject, pParseDelegate); +// pParseDelegate->addNewObject((*storedJsonActionObject)["objectName"].GetString(), newObject); +// } +// } +// +// ValueStorage::getInstance().removeStoredValue(pStoredValueKey, pParseDelegate->getValueStorageContainerName()); +// }; + + //TODO !!!!!! ---> +// return this->finalizeParseActionWithActionFunction(jsonActionObject, parseDelegate, notifyDelegateWhenFinished, std::bind(actionFunction, storedValueKey, parseDelegate)); +} + + + + + + diff --git a/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimerActionParser.h b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimerActionParser.h new file mode 100644 index 0000000..6e0a32a --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ScenarioParsing/TimerActionParser.h @@ -0,0 +1,30 @@ +// +// TimerActionParser.h +// WattsenglishToyApp +// +// Created by Katarzyna Kalinowska-Górska on 28/12/2019. +// + +#ifndef TimerActionParser_h +#define TimerActionParser_h + +#include "ActionParser.h" + +class TimerActionParser : public ActionParser +{ + public: + + static TimerActionParser& getInstance() + { + static TimerActionParser instance; + return instance; + }; + + cocos2d::Action* parseJSONAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished = true); + + protected: + cocos2d::Action* parseStartTimerAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); + cocos2d::Action* parseStopTimerAction(const rapidjson::Value& jsonActionObject, ActionParseDelegate* parseDelegate, bool notifyDelegateWhenFinished); +}; + +#endif /* TimerActionParser_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/SimpleValue.h b/ios/Runner/Wowgame/Classes/Parsing/SimpleValue.h new file mode 100644 index 0000000..960fb16 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/SimpleValue.h @@ -0,0 +1,82 @@ +// +// SimpleValue.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 01.06.2017. +// +// + +#ifndef SimpleValue_h +#define SimpleValue_h + +#include "cocos2d.h" +#include +#include + +//TODO getType +class SimpleValue : public cocos2d::Ref +{ + public: + + SimpleValue(const SimpleValue& val){ + _stringValue = val._stringValue; + _numberValue = val._numberValue; + _boolValue = val._boolValue; + _pointValue = val._pointValue; + }; + + SimpleValue(std::string stringValue) { + _stringValue = stringValue; + }; + + SimpleValue(float number){ + _numberValue = number; + }; + + SimpleValue(bool boolValue){ + _boolValue = boolValue; + }; + + SimpleValue(cocos2d::Point point){ + _pointValue = point; + }; + + virtual std::string getPropertyAsString(std::string propertyName = ""){ + if(propertyName == ""){ + return _stringValue; + } + return "NULL"; + }; + + float getNumberValue(){ + return _numberValue; + } + + bool getBoolValue(){ + return _boolValue; + } + + cocos2d::Point getPointValue(){ + return _pointValue; + } + + std::string getStringValue(){ + return _stringValue; + } + + void setBoolValue(bool pBoolValue){ + _boolValue = pBoolValue; + } + + void setNumberValue(float pNumberValue){ + _numberValue = pNumberValue; + } + + protected: + std::string _stringValue; + float _numberValue; + cocos2d::Point _pointValue; + bool _boolValue; +}; + +#endif /* SimpleString_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/StaticActionParser.cpp b/ios/Runner/Wowgame/Classes/Parsing/StaticActionParser.cpp new file mode 100644 index 0000000..e04f8cb --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/StaticActionParser.cpp @@ -0,0 +1,39 @@ +// +// StaticActionParser.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 21.05.2017. +// +// + +#include +#include "StaticActionParser.h" +#include "SceneWithUtils.h" +#include "SoundsRepo.h" +#include "ResourceUtilities.h" + +const std::string StaticActionParser::ACTION_TYPE_PLAY_SOUND = "playSound"; +const std::string StaticActionParser::ACTION_TYPE_DISMISS_DIALOG = "dismissDialog"; + +void StaticActionParser::parseStaticAction(const rapidjson::Value& actionJson) +{ + if (actionJson.IsObject() && JSONParseUtils::hasMemberString(actionJson, "actionType")){ + + const auto& actionType = actionJson["actionType"].GetString(); + if(ACTION_TYPE_PLAY_SOUND == actionType) + { + if(JSONParseUtils::hasMemberString(actionJson, "soundPath")){ +// printf(ResourceUtilities::getInstance().getFullPathForDownloadedFile(actionJson["soundPath"].GetString(), false).c_str()); + auto cancelOtherSounds = JSONParseUtils::checkMemberBool(actionJson, "cancelOtherSounds", true); + SoundsRepo::playSound(ResourceUtilities::getInstance().getFullPathForDownloadedFile(actionJson["soundPath"].GetString(), false).c_str(), cancelOtherSounds); + } + } + else if(ACTION_TYPE_DISMISS_DIALOG == actionType){ + auto currentScene = dynamic_cast(cocos2d::Director::getInstance()->getRunningScene()); + currentScene->dismissCurrentDialog(); + } + } +} + + + diff --git a/ios/Runner/Wowgame/Classes/Parsing/StaticActionParser.h b/ios/Runner/Wowgame/Classes/Parsing/StaticActionParser.h new file mode 100644 index 0000000..fdb9ed2 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/StaticActionParser.h @@ -0,0 +1,25 @@ +// +// StaticActionParser.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 21.05.2017. +// +// + +#ifndef StaticActionParser_h +#define StaticActionParser_h + +#include "json/document.h" +#include "JSONParseUtils.h" + +class StaticActionParser +{ + public: + + static const std::string ACTION_TYPE_PLAY_SOUND; + static const std::string ACTION_TYPE_DISMISS_DIALOG; + + static void parseStaticAction(const rapidjson::Value& actionJson); +}; + +#endif /* StaticActionParser_h */ diff --git a/ios/Runner/Wowgame/Classes/Parsing/ValueStorage.cpp b/ios/Runner/Wowgame/Classes/Parsing/ValueStorage.cpp new file mode 100644 index 0000000..754100a --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ValueStorage.cpp @@ -0,0 +1,229 @@ +// +// ValueStorage.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 13.06.2017. +// +// + +#include +#include "ValueStorage.h" + +const std::string ValueStorage::DefaultContainer = "DefaultContainer"; + +std::string ValueStorage::storeValue(const rapidjson::Value& value, const std::string& container) +{ + auto key = this->generateNextKey(container); + this->storeValueWithKey(value, key, container); + return key; +} + +void ValueStorage::storeValueWithKey(const rapidjson::Value& value, const std::string& key, const std::string& container) +{ + if(_storedValues[container].find(key) == _storedValues[container].end()){ + rapidjson::Value* copy = new rapidjson::Value(); + copy->CopyFrom(value, _valueStorage->GetAllocator()); + _storedValues[container].insert({key, copy}); + } +} + +rapidjson::Value* ValueStorage::getStoredValue(const std::string& key, const std::string& container) +{ + auto& containerMap = _storedValues[container]; + + if(containerMap.find(key) != containerMap.end()){ + if(containerMap.find(key) != containerMap.end()){ + return containerMap[key]; + } + } + return nullptr; +} + +void ValueStorage::removeStoredValue(const std::string& key, const std::string& container){ +//return; + auto& containerMap = _storedValues[container]; + if(containerMap.find(key) != containerMap.end()){ + +// cocos2d::log("deleting value for key: %s container %s", key.c_str(), container.c_str()); + delete containerMap[key]; + containerMap.erase(key); + } +} + +void ValueStorage::removeAllStoredValues(const std::string& container) +{ +//return; + if(container != ""){ + auto& containerMap = _storedValues[container]; + for(auto& pair : containerMap){ +// cocos2d::log("deleting value for key: %s in container %s", pair.first.c_str(), container.c_str()); + delete pair.second; + } + _storedValues.erase(container); + + } else { + for(auto& containerMap : _storedValues){ + for(auto& pair : containerMap.second){ + delete pair.second; + } + } + _storedValues.clear(); + } +} + +std::string ValueStorage::storeFunction(std::function callback, const std::string& container) +{ + auto key = this->generateNextKey(container); + this->storeFunctionWithKey(callback, key, container); + return key; +} + +void ValueStorage::storeFunctionWithKey(std::function callback, const std::string& key, const std::string& container) +{ + if(_storedFunctions[container].find(key) == _storedFunctions[container].end()){ + _storedFunctions[container].insert({key, callback}); +// cocos2d::log("stored function for key %s continer %s", key.c_str(), container.c_str()); + } +} + +std::function ValueStorage::getStoredFunction(const std::string& key, const std::string& container) +{ + if(container != ""){ + auto& containerMap = _storedFunctions[container]; + if(containerMap.find(key) != containerMap.end()){ + return containerMap[key]; + } + } + + return nullptr; +} + +void ValueStorage::runStoredFunction(const std::string& key, const std::string& container) +{ +// cocos2d::log("running function for key %s container %s", key.c_str(), container.c_str()); + if(container != ""){ + auto& containerMap = _storedFunctions[container]; + if(containerMap.find(key) != containerMap.end()){ +// cocos2d::log("success running function for key %s container %s", key.c_str(), container.c_str()); + containerMap[key](); + } + } +} + +void ValueStorage::runAndRemoveStoredFunction(const std::string& key, const std::string& container) +{ + if(container != ""){ + auto& containerMap = _storedFunctions[container]; + if(containerMap.find(key) != containerMap.end()){ + containerMap[key](); + containerMap.erase(key); +// cocos2d::log("1 removed function for key %s container %s", key.c_str(), container.c_str()); + } + } +} + +void ValueStorage::removeStoredFunction(const std::string& key, const std::string& container) +{ +//return; + if(container != ""){ + auto& containerMap = _storedFunctions[container]; + if(containerMap.find(key) != containerMap.end()){ + containerMap.erase(key); +// cocos2d::log("2 removed function for key %s container %s", key.c_str(), container.c_str()); + } + } +} + +void ValueStorage::removeAllStoredFunctions(const std::string& container) +{ +//return; +// cocos2d::log("removing all stored functions for container %s", container.c_str()); + if(container != ""){ + _storedFunctions.erase(container); + + } else { + _storedFunctions.clear(); + } +} + +std::string ValueStorage::storeSimpleValue(const SimpleValue& value, const std::string& container) +{ + auto key = this->generateNextKey(container); + this->storeSimpleValueWithKey(value, key, container); + return key; +} + +void ValueStorage::storeSimpleValueWithKey(const SimpleValue& value, const std::string& key, const std::string& container) +{ + if(_storedSimpleValues[container].find(key) == _storedSimpleValues[container].end()){ + SimpleValue* copy = new SimpleValue(value); + _storedSimpleValues[container].insert({key, copy}); + } +} + +SimpleValue* ValueStorage::getStoredSimpleValue(const std::string& key, const std::string& container) +{ + auto& containerMap = _storedSimpleValues[container]; + if(containerMap.find(key) != containerMap.end()){ + return containerMap[key]; + } + return nullptr; +} + +void ValueStorage::removeStoredSimpleValue(const std::string& key, const std::string& container) +{ +//return; + auto& containerMap = _storedSimpleValues[container]; + if(containerMap.find(key) != containerMap.end()){ + delete containerMap[key]; + containerMap.erase(key); + } +} + +void ValueStorage::removeAllStoredSimpleValues(const std::string& container) +{ +//return; + if(container != ""){ + + auto& containerMap = _storedSimpleValues[container]; + for(auto& pair : containerMap){ + delete pair.second; + } + _storedSimpleValues.erase(container); + + } else { + for(auto& containerMap : _storedSimpleValues){ + for(auto& pair : containerMap.second){ + delete pair.second; + } + } + _storedSimpleValues.clear(); + } +} + +void ValueStorage::clearStoredData(const std::string& container) +{ + this->removeAllStoredValues(container); + this->removeAllStoredFunctions(container); + this->removeAllStoredSimpleValues(container); + + if(container != ""){ + _lastStoredKeyNumbers.erase(container); + _storedSimpleValues.erase(container); + _storedValues.erase(container); + _storedFunctions.erase(container); + } + else { + _lastStoredKeyNumbers.clear(); + } +} + +std::string ValueStorage::generateNextKey(const std::string& container) +{ + if(_lastStoredKeyNumbers.find(container) == _lastStoredKeyNumbers.end()){ + _lastStoredKeyNumbers[container] = 0; + } else { + _lastStoredKeyNumbers[container] = (_lastStoredKeyNumbers[container]+1)%_modulus; + } + return "value" + std::to_string(_lastStoredKeyNumbers[container]); +}; diff --git a/ios/Runner/Wowgame/Classes/Parsing/ValueStorage.h b/ios/Runner/Wowgame/Classes/Parsing/ValueStorage.h new file mode 100644 index 0000000..c4627ee --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Parsing/ValueStorage.h @@ -0,0 +1,73 @@ +// +// ValueStorage.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 13.06.2017. +// +// + +#ifndef ValueStorage_h +#define ValueStorage_h + +#include "json/document.h" +#include "SimpleValue.h" + +class ValueStorage { + + public: + + static ValueStorage& getInstance() + { + static ValueStorage instance; + return instance; + }; + + static const std::string DefaultContainer; + + std::string storeValue(const rapidjson::Value& value, const std::string& container = DefaultContainer); + void storeValueWithKey(const rapidjson::Value& value, const std::string& key, const std::string& container = DefaultContainer); + rapidjson::Value* getStoredValue(const std::string& key, const std::string& container = DefaultContainer); + void removeStoredValue(const std::string& key, const std::string& container = DefaultContainer); + void removeAllStoredValues(const std::string& container = ""); + + std::string storeFunction(std::function callback, const std::string& container = DefaultContainer); + void storeFunctionWithKey(std::function callback, const std::string& key, const std::string& container = DefaultContainer); + std::function getStoredFunction(const std::string& key, const std::string& container = DefaultContainer); + void runStoredFunction(const std::string& key, const std::string& container = DefaultContainer); + void runAndRemoveStoredFunction(const std::string& key, const std::string& container = DefaultContainer); + void removeStoredFunction(const std::string& key, const std::string& container = DefaultContainer); + void removeAllStoredFunctions(const std::string& container = ""); + + std::string storeSimpleValue(const SimpleValue& value, const std::string& container = DefaultContainer); + void storeSimpleValueWithKey(const SimpleValue& value, const std::string& key, const std::string& container = DefaultContainer); + SimpleValue* getStoredSimpleValue(const std::string& key, const std::string& container = DefaultContainer); + void removeStoredSimpleValue(const std::string&, const std::string& container = DefaultContainer); + void removeAllStoredSimpleValues(const std::string& container = ""); + + // if no container is provided, data from all containers (including the default container) will be cleared + void clearStoredData(const std::string& container = ""); + + protected: + + ValueStorage() + { + _valueStorage = new rapidjson::Document(); + }; + + ~ValueStorage(){ + this->clearStoredData(); + delete _valueStorage; + }; + + std::map _lastStoredKeyNumbers; // per container + const unsigned int _modulus = 10000; + rapidjson::Document* _valueStorage; + std::map> _storedValues; + std::map>> _storedFunctions; + std::map> _storedSimpleValues; + + std::string generateNextKey(const std::string& container); + +}; + +#endif /* ValueStorage_h */ diff --git a/ios/Runner/Wowgame/Classes/Scenes/DragDebugScene.cpp b/ios/Runner/Wowgame/Classes/Scenes/DragDebugScene.cpp new file mode 100644 index 0000000..bf6dfa9 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/DragDebugScene.cpp @@ -0,0 +1,8 @@ +// +// DragDebugScene.cpp +// WattsenglishToyApp-mobile +// +// Created by Katarzyna Kalinowska-Górska on 15/12/2019. +// + +#include diff --git a/ios/Runner/Wowgame/Classes/Scenes/DragDebugScene.h b/ios/Runner/Wowgame/Classes/Scenes/DragDebugScene.h new file mode 100644 index 0000000..534babd --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/DragDebugScene.h @@ -0,0 +1,31 @@ +// +// DragDebugScene.h +// WattsenglishToyApp +// +// Created by Katarzyna Kalinowska-Górska on 15/12/2019. +// + +#ifndef DragDebugScene_h +#define DragDebugScene_h + + +#include "ParentScene.h" + +class DragDebugScene : public ParentScene +{ + public: + + static DragDebugScene* create(std::string layoutFilePath = "", std::string scenarioFilePath = ""); + + virtual void onEnter() override; + virtual void onEnterTransitionDidFinish() override; + + protected: + +// virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override; +// virtual bool onBackButtonClicked(); +// virtual bool onReplayButtonClicked(); +// virtual bool onFastForwardButtonClicked(); +}; + +#endif /* DragDebugScene_h */ diff --git a/ios/Runner/Wowgame/Classes/Scenes/ParentScene.cpp b/ios/Runner/Wowgame/Classes/Scenes/ParentScene.cpp new file mode 100644 index 0000000..b0ad1f9 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/ParentScene.cpp @@ -0,0 +1,556 @@ +// +// ParentScene.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 16.05.2017. +// +// + +#include +#include "ParentScene.h" +#include "LayoutParser.h" +#include "SimpleButton.h" +#include "TwoStateButton.h" +#include "MathUtils.h" +#include "StringUtils.h" +#include "ResourceUtilities.h" +#include "MiscUtils.h" +#include "TOSAcceptPopupView.h" +#include "LevelPickerLayer.h" +#include "SoundsRepo.h" + + +ParentScene* ParentScene::create(std::string layoutFilePath, std::string scenarioFilePath) +{ + ParentScene * scene = new (std::nothrow) ParentScene(); + if(scene && scene->initWithConfigurationFiles(layoutFilePath, scenarioFilePath)) + { + scene->autorelease(); + return scene; + } + CC_SAFE_DELETE(scene); + return nullptr; +} + +bool ParentScene::initWithConfigurationFiles(std::string layoutFilePath, std::string scenarioFilePath) +{ + if(!SceneWithUtils::init()) + { + return false; + } + + _layoutFilePath = layoutFilePath; + _scenarioFilePath = scenarioFilePath; + _loadFromAssets = false; + + _layers.clear(); + _objects.clear(); + + _alwaysSkipDemo = false; + _layoutLoaded = false; + +// _scenarioHandler = new ScenarioHandler(this); +// _scenarioObjects.insert({"scenarioHandler", _scenarioHandler}); + + _userTaskInteractionStarted = false; + _currentTask = ""; + _rightObjectTouchedAlready = false; //TODO these should probably be in the WorksheetScene + + _isHandlingTouches = false; + this->clearTouchHandlers(); + this->resetLastUserTouchTimes(); + + return true; +} + +void ParentScene::reloadLayoutClean() +{ + this->removeAllChildren(); + _layers.clear(); + _objects.clear(); + _scenarioObjects.clear(); +// _scenarioObjects.insert({"scenarioHandler", _scenarioHandler}); + + _userTaskInteractionStarted = false; + _currentTask = ""; + _rightObjectTouchedAlready = false; //TODO these should probably be in the WorksheetScene + + _isHandlingTouches = false; + this->clearTouchHandlers(); + this->resetLastUserTouchTimes(); + + this->loadLayout(true); +} + +void ParentScene::loadLayout(bool forceLoad) +{ + if(!this->_layoutLoaded || forceLoad){ + + _layoutLoaded = false; + + if (_loadFromAssets && cocos2d::FileUtils::getInstance()->isFileExist(this->_layoutFilePath)) { + auto& layoutParser = LayoutParser::getInstance(); + layoutParser.loadLayoutFromJSONFile(this->_layoutFilePath, this); + this->_layoutLoaded = true; + } + else if(!_loadFromAssets){ + auto& layoutParser = LayoutParser::getInstance(); + layoutParser.loadLayoutFromDownloadedJSONFile(this->_layoutFilePath, this); + this->_layoutLoaded = true; + } + + } +} + +void ParentScene::loadScenario(bool skipDemoActions) +{ +// auto fileUtils = cocos2d::FileUtils::getInstance(); +// if (fileUtils->isFileExist(this->_scenarioFilePath)) { +// std::string jsonString = fileUtils->getStringFromFile(this->_scenarioFilePath); +// _scenarioHandler->loadScenarioFromJSONString(jsonString, skipDemoActions); +// } +} + +void ParentScene::setLoadFromAssets(bool loadFromAssets) +{ + _loadFromAssets = loadFromAssets; +} + +// overrides + +void ParentScene::onEnter() +{ + this->configureTouchHandlers(); + this->configureTransitionListeners(); + SceneWithUtils::onEnter(); +// auto playing = this->playBackgroundMusic(true); +// this->adjustBgMusicButton(playing); +} + +void ParentScene::onExit() +{ + SceneWithUtils::onExit(); +// if(_scenarioHandler){ +// _scenarioHandler->end(); +//// delete _scenarioHandler; //TODO do it somewhere when the scene gets dealloced +// } +// this->stopBackgroundMusic(false); +} + + +void ParentScene::configureTransitionListeners() //TODO check if it works. remove somewhere later the vent listeners? leaks? +{ + _eventDispatcher->addCustomEventListener("game_on_hide", CC_CALLBACK_1(ParentScene::onGameHide, this)); + _eventDispatcher->addCustomEventListener("game_on_show", CC_CALLBACK_1(ParentScene::onGameShow, this)); +} + +void ParentScene::onGameHide(cocos2d::EventCustom* event) +{ +// _scenarioHandler->pauseScenario(); +} + +void ParentScene::onGameShow(cocos2d::EventCustom* event) +{ +// _scenarioHandler->resumeScenario(); +} + +// object config & handlers + +ScenarioObject* ParentScene::getObjectByName(std::string objectName) +{ + if(_objects.find(objectName) == _objects.end()){ + + if(_scenarioObjects.find(objectName) == _scenarioObjects.end()){ + return NULL; + } + + return _scenarioObjects.at(objectName); + } + + return dynamic_cast(_objects.at(objectName)); +} + +void ParentScene::addNewObject(std::string objectName, ScenarioObject* newObject) +{ + _scenarioObjects.insert({objectName, newObject}); +} + +void ParentScene::setupBackgroundMusic(std::string backgroundMusicPath) +{ + _backgroundMusicFilePath = backgroundMusicPath; +} + +bool ParentScene::touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) +{ + if(objectName == "backButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ +// _scenarioHandler->pauseScenario(); +// _scenarioHandler->stopAllActions(); + SoundsRepo::stopAllSounds(); + cocos2d::Director::getInstance()->popScene(); + _sceneDismissCallback(); + return true; + } /*else if(objectName == "backgroundMusicButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + +// auto bgMusicButton = dynamic_cast(_objects[objectName]); + +// if(this->isBackgroundMusicPlaying()){ +// this->stopBackgroundMusic(true); +// +// if(bgMusicButton->isActive()){ +// bgMusicButton->setActive(false); +// } +// +// } else { +// this->playBackgroundMusic(false); +// +// if(!bgMusicButton->isActive()){ +// bgMusicButton->setActive(true); +// } +// } + }*/ + + return false; +} + +void ParentScene::adjustBgMusicButton(bool bgMusicPlaying) +{ + if(_objects.find("backgroundMusicButton") != _objects.end()){ + auto bgMusicButton = dynamic_cast(_objects["backgroundMusicButton"]); + if(bgMusicPlaying){ + if(!bgMusicButton->isActive()){ + bgMusicButton->setActive(true); + } + } else { + if(bgMusicButton->isActive()){ + bgMusicButton->setActive(false); + } + } + } +} + +void ParentScene::disableButton(const std::string& buttonName) +{ + auto object = this->getObjectByName(buttonName); + auto button = dynamic_cast(object); + if(button){ + button->setEnabled(false); + if(button->getOpacity() != 0){ + button->setOpacity(128); + for(auto child : button->getChildren()){ + child->setOpacity(128); + } + } + } +} + +void ParentScene::enableButton(const std::string& buttonName) +{ + auto object = this->getObjectByName(buttonName); + auto button = dynamic_cast(object); + if(button){ + button->setEnabled(true); + button->setOpacity(255); + for(auto child : button->getChildren()){ + child->setOpacity(255); + } + } +} + +// fast forward button convenience + +void ParentScene::disableFastForwardButton() +{ + this->disableButton("fastForwardButton"); +} + +void ParentScene::enableFastForwardButton() +{ + this->enableButton("fastForwardButton"); +} + +// touch handlers + +void ParentScene::configureTouchHandlers() +{ + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event) -> bool{ + + _isHandlingTouches = true; + for(auto handler : _touchBeganHandlers){ + handler.second(touch, event); + } + + _isHandlingTouches = false; + this->filterTouchHandlers(); + + return true; + }; + + touchListener->onTouchMoved = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + _isHandlingTouches = true; + _lastUserTouchMovedTime = cocos2d::utils::getTimeInMilliseconds(); + + for(auto handler : _touchMovedHandlers){ + handler.second(touch, event); + } + + _isHandlingTouches = false; + this->filterTouchHandlers(); + }; + + touchListener->onTouchEnded = [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + _isHandlingTouches = true; + _lastUserTouchEndedTime = cocos2d::utils::getTimeInMilliseconds(); + + for(auto handler : _touchEndedHandlers){ + handler.second(touch, event); + } + + _isHandlingTouches = false; + this->filterTouchHandlers(); + }; + + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this); + } + +void ParentScene::filterTouchHandlers() +{ + for(auto pair : _touchHandlersToRemove){ + this->removeTouchHandler(pair.first, pair.second); + } + + _touchHandlersToRemove.clear(); +} + +void ParentScene::clearTouchHandlers() +{ + _touchBeganHandlers.clear(); + _touchMovedHandlers.clear(); + _touchEndedHandlers.clear(); + } + +void ParentScene::addTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType) +{ + auto handlersArray = this->pickTouchHandlersContainer(touchType); + + if(handlersArray){ + handlersArray->insert({key, touchHandler}); + } +} + +void ParentScene::removeTouchHandler(std::string touchHandlerKey, TouchHandlerType touchHandlerType) +{ + if(!_isHandlingTouches){ + auto handlersArray = this->pickTouchHandlersContainer(touchHandlerType); + if(handlersArray){ + handlersArray->erase(touchHandlerKey); + } + } + else { + _touchHandlersToRemove.insert({touchHandlerKey, touchHandlerType}); + } +} + +std::map* ParentScene::pickTouchHandlersContainer(TouchHandlerType touchHandlerType) +{ + std::map* handlersArray = NULL; + switch(touchHandlerType){ + case TouchHandlerType::TOUCHES_BEGAN: + handlersArray = &_touchBeganHandlers; + break; + case TouchHandlerType::TOUCHES_MOVED: + handlersArray = &_touchMovedHandlers; + break; + case TouchHandlerType::TOUCHES_ENDED: + handlersArray = &_touchEndedHandlers; + break; + default: + break; + } + + return handlersArray; +} + +long long ParentScene::getLastScreenTouchTime() +{ + if(_lastUserTouchEndedTime != -1 && _lastUserTouchMovedTime != -1){ + return MAX(_lastUserTouchEndedTime, _lastUserTouchMovedTime); + } else { + return _lastUserTouchMovedTime; // if moved is null, ended must be null as well + } +} + +void ParentScene::resetLastUserTouchTimes() +{ + _lastUserTouchEndedTime = -1; + _lastUserTouchMovedTime = -1; +} + + +void ParentScene::setAlwaysSkipDemo(bool alwaysSkipDemo) +{ + _alwaysSkipDemo = alwaysSkipDemo; +} + +// layout parse delegate +void ParentScene::addLayer(cocos2d::Layer* layer) +{ + _layers.push_back(layer); +} + +void ParentScene::addObject(std::string objectName, cocos2d::Node* object) +{ + _objects.insert({objectName, object}); +} + +void ParentScene::addScenarioObject(std::string objectName, ScenarioObject* object) +{ + _scenarioObjects.insert({objectName, object}); +} + +// ScenarioObject + +void ParentScene::setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) +{ + static std::string demoState = "demoState"; + static std::string userTaskInteractionStarted = "userTaskInteractionStarted"; + static std::string currentTask = "currentTask"; + static std::string rightObjectTouchedAlready = "rightObjectTouchedAlready"; + + if (propertyName == demoState) { +// _scenarioHandler->setProperty(propertyName, newValue, parseDelegate); + } + else if(propertyName == userTaskInteractionStarted){ + _userTaskInteractionStarted = newValue.GetBool(); + } + else if(propertyName.find(userTaskInteractionStarted) == 0){ + std::string additionalName = propertyName.substr(userTaskInteractionStarted.size()); + _userTaskInteractionStartedMap[additionalName] = newValue.GetBool(); + } + else if(propertyName == currentTask){ + _currentTask = newValue.GetString(); + } + else if(propertyName == rightObjectTouchedAlready){ + _rightObjectTouchedAlready = newValue.GetBool(); + } +} + +void ParentScene::callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback) +{ + if(methodName == "disableFastForwardButton"){ + this->disableFastForwardButton(); + } + else if(methodName == "clearTouchHandlers"){ + this->clearTouchHandlers(); + } +} + +std::string ParentScene::getPropertyAsString(std::string propertyName) +{ + static std::string userTaskInteractionStarted = "userTaskInteractionStarted"; + + if(propertyName == userTaskInteractionStarted){ + return _userTaskInteractionStarted ? "true" : "false"; + } + else if(propertyName.find(userTaskInteractionStarted) != std::string::npos){ + auto tokens = StringUtils::splitString(propertyName, userTaskInteractionStarted); + if(tokens.size() > 0){ + auto key = tokens[tokens.size()-1]; + if(_userTaskInteractionStartedMap.find(key) != _userTaskInteractionStartedMap.end()){ + return _userTaskInteractionStartedMap.at(key) ? "true" : "false"; + } + } + } + else if(propertyName == "rightObjectTouchedAlready"){ + return _rightObjectTouchedAlready ? "true" : "false"; + } + return "NULL"; +} + +void ParentScene::addNewNodeToObjectLayer(cocos2d::Node* newNode){ + if(_layers.size() > 0){ + _layers[_layers.size()-1]->addChild(newNode); + } +} + +void ParentScene::showTOSAcceptPopup(std::function onAccept){ + if(MiscUtils::wasTOSAccepted()){ +// gameState->tosAcceptMenuShown = false; + onAccept(); + } else { +// gameState->tosAcceptMenuShown = true; + auto tosPopup = TOSAcceptPopupView::create(std::bind([&](std::functionf){ + MiscUtils::saveTOSAccepted(); +// gameState->tosAcceptMenuShown = false; + f();}, onAccept)); + + addTouchBlockingLayer(tosPopup); + tosPopup->setLocalZOrder(500); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + auto keyboardListener = cocos2d::EventListenerKeyboard::create(); + keyboardListener->onKeyReleased = std::bind([&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event, TOSAcceptPopupView* n){ + if(keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK){ + if(MiscUtils::isNodeVisible(n)){ + if (n->isShowingParentalGate()) { + n->hideParentalGate(); + } else { + cocos2d::Director::getInstance()->end(); + } + } + } + }, std::placeholders::_1, std::placeholders::_2, tosPopup); + _eventDispatcher->addEventListenerWithSceneGraphPriority(keyboardListener, tosPopup); +#endif + } +} + +void ParentScene::showLevelPickerLayer(std::function onLayerDismissed, std::function onLevelChanged) { + isShowingLevelPicker = true; + auto levelPickerLayer = LevelPickerLayer::create(getBoundingBox().size.width, + getBoundingBox().size.height); + addTouchBlockingLayer(levelPickerLayer); + levelPickerLayer->setLocalZOrder(400); + levelPickerLayer->addOnGoPressedCallback(onLayerDismissed); + levelPickerLayer->setOnLevelChangedCallback(onLevelChanged); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + auto keyboardListener = cocos2d::EventListenerKeyboard::create(); + keyboardListener->onKeyReleased = std::bind( + [&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event *event, cocos2d::Node *n) { + if (keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK) { + if (MiscUtils::isNodeVisible(n)) { + cocos2d::Director::getInstance()->end(); + } + } + }, std::placeholders::_1, std::placeholders::_2, levelPickerLayer); + _eventDispatcher->addEventListenerWithSceneGraphPriority(keyboardListener, levelPickerLayer); +#endif +} + +void ParentScene::addTouchBlockingLayer(cocos2d::Node* layer){ + addChild(layer); + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->setSwallowTouches(true); + touchListener->onTouchBegan = std::bind([&](cocos2d::Touch* touch, cocos2d::Event* event, cocos2d::Node* n){ + return MiscUtils::isNodeVisible(n); + }, std::placeholders::_1, std::placeholders::_2, layer); + _eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, layer); +} + +void ParentScene::repeatPickLevelPrompt(){ + static int DelaySecs = 15; + runAction(cocos2d::Sequence::create(cocos2d::DelayTime::create(DelaySecs), + cocos2d::CallFunc::create([&](){ + if(isShowingLevelPicker){ + SoundsRepo::playSound(SoundsRepo::pickLevelSound().filePath); + repeatPickLevelPrompt(); + } + }), + nullptr)); +} + + + diff --git a/ios/Runner/Wowgame/Classes/Scenes/ParentScene.h b/ios/Runner/Wowgame/Classes/Scenes/ParentScene.h new file mode 100644 index 0000000..57ac217 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/ParentScene.h @@ -0,0 +1,137 @@ +// +// ParentScene.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 16.05.2017. +// +// + +#ifndef ParentScene_h +#define ParentScene_h + +#include "SceneWithUtils.h" +//#include "ScenarioHandler.h" +#include "ui/CocosGUI.h" +#include "TouchHandlerTypes.h" +#include "ScenarioObject.h" +#include "LayoutParser.h" +#include "audio/include/AudioEngine.h" + +class ParentScene : public SceneWithUtils, public ScenarioObject, public LayoutViewInterface +{ +// friend class ScenarioHandler; + + public: + + // create + static ParentScene* create(std::string layoutFilePath = "", std::string scenarioFilePath = ""); + + virtual bool initWithConfigurationFiles(std::string layoutFilePath = "", std::string scenarioFilePath = ""); + + // overrides + virtual void onEnter() override; + virtual void onExit() override; + + // layoutViewinterface + virtual void addLayer(cocos2d::Layer* layer) override; + virtual void addObject(std::string objectName, cocos2d::Node* object) override; + virtual void addScenarioObject(std::string objectName, ScenarioObject* object) override; + virtual void setupBackgroundMusic(std::string backgroundMusicPath) override; + virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override; + + + // Scenario Object + + virtual ScenarioObject* getObjectByName(std::string objectName) override; + virtual void setProperty(std::string propertyName, const rapidjson::Value& newValue, ActionParseDelegate* parseDelegate) override; + virtual void callFunctionByName(std::string methodName, const rapidjson::Value* arguments, ActionParseDelegate* parseDelegate, std::function callback = [](){}) override; + virtual std::string getPropertyAsString(std::string propertyName = "") override; + + // other + + virtual void addNewObject(std::string objectName, ScenarioObject* newObject); + + virtual void disableButton(const std::string& buttonName); + virtual void enableButton(const std::string& buttonName); + virtual void disableFastForwardButton(); + virtual void enableFastForwardButton(); + + virtual long long getLastScreenTouchTime(); + + virtual void setAlwaysSkipDemo(bool alwaysSkipDemo); + + virtual void addTouchHandler(std::string key, TouchHandlerFunction touchHandler, TouchHandlerType touchType); + virtual void removeTouchHandler(std::string touchHandlerKey, TouchHandlerType touchHandlerType); + + virtual void setLoadFromAssets(bool loadFromAssets); + + protected: + + // configuration file paths + + std::string _layoutFilePath; + std::string _scenarioFilePath; + bool _loadFromAssets; + + // layout objects + + std::vector _layers; + std::map _objects; + std::map _scenarioObjects; // other than cocos2d::Nodes + + // state vars + + bool _layoutLoaded; + + // scenario handling + + bool _alwaysSkipDemo; +// ScenarioHandler* _scenarioHandler; + + // touch handling + + std::map _touchBeganHandlers; + std::map _touchMovedHandlers; + std::map _touchEndedHandlers; + + std::map _touchHandlersToRemove; + bool _isHandlingTouches; + + long long _lastUserTouchEndedTime; + long long _lastUserTouchMovedTime; + + bool _userTaskInteractionStarted; + std::map _userTaskInteractionStartedMap; + std::string _currentTask; + bool _rightObjectTouchedAlready; + bool isShowingLevelPicker; + + // methods + + virtual void adjustBgMusicButton(bool bgMusicPlaying); + virtual void reloadLayoutClean(); + virtual void loadLayout(bool forceLoad); + virtual void loadScenario(bool skipDemoActions); + + virtual void configureTransitionListeners(); + virtual void onGameHide(cocos2d::EventCustom* event); + virtual void onGameShow(cocos2d::EventCustom* event); + + virtual void resetLastUserTouchTimes(); + + virtual void configureTouchHandlers(); + virtual void filterTouchHandlers(); + virtual void clearTouchHandlers(); + virtual std::map* pickTouchHandlersContainer(TouchHandlerType touchHandlerType); + + virtual void addNewNodeToObjectLayer(cocos2d::Node* newNode); + virtual void addTouchBlockingLayer(cocos2d::Node* layer); + virtual void showTOSAcceptPopup(std::function onAccept); + virtual void showLevelPickerLayer(std::function onLayerDismissed, std::function onLevelChanged = [](int){}); + + virtual void repeatPickLevelPrompt(); +}; + +#endif /* ParentScene_h */ + + diff --git a/ios/Runner/Wowgame/Classes/Scenes/SceneWithUtils.cpp b/ios/Runner/Wowgame/Classes/Scenes/SceneWithUtils.cpp new file mode 100644 index 0000000..60061d0 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/SceneWithUtils.cpp @@ -0,0 +1,192 @@ +// +// SceneWithUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 11.05.2017. +// +// + +#include +#include "SceneWithUtils.h" +#include "TouchInterceptingLayer.h" +#include "GeometryUtils.h" +#include "MiscUtils.h" + +bool SceneWithUtils::init() +{ + if(!cocos2d::Scene::init()) + { + return false; + } + + _currentDialogView = NULL; + _currentLoadingView = NULL; + _dialogDismissCallback = [](){}; + _dialogPresentCallback = [](){}; + _scenePresentCallback = [](){}; + _sceneDismissCallback = [](){}; + _backgroundMusicFilePath = ""; + + _touchOutsideDismissesDialog = true; + + return true; +} + +void SceneWithUtils::onEnterTransitionDidFinish() +{ + cocos2d::Scene::onEnterTransitionDidFinish(); + _scenePresentCallback(); +} + +void SceneWithUtils::onExit() +{ + cocos2d::Scene::onExit(); + _sceneDismissCallback(); +} + +void SceneWithUtils::presentDialog(cocos2d::Node* dialogView, AnimationType presentAnimationType, AnimationType dismissAnimationType, const std::function presentCallback) +{ + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto defaultDialogViewPosition = cocos2d::Point(winSize.width/2, winSize.height/2); + auto defaultDialogViewAnchorPoint = cocos2d::Point(0.5, 0.5); + + this->presentDialog(dialogView, presentAnimationType, dismissAnimationType, defaultDialogViewPosition, defaultDialogViewAnchorPoint, presentCallback); +} + +void SceneWithUtils::presentDialog(cocos2d::Node* dialogView, AnimationType presentAnimationType, AnimationType dismissAnimationType, cocos2d::Point dialogViewPosition, cocos2d::Point dialogViewAnchorPoint, const std::function presentCallback) +{ + if(dialogView != NULL){ + + _dialogPresentCallback = presentCallback; + + this->dismissCurrentDialog(); + + this->_currentDialogView = dialogView; + this->_dialogDismissAnimationType = dismissAnimationType; + + auto dialogOverlayView = cocos2d::Layer::create(); + auto interceptingLayer = TouchInterceptingLayer::create(cocos2d::Color4B(0,0,0,200)); + + dialogOverlayView->setAnchorPoint(dialogViewAnchorPoint); + dialogOverlayView->setPosition(dialogViewPosition); + dialogOverlayView->setIgnoreAnchorPointForPosition(false); + + dialogOverlayView->addChild(interceptingLayer, 0); + dialogOverlayView->addChild(dialogView, 1); + this->addChild(dialogOverlayView); + + dialogView->setIgnoreAnchorPointForPosition(false); + dialogView->setAnchorPoint(dialogViewAnchorPoint); + dialogView->setPosition(dialogViewPosition); + + interceptingLayer->setOnTouchCallback([&](cocos2d::Touch* touch){ + + if(_touchOutsideDismissesDialog){ + auto dialogViewBBToWorld = GeometryUtils::getBoundingBoxToWorld(_currentDialogView); + auto touchPointLocation = touch->getLocationInView(); + if(!dialogViewBBToWorld.containsPoint(touchPointLocation)){ + this->dismissCurrentDialog(); + } + } + }); + + if(presentAnimationType == SceneWithUtils::AnimationType::NONE){ + _dialogPresentCallback(); + } else { + this->_animateDialogView(dialogOverlayView, presentAnimationType, _dialogPresentCallback); + } + } + +} + +void SceneWithUtils::dismissCurrentDialog() +{ + this->dismissCurrentDialog(_dialogDismissCallback); +} + +void SceneWithUtils::dismissCurrentDialog(const std::function dismissCallback) +{ + if(this->_currentDialogView != NULL){ + + _dialogDismissCallback = dismissCallback; + _fullDismissCallback = [&](){ + + if(this->_currentDialogView){ + this->removeChild(this->_currentDialogView->getParent()); + this->_currentDialogView = NULL; + } + _dialogDismissCallback(); + }; + + if(_dialogDismissAnimationType == SceneWithUtils::AnimationType::NONE){ + _fullDismissCallback(); + } else { + this->_animateDialogView(this->_currentDialogView->getParent(), this->_dialogDismissAnimationType, _fullDismissCallback); + } + } + +} + +void SceneWithUtils::presetDialogDismissCallback(const std::function dismissCallback) +{ + _dialogDismissCallback = dismissCallback; +} + +SceneWithUtils::AnimationType SceneWithUtils::animationTypeFromString(std::string animationType) +{ + if(animationType == "SCALE_UP"){ + return SCALE_UP; + } + else if(animationType == "SCALE_DOWN"){ + return SCALE_DOWN; + } else if(animationType == "FADE_OUT"){ + return FADE_OUT; + } else if(animationType == "FADE_IN"){ + return FADE_IN; + } + + return NONE; +} + +void SceneWithUtils::setScenePresentCallback(std::function callback) +{ + _scenePresentCallback = callback; +} + +void SceneWithUtils::setSceneDismissCallback(std::function callback) +{ + _sceneDismissCallback = callback; +} + +/////////////////////////////////////// + +void SceneWithUtils::_animateDialogView(cocos2d::Node* dialogView, AnimationType animationType, const std::function& callback) +{ + auto callbackAction = cocos2d::CallFunc::create([&](){ + callback(); + }); + + switch (animationType) { + case SCALE_UP: + dialogView->setScale(0); + dialogView->runAction(cocos2d::Sequence::create(cocos2d::ScaleTo::create(0.2, 1), callbackAction, nullptr)); + break; + + case SCALE_DOWN: + dialogView->setScale(1); + dialogView->runAction(cocos2d::Sequence::create(cocos2d::ScaleTo::create(0.2, 0), callbackAction, nullptr)); + break; + + case FADE_OUT: + dialogView->runAction(cocos2d::Sequence::create(cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime), callbackAction, nullptr)); + + case FADE_IN: + dialogView->setOpacity(0); + dialogView->runAction(cocos2d::Sequence::create(cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime), callbackAction, nullptr)); + + default: + dialogView->runAction(callbackAction); + break; + } +} + diff --git a/ios/Runner/Wowgame/Classes/Scenes/SceneWithUtils.h b/ios/Runner/Wowgame/Classes/Scenes/SceneWithUtils.h new file mode 100644 index 0000000..04f92fb --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/SceneWithUtils.h @@ -0,0 +1,72 @@ +// +// SceneWithUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 11.05.2017. +// +// + +#ifndef SceneWithUtils_h +#define SceneWithUtils_h + +#include "cocos2d.h" + +class SceneWithUtils : public cocos2d::Scene +{ + + public: + + // enums + + typedef enum AnimationType { + NONE, + SCALE_DOWN, + SCALE_UP, + FADE_OUT, + FADE_IN + } AnimationType; + + // presenting dialogs + + virtual void presentDialog(cocos2d::Node* dialogView, AnimationType presentAnimationType, AnimationType dismissAnimationType, const std::function presentCallback = [](){}); + virtual void presentDialog(cocos2d::Node* dialogView, AnimationType presentAnimationType, AnimationType dismissAnimationType, cocos2d::Point dialogViewPosition, cocos2d::Point dialogViewAnchorPoint, const std::function presentCallback = [](){}); + + virtual void dismissCurrentDialog(); + virtual void dismissCurrentDialog(const std::function dismissCallback); + + virtual void presetDialogDismissCallback(const std::function dismissCallback); + + static AnimationType animationTypeFromString(std::string animationType); + + // other + virtual void setScenePresentCallback(std::function callback); + virtual void setSceneDismissCallback(std::function callback); + + // overrides + + virtual bool init() override; + virtual void onEnterTransitionDidFinish() override; + virtual void onExit() override; + + protected: + + cocos2d::Node* _currentDialogView; + SceneWithUtils::AnimationType _dialogDismissAnimationType; + std::function _dialogDismissCallback; + std::function _dialogPresentCallback; + std::function _fullDismissCallback; + + bool _touchOutsideDismissesDialog; + + cocos2d::Node* _currentLoadingView; + + std::string _backgroundMusicFilePath; + + std::function _scenePresentCallback; + std::function _sceneDismissCallback; + + virtual void _animateDialogView(cocos2d::Node* dialogView, AnimationType animationType, const std::function& callback); +}; + +#endif /* SceneWithUtils_h */ + diff --git a/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameScene.cpp b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameScene.cpp new file mode 100644 index 0000000..e144a37 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameScene.cpp @@ -0,0 +1,293 @@ +// +// SubGameScene.cpp +// SteveAndMaggieGame-mobile +// +// Created by Katarzyna Kalinowska-Górska on 07/05/2019. +// + +#include "SubGameScene.h" +#include "SoundUtils.h" +#include "SimpleButton.h" +#include "MathUtils.h" +#include "MiscUtils.h" +#include "ui/CocosGUI.h" +#include "ScalingUtils.h" +#include "LevelPickerView.h" +#include +#include "LevelPickerLayer.h" +#include "cocos2d.h" +#include "TOSAcceptPopupView.h" +#include "SoundsRepo.h" + +static float SOUND_EFFECTS_VOLUME = 0.75; + +bool SubGameScene::initWithConfiguration(std::string layoutFilePath) +{ + if(!ParentScene::initWithConfigurationFiles(layoutFilePath)){ + return false; + } + + gameState = createGameState(); + + auto backgroundLayer = cocos2d::LayerColor::create(cocos2d::Color4B(255,255,255,255)); + this->addChild(backgroundLayer); + +// soundEngine = CocosDenshion::SimpleAudioEngine::getInstance(); + + SoundsRepo::preloadAllLoadedSoundEffects(); + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + addBackButtonListener(); + #endif + + return true; +} + +SubGameScene::~SubGameScene(){ + removeGameState(); +} + +SubGameScene::GameState* SubGameScene::createGameState(){ + return new SubGameScene::GameState(); +} + +void SubGameScene::clearGameState(){ + clearAllItems(); + gameState->playState = SubGameScene::PlayState::INIT; + gameState->currentItemTypeIndex = -1; + gameState->itemVanishingMode = false; + gameState->timeCount = 0; + gameState->lossTimeCount = 0; + gameState->lossHalfTime = 0; + gameState->wrongItemCount = 0; + gameState->currentLevel = -1; + gameState->itemTypeOrder.clear(); + gameState->itemTypeOrder.push_back(ItemType::ONE); + gameState->itemTypeOrder.push_back(ItemType::TWO); + gameState->itemTypeOrder.push_back(ItemType::THREE); + gameState->itemTypeOrder.push_back(ItemType::FOUR); +// std::random_shuffle ( gameState->itemTypeOrder.begin(), gameState->itemTypeOrder.end() ); +} + + +void SubGameScene::removeGameState(){ + if(gameState != nullptr){ + clearAllItems(); +// for(auto it = gameState->items.begin(); it != gameState->items.end(); ++it){ +// delete it->second; +// } + delete gameState; + gameState = nullptr; + } +} + +void SubGameScene::onEnter() +{ + ParentScene::onEnter(); + loadLayout(false); + addLivesIndicatorView(); + prepareSettingsMenu(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + auto keyboardListener = cocos2d::EventListenerKeyboard::create(); + keyboardListener->onKeyReleased = [&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event){ + if(keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK) { + ParentScene::touchHandlerForWidget("backButton", + cocos2d::ui::Widget::TouchEventType::ENDED); + } + }; + _eventDispatcher->addEventListenerWithSceneGraphPriority(keyboardListener, this); +#endif +} + +//void SubGameScene::onExit(){ +// ParentScene::onEnter(); +// +//} + +bool SubGameScene::touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) +{ + if(objectName == "pauseButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + presentGameResumeLayer(); + } else if(objectName == "prevButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + if(this->onPrevLevelButtonClicked()){ + return true; + } + } else if(objectName == "replayButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + + return this->onReplayButtonClicked(); + + } + else if(objectName == "nextButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + + return this->onNextLevelButtonClicked(); + } + else if(objectName == "fastForwardButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + + return this->onFastForwardButtonClicked(); + } + + return ParentScene::touchHandlerForWidget(objectName, touchEventType); +} + +bool SubGameScene::onPrevLevelButtonClicked() +{ + return true; +} + +bool SubGameScene::onReplayButtonClicked() +{ + lifeIndicatorView->reset(); + resetGame(); + return true; +} + +bool SubGameScene::onNextLevelButtonClicked() +{ + return true; +} + +bool SubGameScene::onFastForwardButtonClicked() +{ + disableButton("fastForwardButton"); + clearAllItems(); + return SubGameScene::onReplayButtonClicked(); +} + +void SubGameScene::resetGame(){ + stopAllActions(); + clearGameState(); + startGame(false); +} + +void SubGameScene::clearAllItems(){ + std::map::iterator it = gameState->items.begin(); + while(it != gameState->items.end()){ + delete it->second; + ++it; + } + gameState->items.clear(); +} + +void SubGameScene::gameWon(){ + gameState->playState = PlayState::WON; +} + +void SubGameScene::gameLost(){ + gameState->playState = PlayState::LOST; +} + +static int ResumeLayerTag = 123; + +void SubGameScene::presentGameResumeLayer(){ + if(this->getChildByTag(ResumeLayerTag) == nullptr && !gameState->settingsMenuShown && (gameState->playState == PlayState::PLAYING || gameState->playState == PlayState::PRE_PLAYING || gameState->playState == PlayState::CHANGING_LEVEL)){ + pauseGame(); + //TODO constant for all the layers that have semi-transparent dark bg + auto resumeLayer = cocos2d::LayerColor::create(cocos2d::Color4B(0,0,0,220),getBoundingBox().size.width, getBoundingBox().size.height); + resumeLayer->setCascadeOpacityEnabled(true); + addTouchBlockingLayer(resumeLayer); + resumeLayer->setLocalZOrder(400); + resumeLayer->setTag(ResumeLayerTag); + // add the resume button + auto buttonResume = SimpleButton::create(); + buttonResume->setCascadeOpacityEnabled(true); + auto buttonTexturePath = "buttons/graphics/dark_green.png"; + buttonResume->loadTextures(buttonTexturePath, buttonTexturePath, buttonTexturePath); + auto buttonBg = cocos2d::Sprite::create("buttons/graphics/button_repeat.png"); + buttonResume->addChild(buttonBg); + buttonBg->setPosition(cocos2d::Vec2(buttonResume->getContentSize().width/2,buttonResume->getContentSize().height/2)); + resumeLayer->addChild(buttonResume); + buttonResume->setPosition(cocos2d::Vec2(resumeLayer->getContentSize().width/2, resumeLayer->getContentSize().height/2)); + buttonResume->setOnTouchEndedCallback(std::bind([&](std::string name, cocos2d::ui::Widget::TouchEventType eventType, cocos2d::Node* n){ + resumeGame(); + MiscUtils::hideAndRemoveView(n, true); + }, std::placeholders::_1, std::placeholders::_2, resumeLayer)); + resumeLayer->setOpacity(0); + MiscUtils::showView(resumeLayer, true, 220.f); + } +} + +void SubGameScene::prepareSettingsMenu(){ + if(settingsMenu == nullptr){ + isShowingSettings = false; + auto screenSize = cocos2d::Director::getInstance()->getWinSize(); + settingsMenu = SettingsLayer::create(screenSize.width, screenSize.height, CC_CALLBACK_0(SubGameScene::hideSettingsMenuWithLevelReset, this)); + // addChild(settingsMenu); + addTouchBlockingLayer(settingsMenu); + settingsMenu->setLocalZOrder(200); + moveSettingsButtonToFront(210); + hideSettingsMenu(false); + + settingsMenu->setPosition(cocos2d::Vec2(0, 0)); + settingsMenu->setCascadeOpacityEnabled(true); + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + auto keyboardListener = cocos2d::EventListenerKeyboard::create(); + keyboardListener->onKeyReleased = std::bind([&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event, cocos2d::Node* n){ + if(keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK){ + if(MiscUtils::isNodeVisible(n)) { + if (settingsMenu->isShowingParentalGate()) { + settingsMenu->hideParentalGate(); + } else { + resumeGame(); + hideSettingsMenu(true); + } + } + } + }, std::placeholders::_1, std::placeholders::_2, settingsMenu); + _eventDispatcher->addEventListenerWithSceneGraphPriority(keyboardListener, settingsMenu); + #endif + } +} + +void SubGameScene::showSettingsMenu(bool animated){ + gameState->settingsMenuShown = true; +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + _keyboardListener->setEnabled(false); +#endif + settingsMenu->prepareForShowing(); + if(animated){ + settingsMenu->stopAllActions(); + settingsMenu->setVisible(true); + settingsMenu->setOpacity(0); + settingsMenu->runAction(cocos2d::FadeTo::create(MiscUtils::StandardAnimationTime, 240)); //TODO magic number + } else { + settingsMenu->setOpacity(255); + } +} + +void SubGameScene::hideSettingsMenu(bool animated){ + gameState->settingsMenuShown = false; + if(animated){ + settingsMenu->stopAllActions(); + settingsMenu->runAction(cocos2d::Sequence::create(cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime), + cocos2d::CallFunc::create([&](){ + settingsMenu->setVisible(false); + }), nullptr)); + } else { + settingsMenu->setOpacity(0); + settingsMenu->setVisible(false); + } + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + settingsMenu->runAction(cocos2d::CallFunc::create([&](){ + _keyboardListener->setEnabled(true); + })); + #endif +} + +void SubGameScene::moveSettingsButtonToFront(int localZOrder){ + auto settingsButton = _objects["settingsButton"]; + settingsButton->removeFromParent(); //remove from the object layer, which it is originally in, as specified in the scene_layout file + addChild(settingsButton); + settingsButton->setLocalZOrder(localZOrder); +} + +void SubGameScene::addLivesIndicatorView(){ + lifeIndicatorView = GameLifeIndicatorView::create("graphics/g_life_indicator_ok.png", "graphics/g_life_indicator_dead.png", 3); //TODO no slives + addChild(lifeIndicatorView); + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto paddingTop = lifeIndicatorView->getPaddingX()/2; + lifeIndicatorView->setPosition(winSize.width - lifeIndicatorView->getBoundingBox().size.width, winSize.height - lifeIndicatorView->getBoundingBox().size.height - paddingTop); + lifeIndicatorView->setLocalZOrder(100); + lifeIndicatorView->setCascadeOpacityEnabled(true); +} + diff --git a/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameScene.h b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameScene.h new file mode 100644 index 0000000..d6ba8b1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameScene.h @@ -0,0 +1,151 @@ +// +// SubGameScene.h +// SteveAndMaggieGame +// +// Created by Katarzyna Kalinowska-Górska on 07/05/2019. +// + +#ifndef SubGameScene_h +#define SubGameScene_h + +#include "ParentScene.h" +#include "audio/include/AudioEngine.h" +#include "GameLifeIndicatorView.h" +#include "SettingsLayer.h" + +class SubGameScene : public ParentScene +{ +public: + + class GameCreator { + public: + virtual SubGameScene* createGameScene(int gameId,std::string layoutFilePath) = 0; + }; + + virtual void onEnter() override; +// virtual void onExit() override; +// virtual void onEnterTransitionDidFinish() override; + + virtual bool initWithConfiguration(std::string layoutFilePath); + virtual ~SubGameScene(); + + bool isPaused(){return m_pauseState == PauseState::PAUSED;} + + virtual void pauseGame() { m_pauseState = PauseState::PAUSED; } + virtual void resumeGame() { m_pauseState = PauseState::RUNNING; } + virtual void presentGameResumeLayer(); + + enum class PauseState { + RUNNING, + PAUSED + }; + +protected: + + enum class PlayState + { + INIT, + PRE_PLAYING, + PLAYING, + CHANGING_LEVEL, + LOST, + WON + }; + + enum class ItemType : int { + NONE = 0, + ONE = 1, + TWO = 2, + THREE = 3, + FOUR = 4 + }; + + class Item { + public: + cocos2d::Sprite* sprite; + cocos2d::Rect rect; + ItemType type; + + bool operator==(const Item& item2) { + if(sprite == nullptr || item2.sprite == nullptr){ + return false; + } + return sprite->getTag() == item2.sprite->getTag(); + } + + virtual ~Item(){ + if(sprite != nullptr){ + sprite->removeFromParent(); + } + } + }; + + // state variables + class GameState { + public: + PlayState playState; + bool settingsMenuShown; + bool tosAcceptMenuShown; + std::map items; + int currentLevel; + int currentItemTypeIndex; + std::vector itemTypeOrder; //the order of the types to catch (shuffled randomly at the beginning of each level) + bool itemVanishingMode; + float timeCount; + float lossTimeCount; + bool lossHalfTime; + int wrongItemCount; + virtual ~GameState(){} + }; + + PauseState m_pauseState { PauseState::RUNNING }; + GameState* gameState; + SettingsLayer* settingsMenu; + GameLifeIndicatorView* lifeIndicatorView; + + void addLivesIndicatorView(); + bool isShowingSettings {false}; + virtual void prepareSettingsMenu(); + virtual void showSettingsMenu(bool animated = true); + virtual void hideSettingsMenu(bool animated = true); //TODO move all these to an interface maybe? + virtual void hideSettingsMenuWithLevelReset() { hideSettingsMenu(); } + virtual void moveSettingsButtonToFront(int localZOrder); + + virtual GameState* createGameState(); + virtual void removeGameState(); + virtual void clearGameState(); + virtual void clearAllItems(); + + virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override; + virtual bool onPrevLevelButtonClicked(); + virtual bool onReplayButtonClicked(); + virtual bool onNextLevelButtonClicked(); + virtual bool onFastForwardButtonClicked(); + + virtual void startGame(bool playIntro = true) = 0; + virtual void gameWon(); + virtual void gameLost(); + virtual void resetGame(); + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + + cocos2d::EventListenerKeyboard* _keyboardListener; + + void addBackButtonListener(){ + _keyboardListener = cocos2d::EventListenerKeyboard::create(); + _keyboardListener->onKeyReleased = [&](cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event){ + if(keyCode == cocos2d::EventKeyboard::KeyCode::KEY_BACK){ + if(!gameState->settingsMenuShown && !gameState->tosAcceptMenuShown){ + pauseGame(); + MiscUtils::showAppCloseConfirmDialog([&](){ + resumeGame(); + }); + } + } + }; + cocos2d::Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(_keyboardListener, this); + } + #endif +}; + +#endif /* SubGameScene_h */ diff --git a/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameSceneShoot.cpp b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameSceneShoot.cpp new file mode 100644 index 0000000..f8f75a8 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameSceneShoot.cpp @@ -0,0 +1,1299 @@ +// +// SubGameSceneTapNCatch.cpp +// SteveAndMaggieGame-mobile +// +// Created by Katarzyna Kalinowska-Górska on 07/05/2019. +// + +#include "SubGameSceneShoot.h" +#include "MathUtils.h" +#include "SoundUtils.h" +#include "ScalingUtils.h" +#include "MiscUtils.h" +#include "SoundsRepo.h" +#include "PlainLabel.h" +#include "SimpleButton.h" +#include "GeometryUtils.h" + +//#include + +SubGameSceneShoot* SubGameSceneShoot::create(int pGameId, std::string layoutFilePath, std::function gameConfigParser){ + SubGameSceneShoot * scene = new (std::nothrow) SubGameSceneShoot(); + if(scene && scene->initWithConfiguration(pGameId, layoutFilePath, gameConfigParser)) + { + scene->autorelease(); + return scene; + } + CC_SAFE_DELETE(scene); + return nullptr; +} + +bool SubGameSceneShoot::initWithConfiguration(int pGameId,std::string layoutFilePath, std::function gameConfigParse){ + + if(!SubGameScene::initWithConfiguration(layoutFilePath)){ + return false; + } + + gameId = pGameId; + + gameConfigParse(gameConfig); + + _baseSpringOmegaZero = 5;//15; + _baseSpringDXForOmegaZero = 70.0; + slingAmpForBaseItemV = 100; + baseItemV = 200; + _springDampCoeff = 0; + slingHeight = 1; + + currentSteveHead = "steveHeadHappy"; //TODO var baseSteveHead + clearGameState(); + + return true; +} + +void SubGameSceneShoot::clearGameState(){ + + tut_intro_stop(); + + gameState->playState = SubGameScene::PlayState::INIT; + gameState->currentLevel = (int)MiscUtils::lastLevel(); + + stopAllActions(); + + if(_layoutLoaded){ + tut_hideFinger(); + cancelSlingDrag(false); + cancelItemDrag(); + lifeIndicatorView->reset(); + setStartTimeAndLabel(); + emptyTrolley(); + cleanupSplashedItems(); + switchSteveHead("steveHeadHappy"); + maggieCloseBeak(); + } + + shootGameState.currentItem = -1; + + shootGameState.itemIdsOrder.clear(); + auto maxId = 8; + for(int i = 1; i <= maxId; ++i){ + shootGameState.itemIdsOrder.push_back(i); + } + MathUtils::shuffleArray(shootGameState.itemIdsOrder); + + _currentItem = nullptr; + currentlyDraggedObjectId = -1; + _isDraggingSling = false; + + shootGameState.itemState = NONE; + shootGameState.itemFirstShot = false; +} + +void SubGameSceneShoot::onEnter(){ + SubGameScene::onEnter(); + disableButton("replayButton"); + + //TODO all this below make an init game function or sthng + _slingStick = dynamic_cast(_objects["slingStick"]); + _movingSling = dynamic_cast(_objects["sling"]); + _slingHand = dynamic_cast(_objects["slingHandWhole"]); + _slingSubHand = dynamic_cast(_objects["slingHand"]); + _slingGumLeft = dynamic_cast(_objects["slingGumLeft"]); + _slingGumRight = dynamic_cast(_objects["slingGumRight"]); + _cart = dynamic_cast(_objects["cartWhole"]); + _shelf = dynamic_cast(_objects["shelfWhole"]); + _cartFoodLayer = dynamic_cast(_objects["cartFood"]); + if(ScalingUtils::getDeviceAspectRatio() > 2.1f){ + auto wellDoneLabel = dynamic_cast(_objects["wellDoneLabel"]); + wellDoneLabel->setPositionY(cocos2d::Director::getInstance()->getVisibleSize().height-70*ScalingUtils::getAdjustedContentScaleFactor()); + } + _timeLabel = dynamic_cast(_objects["clockLabel"]); + _timeLabel->setWidth(_timeLabel->getContentSize().width); //to ake it invariable + + addTouchHandler("spacinTB", prepareTouchBeganHandler(), TOUCHES_BEGAN); + addTouchHandler("spacinTM", prepareTouchMovedHandler(), TOUCHES_MOVED); + addTouchHandler("spacinTE", prepareTouchEndedHandler(), TOUCHES_ENDED); + + _movingSlingOriginalPosition = _movingSling->getParent()->convertToWorldSpace(_movingSling->getPosition()); + _handOriginalPosition = _slingHand->getPosition(); + _slingLeftAttachmentPoint = _slingGumLeft->getParent()->convertToWorldSpace(cocos2d::Vec2(_slingGumLeft->getBoundingBox().getMaxX(), _slingGumLeft->getBoundingBox().getMaxY())); + _slingLeftStartLength = _slingGumLeft->getBoundingBox().size.height; + _slingRightAttachmentPoint = _slingGumRight->getParent()->convertToWorldSpace(cocos2d::Vec2(_slingGumRight->getBoundingBox().getMinX(), _slingGumRight->getBoundingBox().getMaxY())); + _slingRightStartLength = _slingGumRight->getBoundingBox().size.height; + + _currentItem = nullptr; + shootGameState.itemState = NONE; + + gumsFollowTheSling(false); + +// auto trolleyRect = shootGameState.cartFlippedX ? GeometryUtils::flippedXRect(_cart, gameConfig.steveRect) : gameConfig.steveRect; +// auto cartArea = trolleyRect;////GeometryUtils::getBoundingBoxToWorldForSubrect(_cart, trolleyRect); +//// +// auto texture = cocos2d::Director::getInstance()->getTextureCache()->addImage("graphics/shoot_game/graphics/wooden_shelf.png"); +// auto shelfBg = cocos2d::Sprite::createWithTexture(texture); +// cocos2d::Texture2D::TexParams params; +// params.sAddressMode = cocos2d::backend::SamplerAddressMode::REPEAT; //GL_REPEAT; +// params.tAddressMode = cocos2d::backend::SamplerAddressMode::REPEAT; +// shelfBg->getTexture()->setTexParameters(params); +// _cart->addChild(shelfBg); +// shelfBg->setPosition(cocos2d::Vec2(cartArea.getMidX(), cartArea.getMidY())); +// shelfBg->setContentSize(cartArea.size); + + + _timeLabel->setString(MiscUtils::clockMinSecTimeString(gameConfig.levelConfigs[(int)MiscUtils::lastLevel()].levelTime)); + + switchSteveHead("steveHeadHappy"); + + prepareCartPosition(); + shootGameState.isAnimatingCart = false; + + showTOSAcceptPopup([&](){ + isShowingLevelPicker = true; + showLevelPickerLayer([&]{ + if(gameState->playState == SubGameScene::PlayState::INIT){ //to prevent quick double click which would make the game start twice with intro tut + isShowingLevelPicker = false; + stopAllActions(); + SoundsRepo::stopAllSounds(); + startGame(); + } + }, [&](int level){ + setStartTimeAndLabel(); + }); + // auto introSoundInfo = SoundsRepo::introSound(); + auto pickLevelSoundInfo = SoundsRepo::pickLevelSound(); + runAction(cocos2d::Sequence::create(/*cocos2d::CallFunc::create(std::bind([&](std::string introSoundFilePath){ + SoundsRepo::playSound(introSoundFilePath); + },introSoundInfo.filePath)), + cocos2d::DelayTime::create(introSoundInfo.soundDuration) + ,*/cocos2d::CallFunc::create(std::bind([&](std::string pickLevelSoundPath){ + SoundsRepo::playSound(pickLevelSoundPath); + repeatPickLevelPrompt(); + },pickLevelSoundInfo.filePath)), + nullptr)); + }); +} + +void SubGameSceneShoot::prepareCartPosition(){ + auto contentSize = getContentSize(); + _cart->setPosition(cocos2d::Point(contentSize.width/2, contentSize.height*0.75f)); + +// _cart->setPositionX(- _cart->getBoundingBox().size.width/2); + shootGameState.cartFlippedX = false; + +} + +void SubGameSceneShoot::prepareCartPositionOutside(){ + _cart->stopAllActions(); + shootGameState.isAnimatingCart = false; + _cart->setPositionX(- _cart->getBoundingBox().size.width/2); + shootGameState.cartFlippedX = false; + +} + +void SubGameSceneShoot::runCartAnimations(bool faster){ + _cart->stopAllActions(); + + shootGameState.isAnimatingCart = true; + + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto x = _cart->getPositionX() > winSize.width ? -_cart->getBoundingBox().size.width/2 : winSize.width + _cart->getBoundingBox().size.width/2; + + auto isAdult = MiscUtils::lastLevel() == MiscUtils::Level::ADULT; + shootGameState.cartFlippedX = x < 0; + float deltaX = 0; + if(isAdult){ + auto minDeltaX = winSize.width/3; + if(_cart->getPositionX() >= winSize.width/2){ + x = MathUtils::getRandom(_cart->getBoundingBox().size.width/2, _cart->getPositionX()-minDeltaX); + shootGameState.cartFlippedX = true; + } else { + x = MathUtils::getRandom(_cart->getPositionX()+minDeltaX, winSize.width-_cart->getBoundingBox().size.width/2); + shootGameState.cartFlippedX = false; + } + deltaX = x - _cart->getPositionX(); + } + + if(!isAdult){ + flipCart(); + } + + //////////////////////// +// if(x < 0){ +// auto trolleyRect = shootGameState.cartFlippedX ? GeometryUtils::flippedXRect(_cart, gameConfig.trolleyRect) : gameConfig.trolleyRect; +// // +// auto texture = cocos2d::Director::getInstance()->getTextureCache()->addImage("graphics/shoot_game/graphics/wooden_shelf.png"); +// auto shelfBg = cocos2d::Sprite::createWithTexture(texture); +// cocos2d::Texture2D::TexParams params; +// params.sAddressMode = cocos2d::backend::SamplerAddressMode::REPEAT; //GL_REPEAT; +// params.tAddressMode = cocos2d::backend::SamplerAddressMode::REPEAT; +// shelfBg->getTexture()->setTexParameters(params); +// _cart->addChild(shelfBg); +// shelfBg->setPosition(cocos2d::Vec2(trolleyRect.getMidX(), trolleyRect.getMidY())); +// shelfBg->setContentSize(trolleyRect.size); +// } + ///////////////////////// + + auto y = MathUtils::getRandom(_cart->getBoundingBox().size.height/2 + _shelf->getBoundingBox().getMaxY(), winSize.height-_cart->getBoundingBox().size.height/2); + auto nextPoint = cocos2d::Point(x, y); + auto delay = faster ? 0 : MathUtils::getRandom(0, 2); + auto cartTime = gameConfig.levelConfigs[(int)MiscUtils::lastLevel()].trolleyTime; + if(faster){ + cartTime /= 2; + } + if(isAdult){ + cartTime *= MAX((abs(deltaX))/winSize.width, 0.1f); + delay = MathUtils::getRandom(0.15, 0.3f); + } + +// auto cartAnimationAction = cocos2d::Sequence::create(cocos2d::DelayTime::create(delay), cocos2d::MoveTo::create(cartTime, nextPoint), cocos2d::CallFunc::create([&](){ +// runCartAnimations(); +// }), nullptr); + + auto cartAnimationAction = isAdult ? + cocos2d::Sequence::create(cocos2d::DelayTime::create(delay), + cocos2d::CallFunc::create([&](){ + flipCart();}), + cocos2d::EaseInOut::create(cocos2d::MoveBy::create(cartTime, nextPoint - _cart->getPosition()), 1.2), + cocos2d::CallFunc::create([&](){ + runCartAnimations(); + }), nullptr) + : cocos2d::Sequence::create(cocos2d::DelayTime::create(delay), + cocos2d::EaseInOut::create(cocos2d::MoveTo::create(cartTime, nextPoint), 1.2), + cocos2d::CallFunc::create([&](){ + runCartAnimations(); + }), nullptr); + + _cart->runAction(cartAnimationAction); + + //cocos2d::Spawn::create(cartYAnimationAction, +// cartAnimationAction, +// nullptr)); +} + +void SubGameSceneShoot::flipCart(){ + for(int i = 0; i < _cart->getChildren().size(); ++i){ + auto childSprite = dynamic_cast(_cart->getChildren().at(i)); + if(childSprite != nullptr){ + auto oldFlipped = childSprite->isFlippedX(); + childSprite->setFlippedX(shootGameState.cartFlippedX); + if(childSprite->isFlippedX() != oldFlipped){ + GeometryUtils::flipChildX(_cart, childSprite); + } + } + } + //TODO deduplicate code + for(int i = 0; i < _cartFoodLayer->getChildren().size(); ++i){ + auto childSprite = dynamic_cast(_cartFoodLayer->getChildren().at(i)); + auto oldFlipped = childSprite->isFlippedX(); + childSprite->setFlippedX(shootGameState.cartFlippedX); + if(childSprite->isFlippedX() != oldFlipped){ + GeometryUtils::flipChildX(_cart, childSprite); + } + } +} + + +TouchHandlerFunction SubGameSceneShoot::prepareTouchBeganHandler() +{ + return [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(gameState->playState == PlayState::PLAYING) { + + if (shootGameState.itemState != ItemState::SHOT && + shootGameState.itemState != ItemState::SHOT_RELEASED) { + + auto slingGrabArea = GeometryUtils::getBoundingBoxToWorld(_slingHand, false); + + if (slingGrabArea.containsPoint(touch->getLocation())) { + _slingDragStartLocation = touch->getLocation(); + _slingOriginalDeltaAnchorPoint = + _slingHand->getPosition() - _slingDragStartLocation; + // just to make sure the sling's not moving at that point + cancelSlingDrag(false); // to cancel the after-shot returning of the sling, actually + _isDraggingSling = true; + tut_showSlingDragAlongX(); + + return true; + } + } + + if (shootGameState.itemState == ItemState::WAITING_TO_BE_LOADED && + shootGameState.currentItem >= 0) { + auto shelfGrabArea = GeometryUtils::getBoundingBoxToWorld(_shelf); + if (shelfGrabArea.containsPoint(touch->getLocation())) { + + for (auto it = gameConfig.shelfItems.begin(); + it != gameConfig.shelfItems.end(); ++it) { + auto groupNode = _objects[it->second.groupPictureNodeName]; + auto itemGrabArea = GeometryUtils::getBoundingBoxToWorld(groupNode); + if (itemGrabArea.containsPoint(touch->getLocation())) { + _currentItem = cocos2d::Sprite::create( + MathUtils::getRandomElement(it->second.picFilePaths)); + _currentItem->setAnchorPoint(cocos2d::Vec2(0.5, 0)); + addChild(_currentItem); + auto paddingY = _currentItem->getBoundingBox().size.height < _shelf->getBoundingBox().size.height/2 ? _currentItem->getBoundingBox().size.height*0.6 : 0; //TODO dedup + _currentItem->setPosition(touch->getLocation().x, touch->getLocation().y + paddingY); + currentlyDraggedObjectId = it->first; + shootGameState.itemState = ItemState::DRAGGING; + break; + } + } + } + } + } + + return false; + }; +} + +TouchHandlerFunction SubGameSceneShoot::prepareTouchMovedHandler() +{ + return [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(gameState->playState == PlayState::PLAYING) { + + if(_currentItem != nullptr && shootGameState.itemState == ItemState::DRAGGING){ + + // _currentItem->setPosition(touch->getLocation()); + auto paddingY = _currentItem->getBoundingBox().size.height < _shelf->getBoundingBox().size.height/2 ? _currentItem->getBoundingBox().size.height*0.6 : 0; + _currentItem->setPosition(touch->getLocation().x, touch->getLocation().y + paddingY); //TODO dedup + + } else if(_isDraggingSling){ + + auto touchLocation = touch->getLocation(); + + auto newMovingSlingMaxY = (touchLocation + _slingOriginalDeltaAnchorPoint).y + _slingHand->getBoundingBox().size.height/2; + + if(newMovingSlingMaxY > _slingStick->getBoundingBox().getMaxY()){ + cancelSlingDrag(); + return true; + } + + _slingHand->setPosition(touchLocation + _slingOriginalDeltaAnchorPoint); + + auto leftAngleDegrees = _slingGumLeft->getRotation(); //leftAngle*180.0/3.14; + auto rightAngleDegrees = _slingGumRight->getRotation(); + if(abs(rightAngleDegrees) > 89 || abs(leftAngleDegrees) > 89){ + cancelSlingDrag(); + } + + return true; + } + } + return false; + }; +} + +TouchHandlerFunction SubGameSceneShoot::prepareTouchEndedHandler(){ + return [&](cocos2d::Touch* touch, cocos2d::Event* event){ + + if(gameState->playState != PlayState::PLAYING) { + return; + } + + if(shootGameState.itemState == DRAGGING && _currentItem != nullptr){ + +// _currentItem->setPosition(touch->getLocation()); + + auto _slingArea = GeometryUtils::getBoundingBoxToWorld(_slingStick); + if(_slingArea.intersectsRect(_currentItem->getBoundingBox())){ + if(currentlyDraggedObjectId == shootGameState.itemIdsOrder[shootGameState.currentItem]){ + auto currentSoundPath = shootGameState.itemFirstShot ? gameConfig.shelfItems[shootGameState.itemIdsOrder[shootGameState.currentItem]].soundConf : SoundsRepo::hooraySound().filePath; + SoundsRepo::playSound(currentSoundPath); + placeItemInSling(_currentItem); + } else { + auto currentSoundPath = gameConfig.shelfItems[shootGameState.itemIdsOrder[shootGameState.currentItem]].soundNo; + SoundsRepo::playSound(currentSoundPath); + cancelItemDrag(); + if(MiscUtils::lastLevel() != MiscUtils::Level::CHILD) { + loseLife(); + } + } + } else { + cancelItemDrag(); + } + + } else if(_isDraggingSling) { + if(shootGameState.itemState == LOADED){ + tryShoot(); + } else { + cancelSlingDrag(); + } + } + }; +} + +bool SubGameSceneShoot::touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType){ + if(objectName == "settingsButton" && touchEventType == cocos2d::ui::Widget::TouchEventType::ENDED){ + if(!gameState->settingsMenuShown){ + pauseGame(); + showSettingsMenu(); + } else { + if(settingsMenu->isShowingParentalGate()){ + settingsMenu->hideParentalGate(); + } else { + settingsMenu->hideParentalGate(); // in case showing parental gate is in progress... + resumeGame(); + hideSettingsMenu(); + } + } + } + return SubGameScene::touchHandlerForWidget(objectName, touchEventType); +} + +void SubGameSceneShoot::tryShoot() { + + auto slingReturnPoint = (_slingLeftAttachmentPoint + _slingRightAttachmentPoint)/2; + auto movingSlingWorldPos = _movingSling->getParent()->convertToWorldSpace(_movingSling->getPosition()); + _slingDragTotalDelta = movingSlingWorldPos - slingReturnPoint; + // __android_log_print(ANDROID_LOG_DEBUG, "LOG_TAG", "Need to print : %f",_slingDragTotalDelta.length()); + static float minDelta = _movingSling->getBoundingBox().size.width; + + if( _slingDragTotalDelta.length() < minDelta){ + cancelSlingDrag(); + tut_showSlingDrag(); + } else { + shoot(); + tut_hideFinger(); + } +} + + +void SubGameSceneShoot::shoot() { + + //TODO throw item action should be in between the scale to and rotate to action + //add bounce + + if(_currentItem != nullptr){ + + _isDraggingSling = false; + shootGameState.itemFirstShot = false; + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_EFFECT_CATAPULT, false); + auto itemBBToWorld = GeometryUtils::getBoundingBoxToWorld(_currentItem, false); + _currentItem->retain(); + _currentItem->removeFromParent(); + addChild(_currentItem); + _currentItem->release(); + _currentItem->setPosition(itemBBToWorld.getMidX(), itemBBToWorld.getMidY()); +// _currentItem->setRotation(_slingGumLeft->getRotation()); + + auto slingReturnPoint = (_slingLeftAttachmentPoint + _slingRightAttachmentPoint)/2; + auto movingSlingWorldPos = _movingSling->getParent()->convertToWorldSpace(_movingSling->getPosition()); + moveSlingToTheWorld(); + + _slingDragTotalDelta = movingSlingWorldPos - slingReturnPoint;//_slingDragStartLocation; + + _slingAmplitude = _slingDragTotalDelta.length(); //!!!!! TODO LENGTH NIEKONIECZNE ZNACZY TO CO MYSLISZ!!!!!! + _slingGumLeftShootRotation = _slingGumLeft->getRotation(); + _slingGumRightShootRotation = _slingGumRight->getRotation(); + + _oscMidPoint = movingSlingWorldPos - cocos2d::Vec2(_slingDragTotalDelta.x, _slingDragTotalDelta.y); + _springOmegaZero = _baseSpringOmegaZero*_slingAmplitude/_baseSpringDXForOmegaZero; + auto eps = 3.14/2.5; + _slingReturnAnimTotalTime = ((3.0*3.14/2)+eps)/_springOmegaZero; + auto alpha = _springOmegaZero*_slingReturnAnimTotalTime - 3.14; + _springDampCoeff = -_springOmegaZero*sin(alpha)/cos(alpha); +// printf("TOTAL TIME: %f\n damp coeff: %f dx: %f\n", _slingReturnAnimTotalTime, _springDampCoeff, _slingAmplitude); + + _totalReturningTime = 0; + _isSlingReturning = true; + prevCosVal = -5; + shootGameState.itemState = ItemState::SHOT; + + } else { + cancelSlingDrag(); + } +} + +void SubGameSceneShoot::cancelSlingDrag(bool onlyOnStateDragging){ + if(_isDraggingSling || !onlyOnStateDragging){ + _movingSling->stopAllActions(); + _slingHand->stopAllActions(); + _isDraggingSling = false; + _isSlingReturning = false; //all of this should have been resolved better - the sling hsould have its own state var / enum, just like the item + _slingGumRight->setRotation(0); + _slingGumLeft->setRotation(0); + _slingGumRight->setScaleY(1); + _slingGumLeft->setScaleY(1); + _slingHand->setPosition(_handOriginalPosition); + _movingSling->setPosition(_movingSlingOriginalPosition); + moveSlingBackToTheHand(); + if(shootGameState.itemState == ItemState::LOADED){ + tut_showSlingDrag(); + } else { + tut_showItemDrag(); + } + } +} + +void SubGameSceneShoot::pauseGame(){ + SubGameScene::pauseGame(); + unscheduleUpdate(); + SoundsRepo::pauseAllSounds(); + pause(); + _cart->pause(); + if(hintFingerSprite != nullptr){ + hintFingerSprite->pause(); + } +} + +void SubGameSceneShoot::resumeGame(){ + SubGameScene::resumeGame(); + if(gameState->playState == SubGameScene::PlayState::PLAYING && shootGameState.itemState != ItemState::IN_TROLLEY) { + auto currentSoundPath = currentItem().soundRequest; + SoundsRepo::playSound(currentSoundPath); + } + scheduleUpdate(); + resume(); + SoundsRepo::resumeAllSounds(); + _cart->resume(); + if(hintFingerSprite != nullptr){ + hintFingerSprite->resume(); + } +} + +void SubGameSceneShoot::itemFollowsTheSling() { + if(_currentItem != nullptr) { + _currentItem->setPosition(_movingSling->getBoundingBox().getMidX(), + _movingSling->getBoundingBox().getMaxY()); + } +} + +void SubGameSceneShoot::gumsFollowTheSling(bool switchRotation){ + static auto leftDX = 6.f; + static auto leftDY = -20.f; + static auto rightDX = -6.f; + static auto rightDY = -20.f; + auto leftGumDragPoint = cocos2d::Point(_movingSling->getParent()->convertToWorldSpace(cocos2d::Vec2(_movingSling->getBoundingBox().getMinX() + leftDX, _movingSling->getBoundingBox().getMaxY() + leftDY))); + auto newLeftSlingVec = leftGumDragPoint - _slingLeftAttachmentPoint; + _slingGumLeft->setScaleY(newLeftSlingVec.getLength()/_slingLeftStartLength); //!!!!! TODO LENGTH NIEKONIECZNE ZNACZY TO CO MYSLISZ!!!!!! + auto rightGumDragPoint = cocos2d::Point(_movingSling->getParent()->convertToWorldSpace(cocos2d::Vec2(_movingSling->getBoundingBox().getMaxX() + rightDX, _movingSling->getBoundingBox().getMaxY()+rightDY))); + auto newRightSlingVec = rightGumDragPoint - _slingRightAttachmentPoint; + _slingGumRight->setScaleY(newRightSlingVec.getLength()/_slingRightStartLength); //!!!!! TODO LENGTH NIEKONIECZNE ZNACZY TO CO MYSLISZ!!!!!! + + if(switchRotation){ + _slingGumLeft->setRotation(_slingGumLeftShootRotation + 180); + _slingGumRight->setRotation(_slingGumRightShootRotation + 180); + } else { + auto leftAngle = newLeftSlingVec.x == 0 || newLeftSlingVec.y == 0 ? 0 : atan((newLeftSlingVec.x)/(newLeftSlingVec.y)); + auto leftAngleDegrees = leftAngle*180.0/3.14; + _slingGumLeft->setRotation(leftAngleDegrees); + + auto rightAngle = newRightSlingVec.x == 0 || newRightSlingVec.y == 0 ? 0 : atan((newRightSlingVec.x)/(newRightSlingVec.y)); + auto rightAngleDegrees = rightAngle*180.0/3.14; + _slingGumRight->setRotation(rightAngleDegrees); + } +} + +//static int g = 0; //use to emulate an extreely slow device +void SubGameSceneShoot::update(float dt){ + + //use to emulate an extreely slow device +// if((g++)%10 != 0) return; +// dt = dt*10; + ////////////////////////////////////////////////////////////////////////////////////////// + + SubGameScene::update(dt); + + gumsFollowTheSling(false); //gums should always follow the sling + + if(_isSlingReturning){ + _totalReturningTime += dt; + + auto cosVal = cos(_springOmegaZero*_totalReturningTime - 3.14); + auto slingDD = -_slingAmplitude*exp(-_springDampCoeff*_totalReturningTime)*cosVal;// - _slingAmplitude; +// auto prevPos = _movingSling->getPosition(); + auto slingDX = slingDD*_slingDragTotalDelta.x/_slingAmplitude; + auto slingDY = slingDD*_slingDragTotalDelta.y/_slingAmplitude; + + _movingSling->setPosition(_oscMidPoint.x + slingDX, _oscMidPoint.y + slingDY); + + if(shootGameState.itemState == ItemState::SHOT){ + if(cosVal > prevCosVal){ + itemFollowsTheSling(); + } else {//if(shootGameState.itemState != ItemState::SHOT_RELEASED){ + itemFlyTime = sqrt(2*slingHeight/9.81f); + itemFlyTimeElapsed = 0; + itemV = baseItemV*_slingAmplitude/slingAmpForBaseItemV; + shootGameState.itemState = ItemState::SHOT_RELEASED; + } + } + + prevCosVal = cosVal; + + gumsFollowTheSling(cosVal > 0); //fix the gums + auto eps = 0.01; + if(_totalReturningTime >= _slingReturnAnimTotalTime){ + _isSlingReturning = false; + auto animTime = 0.3f; + _movingSling->runAction(cocos2d::Sequence::create(cocos2d::MoveTo::create(animTime, _movingSlingOriginalPosition), nullptr)); + _slingHand->runAction(cocos2d::Sequence::create(cocos2d::MoveTo::create(animTime, _handOriginalPosition), cocos2d::CallFunc::create([&]{ + moveSlingBackToTheHand(); + }), nullptr)); + if(shootGameState.itemState == ItemState::SHOT){ //it should always be SHOT_RELEASED at this point. It's just a fix for VERY slow devices (emulators...), for which if(cosVal > prevCosVal) always evaluates to true, and then _isSlingReturning is being called before the item can be shot out + itemFlyTime = sqrt(2*slingHeight/9.81f); + itemFlyTimeElapsed = 0; + itemV = baseItemV*_slingAmplitude/slingAmpForBaseItemV; + shootGameState.itemState = ItemState::SHOT_RELEASED; //TODO dedup + } + } + } + + if(shootGameState.itemState == ItemState::SHOT_RELEASED && _currentItem != nullptr) { + itemFlyTimeElapsed += dt; + auto itemDX = -itemV*dt*_slingDragTotalDelta.x/_slingAmplitude; + auto itemDY = -itemV*dt*_slingDragTotalDelta.y/_slingAmplitude; + _currentItem->setPosition(_currentItem->getPositionX()+itemDX,_currentItem->getPositionY()+itemDY); + + auto h = cocos2d::Director::getInstance()->getWinSize().height/2; + _currentItem->setScale(MAX(0.5f,(h-itemV*itemFlyTimeElapsed)/h));//todo to musi byc miara odleglosci przebytej przez stala odleglosc + //TODO parametrize 0.5 + + auto trolleyRect = shootGameState.cartFlippedX ? GeometryUtils::flippedXRect(_cart, gameConfig.trolleyRect) : gameConfig.trolleyRect; + auto cartArea = GeometryUtils::getBoundingBoxToWorldForSubrect(_cart, trolleyRect); + + static auto splashTime = 2; + + if(cartArea.intersectsRect(_currentItem->getBoundingBox())){ + shootGameState.itemState = ItemState::IN_TROLLEY; + _currentItem->retain(); + _currentItem->removeFromParent(); + _cartFoodLayer->addChild(_currentItem); + _currentItem->setScale(0.5); + _currentItem->release(); + auto position = gameConfig.trolleyItemPoints[shootGameState.currentItem]; + if(shootGameState.cartFlippedX){ + position = GeometryUtils::flippedXPoint(_cart, position); + _currentItem->setFlippedX(true); + } + position.y += _currentItem->getBoundingBox().size.height/2; + _currentItem->setPosition(position); + if(shootGameState.currentItem >= gameConfig.trolleyItemPoints.size()/2){ + _currentItem->setLocalZOrder(1); + } else { + _currentItem->setLocalZOrder(2); + } + _currentItem = nullptr; + + if(gameState->playState != PlayState::PRE_PLAYING){ + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_IN_TROLLEY); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_EFFECT_IN_TROLLEY, false); + tut_hideFinger(true); + saveTutorialComplete(); + runAction(cocos2d::Sequence::create(cocos2d::DelayTime::create(5), cocos2d::CallFunc::create([&]{ + nextItem(); + }), NULL)); + } else { // == if playing the tutorial + if(shootGameState.currentTutorialItem == 1){ + scheduleOnce([&](float){ + tut_intro_shootChocolate(); + }, 0.4f, "ShootChoc"); + } else if(shootGameState.currentTutorialItem == 2){ + scheduleOnce([&](float){ + tut_intro_shootBanana(); + }, 0.4f, "ShootBanana"); + } + ++shootGameState.currentTutorialItem; + } + } else { + auto steveRect = shootGameState.cartFlippedX ? GeometryUtils::flippedXRect(_cart, gameConfig.steveRect) : gameConfig.steveRect; + auto steveArea = GeometryUtils::getBoundingBoxToWorldForSubrect(_cart, steveRect); + if (steveArea.intersectsRect(_currentItem->getBoundingBox())) { + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_HIT_STEVE); + shootGameState.itemState = ItemState::WAITING_TO_BE_LOADED; + tut_showItemDrag(); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_EFFECT_SPLAT, false); + auto item = splashItem(_cart, cocos2d::Point(steveRect.getMidX(), steveRect.getMidY()-steveRect.size.height/4), splashTime); + item->setFlippedX(shootGameState.cartFlippedX); + switchSteveHead("steveHeadGrr"); + runAction(cocos2d::Sequence::create(cocos2d::DelayTime::create(splashTime), cocos2d::CallFunc::create([&](){ + switchSteveHead("steveHeadHappy"); + }), NULL)); + } else { + auto maggieRect = shootGameState.cartFlippedX ? GeometryUtils::flippedXRect(_cart, gameConfig.maggieRect) : gameConfig.maggieRect; + auto maggieArea = GeometryUtils::getBoundingBoxToWorldForSubrect(_cart, maggieRect); + if (maggieArea.intersectsRect(_currentItem->getBoundingBox())) { + shootGameState.itemState = ItemState::WAITING_TO_BE_LOADED; + tut_showItemDrag(); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_HIT_MAGGIE); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_EFFECT_SPLAT , false); + auto item = splashItem(_cart, cocos2d::Point(maggieRect.getMidX(), gameConfig.maggieRect.getMidY()-maggieRect.size.height/4), 2); + item->setFlippedX(shootGameState.cartFlippedX); + maggieOpenBeak(); + runAction(cocos2d::Sequence::create(cocos2d::DelayTime::create(splashTime), cocos2d::CallFunc::create([&](){ + maggieCloseBeak(); + }), NULL)); + + } else if (itemFlyTimeElapsed >= itemFlyTime && !_cart->getBoundingBox().intersectsRect(_currentItem->getBoundingBox())){ + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_NOT_IN_TROLLEY); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_EFFECT_SPLAT , false); + shootGameState.itemState = ItemState::WAITING_TO_BE_LOADED; + tut_showItemDrag(); + splashItem(_cart->getParent(), _currentItem->getPosition(), 1, _cart->getLocalZOrder()-1); + auto random = MathUtils::getRandomInt(0, 1); + switchSteveHead(random > 0 ? "steveHeadOhNo1" : "steveHeadOhNo2"); + runAction(cocos2d::Sequence::create(cocos2d::DelayTime::create(splashTime), cocos2d::CallFunc::create([&](){ + switchSteveHead("steveHeadHappy"); + }), NULL)); + } + } + } + } + +// if(shootGameState.isAnimatingCart && shootGameState.cartSineMovement){ +// auto dx = dt*shootGameState.cartBaseVelocity*shootGameState.cartVelocityModifier; +// _cart->setPositionX(_cart->getPositionX()+dx); +// auto dy = _cart->getBoundingBox().size.height*shootGameState.cartSineAmpModifier*sin(_cart->getPositionX()/shootGameState.cartSineBreadth + shootGameState.cartSineShift); +// _cart->setPositionY(MAX(shootGameState.cartBaseY + dy, _cart->getBoundingBox().size.height/2*1.3)); +// } +} + +void SubGameSceneShoot::maggieOpenBeak(){ + auto maggieOpenBeak = _objects["cartBack2"]; + auto maggieClosedBeak = _objects["cartBack"]; + maggieOpenBeak->setOpacity(255); + maggieClosedBeak->setOpacity(0); +} + +void SubGameSceneShoot::maggieCloseBeak(){ + auto maggieOpenBeak = _objects["cartBack2"]; + auto maggieClosedBeak = _objects["cartBack"]; + maggieOpenBeak->setOpacity(0); + maggieClosedBeak->setOpacity(255); +} + +void SubGameSceneShoot::switchSteveHead(std::string headName){ + if(headName != currentSteveHead) { + auto steveCurrentFace = _objects[currentSteveHead]; + if (steveCurrentFace != nullptr) { + steveCurrentFace->setOpacity(0); + } + auto steveNewFace = _objects[headName]; + if (steveNewFace != nullptr) { + steveNewFace->setOpacity(255); + } + currentSteveHead = headName; + } +} + +void SubGameSceneShoot::placeItemInSling(cocos2d::Sprite* _item){ + + shootGameState.itemState = ItemState::LOADED; + _item->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); + _item->retain(); + _item->removeFromParent(); + _slingHand->addChild(_item); + _item->release(); + _item->setPosition(_movingSling->getBoundingBox().getMidX(), _movingSling->getBoundingBox().getMaxY()); + auto slingComponents = _slingHand->getChildren(); + for(int i = 0; i < slingComponents.size(); ++i){ + if(slingComponents.at(i) != _item){ + _slingHand->reorderChild(slingComponents.at(i), 10); + } + } + tut_showSlingDrag(); +} + +void SubGameSceneShoot::removeItemFromSling(){ + if(_currentItem != nullptr && shootGameState.itemState == ItemState::LOADED) { + _currentItem->removeFromParent(); + _currentItem = nullptr; + } +} + +void SubGameSceneShoot::cancelItemDrag(){ + shootGameState.itemState = ItemState::WAITING_TO_BE_LOADED; + if(_currentItem != nullptr){ + _currentItem->removeFromParent(); + _currentItem = nullptr; + currentlyDraggedObjectId = -1; + } +} + +void SubGameSceneShoot::moveSlingToTheWorld(){ + auto movingSlingWorldPos = _movingSling->getParent()->convertToWorldSpace(_movingSling->getPosition()); + _movingSling->retain(); + _movingSling->removeFromParent(); + addChild(_movingSling); + _movingSling->setPosition(movingSlingWorldPos); + _movingSling->release(); +} + +void SubGameSceneShoot::moveSlingBackToTheHand(){ + auto movingSlingPos = _slingHand->convertToNodeSpace(_movingSling->getPosition()); + _movingSling->retain(); + _movingSling->removeFromParent(); + _slingHand->addChild(_movingSling); + _movingSling->setPosition(movingSlingPos); + _movingSling->release(); + _movingSling->setLocalZOrder(1); + _slingSubHand->setLocalZOrder(2); + if(shootGameState.itemState == ItemState::LOADED) { + itemFollowsTheSling(); + } +} + +void SubGameSceneShoot::scrollShelf(cocos2d::Node* nodeToBeVisible, std::function completion){ + + auto winWidth = cocos2d::Director::getInstance()->getWinSize().width; + + auto bb = GeometryUtils::getBoundingBoxToWorld(nodeToBeVisible); + if (bb.getMaxX() > winWidth || bb.getMinX() < 0 || checkRectHidesBehindSling(bb)) { // if out of the screen or the item hides behind the sling, which makes it difficult to drag the item + // it's not fully visible, we need to move the shelf + // pick a random x so that the whole item will be visible on the screen, shift the shelf accordingly + float x, dx; + auto newBB = bb; + int iter = 0; + do { + x = MathUtils::getRandom(nodeToBeVisible->getBoundingBox().size.width, winWidth-nodeToBeVisible->getBoundingBox().size.width); + dx = x - bb.origin.x; + newBB.origin.x = x; + ++iter; + } while((abs(dx) < bb.size.width*2 && iter < 20) || checkRectHidesBehindSling(newBB)); // too small delta means task too easy, the second condition prevents the situation when the item hides behind the sling, which would make it difficult to drag the item + + auto shelfPadding = 30; + if(_shelf->getBoundingBox().getMinX() + dx > -shelfPadding){ + dx = -shelfPadding - _shelf->getBoundingBox().getMinX(); + } else if(_shelf->getBoundingBox().getMaxX() + dx < winWidth + shelfPadding){ + dx = winWidth + shelfPadding - _shelf->getBoundingBox().getMaxX(); + } + +// nodeToBeVisible->runAction(cocos2d::MoveBy::create(0.4, cocos2d::Vec2(dx,0))); + _shelf->runAction(cocos2d::Sequence::create(cocos2d::MoveBy::create(0.4, cocos2d::Vec2(dx,0)), + cocos2d::CallFunc::create(completion), + nullptr)); + + } else { + //else it's fully visible already, so leave it as it is and just call the completion + completion(); + } + +} + +bool SubGameSceneShoot::checkRectHidesBehindSling(cocos2d::Rect rectWorldCoord){ + auto width = _slingStick->getBoundingBox().size.width; + auto slingMinX = _handOriginalPosition.x - width/2; + auto slingMaxX = _handOriginalPosition.x + width/2; + return !(rectWorldCoord.getMaxX() <= slingMinX || rectWorldCoord.getMinX() >= slingMaxX); +} + +void SubGameSceneShoot::nextItem(){ + + if(shootGameState.currentItem == shootGameState.itemIdsOrder.size() - 1){ + gameWon(); + stopAllActions(); + unscheduleAllCallbacks(); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_ALL_IN_TROLLEY); + switchSteveHead("steveHeadHappy"); + _cart->stopAllActions(); + shootGameState.isAnimatingCart = false; + _cart->runAction(cocos2d::MoveTo::create(1, cocos2d::Vec2(getBoundingBox().size.width/2, getBoundingBox().size.height*2/3.0))); + showWellDoneAndReplay(); + } else { + scheduleUpdate(); + shootGameState.itemFirstShot = true; + shootGameState.wrongItemsCount = 0; + lifeIndicatorView->reset(); + ++shootGameState.currentItem; + auto item = currentItem(); + auto currentSoundPath = item.soundRequest; + SoundsRepo::playSound(currentSoundPath); + auto correspondingShelfNode = _objects[item.groupPictureNodeName]; + scrollShelf(correspondingShelfNode, [&](){ + shootGameState.itemState = ItemState::WAITING_TO_BE_LOADED; + tut_showItemDrag();}); + } +} + +cocos2d::Sprite* SubGameSceneShoot::splashItem(cocos2d::Node* where, cocos2d::Vec2 pos, float forHowLong, int zOrder){ +// if(MiscUtils::lastLevel() == MiscUtils::Level::ADULT) { +// loseLife(); +// } + auto splashedItem = cocos2d::Sprite::create(currentItem().splodgePicFilePath); + if(_currentItem){ + _currentItem->removeFromParent(); + _currentItem = nullptr; + } + where->addChild(splashedItem); + splashedItem->setPosition(pos); + splashedItem->setLocalZOrder(zOrder); + shootGameState.splashedItems.push_back(splashedItem); + + if(forHowLong > 0){ + runAction(cocos2d::Sequence::create(cocos2d::DelayTime::create(forHowLong), cocos2d::CallFunc::create(std::bind([&](cocos2d::Node* item){ + shootGameState.splashedItems.erase(std::find(shootGameState.splashedItems.begin(), shootGameState.splashedItems.end(), item)); + item->removeFromParent(); + }, splashedItem)), nullptr)); + } + + return splashedItem; +} + +void SubGameSceneShoot::startGame(bool playIntro){ + + gameState->currentLevel = (int)MiscUtils::lastLevel(); + gameState->playState = PlayState::PRE_PLAYING; + lifeIndicatorView->setVisible(gameState->currentLevel != (int)MiscUtils::Level::CHILD); + + scheduleUpdate(); + + if(playIntro){ + tut_intro_start(); + runAction(cocos2d::Sequence::create(cocos2d::CallFunc::create([&](){ + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_INTRO); //TODO FIXED TIME BAD BAD BAD sounds.info todo + }), cocos2d::DelayTime::create(10.4), cocos2d::CallFunc::create([&](){ + disableFastForwardButton(); + startGame(false); +// gameState->playState = PlayState::PLAYING; +// nextItem(); +// startTimer(); + }), nullptr)); + } else { + tut_intro_stop(); + if(!shootGameState.isAnimatingCart){ + auto faster = _cart->getBoundingBox().containsPoint(cocos2d::Point(getContentSize().width/2, getContentSize().height/2)); + runCartAnimations(faster); + } + gameState->playState = PlayState::PLAYING; + switchSteveHead("steveHeadHappy"); + nextItem(); + startTimer(); + } +} + +void SubGameSceneShoot::startTimer(){ + setStartTimeAndLabel(); + this->schedule(CC_SCHEDULE_SELECTOR(SubGameSceneShoot::onSecondElapsed), 1, CC_REPEAT_FOREVER, 0); +} + +void SubGameSceneShoot::setStartTimeAndLabel(){ + shootGameState.currentTimeSeconds = gameConfig.levelConfigs[(int)MiscUtils::lastLevel()].levelTime; + _timeLabel->setString(MiscUtils::clockMinSecTimeString(shootGameState.currentTimeSeconds)); +} + +void SubGameSceneShoot::onSecondElapsed(float dt){ + --shootGameState.currentTimeSeconds; + _timeLabel->setString(MiscUtils::clockMinSecTimeString(shootGameState.currentTimeSeconds)); + if(shootGameState.currentTimeSeconds <= 0){ + this->unschedule(CC_SCHEDULE_SELECTOR(SubGameSceneShoot::onSecondElapsed)); + gameLost(); + fadeDarkLayer(true); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_SHOP_CLOSED); + } +} + +void SubGameSceneShoot::cleanupSplashedItems(){ + for(int i = 0; i < shootGameState.splashedItems.size(); ++i){ + shootGameState.splashedItems.at(i)->removeFromParent(); + } + shootGameState.splashedItems.clear(); +} + +void SubGameSceneShoot::emptyTrolley(){ + if(_cartFoodLayer != nullptr){ + _cartFoodLayer->removeAllChildren(); + } +} + +void SubGameSceneShoot::loseLife(){ + ++shootGameState.wrongItemsCount; + lifeIndicatorView->loseLife(); + if (shootGameState.wrongItemsCount >= gameConfig.lives) { + gameLost(); + SoundsRepo::playSound(SoundsRepo::SHOOT_GAME_SOUND_WRONG_THREE_TIMES); + } +} + +void SubGameSceneShoot::gameLost(){ + SubGameScene::gameLost(); + stopAllActions(); + unscheduleAllCallbacks(); + SoundsRepo::stopAllSounds(); + switchSteveHead("steveHeadSad"); + _cart->stopAllActions(); + auto positionX = shootGameState.cartFlippedX ? -_cart->getBoundingBox().size.width/2 : _cart->getParent()->getBoundingBox().size.width + _cart->getBoundingBox().size.width/2; +// _cart->runAction(cocos2d::MoveTo::create(2, cocos2d::Vec2(positionX, _cart->getPositionY()))); + _cart->runAction(cocos2d::Sequence::create(cocos2d::MoveTo::create(1, cocos2d::Vec2(getBoundingBox().size.width/2, getBoundingBox().size.height*2/3.0)), cocos2d::DelayTime::create(5), cocos2d::CallFunc::create([&](){ + auto positionX = shootGameState.cartFlippedX ? -_cart->getBoundingBox().size.width/2 : _cart->getParent()->getBoundingBox().size.width + _cart->getBoundingBox().size.width/2; + _cart->runAction(cocos2d::MoveTo::create(2.f, cocos2d::Vec2(positionX, _cart->getPositionY()))); + }), nullptr)); + shootGameState.isAnimatingCart = false; + emptyTrolley(); + cancelItemDrag(); + cancelSlingDrag(false); + removeItemFromSling(); + tut_hideFinger(); + switchMenuToReplayButton(); +} + +bool SubGameSceneShoot::onReplayButtonClicked() +{ + if(gameState->playState == SubGameScene::PlayState::PRE_PLAYING){ + tut_intro_stop(); + } + fadeDarkLayer(false); + hideWellDoneAndReplay(); + disableButton("fastForwardButton"); +// disableButton("replayButton"); + clearAllItems(); + return SubGameScene::onReplayButtonClicked(); +} + +bool SubGameSceneShoot::onFastForwardButtonClicked() +{ +// auto anotherLabel = cocos2d::Label::createWithTTF("Another example label", "fonts/ComicSansMSBold.ttf", 120*ScalingUtils::getScaleForFont()); +// addChild(anotherLabel); +// + cancelSlingDrag(false); + removeItemFromSling(); + return SubGameScene::onFastForwardButtonClicked(); +} + +void SubGameSceneShoot::switchMenuToReplayButton(){ + auto replayButton = _objects["replayButton"]; + auto ffButton = _objects["fastForwardButton"]; + auto pauseButton = _objects["pauseButton"]; + enableButton("replayButton"); + disableButton("fastForwardButton"); + MiscUtils::showView(replayButton, true); + MiscUtils::hideView(ffButton, true); + MiscUtils::hideView(pauseButton, true); + MiscUtils::hideView(lifeIndicatorView, true); +} +void SubGameSceneShoot::fadeDarkLayer(bool fadeIn) { + if (darkLayer == nullptr) { + darkLayer = cocos2d::LayerColor::create(cocos2d::Color4B(0, 0, 0, 0)); + _slingStick->getParent()->addChild(darkLayer); + _slingHand->setLocalZOrder(9); + darkLayer->setLocalZOrder(20); + } + darkLayer->stopAllActions(); + if(fadeIn){ + darkLayer->runAction(cocos2d::FadeTo::create(2, 180)); + } else { + darkLayer->runAction(cocos2d::FadeOut::create(0.2)); + } +} + +void SubGameSceneShoot::showWellDoneAndReplay(){ + auto replayButton = _objects["replayButton"]; + auto ffButton = _objects["fastForwardButton"]; + auto pauseButton = _objects["pauseButton"]; + auto wellDoneBackground = _objects["wellDoneBackground"]; + auto wellDoneLabel = dynamic_cast(_objects["wellDoneLabel"]); + MiscUtils::showView(wellDoneBackground, true); + MiscUtils::showView(wellDoneLabel, true); + MiscUtils::showView(replayButton, true); + enableButton("replayButton"); + MiscUtils::hideView(ffButton, true); + MiscUtils::hideView(pauseButton, true); + MiscUtils::hideView(lifeIndicatorView, true); +} + +void SubGameSceneShoot::hideWellDoneAndReplay(){ + auto replayButton = _objects["replayButton"]; + auto ffButton = _objects["fastForwardButton"]; + auto pauseButton = _objects["pauseButton"]; + auto wellDoneBackground = _objects["wellDoneBackground"]; + auto wellDoneLabel = dynamic_cast(_objects["wellDoneLabel"]); + MiscUtils::hideView(wellDoneBackground, true); + MiscUtils::hideView(wellDoneLabel, true); + MiscUtils::hideView(replayButton, true); + MiscUtils::showView(ffButton, true, 128); + MiscUtils::showView(lifeIndicatorView, true); + MiscUtils::showView(pauseButton, true); + enableButton("pauseButton"); + disableButton("replayButton"); + disableButton("fastForwardButton"); +} + +void SubGameSceneShoot::hideSettingsMenuWithLevelReset(){ + resumeGame(); + hideSettingsMenu(true); + auto newLevel = (int)(MiscUtils::lastLevel()); + if(newLevel != gameState->currentLevel){ + prepareCartPositionOutside(); + onReplayButtonClicked(); + } +} + +// TUTORIAL +void SubGameSceneShoot::tut_showItemDrag(){ + if(gameState->playState == PlayState::PLAYING && !tutorialComplete()){ + auto item = _objects[currentItem().groupPictureNodeName]; + auto currentItemBB = item->getBoundingBox(); + auto currentItemMidPoint = cocos2d::Point(currentItemBB.getMidX(), currentItemBB.getMidY()); + currentItemMidPoint = item->getParent()->convertToWorldSpace(currentItemMidPoint); + auto slingMidPoint = cocos2d::Vec2(_handOriginalPosition.x, _handOriginalPosition.y*1.5f); + slingMidPoint = _slingHand->getParent()->convertToWorldSpace(slingMidPoint); + tut_moveFinger(currentItemMidPoint, slingMidPoint, 2, 0.6, true); + } +} + +//todo make the finger react to the position of the trolley +void SubGameSceneShoot::tut_showSlingDrag(){ + if(gameState->playState == PlayState::PLAYING && !tutorialComplete()){ + tut_prepareFingerIfNeeded(); + auto slingHighPoint = cocos2d::Vec2(_slingHand->getBoundingBox().getMidX(), _slingHand->getBoundingBox().getMaxY()*0.8f); + slingHighPoint = _slingHand->getParent()->convertToWorldSpace(slingHighPoint); + auto deltaXToTrolley = _cart->getPositionX() - _handOriginalPosition.x; + auto deltaX = -deltaXToTrolley/4; //TODO magic number + auto deltaY = -_slingHand->getBoundingBox().size.height/4; + tut_moveFinger(slingHighPoint, cocos2d::Point(slingHighPoint.x + deltaX, slingHighPoint.y + deltaY), 0.3f, 0.1f, false, [&](){ + tut_showSlingDrag(); + }); + } +} + +void SubGameSceneShoot::tut_showSlingDragAlongX(){ + if(gameState->playState == PlayState::PLAYING && !tutorialComplete()){ + tut_prepareFingerIfNeeded(); + auto bottomYForFinger = hintFingerSprite->getAnchorPoint().y * hintFingerSprite->getBoundingBox().size.height/1.4f; //because rotated by 45 :P +// auto deltaToTrolley = _cart->getPosition() - _movingSlingOriginalPosition; +// auto multiplier = 0.2; +// auto deltaX = (deltaToTrolley.x * (bottomYForFinger - _movingSlingOriginalPosition.y) / deltaToTrolley.y)*multiplier; + auto deltaX = _slingHand->getBoundingBox().size.width*2; + tut_moveFingerBackAndForth(cocos2d::Point(_movingSlingOriginalPosition.x - deltaX, bottomYForFinger), cocos2d::Point(_movingSlingOriginalPosition.x + deltaX, bottomYForFinger), 1, 0.1); + } +} + +void SubGameSceneShoot::tut_moveFinger(const cocos2d::Point& startPosition, const cocos2d::Point& endPosition, float moveTime, float pauseTime, bool loop, std::function completion){ + if(!tutorialComplete()){ + tut_prepareFingerIfNeeded(); + hintFingerSprite->setPosition(startPosition); + auto moveAction = cocos2d::Sequence::create(cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime), + cocos2d::EaseInOut::create( + cocos2d::MoveTo::create(moveTime, endPosition), 1.2), + cocos2d::DelayTime::create(pauseTime), + cocos2d::FadeOut::create(MiscUtils::StandardAnimationTime), + cocos2d::CallFunc::create([&, startPosition](){ + hintFingerSprite->setPosition(startPosition); + }), + cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime), + nullptr); + if(loop){ + hintFingerSprite->runAction(cocos2d::RepeatForever::create(moveAction)); + } else { + hintFingerSprite->runAction(cocos2d::Sequence::create(moveAction, cocos2d::CallFunc::create(completion), nullptr)); + } + } +} + +void SubGameSceneShoot::tut_moveFingerBackAndForth(const cocos2d::Point& startPosition, const cocos2d::Point& endPosition, float moveTime, float pauseTime){ + if(!tutorialComplete()){ + tut_prepareFingerIfNeeded(); + hintFingerSprite->setPosition(startPosition); + auto moveAction = cocos2d::Sequence::create(cocos2d::FadeIn::create(MiscUtils::StandardAnimationTime), + cocos2d::EaseInOut::create( + cocos2d::MoveTo::create(moveTime, endPosition), 1.2), + cocos2d::DelayTime::create(pauseTime), + cocos2d::EaseInOut::create( + cocos2d::MoveTo::create(moveTime, startPosition), 1.2), + nullptr); + hintFingerSprite->runAction(cocos2d::RepeatForever::create(moveAction)); + } +} + +void SubGameSceneShoot::tut_prepareFingerIfNeeded(){ + if(hintFingerSprite == nullptr) { + hintFingerSprite = cocos2d::Sprite::create( + "graphics/g_finger.png"); + addChild(hintFingerSprite, 190); + hintFingerSprite->setAnchorPoint(cocos2d::Vec2(0.4f, 14/15.f)); //TODO fixed + hintFingerSprite->setRotation(-45); + hintFingerSprite->setColor(cocos2d::Color3B(200, 200, 200)); + } else { + hintFingerSprite->stopAllActions(); + hintFingerSprite->setVisible(true); + } +} + +void SubGameSceneShoot::tut_hideFinger(bool remove){ + if(hintFingerSprite != nullptr){ + hintFingerSprite->stopAllActions(); + if(remove){ + MiscUtils::hideAndRemoveView(hintFingerSprite, true); + hintFingerSprite = nullptr; + } else { + MiscUtils::hideView(hintFingerSprite, true); + } + } +} + +static int TutIntroActionTag = 10; + +void SubGameSceneShoot::tut_intro_start(){ + shootGameState.currentTutorialItem = 1; + tut_intro_shootApple(); +} + +void SubGameSceneShoot::tut_intro_stop(){ + if(_layoutLoaded) { + unscheduleAllCallbacks(); + stopActionByTag(TutIntroActionTag); + _slingHand->stopAllActions(); + _movingSling->stopAllActions(); + emptyTrolley(); + cancelItemDrag(); + cancelSlingDrag(false); + removeItemFromSling(); + shootGameState.currentItem = -1; + shootGameState.itemState = ItemState::NONE; + } +} + +void SubGameSceneShoot::tut_intro_shootApple(){ + shootGameState.currentItem = 0; + tut_intro_shootItem("apples", "graphics/shoot_game/graphics/single_food/apple1.png"); +} + +void SubGameSceneShoot::tut_intro_shootChocolate(){ + shootGameState.currentItem = 1; + tut_intro_shootItem("chocolate", "graphics/shoot_game/graphics/single_food/chocolate1.png"); +} + +void SubGameSceneShoot::tut_intro_shootBanana(){ + shootGameState.currentItem = 1; + tut_intro_shootItem("bananas", "graphics/shoot_game/graphics/single_food/banana1.png", 0.6); +} + +void SubGameSceneShoot::tut_intro_shootItem(std::string groupNodeName, std::string singleItemFilePath, float moveAnimTime){ + auto groupNode = _objects[groupNodeName]; + auto currentItemBB = groupNode->getBoundingBox(); + auto currentItemMidPoint = cocos2d::Point(currentItemBB.getMidX(), currentItemBB.getMidY()); + currentItemMidPoint = groupNode->getParent()->convertToWorldSpace(currentItemMidPoint); + auto slingUpperPoint = cocos2d::Vec2(_handOriginalPosition.x, _handOriginalPosition.y*2.f); + slingUpperPoint = _slingHand->getParent()->convertToWorldSpace(slingUpperPoint); + + _currentItem = cocos2d::Sprite::create(singleItemFilePath); + addChild(_currentItem); + _currentItem->setPosition(currentItemMidPoint); + _currentItem->runAction(cocos2d::Sequence::create( + cocos2d::MoveTo::create(moveAnimTime, slingUpperPoint), + cocos2d::CallFunc::create([&](){ + placeItemInSling(_currentItem); + _slingHand->runAction(cocos2d::MoveBy::create(0.8, cocos2d::Vec2(0, -_slingHand->getContentSize().height*0.5f))); + }), + nullptr)); + auto tutIntroAction = cocos2d::Sequence::create(cocos2d::DelayTime::create(2.2f), + cocos2d::CallFunc::create([&](){ + shoot();}), + nullptr); + tutIntroAction->setTag(TutIntroActionTag); + runAction(tutIntroAction); +} + +static constexpr char* TUTORIAL_COMPLETE_KEY {"TUTORIAL_COMPLETE_KEY"}; + +bool SubGameSceneShoot::tutorialComplete(){ + return cocos2d::UserDefault::getInstance()->getBoolForKey(TUTORIAL_COMPLETE_KEY, false); +} + +void SubGameSceneShoot::saveTutorialComplete(){ + if(!tutorialComplete()){ + cocos2d::UserDefault::getInstance()->setBoolForKey(TUTORIAL_COMPLETE_KEY, true); + cocos2d::UserDefault::getInstance()->flush(); + } +} + +//// diff --git a/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameSceneShoot.h b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameSceneShoot.h new file mode 100644 index 0000000..d0734d6 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Scenes/SubGameScenes/SubGameSceneShoot.h @@ -0,0 +1,230 @@ +// +// SubGameSceneTapNCatch.h +// SteveAndMaggieGame +// +// Created by Katarzyna Kalinowska-Górska on 07/05/2019. +// + +#ifndef SubGameSceneShoot_h +#define SubGameSceneShoot_h + +#include "SubGameScene.h" +#include +#include +#include "TouchableSprite.h" +#include "SoundsRepo.h" +#include "MathUtils.h" + +class SubGameSceneShoot : public SubGameScene { + +public: + + struct LevelConfig { + float levelTime; + float trolleyTime; + }; + + struct SItem { + int itemId; + std::vector picFilePaths; + std::string groupPictureNodeName; + std::string splodgePicFilePath; + std::string soundRequest; + std::string soundConf; + std::string soundNo; + }; + + struct GameConfig { + int lives; + std::vector levelConfigs; + std::map shelfItems; + cocos2d::Rect steveRect; + cocos2d::Rect maggieRect; + cocos2d::Rect trolleyRect; + std::vector trolleyItemPoints; + }; + + enum ItemState { + NONE, + WAITING_TO_BE_LOADED, + DRAGGING, + LOADED, + SHOT, + SHOT_RELEASED, + IN_TROLLEY + }; + + struct ShootGameState { + std::vector itemIdsOrder; + std::vector splashedItems; + int currentItem; + bool cartFlippedX; + float currentTimeSeconds; + int wrongItemsCount; + ItemState itemState; + bool itemFirstShot; + int currentTutorialItem { 0}; + + bool isAnimatingCart; +// bool cartSineMovement {false}; +// float cartBaseY; +// float cartBaseVelocity; +// float cartVelocityModifier; +// float cartSineAmpModifier; +// float cartSineBreadth; +// float cartSineShift; +// cocos2d::Point cartStartPoint; +// cocos2d::Point cartEndPoint; + }; + + static SubGameSceneShoot* create(int pGameId, std::string layoutFilePath, std::function gameConfigParser); + + virtual void onEnter() override; + virtual void update(float time) override; + +protected: + + // tutorial + cocos2d::Sprite* hintFingerSprite {nullptr}; + void tut_showItemDrag(); + void tut_showSlingDrag(); + void tut_showSlingDragAlongX(); + void tut_prepareFingerIfNeeded(); + // completion only for non-looped + void tut_moveFinger(const cocos2d::Point& startPosition, const cocos2d::Point& endPosition, float moveTime, float pauseTime, bool loop = false, std::function completion = [](){}); + void tut_moveFingerBackAndForth(const cocos2d::Point& startPosition, const cocos2d::Point& endPosition, float moveTime, float pauseTime); + void tut_hideFinger(bool remove = true); + + void tut_intro_start(); + void tut_intro_stop(); + void tut_intro_shootApple(); + void tut_intro_shootChocolate(); + void tut_intro_shootBanana(); + void tut_intro_shootItem(std::string groupNodeName, std::string singleItemFilePath, float moveAnimTime = 1); + + bool tutorialComplete(); + void saveTutorialComplete(); + ///// + + std::string currentSteveHead; + + cocos2d::Node* _cart; + cocos2d::Node* _cartFoodLayer; + cocos2d::Node* _shelf; + cocos2d::Layer* darkLayer; + + cocos2d::Label* _timeLabel; + + int currentlyDraggedObjectId; + cocos2d::Sprite* _currentItem; +// bool itemInSling; + + cocos2d::Sprite* _slingGumLeft; + cocos2d::Sprite* _slingGumRight; + cocos2d::Sprite* _movingSling; + cocos2d::Sprite* _slingStick; + cocos2d::Node* _slingHand; + cocos2d::Node* _slingSubHand; + cocos2d::Point _slingLeftAttachmentPoint; + cocos2d::Point _slingRightAttachmentPoint; + float _slingLeftStartLength; + float _slingRightStartLength; + bool _isDraggingSling; + + bool _isSlingReturning; + + float _baseSpringOmegaZero; + float _baseSpringDXForOmegaZero; + float _springOmegaZero; + float _springDampCoeff; + float _slingAmplitude; + float _totalReturningTime; + cocos2d::Point _slingDragStartLocation; + cocos2d::Point _movingSlingOriginalPosition; + cocos2d::Point _handOriginalPosition; + cocos2d::Vec2 _slingOriginalDeltaAnchorPoint; + cocos2d::Point _slingDragTotalDelta; + cocos2d::Point _oscMidPoint; + float _slingGumLeftShootRotation; + float _slingGumRightShootRotation; + float _slingReturnAnimTotalTime; + float prevCosVal; +// bool itemShot; +// bool itemReachedTarget; + float slingHeight; + float itemFlyTime; + float itemFlyTimeElapsed; + float itemV; + float baseItemV; + float slingAmpForBaseItemV; + + + void itemFollowsTheSling(); + void gumsFollowTheSling(bool switchRotation); + + int gameId; + + GameConfig gameConfig; + ShootGameState shootGameState; + + void cleanupSplashedItems(); + + void startTimer(); + void setStartTimeAndLabel(); + void onSecondElapsed(float dt); + + virtual bool initWithConfiguration(int pGameId, std::string layoutFilePath, std::function gameConfigParse); + virtual void clearGameState() override; + + void maggieOpenBeak(); + void maggieCloseBeak(); + + void prepareCartPosition(); + void prepareCartPositionOutside(); + void runCartAnimations(bool faster = false); + void flipCart(); + + void moveSlingToTheWorld(); + void moveSlingBackToTheHand(); + void placeItemInSling(cocos2d::Sprite* _item); + void removeItemFromSling(); + void cancelItemDrag(); + + // scroll the items on the shelf so that the given index is visible (two pages) + void scrollShelf(cocos2d::Node* pageForNode, std::function completion = [](){}); + bool checkRectHidesBehindSling(cocos2d::Rect rectWorldCoord); + SItem currentItem(){ return gameConfig.shelfItems[shootGameState.itemIdsOrder[shootGameState.currentItem]];} + void nextItem(); + cocos2d::Sprite* splashItem(cocos2d::Node* where, cocos2d::Vec2 pos, float forHowLong = -1, int zOrder = 100); + void switchSteveHead(std::string headName); + + virtual TouchHandlerFunction prepareTouchBeganHandler(); + virtual TouchHandlerFunction prepareTouchMovedHandler(); + virtual TouchHandlerFunction prepareTouchEndedHandler(); + virtual bool touchHandlerForWidget(std::string objectName, cocos2d::ui::Widget::TouchEventType touchEventType) override; + + void tryShoot(); + void shoot(); + void cancelSlingDrag(bool onlyOnStateDragging = true); + + void emptyTrolley(); + + virtual void startGame(bool playIntro = true) override; + + void loseLife(); + virtual void gameLost() override; + virtual bool onReplayButtonClicked() override; + virtual bool onFastForwardButtonClicked() override; +// + virtual void pauseGame() override; + virtual void resumeGame() override; + virtual void hideSettingsMenuWithLevelReset() override; + + void switchMenuToReplayButton(); + void fadeDarkLayer(bool fadeIn); + + void showWellDoneAndReplay(); + void hideWellDoneAndReplay(); +}; + +#endif /* SubGameSceneShoot_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/DrawingUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/DrawingUtils.cpp new file mode 100644 index 0000000..1fe1e39 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/DrawingUtils.cpp @@ -0,0 +1,55 @@ +// +// DrawingUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 20.05.2017. +// +// + +#include +#include "DrawingUtils.h" +#include "GeometryUtils.h" + +//TODO: this is not so needed here, maybe for thinner lines in scribbles. but it needs to be improved, because it causes android to get stuck. +std::vector DrawingUtils::calculateSmoothLinePoints(std::vector threeLastPoints) +{ +// if(threeLastPoints.size() != 3){ +//// log("DrawingUtils: calculateSmoothLinePoints: argument should be an array with exactly three elements"); +// return threeLastPoints; +// } +// +// std::vector smoothedPoints; +// +// auto point1 = threeLastPoints[0], point2 = threeLastPoints[1], point3 = threeLastPoints[2]; +// +// auto midPoint1 = point1.getMidpoint(point2); +// auto midPoint2 = point2.getMidpoint(point3); +// +// auto distance = midPoint1.distance(midPoint2); +// auto segmentDistance = 2; //2 pixels +// auto numberOfSegments = MIN(128, MAX(floor(distance / segmentDistance), 32)); +// +// float t = 0; +// float step = 1 / numberOfSegments; +// +// for(int i = 0; i < numberOfSegments; ++i){ +// +// std::vector argumentPoints; +// auto p1 = midPoint1 * (1-t)*(1-t); +// auto p2 = point2 * t*(1-t)*2; +// auto p3 = midPoint2 * t*t; +// argumentPoints.push_back(p1); +// argumentPoints.push_back(p2); +// argumentPoints.push_back(p3); +// +// auto newPoint = GeometryUtils::addPoints(argumentPoints); +// +// smoothedPoints.push_back(newPoint); +// t += step; +// } +// +// smoothedPoints.push_back(midPoint2); + +// return smoothedPoints; + return threeLastPoints; +} diff --git a/ios/Runner/Wowgame/Classes/Utils/DrawingUtils.h b/ios/Runner/Wowgame/Classes/Utils/DrawingUtils.h new file mode 100644 index 0000000..2a616e9 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/DrawingUtils.h @@ -0,0 +1,21 @@ +// +// DrawingUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 20.05.2017. +// +// + +#ifndef DrawingUtils_h +#define DrawingUtils_h + +#include "cocos2d.h" +#include + +class DrawingUtils +{ + public: + static std::vector calculateSmoothLinePoints(std::vector threeLastPoints); +}; + +#endif /* DrawingUtils_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/GeometryUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/GeometryUtils.cpp new file mode 100644 index 0000000..f2ff597 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/GeometryUtils.cpp @@ -0,0 +1,186 @@ +// +// GeometryUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 20.05.2017. +// +// + +#include +#include "GeometryUtils.h" + +//TODO: use original scale doesn't seem to work +cocos2d::Rect GeometryUtils::getBoundingBoxToWorld(cocos2d::Node* node, bool ignoreTransformations) +{ + auto tempScale = node->getScaleX() != node->getScaleY() ? node->getScaleX() : node->getScale(); + auto tempRotation = node->getRotation(); + + if(ignoreTransformations){ + node->setScale(1); + node->setRotation(0); + } + + auto bb = node->getBoundingBox(); + bb.origin = cocos2d::Point(0,0); + if(ignoreTransformations){ + node->setScale(tempScale); + node->setRotation(tempRotation); + } + auto bbToWorld = cocos2d::RectApplyTransform(bb, node->getNodeToWorldTransform()); + +// if(ignoreTransformations){ +// node->setScale(tempScale); +// node->setRotation(tempRotation); +// } + + return bbToWorld; +} + +void GeometryUtils::flipChildX(cocos2d::Node* flippedParent, cocos2d::Node* child){ + auto childDFromCenter = flippedParent->getBoundingBox().size.width/2 - child->getPositionX(); + child->setPositionX(flippedParent->getBoundingBox().size.width/2 + childDFromCenter); +} + +cocos2d::Rect GeometryUtils::flippedXRect(cocos2d::Node* flippedParent, cocos2d::Rect rect){ + auto rectMidDFromCenter = flippedParent->getBoundingBox().size.width/2 - rect.getMidX(); + auto anchorPointcorrection = /*rectMidDFromCenter > 0 ? rect.size.width/2 :*/ -rect.size.width/2; + auto newRect = rect; + newRect.origin.x = flippedParent->getBoundingBox().size.width/2 + rectMidDFromCenter + anchorPointcorrection; + return newRect; +} + +cocos2d::Point GeometryUtils::flippedXPoint(cocos2d::Node* flippedParent, cocos2d::Point point){ + auto dxFromCenter = flippedParent->getBoundingBox().size.width/2 - point.x; + return cocos2d::Point(flippedParent->getBoundingBox().size.width/2 + dxFromCenter, point.y); +} + +cocos2d::Rect GeometryUtils::getBoundingBoxToWorldForSubrect(cocos2d::Node* node, cocos2d::Rect subrect){ + auto subrectToWorld = GeometryUtils::getBoundingBoxToWorld(node); + subrectToWorld.origin.y += subrect.origin.y; + subrectToWorld.size.height = subrect.size.height; + subrectToWorld.origin.x += subrect.origin.x; + subrectToWorld.size.width = subrect.size.width; + return subrectToWorld; +} + +cocos2d::Rect GeometryUtils::getRectIntersection(cocos2d::Rect rect1, cocos2d::Rect rect2) +{ + auto intersection = cocos2d::Rect(MAX(rect1.origin.x, rect2.origin.x), MAX(rect1.origin.y, rect2.origin.y), 0, 0); + intersection.size.width = MIN(rect1.origin.x + rect1.size.width, rect2.origin.x + rect2.size.width) - intersection.origin.x; + intersection.size.height = MIN(rect1.origin.y + rect1.size.height, rect2.origin.y + rect2.size.height) - intersection.origin.y; + return intersection; +} + +bool GeometryUtils::segmentIntersectsRect(cocos2d::Rect rect, cocos2d::Point lineP1, cocos2d::Point lineP2) +{ + if(rect.containsPoint(lineP1) || rect.containsPoint(lineP2)){ + return true; + } + + auto rectX2 = rect.origin.x + rect.size.width; + auto rectY2 = rect.origin.y + rect.size.height; + + if((lineP1.x > rectX2 && lineP2.x > rectX2) || (lineP1.x < rect.origin.x && lineP2.x < rect.origin.x) || (lineP1.y > rectY2 && lineP2.y > rectY2) || (lineP1.y < rect.origin.y && lineP2.y < rect.origin.y)){ + return false; + } + + if(lineP1.y == lineP2.y){ + return true; + } + + if(lineP1.x == lineP2.x){ + return true; + } + + auto lineA = (lineP1.y - lineP2.y)/(lineP1.x - lineP2.x); + auto lineB = lineP1.y - lineP1.x * lineA; + + auto yr1 = rect.origin.x*lineA + lineB; + auto yr2 = (rect.origin.x+rect.size.width)*lineA + lineB; + auto xr1 = (rect.origin.y - lineB)/lineA; + auto xr2 = (rect.origin.y+rect.size.height - lineB)/lineA; + + return (yr1 >= rect.origin.y && yr1 <= rectY2) || (yr2 >= rect.origin.y && yr2 <= rectY2) || (xr1 >= rect.origin.x && xr1 <= rectX2) || (xr2 >= rect.origin.x && xr2 <= rectX2); +} + +cocos2d::Point GeometryUtils::addPoints(std::vector points) +{ + float sumX = 0, sumY = 0; + for(int i = 0; i < points.size(); ++i){ + sumX += points[i].x; + sumY += points[i].y; + } + + return cocos2d::Point(sumX, sumY); +} + +void GeometryUtils::getLineABCFromPoints(cocos2d::Point pointA, cocos2d::Point pointB, float (&line)[3]) +{ + auto A = pointA.y - pointB.y; + auto B = pointB.x - pointA.x; + auto C = pointA.x * pointB.y - pointB.x * pointA.y; + + line[0] = A; + line[1] = B; + line[2] = C; +} + +bool GeometryUtils::segmentCrossesLine(cocos2d::Point sPointA, cocos2d::Point sPointB, float lineA, float lineB, float lineC) +{ + auto valueA = lineA * sPointA.x + lineB * sPointA.y + lineC; + auto valueB = lineA * sPointB.x + lineB * sPointB.y + lineC; + + if(valueA * valueB <= 0){ + return true; + } + + return false; +} + +float GeometryUtils::calculateIntersectionPercentage(cocos2d::Rect rect1, cocos2d::Rect rect2, int percentageOfWhichRect) +{ + if(rect1.size.width == 0 || rect1.size.height == 0 || rect2.size.width == 0 || rect2.size.height == 0){ + return 0; + } + + if(!rect1.intersectsRect(rect2)){ + return 0; + } + + auto intersection = GeometryUtils::getRectIntersection(rect1, rect2); + + auto r = percentageOfWhichRect == 0 ? rect1 : rect2; + return intersection.size.width * intersection.size.height / (r.size.width * r.size.height); +} + + +/* + // relatively to line y = 0 + lineAngle : function(lineP1, lineP2){ + + if(lineP1.x == lineP2.x){ + return 0; + } else if(lineP1.y == lineP2.y){ + return Math.PI/2; + } + + // build a triangle, with third point equal to (x1, y2), and get the arc sin of (p3,p2)/(p1,p2) + let point3 = new cc.p(lineP1.x, lineP2.y); + let angle = Math.asin(cc.pDistance(lineP2, point3)/cc.pDistance(lineP1, lineP2)); + + // add a multiple of PI/2, depending on the quarter + if(lineP2.y < lineP1.y){ + if(lineP2.x > lineP1.x){ + angle = Math.PI - angle; + } else { + angle = Math.PI + angle; + } + } else if(lineP2.x < lineP1.x){ + angle = Math.PI*2 - angle; + } + + return angle; + } + +}; +*/ diff --git a/ios/Runner/Wowgame/Classes/Utils/GeometryUtils.h b/ios/Runner/Wowgame/Classes/Utils/GeometryUtils.h new file mode 100644 index 0000000..22c057d --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/GeometryUtils.h @@ -0,0 +1,51 @@ +// +// GeometryUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 20.05.2017. +// +// + +#ifndef GeometryUtils_h +#define GeometryUtils_h + +#include "cocos2d.h" + + +class GeometryUtils +{ + public: + + struct ThickSegment + { + cocos2d::Point point1; + cocos2d::Point point2; + float thickness; + + ThickSegment(){ + point1 = cocos2d::Point(0,0); + point2 = cocos2d::Point(0,0); + thickness = 0; + } + + ThickSegment(cocos2d::Point p1, cocos2d::Point p2, float pThickness){ + point1 = p1; + point2 = p2; + thickness = pThickness; + } + }; + + static void flipChildX(cocos2d::Node* flippedParent, cocos2d::Node* child); + static cocos2d::Rect flippedXRect(cocos2d::Node* flippedParent, cocos2d::Rect rect); + static cocos2d::Point flippedXPoint(cocos2d::Node* flippedParent, cocos2d::Point point); + static cocos2d::Rect getBoundingBoxToWorld(cocos2d::Node* node, bool ignoreTransformations = true); + static cocos2d::Rect getBoundingBoxToWorldForSubrect(cocos2d::Node* node, cocos2d::Rect subrect); + static cocos2d::Rect getRectIntersection(cocos2d::Rect rect1, cocos2d::Rect rect2); + static bool segmentIntersectsRect(cocos2d::Rect rect, cocos2d::Point lineP1, cocos2d::Point lineP2); + static cocos2d::Point addPoints(std::vector points); + static void getLineABCFromPoints(cocos2d::Point pointA, cocos2d::Point pointB, float (&line)[3]); + static bool segmentCrossesLine(cocos2d::Point sPointA, cocos2d::Point sPointB, float lineA, float lineB, float lineC); + static float calculateIntersectionPercentage(cocos2d::Rect rect1, cocos2d::Rect rect2, int percentageOfWhichRect = 0); +}; + +#endif /* GeometryUtils_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/MathUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/MathUtils.cpp new file mode 100644 index 0000000..bcdfe63 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/MathUtils.cpp @@ -0,0 +1,72 @@ +// +// MathUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 10.05.2017. +// +// + +#include +#include "MathUtils.h" +#include + +// random generator + +double MathUtils::getRandom(double min, double max){ + + auto rng = _getRNG(); + std::uniform_real_distribution<> dist(min, max); + return dist(rng); +} + +int MathUtils::getRandomInt(int min, int max){ + + auto rng = _getRNG(); + std::uniform_int_distribution dist6(min,max); + return dist6(rng); +} + +cocos2d::Color4F MathUtils::getRandomOpaqueColor(){ + auto r = MathUtils::getRandom(0, 1); + auto g = MathUtils::getRandom(0, 1); + auto b = MathUtils::getRandom(0, 1); + return cocos2d::Color4F(r,g,b,1); +} + +//void MathUtils::drawRoundedCorneredRect(cocos2d::DrawNode* drawNode, cocos2d::Rect rect, float cornerRadius, cocos2d::Color4F& color){ +// +// drawNode->drawLine(cocos2d::Vec2(rect.getMinX()+cornerRadius, rect.getMinY()), cocos2d::Vec2(rect.getMaxX()-cornerRadius, rect.getMinY()), color); +// drawNode->drawLine(cocos2d::Vec2(rect.getMaxX(), rect.getMinY()+cornerRadius), cocos2d::Vec2(rect.getMaxX(), rect.getMaxY()-cornerRadius), color); +// drawNode->drawLine(cocos2d::Vec2(rect.getMaxX()-cornerRadius, rect.getMaxY()), cocos2d::Vec2(rect.getMinX()+cornerRadius, rect.getMaxY()), color); +// drawNode->drawLine(cocos2d::Vec2(rect.getMinX(), rect.getMaxY()-cornerRadius), cocos2d::Vec2(rect.getMinX(), rect.getMinY()+cornerRadius), color); +// +// static float MagicConst = 0.552f; +// +// drawNode->setLineWidth(1); +// +// auto corner = cocos2d::Vec2(rect.getMinX(), rect.getMinY()); //bottom left +// drawNode->drawCubicBezier(cocos2d::Vec2(corner.x, corner.y + cornerRadius), cocos2d::Vec2(corner.x, corner.y + cornerRadius*(1-MagicConst)), cocos2d::Vec2(corner.x + cornerRadius*(1-MagicConst), corner.y), cocos2d::Vec2(corner.x + cornerRadius, corner.y), 100, color); +// corner = cocos2d::Vec2(rect.getMinX(), rect.getMaxY()); +// drawNode->drawCubicBezier(cocos2d::Vec2(corner.x, corner.y - cornerRadius), cocos2d::Vec2(corner.x, corner.y - cornerRadius*(1-MagicConst)), cocos2d::Vec2(corner.x + cornerRadius*(1-MagicConst), corner.y), cocos2d::Vec2(corner.x + cornerRadius, corner.y), 80, color); +// corner = cocos2d::Vec2(rect.getMaxX(), rect.getMaxY()); +// drawNode->drawCubicBezier(cocos2d::Vec2(corner.x - cornerRadius, corner.y), cocos2d::Vec2(corner.x - cornerRadius*(1-MagicConst), corner.y), cocos2d::Vec2(corner.x, corner.y - cornerRadius*(1-MagicConst)), cocos2d::Vec2(corner.x, corner.y - cornerRadius), 50, color); +// corner = cocos2d::Vec2(rect.getMaxX(), rect.getMinY()); +// drawNode->drawCubicBezier(cocos2d::Vec2(corner.x, corner.y + cornerRadius), cocos2d::Vec2(corner.x, corner.y + cornerRadius*(1-MagicConst)), cocos2d::Vec2(corner.x - cornerRadius*(1-MagicConst), corner.y), cocos2d::Vec2(corner.x - cornerRadius, corner.y), 30, color); +// +//} + + + +/////////////////////////////////////// +// private + +std::mt19937 MathUtils::_getRNG(){ + std::mt19937 rng; + rng.seed(std::random_device()()); + return rng; +} + + + + + diff --git a/ios/Runner/Wowgame/Classes/Utils/MathUtils.h b/ios/Runner/Wowgame/Classes/Utils/MathUtils.h new file mode 100644 index 0000000..86463d4 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/MathUtils.h @@ -0,0 +1,139 @@ +// +// MathUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 10.05.2017. +// +// + +#ifndef MathUtils_h +#define MathUtils_h + +#include +#include +#include +#include +#include "cocos2d.h" + +class MathUtils { + + public: + + // Returns a random number between min (inclusive) and max (exclusive) + static double getRandom(double min, double max); + + // Returns a random integer between min (included) and max (excluded) + static int getRandomInt(int min, int max); + + static cocos2d::Color4F getRandomOpaqueColor(); + + static int signum(float expression){ + if(expression < 0){ + return -1; + } else if(expression > 0){ + return 1; + } + return 0; + }; + + template + static T getRandomElement(std::vector& arr){ + auto size = arr.size(); + if(size > 0){ + int randomIndex = MathUtils::getRandomInt(0, (int)size-1); + return arr[randomIndex]; + } + throw "Empty array!"; + } + + template + static void shuffleArray(std::vector& arr) + { + int currentIndex = (int)arr.size(), randomIndex; + T temporaryValue; + + // While there remain elements to shuffle... + while (0 != currentIndex) { + + // Pick a remaining element... + randomIndex = MathUtils::getRandomInt(0, currentIndex-1); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = arr[currentIndex]; + arr[currentIndex] = arr[randomIndex]; + arr[randomIndex] = temporaryValue; + } + } + + template + static void multiplyArray(std::vector& arr, T byValue) + { + for(int i = 0; i < arr.size(); ++i){ + arr[i] *= byValue; + } + } + + template + static void multiplyPointArray(std::vector& arr, T byValue) + { + for(int i = 0; i < arr.size(); ++i){ + arr[i].x *= byValue; + arr[i].y *= byValue; + } + } + + template + static void multiplyRectPositionsArray(std::vector& arr, T byValue) + { + for(int i = 0; i < arr.size(); ++i){ + arr[i].origin.x *= byValue; + arr[i].origin.y *= byValue; + arr[i].size.width *= byValue; + arr[i].size.height *= byValue; + } + } + + template + static void multiplyRectPosition(cocos2d::Rect& rect, T byValue) + { + rect.origin.x *= byValue; + rect.origin.y *= byValue; + rect.size.width *= byValue; + rect.size.height *= byValue; + } + + template + static void multiplyPoint(cocos2d::Point& point, T byValue) + { + point.x *= byValue; + point.y *= byValue; + } + + //NOT WORKING, WHY? Container size is always 0. +// template +// static void averageValue(const Container& valueArray, T& averageValue){ +// if(valueArray.size() == 0){ +// averageValue = 0; +// } else { +// averageValue = std::accumulate(valueArray.begin(), valueArray.end(), 0) / valueArray.size(); +// } +// } + + //temp + static void averageValue(const std::deque& valueArray, float& averageValue){ + if(valueArray.size() == 0){ + averageValue = 0; + } else { + float size = valueArray.size(); + averageValue = std::accumulate(valueArray.begin(), valueArray.end(), 0) / size; + } + } + +// static void drawRoundedCorneredRect(cocos2d::DrawNode*, cocos2d::Rect rect, float cornerRadius, cocos2d::Color4F&); + + private: + static std::mt19937 _getRNG(); +}; + +#endif /* MathUtils_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/MiscUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/MiscUtils.cpp new file mode 100644 index 0000000..32dca14 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/MiscUtils.cpp @@ -0,0 +1,229 @@ +// +// MiscUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#include +#include "MiscUtils.h" +#include "GeometryUtils.h" +#include "AlertView.h" + +float MiscUtils::StandardAnimationTime = 0.2; +const std::string MiscUtils::WHICH_LEVEL_UD_KEY = "WHICH_LEVEL_UD_KEY"; +const std::string MiscUtils::TOS_ACCEPTED_UD_KEY = "TOS_ACCEPTED_UD_KEY"; + +void MiscUtils::saveTOSAccepted(){ + cocos2d::UserDefault::getInstance()->setBoolForKey(TOS_ACCEPTED_UD_KEY.c_str(), true); + cocos2d::UserDefault::getInstance()->flush(); +} + +bool MiscUtils::wasTOSAccepted(){ + return cocos2d::UserDefault::getInstance()->getBoolForKey(TOS_ACCEPTED_UD_KEY.c_str(), false); +} + +//void MiscUtils::saveLastLevel(Level level){ +// cocos2d::UserDefault::getInstance()->setIntegerForKey(WHICH_LEVEL_UD_KEY.c_str(), (int)level); +//} + +void MiscUtils::saveLastLevel(int level){ + cocos2d::UserDefault::getInstance()->setIntegerForKey(WHICH_LEVEL_UD_KEY.c_str(), level); + cocos2d::UserDefault::getInstance()->flush(); +} + +MiscUtils::Level MiscUtils::lastLevel(){ + return (Level)cocos2d::UserDefault::getInstance()->getIntegerForKey(WHICH_LEVEL_UD_KEY.c_str(), (int)Level::TEEN); +} + +int MiscUtils::nextLevel(){ + return MIN((int)lastLevel() + 1, (int)Level::ADULT); +} + +static int FadeAnimationTag = 88; +void MiscUtils::showView(cocos2d::Node* node, bool animated, float toAlpha){ + if(node != nullptr){ + node->stopActionByTag(FadeAnimationTag); + node->setVisible(true); + if(animated){ + auto fadeAction = cocos2d::FadeTo::create(StandardAnimationTime, toAlpha); + fadeAction->setTag(FadeAnimationTag); + node->runAction(fadeAction); + } else { + node->setOpacity(toAlpha); + } + } +} + +void MiscUtils::hideView(cocos2d::Node* node, bool animated){ + if(node != nullptr){ + node->stopActionByTag(FadeAnimationTag); + if(animated){ + auto fadeAction = cocos2d::Sequence::create(cocos2d::FadeOut::create(StandardAnimationTime), + cocos2d::CallFunc::create(std::bind([&](cocos2d::Node* n){ + n->setVisible(false); + },node)), + nullptr); + fadeAction->setTag(FadeAnimationTag); + node->runAction(fadeAction); + } else { + node->setVisible(false); + } + } +} + +void MiscUtils::hideAndRemoveView(cocos2d::Node* node, bool animated){ + if(node != nullptr){ + if(animated){ + node->runAction(cocos2d::Sequence::create(cocos2d::FadeOut::create(StandardAnimationTime), + cocos2d::CallFunc::create(std::bind([&](cocos2d::Node* n){ + n->removeFromParent(); + },node)), + nullptr)); + } else { + node->removeFromParent(); + } + } +} + +cocos2d::Rect MiscUtils::getExtendedActiveArea(cocos2d::Node* object, float extendPercentValueX, float extendPercentValueY, ExtendDirectionX extendDirX, ExtendDirectionY extendDirY) +{ + auto ignoreTransoframtions = object->getScale() == 1 && object->getRotation() == 0; + auto objectBoundingBox = GeometryUtils::getBoundingBoxToWorld(object, ignoreTransoframtions); + + if(extendPercentValueX == 0 && extendPercentValueY == 0){ + return objectBoundingBox; + } + + auto extendValueX = objectBoundingBox.size.width*extendPercentValueX/100.0; + auto extendValueY = objectBoundingBox.size.height*extendPercentValueY/100.0; + + auto x = objectBoundingBox.origin.x; + auto y = objectBoundingBox.origin.y; + auto w = objectBoundingBox.size.width; + auto h = objectBoundingBox.size.height; + + switch(extendDirX){ + case ExtendDirectionX::LEFT: + x -= extendValueX; + w += extendValueX; + break; + case ExtendDirectionX::RIGHT: + w += extendValueX; + break; + case ExtendDirectionX::BOTH: + x -= extendValueX/2; + w += extendValueX; + break; + } + + switch(extendDirY){ + case ExtendDirectionY::DOWN: + y -= extendValueY; + h += extendValueY; + break; + case ExtendDirectionY::UP: + h += extendValueY; + break; + case ExtendDirectionY::BOTH: + y -= extendValueY/2; + h += extendValueY; + break; + } + + return cocos2d::Rect(x, y, w, h); +} + +bool MiscUtils::isNodeVisible(cocos2d::Node* node){ + bool ret = true; + cocos2d::Node* parent = node; + while (parent != nullptr) { + if(!parent->isVisible()){ + ret = false; + break; + } else { + parent = parent->getParent(); + } + } + return ret; +} + +//without moving the position +void MiscUtils::changeAnchorPoint(cocos2d::Node* p_node, cocos2d::Point p_newAnchorPoint){ + auto originalAnchorPoint = p_node->getAnchorPoint(); + p_node->setAnchorPoint(p_newAnchorPoint); + // when we change the anchor point, we also need to adjust the postion so the sprite stays at the same spot + auto anchorPointChange = p_node->getAnchorPoint() - originalAnchorPoint; + p_node->setPositionX(p_node->getPositionX() + anchorPointChange.x*p_node->getBoundingBox().size.width); + p_node->setPositionY(p_node->getPositionY() + anchorPointChange.y*p_node->getBoundingBox().size.height); +} + +std::string MiscUtils::boolToString(bool value) +{ + if(value){ + return "true"; + } else { + return "false"; + } +} + +std::string MiscUtils::clockMinSecTimeString(int seconds){ + auto mins = (int)floor(seconds/60); + auto secs = seconds%60; + std::string timeString = std::to_string(mins) + ":"; + if(secs < 10){ + timeString += "0" + std::to_string(secs); + } else { + timeString += std::to_string(secs); + } + return timeString; +} + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + +static const int AlertViewTag = 999; + +void MiscUtils::showAppCloseConfirmDialog(std::function onCancelCallback){ + + if(cocos2d::Director::getInstance()->getRunningScene()->getChildByTag(AlertViewTag) == nullptr) { + + auto alpha = 220; + + auto message = "Are you sure you want to quit?"; //TODO + auto okText = "Yes, bye!"; + auto cancelText = "No, let's play!"; + + auto cancelColor = cocos2d::Color3B(68, 200, 220); + auto okColor = cocos2d::Color3B(200, 100, 100); + + auto alert = AlertView::create(message, okText, cancelText, okColor, cancelColor, []() { + cocos2d::Director::getInstance()->end(); + }, onCancelCallback); + auto touchListener = cocos2d::EventListenerTouchOneByOne::create(); + touchListener->setSwallowTouches(true); + touchListener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event) { + return true; + }; + cocos2d::Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(touchListener, alert); + alert->setTag(AlertViewTag); + alert->setLocalZOrder(1000); //TODO make general zorders, named + alert->setOpacity(0); + cocos2d::Director::getInstance()->getRunningScene()->addChild(alert); + alert->runAction(cocos2d::FadeTo::create(MiscUtils::StandardAnimationTime, alpha)); + } +} + +bool MiscUtils::closeAppCloseConfirmDialogIfNecessary(){ + auto scene = cocos2d::Director::getInstance()->getRunningScene(); + if(scene != nullptr) { + auto alertNode = scene->getChildByTag(AlertViewTag); + if (alertNode != nullptr) { + alertNode->removeFromParent(); + return true; + } + } + return false; +} + +#endif diff --git a/ios/Runner/Wowgame/Classes/Utils/MiscUtils.h b/ios/Runner/Wowgame/Classes/Utils/MiscUtils.h new file mode 100644 index 0000000..c7ad754 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/MiscUtils.h @@ -0,0 +1,76 @@ +// +// MiscUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 17.05.2017. +// +// + +#ifndef MiscUtils_h +#define MiscUtils_h + +#include "PlainSprite.h" + +class MiscUtils +{ + public: + + enum class ExtendDirectionX { + BOTH = 0, + LEFT = 1, + RIGHT = 2 + }; + + enum class ExtendDirectionY { + BOTH = 0, + UP = 1, + DOWN = 2, + }; + + enum class Level { + CHILD = 0, + TEEN = 1, + ADULT = 2 + }; + + static const char* levelToString(Level level) { + if(level == Level::CHILD){ + return "CHILD"; + } else if(level == Level::TEEN){ + return "TEEN"; + } else return "ADULT"; + } + + static float StandardAnimationTime; + static float QuickAnimationTime; + + static const std::string WHICH_LEVEL_UD_KEY; + static const std::string TOS_ACCEPTED_UD_KEY; + + static void saveTOSAccepted(); + static bool wasTOSAccepted(); + static void saveLastLevel(Level level); + static void saveLastLevel(int level); + static Level lastLevel(); + static int nextLevel(); + + static std::string clockMinSecTimeString(int seconds); + + static void showView(cocos2d::Node*, bool animated, float toAlpha = 255); + static void hideView(cocos2d::Node*, bool animated); + static void hideAndRemoveView(cocos2d::Node*, bool animated); + + static cocos2d::Rect getExtendedActiveArea(cocos2d::Node* object, float extendPercentValueX = 0, float extendPercentValueY = 0, ExtendDirectionX extendDirX = ExtendDirectionX::BOTH, ExtendDirectionY extendDirY = ExtendDirectionY::BOTH); + + static bool isNodeVisible(cocos2d::Node* node); +static void changeAnchorPoint(cocos2d::Node* p_node, cocos2d::Point p_newAnchorPoint); + + static std::string boolToString(bool value); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + static void showAppCloseConfirmDialog(std::function onCancelCallback); + static bool closeAppCloseConfirmDialogIfNecessary(); +#endif +}; + +#endif /* MiscUtils_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/ResourceUtilities.cpp b/ios/Runner/Wowgame/Classes/Utils/ResourceUtilities.cpp new file mode 100644 index 0000000..b244144 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/ResourceUtilities.cpp @@ -0,0 +1,62 @@ +// +// ResourceUtilities.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 23.06.2017. +// +// + +#include +#include "ResourceUtilities.h" +#include "JSONParseUtils.h" +#include "ValueStorage.h" +//#include "ResourceDownloader_cpp.h" +#include "ResourcesConfig.h" + +#define RESOURCES_LOAD_FROM_ASSETS +//#define FORCE_REDOWNLOAD_RESOURCES + + +std::string ResourceUtilities::getDownloadedResourcesPath(bool deviceDependentFiles) +{ +#ifdef RESOURCES_LOAD_FROM_ASSETS + return ""; +#endif +// std::string resDownloadDir = ResourceDownloader_getResourceDownloadDirectoryPath(); +// +// if(deviceDependentFiles){ +// return resDownloadDir + "/" + this->getDeviceSpecificFolderName(); +// } +// +// return resDownloadDir + "/" + ResourcesConfig::UNIVERSAL_RESOURCES_FOLDER_NAME; +} + +std::string ResourceUtilities::getFullPathForDownloadedFile(const std::string& path, bool isDeviceDependent) +{ +#ifdef RESOURCES_LOAD_FROM_ASSETS + return path; +#endif +// std::string resDownloadDir = this->getDownloadedResourcesPath(isDeviceDependent); +// return resDownloadDir + "/" + path; +} + +std::vector ResourceUtilities::getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent) +{ + std::vector fullPaths; + fullPaths.reserve(paths.size()); + for(const auto& path : paths){ + fullPaths.push_back(this->getFullPathForDownloadedFile(path, areDeviceDependent)); + } + return fullPaths; +} + +std::vector ResourceUtilities::getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent) +{ + std::vector fullPaths; + fullPaths.reserve(paths.size()); + for(const auto& path : paths){ + fullPaths.push_back(this->getFullPathForDownloadedFile(path, areDeviceDependent)); + } + return fullPaths; +} + diff --git a/ios/Runner/Wowgame/Classes/Utils/ResourceUtilities.h b/ios/Runner/Wowgame/Classes/Utils/ResourceUtilities.h new file mode 100644 index 0000000..d89adf6 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/ResourceUtilities.h @@ -0,0 +1,38 @@ +// +// ResourceUtilities.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 23.06.2017. +// +// + +#ifndef ResourceUtilities_h +#define ResourceUtilities_h + +#include "json/document.h" +#include + +class ResourceUtilities +{ + public: + + static ResourceUtilities& getInstance() + { + static ResourceUtilities instance; + return instance; + } + + void setDeviceSpecificFolderName(std::string folderName){ DeviceSpecificFolderName = folderName; } + std::string getDeviceSpecificFolderName(){return DeviceSpecificFolderName;} + + std::string getDownloadedResourcesPath(bool deviceDependentFiles = true); + std::string getFullPathForDownloadedFile(const std::string& path, bool isDeviceDependent = true); + std::vector getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent = true); + std::vector getFullPathsForDownloadedFiles(const std::vector& paths, bool areDeviceDependent = true); + + protected: + + std::string DeviceSpecificFolderName; +}; + +#endif /* ResourceUtilities_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/ScalingUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/ScalingUtils.cpp new file mode 100644 index 0000000..5a8bc1e --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/ScalingUtils.cpp @@ -0,0 +1,141 @@ +// +// ScalingUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 18.05.2017. +// +// + +#include + +#include "ScalingUtils.h" + +float ScalingUtils::getAdjustedContentScaleFactor(){ + auto cocosScaleFactor = cocos2d::Director::getInstance()->getContentScaleFactor(); + if(isSmallDevice()){ + return cocosScaleFactor*2; + } else { + return cocosScaleFactor; + } +} + +bool ScalingUtils::isSmallDevice(){ + int dpi = cocos2d::Device::getDPI(); + float xInches = cocos2d::Director::getInstance()->getWinSize().width / dpi; + float yInches = cocos2d::Director::getInstance()->getWinSize().height / dpi; + float diagonalInches = sqrtf(xInches * xInches + yInches * yInches); + diagonalInches = roundf(diagonalInches * 100.0f) / 100.0f; + return diagonalInches < 7.0f; +} + +bool ScalingUtils::isElementTooSmallForSmallDevice(int elementWidth){ + return elementWidth < 300; +} + +float ScalingUtils::getScaleForSmallDevice(){ + return 1.4f; +} + +float ScalingUtils::getAspectRatioBasedModifierForVelocity(){ + static float designTabletAspectRatio = 2560.f / 1600.f;//my huawei media pad m5 + static float currentDeviceAspectRatio = cocos2d::Director::getInstance()->getWinSize().width / cocos2d::Director::getInstance()->getWinSize().height; + if(currentDeviceAspectRatio < 1.4){ //around 1.333 is an ipad, and it's too difficult for ipads - so this is a fix + return 0.9f;//currentDeviceAspectRatio / designTabletAspectRatio; + } + return 1.0f; //else just leave the velocity as it is - let is adjust based on scale factor only +} + +float ScalingUtils::getDeviceAspectRatio(){ + static float currentDeviceAspectRatio = cocos2d::Director::getInstance()->getWinSize().width / cocos2d::Director::getInstance()->getWinSize().height; + return currentDeviceAspectRatio; +} + +void ScalingUtils::setScaledScreenSurplusSize(float width, float height) +{ + _scaledScreenSurplusWidth = width; + _scaledScreenSurplusWidth = height; +} + +float ScalingUtils::getScaledScreenSurplusWidth() +{ + return _scaledScreenSurplusWidth; +} + +float ScalingUtils::getScaledScreenSurplusHeight() +{ + return _scaledScreenSurplusHeight; +} + +float ScalingUtils::widthScale(){ + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto ipadProSize = getDesignSize(); + return winSize.width / ipadProSize.width;// * designDpi / dpi; +} + +float ScalingUtils::heightScale(){ + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto ipadProSize = getDesignSize(); + return winSize.height / ipadProSize.height;// * designDpi / dpi; +} + +float ScalingUtils::scaleAspectFitToDesignIpadProSize(){ + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto ipadProSize = getDesignSize(); + return MIN(winSize.width / ipadProSize.width, winSize.height / ipadProSize.height); +} + +float ScalingUtils::scaleAspectFillToDesignIpadProSize(){ + auto winSize = cocos2d::Director::getInstance()->getWinSize(); + auto ipadProSize = getDesignSize(); + return MAX(winSize.width / ipadProSize.width, winSize.height / ipadProSize.height); +} + +float ScalingUtils::getScaleForFont(){ + return 1.f/getAdjustedContentScaleFactor(); +} +// + +cocos2d::Size ScalingUtils::getDesignSize(){ + return cocos2d::Size(2732, 2048); +} + +float ScalingUtils::getDesignDpi(){ + return 266.f; +} + +float ScalingUtils::imageAspectFillGetScale(cocos2d::Size nodeSize, cocos2d::Size targetSize) +{ + return MAX(targetSize.width / nodeSize.width, targetSize.height / nodeSize.height); +} + +float ScalingUtils::imageAspectFitGetScale(cocos2d::Size nodeSize, cocos2d::Size targetSize) +{ + return MIN(targetSize.width / nodeSize.width, targetSize.height / nodeSize.height); +} + +float ScalingUtils::configureNodeDimension(float originalDimension) +{ + float scale = getAdjustedContentScaleFactor();//scocos2d::Director::getInstance()->getContentScaleFactor(); + return originalDimension/scale; +} + +cocos2d::Point ScalingUtils::configurePoint(cocos2d::Point point) +{ + auto scale = getAdjustedContentScaleFactor();//cocos2d::Director::getInstance()->getContentScaleFactor(); + auto additionalPaddingW = _scaledScreenSurplusWidth/2; + auto additionalPaddingH = _scaledScreenSurplusHeight/2; + + return cocos2d::Point(point.x/scale+additionalPaddingW, point.y/scale+additionalPaddingH); +} + +cocos2d::Rect ScalingUtils::configureRect(cocos2d::Rect rect) +{ + auto scale = getAdjustedContentScaleFactor();//cocos2d::Director::getInstance()->getContentScaleFactor(); + auto additionalPaddingW = _scaledScreenSurplusWidth/2; + auto additionalPaddingH = _scaledScreenSurplusHeight/2; + + return cocos2d::Rect(rect.origin.x/scale+additionalPaddingW, rect.origin.y/scale+additionalPaddingH, rect.size.width/scale, rect.size.height/scale); +} + + + diff --git a/ios/Runner/Wowgame/Classes/Utils/ScalingUtils.h b/ios/Runner/Wowgame/Classes/Utils/ScalingUtils.h new file mode 100644 index 0000000..8551fcd --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/ScalingUtils.h @@ -0,0 +1,61 @@ +// +// ScalingUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 18.05.2017. +// +// + +#ifndef ScalingUtils_h +#define ScalingUtils_h + +#include "cocos2d.h" + +class ScalingUtils //TODO make a singleton +{ + public: + + static ScalingUtils& getInstance() + { + static ScalingUtils instance; + return instance; + } + + static float getAdjustedContentScaleFactor(); + + static bool isSmallDevice(); + static bool isElementTooSmallForSmallDevice(int elementWidth); + static float getScaleForSmallDevice(); + static float getAspectRatioBasedModifierForVelocity(); + static cocos2d::Size getDesignSize(); + static float getDesignDpi(); + void setScaledScreenSurplusSize(float width, float height); + float getScaledScreenSurplusWidth(); + float getScaledScreenSurplusHeight(); + cocos2d::Point configurePoint(cocos2d::Point point); + cocos2d::Rect configureRect(cocos2d::Rect rect); + static float widthScale(); + static float heightScale(); + static float scaleAspectFitToDesignIpadProSize(); + static float scaleAspectFillToDesignIpadProSize(); + static float getScaleForFont(); + static float imageAspectFillGetScale(cocos2d::Size nodeSize, cocos2d::Size targetSize); + static float imageAspectFitGetScale(cocos2d::Size nodeSize, cocos2d::Size targetSize); + static float configureNodeDimension(float originalDimension); + static float getDeviceAspectRatio(); + + private: + + ScalingUtils(){ + this->_scaledScreenSurplusWidth = 0; + this->_scaledScreenSurplusHeight = 0; + }; + + DISALLOW_COPY_AND_ASSIGN(ScalingUtils); + + float _scaledScreenSurplusWidth; + float _scaledScreenSurplusHeight; + +}; + +#endif /* ScalingUtils_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/SoundUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/SoundUtils.cpp new file mode 100644 index 0000000..5de558c --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/SoundUtils.cpp @@ -0,0 +1,23 @@ +// +// SoundUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 10.05.2017. +// +// + +#include "SoundUtils.h" +#include "MathUtils.h" +#include "SoundsRepo.h" + + unsigned int SoundUtils::playRandomSound(std::string soundFolderPath, std::vector soundNames, bool stopEffects){ + + auto soundsLength = soundNames.size(); + if(soundsLength > 0){ + int randomIndex = MathUtils::getRandomInt(0, (int)soundsLength-1); + std::string fullSoundPath = soundFolderPath == "" ? soundNames[randomIndex] : soundFolderPath /*+ "/"*/ + soundNames[randomIndex]; + return SoundsRepo::playSound(fullSoundPath, stopEffects); + } + + return 0; + } diff --git a/ios/Runner/Wowgame/Classes/Utils/SoundUtils.h b/ios/Runner/Wowgame/Classes/Utils/SoundUtils.h new file mode 100644 index 0000000..b765c3e --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/SoundUtils.h @@ -0,0 +1,23 @@ +// +// SoundUtils.hpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 10.05.2017. +// +// + +#ifndef SoundUtils_h +#define SoundUtils_h + +#include +#include +#include + +class SoundUtils { + + public: + static unsigned int playRandomSound(std::string soundFolderPath = "", std::vector soundNames = std::vector(), bool stopEffects = true); + +}; + +#endif /* SoundUtils_hpp */ diff --git a/ios/Runner/Wowgame/Classes/Utils/SoundsRepo.cpp b/ios/Runner/Wowgame/Classes/Utils/SoundsRepo.cpp new file mode 100644 index 0000000..5ae50f1 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/SoundsRepo.cpp @@ -0,0 +1,229 @@ +// +// SoundsRepo.cpp +// WattsenglishToyApp-mobile +// +// Created by Katarzyna Kalinowska-Górska on 26/11/2019. +// + +#include +#include "SoundsRepo.h" +#include "MathUtils.h" +#include "json/document.h" + +static float SOUND_EFFECTS_VOLUME = 0.75; + +std::string SoundsRepo::musicBgFilePath = "common/sounds/menu_bg_music.mp3"; +std::string SoundsRepo::soundsFolder = "common/sounds/"; +std::map SoundsRepo::soundDurations = std::map(); +int SoundsRepo::currentMusicSoundId = -1; + +const char * SoundsRepo::SHOOT_GAME_SOUND_INTRO = "common/sounds/games/game_shoot/start.mp3"; +const char * SoundsRepo::SHOOT_GAME_SOUND_ALL_IN_TROLLEY = "common/sounds/games/game_shoot/all_in_trolley.mp3"; +const char * SoundsRepo::SHOOT_GAME_SOUND_SHOP_CLOSED = "common/sounds/games/game_shoot/shop_closed.mp3"; +const char * SoundsRepo::SHOOT_GAME_SOUND_WRONG_THREE_TIMES = "common/sounds/games/game_shoot/wrong_3_times.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_EFFECT_CATAPULT = "common/sounds/games/game_shoot/effect_catapult.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_EFFECT_IN_TROLLEY = "common/sounds/games/game_shoot/effect_in_trolley.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_EFFECT_SPLAT = "common/sounds/games/game_shoot/effect_hit.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_IN_TROLLEY = "common/sounds/games/game_shoot/in_trolley.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_NOT_IN_TROLLEY = "common/sounds/games/game_shoot/not_in_trolley.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_HIT_STEVE = "common/sounds/games/game_shoot/hit_steve.mp3"; +const char* SoundsRepo::SHOOT_GAME_SOUND_HIT_MAGGIE = "common/sounds/games/game_shoot/hit_maggie.mp3"; + +const char * SoundsRepo::MAP_GAME_SOUND_INTRO = "common/sounds/games/game_map/intro.mp3"; +const char * SoundsRepo::MAP_GAME_SOUND_ALL_DONE = "common/sounds/games/game_map/full_tummy.mp3"; + +void SoundsRepo::preloadAllShootGameSounds(){ + preloadSoundEffect(SHOOT_GAME_SOUND_ALL_IN_TROLLEY); + preloadSoundEffect(SHOOT_GAME_SOUND_SHOP_CLOSED); + preloadSoundEffect(SHOOT_GAME_SOUND_WRONG_THREE_TIMES); + preloadSoundEffect(SHOOT_GAME_SOUND_EFFECT_CATAPULT); + preloadSoundEffect(SHOOT_GAME_SOUND_EFFECT_IN_TROLLEY); + preloadSoundEffect(SHOOT_GAME_SOUND_EFFECT_SPLAT); + preloadSoundEffect(SHOOT_GAME_SOUND_IN_TROLLEY); + preloadSoundEffect(SHOOT_GAME_SOUND_NOT_IN_TROLLEY); + preloadSoundEffect(SHOOT_GAME_SOUND_HIT_MAGGIE); + preloadSoundEffect(SHOOT_GAME_SOUND_HIT_STEVE); +} + + +SoundsRepo::SoundInfo SoundsRepo::gameTNCIntroSound(){ + auto fp = soundsFolder + "games/g_tnc_intro.mp3"; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::gameLetsStartIntroSound(){ + auto fp = soundsFolder + "games/g_letsstart.mp3"; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::hooraySound(){ + std::vector hooraySounds = {/*"games/g_yes.mp3",*/ "../g_whoo_hoo.mp3", "../g_yeah.mp3", "../g_well_done.mp3", "../maggie_thats_right.mp3", "../maggie_yeah.mp3", "../maggie_super.mp3"}; + auto soundFilename = MathUtils::getRandomElement(hooraySounds); + auto fp = soundsFolder + soundFilename; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::oopsSound(){ + std::vector oopsSounds = {"games/g_oops.mp3", "games/g_no.mp3", "games/g_uh_oh.mp3"}; + auto soundFilename = MathUtils::getRandomElement(oopsSounds); + auto fp = soundsFolder + soundFilename; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::pureOopsSound(){ + std::vector oopsSounds = {"games/g_oops.mp3", "games/g_uh_oh.mp3"}; + auto soundFilename = MathUtils::getRandomElement(oopsSounds); + auto fp = soundsFolder + soundFilename; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::noSound(){ + auto fp = soundsFolder + "games/g_no.mp3"; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::pickLevelSound(){ + auto fp = soundsFolder + "../../level_picking/g_pick_level.mp3"; + return SoundInfo(fp, soundDuration(fp)); +} + +SoundsRepo::SoundInfo SoundsRepo::changeLevelSound(){ + auto fp = soundsFolder + "games/g_next_level.mp3"; + return SoundInfo(fp, soundDuration(fp)); +} + +//SoundsRepo::SoundInfo SoundsRepo::gameFinishedSound(){ +// auto fp = soundsFolder + "games/g_finished.mp3"; +// return SoundInfo(fp, soundDuration(fp)); +//} +// +//SoundsRepo::SoundInfo SoundsRepo::scoreSound(){ +// auto fp = soundsFolder + "games/g_your_score.mp3"; +// return SoundInfo(fp, soundDuration(fp)); +//} + +SoundsRepo::SoundInfo SoundsRepo::hurryUpSound(){ + auto fp = soundsFolder + "games/g_hurry_up.mp3"; + return SoundInfo(fp, soundDuration(fp)); +} + +//SoundsRepo::SoundInfo SoundsRepo::tooSlowSound(){ +// std::vector hooraySounds = {"games/g_slow.mp3", "games/g_slow2.mp3"}; +// auto soundFilename = MathUtils::getRandomElement(hooraySounds); +// auto fp = soundsFolder + soundFilename; +// return SoundInfo(fp, soundDuration(fp)); +//} + +//SoundsRepo::SoundInfo SoundsRepo::wrongThreeTimesSound(){ +// auto fp = soundsFolder + "games/g_wrong_3_times.mp3"; +// return SoundInfo(fp, soundDuration(fp)); +//} + +SoundsRepo::SoundInfo SoundsRepo::typeConfirmSound(int game, int itemType){ + std::string soundPath = soundsFolder; + switch(itemType){ + case 1: + soundPath += "games/game" + std::to_string(game) + "/g_conf_1.mp3"; break; + case 2: + soundPath += "games/game" + std::to_string(game) + "/g_conf_2.mp3"; break; + case 3: + soundPath += "games/game" + std::to_string(game) + "/g_conf_3.mp3"; break; + case 4: + soundPath += "games/game" + std::to_string(game) + "/g_conf_4.mp3"; break; + default: + soundPath = ""; break; + } + return SoundInfo(soundPath, soundDurations[soundPath]); +} + +SoundsRepo::SoundInfo SoundsRepo::typeRequestSound(int game, int itemType){ + std::string soundPath = soundsFolder; + switch(itemType){ + case 1: + soundPath += "games/game" + std::to_string(game) + "/g_request_1.mp3"; break; + case 2: + soundPath += "games/game" + std::to_string(game) + "/g_request_2.mp3"; break; + case 3: + soundPath += "games/game" + std::to_string(game) + "/g_request_3.mp3"; break; + case 4: + soundPath += "games/game" + std::to_string(game) + "/g_request_4.mp3"; break; + default: + soundPath = ""; break; + } + return SoundInfo(soundPath, soundDurations[soundPath]); +} + +void SoundsRepo::stopAllSounds(){ + cocos2d::AudioEngine::stopAll(); +} + +void SoundsRepo::stopSoundById(int audioId){ + cocos2d::AudioEngine::stop(audioId); +} + +int SoundsRepo::playSound(const std::string soundFilepath, bool stopOtherEffects){ + if(stopOtherEffects){ + cocos2d::AudioEngine::stopAll(); + } + auto soundId = cocos2d::AudioEngine::play2d(soundFilepath); +// cocos2d::AudioEngine::setVolume(soundId, SOUND_EFFECTS_VOLUME); + return soundId; +//return 0; +} + +int SoundsRepo::playMusic(const std::string musicFilepath){ + currentMusicSoundId = cocos2d::AudioEngine::play2d(musicFilepath, true); + return currentMusicSoundId; +} + +void SoundsRepo::stopMusic(){ + cocos2d::AudioEngine::stop(currentMusicSoundId); +} + +float SoundsRepo::soundDuration(const std::string soundFilepath){ + if(soundDurations.find(soundFilepath) != soundDurations.end()){ + return soundDurations[soundFilepath]; + } else { + return 0; + } +} + +void SoundsRepo::preloadSoundEffect(std::string soundPath){ + cocos2d::AudioEngine::preload(soundPath); +} + +void SoundsRepo::preloadAllLoadedSoundEffects(){ + for(auto soundIt = soundDurations.begin(); soundIt != soundDurations.end(); soundIt++){ + std::string fullSoundPath = /*commonConfig.soundConfig.soundsFolder + */soundIt->first; +// soundEngine->preloadEffect(fullSoundPath.c_str()); + cocos2d::AudioEngine::preload(fullSoundPath); + } +} + +void SoundsRepo::pauseAllSounds(){ + cocos2d::AudioEngine::pauseAll(); +} + +void SoundsRepo::resumeAllSounds(){ + cocos2d::AudioEngine::resumeAll(); +} + +void SoundsRepo::loadSoundsList(){ + parseSoundInfoFile(SoundsRepo::soundsFolder, SoundsRepo::soundsFolder + "sounds_info.si", SoundsRepo::soundDurations); +} + +void SoundsRepo::parseSoundInfoFile(std::string soundFolderPath, std::string filePath, std::map& mapToFill){ + if(cocos2d::FileUtils::getInstance()->isFileExist(filePath)){ + auto soundInfoJson = new rapidjson::Document(); + auto jsonString = cocos2d::FileUtils::getInstance()->getStringFromFile(filePath); + soundInfoJson->Parse(jsonString.c_str()); + + auto soundsList = (*soundInfoJson)["sounds"].GetArray(); + for(const auto& sound : soundsList){ + auto soundFilename = sound["filename"].GetString(); + auto soundDuration = sound["duration_seconds"].GetFloat(); + mapToFill.insert(std::make_pair(soundFolderPath + soundFilename, soundDuration)); + } + } +} + diff --git a/ios/Runner/Wowgame/Classes/Utils/SoundsRepo.h b/ios/Runner/Wowgame/Classes/Utils/SoundsRepo.h new file mode 100644 index 0000000..5fa5a1b --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/SoundsRepo.h @@ -0,0 +1,88 @@ +// +// SoundsRepo.h +// WattsenglishToyApp +// +// Created by Katarzyna Kalinowska-Górska on 26/11/2019. +// + +#ifndef SoundsRepo_h +#define SoundsRepo_h + +#include +#include "audio/include/AudioEngine.h" + +class SoundsRepo { + +public: + + static std::string soundsFolder; + static std::string musicBgFilePath; + static std::map soundDurations; + + static int currentMusicSoundId; + + struct SoundInfo { + SoundInfo(std::string fp, float sd){ + filePath = fp; + soundDuration = sd; + }; + std::string filePath; + float soundDuration; + }; + + // shoot game + + static void preloadAllShootGameSounds(); + + static const char* SHOOT_GAME_SOUND_INTRO; + static const char * SHOOT_GAME_SOUND_ALL_IN_TROLLEY; + static const char* SHOOT_GAME_SOUND_SHOP_CLOSED; + static const char* SHOOT_GAME_SOUND_WRONG_THREE_TIMES; + static const char* SHOOT_GAME_SOUND_IN_TROLLEY; + static const char* SHOOT_GAME_SOUND_NOT_IN_TROLLEY; + static const char* SHOOT_GAME_SOUND_HIT_STEVE; + static const char* SHOOT_GAME_SOUND_HIT_MAGGIE; + static const char* SHOOT_GAME_SOUND_EFFECT_CATAPULT; + static const char* SHOOT_GAME_SOUND_EFFECT_IN_TROLLEY; + static const char* SHOOT_GAME_SOUND_EFFECT_SPLAT; + + static const char * MAP_GAME_SOUND_INTRO; + static const char * MAP_GAME_SOUND_ALL_DONE; + + /// + + static SoundInfo hooraySound(); + static SoundInfo oopsSound(); + static SoundInfo pureOopsSound(); + static SoundInfo noSound(); + static SoundInfo pickLevelSound(); + static SoundInfo changeLevelSound(); +// static SoundInfo gameFinishedSound(); +// static SoundInfo scoreSound(); + static SoundInfo gameLostSound(); + static SoundInfo gameTNCIntroSound(); + static SoundInfo gameLetsStartIntroSound(); + static SoundInfo typeRequestSound(int game, int itemType); + static SoundInfo typeConfirmSound(int game, int itemType); + static SoundInfo typeWrongSound(int game, int itemType); + + static SoundInfo hurryUpSound(); +// static SoundInfo tooSlowSound(); +// static SoundInfo wrongThreeTimesSound(); + + static int playSound(const std::string soundFilepath, bool stopOtherEffects = true); + static int playMusic(const std::string musicFilepath); + static void stopAllSounds(); + static void stopSoundById(int audioId); + static void stopMusic(); + static void pauseAllSounds(); + static void resumeAllSounds(); + static float soundDuration(const std::string soundFilepath); + static void preloadSoundEffect(std::string soundPath); + static void preloadAllLoadedSoundEffects(); + + static void loadSoundsList(); + static void parseSoundInfoFile(std::string soundFolderPath, std::string filePath, std::map& mapToFill); +}; + +#endif /* SoundsRepo_h */ diff --git a/ios/Runner/Wowgame/Classes/Utils/StringUtils.cpp b/ios/Runner/Wowgame/Classes/Utils/StringUtils.cpp new file mode 100644 index 0000000..9906a26 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/StringUtils.cpp @@ -0,0 +1,47 @@ +// +// StringUtils.cpp +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 02.06.2017. +// +// + +#include +#include "StringUtils.h" + +std::vector StringUtils::splitString(const std::string& string, char separator) +{ + std::vector tokens; + + std::string::size_type prev_pos = 0, pos = 0; + + while((pos = string.find(separator, pos)) != std::string::npos) + { + std::string substring( string.substr(prev_pos, pos-prev_pos) ); + tokens.push_back(substring); + prev_pos = ++pos; + } + + tokens.push_back(string.substr(prev_pos, pos-prev_pos)); + + return tokens; +} + +std::vector StringUtils::splitString(const std::string& string, std::string separator) +{ + std::vector tokens; + + std::string::size_type prev_pos = 0, pos = 0; + + while((pos = string.find(separator, pos)) != std::string::npos) + { + std::string substring( string.substr(prev_pos, pos-prev_pos) ); + tokens.push_back(substring); + prev_pos = pos + separator.length(); + pos = prev_pos; + } + + tokens.push_back(string.substr(prev_pos, pos-prev_pos)); + + return tokens; +} diff --git a/ios/Runner/Wowgame/Classes/Utils/StringUtils.h b/ios/Runner/Wowgame/Classes/Utils/StringUtils.h new file mode 100644 index 0000000..d2c1240 --- /dev/null +++ b/ios/Runner/Wowgame/Classes/Utils/StringUtils.h @@ -0,0 +1,24 @@ +// +// StringUtils.h +// SteveMaggieCpp +// +// Created by Katarzyna Kalinowska-Górska on 02.06.2017. +// +// + +#ifndef StringUtils_h +#define StringUtils_h + +#include +#include + +class StringUtils +{ + public: + + static std::vector splitString(const std::string& string, char separator); + static std::vector splitString(const std::string& string, std::string separator); + +}; + +#endif /* StringUtils_h */ diff --git a/ios/Runner/Wowgame/Resources/fonts/ComicSansMSBold.ttf b/ios/Runner/Wowgame/Resources/fonts/ComicSansMSBold.ttf new file mode 100644 index 0000000..75be504 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/fonts/ComicSansMSBold.ttf diff --git a/ios/Runner/Wowgame/Resources/fonts/ComicSansMSRegular.ttf b/ios/Runner/Wowgame/Resources/fonts/ComicSansMSRegular.ttf new file mode 100644 index 0000000..d17e1be --- /dev/null +++ b/ios/Runner/Wowgame/Resources/fonts/ComicSansMSRegular.ttf diff --git a/ios/Runner/Wowgame/Resources/res/.gitkeep b/ios/Runner/Wowgame/Resources/res/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/.gitkeep diff --git a/ios/Runner/Wowgame/Resources/res/common/games/shoot_game/gconfig.gcf b/ios/Runner/Wowgame/Resources/res/common/games/shoot_game/gconfig.gcf new file mode 100644 index 0000000..e20ae36 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/games/shoot_game/gconfig.gcf @@ -0,0 +1,204 @@ +{ +"game_type" : "shoot", +"sounds_path" : "common/sounds/games/game_shoot/", + "game_properties" : { + "max_seconds_inactivity" : 12, + "lives" : 3, + "itemPictureFilePaths":[], + "trolleySubRect" : { + "x" : 230, + "y" : 630, + "w" : 426, + "h" : 100 + }, + "maggieSubRect" : { + "x" : 25, + "y" : 635, + "w" : 200, + "h" : 250 + }, + "steveSubRect" : { + "x" : 664, + "y" : 452, + "w" : 185, + "h" : 400 + }, + "trolleyItemPoints" : [ + { + "x" : 345, + "y" : 350 + }, + { + "x" : 435, + "y" : 350 + }, + { + "x" : 535, + "y" : 350 + }, + { + "x" : 405, + "y" : 400 + }, + { + "x" : 515, + "y" : 400 + }, + { + "x" : 600, + "y" : 400 + }, + { + "x" : 345, + "y" : 400 + }, + { + "x" : 450, + "y" : 450 + } + ], + "itemInfo" : + [ + { + "itemId" : 1, + "shelfIndex" : 0, + "groupNodeName" : "apples", + "pictures" : ["graphics/shoot_game/graphics/single_food/apple1.png", + "graphics/shoot_game/graphics/single_food/apple2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/apple_splodge.png", + "soundRequest" : "apple.mp3", + "soundNo" : "not_apple.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 2, + "shelfIndex" : 2, + "groupNodeName" : "bananas", + "pictures" : ["graphics/shoot_game/graphics/single_food/banana1.png", + "graphics/shoot_game/graphics/single_food/banana2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/banana_splodge.png", + "soundRequest" : "banana.mp3", + "soundNo" : "not_banana.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 3, + "shelfIndex" : 3, + "groupNodeName" : "cakes", + "pictures" : ["graphics/shoot_game/graphics/single_food/cake1.png", + "graphics/shoot_game/graphics/single_food/cake2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/cake_splodge.png", + "soundRequest" : "cake.mp3", + "soundNo" : "not_cake.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 4, + "shelfIndex" : 4, + "groupNodeName" : "chocolate", + "pictures" : ["graphics/shoot_game/graphics/single_food/chocolate1.png", + "graphics/shoot_game/graphics/single_food/chocolate2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/chocolate_splodge.png", + "soundRequest" : "chocolate.mp3", + "soundNo" : "not_chocolate.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 5, + "shelfIndex" : 5, + "groupNodeName" : "cucumbers", + "pictures" : ["graphics/shoot_game/graphics/single_food/cucumber1.png", + "graphics/shoot_game/graphics/single_food/cucumber2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/cucumber_splodge.png", + "soundRequest" : "cucumber.mp3", + "soundNo" : "not_cucumber.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 6, + "shelfIndex" : 6, + "groupNodeName" : "donuts", + "pictures" : ["graphics/shoot_game/graphics/single_food/donut1.png", + "graphics/shoot_game/graphics/single_food/donut2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/donut_splodge.png", + "soundRequest" : "donut.mp3", + "soundNo" : "not_donut.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 7, + "shelfIndex" : 7, + "groupNodeName" : "icecream", + "pictures" : ["graphics/shoot_game/graphics/single_food/icecream1.png", + "graphics/shoot_game/graphics/single_food/icecream2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/icecream_splodge.png", + "soundRequest" : "icecream.mp3", + "soundNo" : "not_icecream.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 8, + "shelfIndex" : 11, + "groupNodeName" : "tomatoes", + "pictures" : ["graphics/shoot_game/graphics/single_food/tomato1.png", + "graphics/shoot_game/graphics/single_food/tomato2.png"], + "splodgePicture" : "graphics/shoot_game/graphics/single_food/tomato_splodge.png", + "soundRequest" : "tomato.mp3", + "soundNo" : "not_tomato.mp3", + "soundYes" : "put_it_trolley.mp3" + }, + { + "itemId" : 9, + "shelfIndex" : 1, + "pictures" : ["graphics/shoot_game/graphics/single_food/baguette.png"], + "groupNodeName" : "baguettes" + }, + { + "itemId" : 10, + "shelfIndex" : 8, + "groupNodeName" : "lettuce", + "pictures" : ["graphics/shoot_game/graphics/single_food/lettuce.png"] + }, + { + "itemId" : 11, + "shelfIndex" : 9, + "groupNodeName" : "milk", + "pictures" : ["graphics/shoot_game/graphics/single_food/milk.png"] + }, + { + "itemId" : 12, + "shelfIndex" : 10, + "groupNodeName" : "oranges", + "pictures" : ["graphics/shoot_game/graphics/single_food/orange.png"] + } + ], + "itemGroupNodeNames" : [ + "bananas", + "cakes", + "chocolate", + "cucumbers", + "donuts", + "icecream", + "lettuce", + "milk", + "orange", + "tomatoes" + ], + "level_info" : [ + { + "levelTime" : 240, + "trolleyTime" : 8 + }, + { + "levelTime" : 180, + "trolleyTime" : 5 + }, + { + "levelTime" : 150, + "trolleyTime" : 2.2 + } + ], + "screen_padding" : 40, + "static_items" : 10 + } +} diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_no.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_no.mp3 new file mode 100644 index 0000000..d86778d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_no.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_oops.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_oops.mp3 new file mode 100644 index 0000000..f3e0b88 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_oops.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_uh_oh.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_uh_oh.mp3 new file mode 100644 index 0000000..768ac0b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_uh_oh.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_well_done.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_well_done.mp3 new file mode 100644 index 0000000..1787915 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_well_done.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_whoo_hoo.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_whoo_hoo.mp3 new file mode 100644 index 0000000..1bc94eb --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_whoo_hoo.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_yeah.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_yeah.mp3 new file mode 100644 index 0000000..976bc6e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/g_yeah.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/all_in_trolley.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/all_in_trolley.mp3 new file mode 100644 index 0000000..87a0331 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/all_in_trolley.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/apple.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/apple.mp3 new file mode 100644 index 0000000..a6606a7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/apple.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/banana.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/banana.mp3 new file mode 100644 index 0000000..3947567 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/banana.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/cake.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/cake.mp3 new file mode 100644 index 0000000..c29f3b6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/cake.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/chocolate.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/chocolate.mp3 new file mode 100644 index 0000000..4e4f95d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/chocolate.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/cucumber.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/cucumber.mp3 new file mode 100644 index 0000000..393753a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/cucumber.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/donut.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/donut.mp3 new file mode 100644 index 0000000..d0c41cd --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/donut.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_catapult.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_catapult.mp3 new file mode 100755 index 0000000..154bb5f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_catapult.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_hit.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_hit.mp3 new file mode 100644 index 0000000..a81a581 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_hit.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_in_trolley.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_in_trolley.mp3 new file mode 100755 index 0000000..0bb8a00 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/effect_in_trolley.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/hit_maggie.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/hit_maggie.mp3 new file mode 100644 index 0000000..eb58c64 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/hit_maggie.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/hit_steve.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/hit_steve.mp3 new file mode 100644 index 0000000..06721f5 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/hit_steve.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/icecream.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/icecream.mp3 new file mode 100644 index 0000000..5d30d90 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/icecream.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/in_trolley.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/in_trolley.mp3 new file mode 100644 index 0000000..6af9f1b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/in_trolley.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_apple.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_apple.mp3 new file mode 100644 index 0000000..caeb7bf --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_apple.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_banana.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_banana.mp3 new file mode 100644 index 0000000..8e68e69 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_banana.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_cake.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_cake.mp3 new file mode 100644 index 0000000..3f3b668 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_cake.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_chocolate.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_chocolate.mp3 new file mode 100644 index 0000000..58f475a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_chocolate.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_cucumber.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_cucumber.mp3 new file mode 100644 index 0000000..108815b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_cucumber.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_donut.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_donut.mp3 new file mode 100644 index 0000000..ebede71 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_donut.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_icecream.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_icecream.mp3 new file mode 100644 index 0000000..f0331a6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_icecream.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_in_trolley.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_in_trolley.mp3 new file mode 100644 index 0000000..fcd7a5f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_in_trolley.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_tomato.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_tomato.mp3 new file mode 100644 index 0000000..89643ac --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/not_tomato.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/put_it_trolley.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/put_it_trolley.mp3 new file mode 100644 index 0000000..d188021 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/put_it_trolley.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/shop_closed.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/shop_closed.mp3 new file mode 100644 index 0000000..23d5966 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/shop_closed.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/start.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/start.mp3 new file mode 100644 index 0000000..3577b29 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/start.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/tomato.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/tomato.mp3 new file mode 100644 index 0000000..b3ca15e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/tomato.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/wrong_3_times.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/wrong_3_times.mp3 new file mode 100644 index 0000000..e4fdb54 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/game_shoot/wrong_3_times.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_super.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_super.mp3 new file mode 100644 index 0000000..08a3b76 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_super.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_thats_right.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_thats_right.mp3 new file mode 100644 index 0000000..e02671a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_thats_right.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_yeah.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_yeah.mp3 new file mode 100644 index 0000000..feb595b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/games/maggie_yeah.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/common/sounds/level_picking/g_pick_level.mp3 b/ios/Runner/Wowgame/Resources/res/common/sounds/level_picking/g_pick_level.mp3 new file mode 100644 index 0000000..a7103a3 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/common/sounds/level_picking/g_pick_level.mp3 diff --git a/ios/Runner/Wowgame/Resources/res/small/app_links/app_link_halloween.png b/ios/Runner/Wowgame/Resources/res/small/app_links/app_link_halloween.png new file mode 100644 index 0000000..8317881 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/app_links/app_link_halloween.png diff --git a/ios/Runner/Wowgame/Resources/res/small/app_links/app_link_toy.png b/ios/Runner/Wowgame/Resources/res/small/app_links/app_link_toy.png new file mode 100644 index 0000000..10b48ac --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/app_links/app_link_toy.png diff --git a/ios/Runner/Wowgame/Resources/res/small/app_links/doll_toy_app.png b/ios/Runner/Wowgame/Resources/res/small/app_links/doll_toy_app.png new file mode 100644 index 0000000..6737e87 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/app_links/doll_toy_app.png diff --git a/ios/Runner/Wowgame/Resources/res/small/app_links/halo_icon.png b/ios/Runner/Wowgame/Resources/res/small/app_links/halo_icon.png new file mode 100644 index 0000000..540edce --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/app_links/halo_icon.png diff --git a/ios/Runner/Wowgame/Resources/res/small/app_links/steve_maggie.png b/ios/Runner/Wowgame/Resources/res/small/app_links/steve_maggie.png new file mode 100644 index 0000000..00384b6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/app_links/steve_maggie.png diff --git a/ios/Runner/Wowgame/Resources/res/small/app_links/witch_halloween_app.png b/ios/Runner/Wowgame/Resources/res/small/app_links/witch_halloween_app.png new file mode 100644 index 0000000..3432da7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/app_links/witch_halloween_app.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_back.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_back.png new file mode 100644 index 0000000..0418026 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_back.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_go.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_go.png new file mode 100644 index 0000000..a2a9c30 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_go.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_green.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_green.png new file mode 100644 index 0000000..787b9bf --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_green.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_grey.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_grey.png new file mode 100644 index 0000000..b1ba93a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_grey.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_orange.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_orange.png new file mode 100644 index 0000000..65c038b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_orange.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_pause.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_pause.png new file mode 100644 index 0000000..c956bd1 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_pause.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_purple.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_purple.png new file mode 100644 index 0000000..ff14f58 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_purple.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_red.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_red.png new file mode 100644 index 0000000..d47e81f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_red.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_repeat.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_repeat.png new file mode 100644 index 0000000..daf68a1 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_repeat.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_setting.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_setting.png new file mode 100644 index 0000000..8de11e0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_setting.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_sound_off.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_sound_off.png new file mode 100644 index 0000000..5a01b3e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_sound_off.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_sound_on.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_sound_on.png new file mode 100644 index 0000000..9bb9f45 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_sound_on.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_turquoise.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_turquoise.png new file mode 100644 index 0000000..bb15d61 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_turquoise.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_yellow.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_yellow.png new file mode 100644 index 0000000..ca64baa --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/button_yellow.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/buttonff.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/buttonff.png new file mode 100644 index 0000000..3c1a141 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/buttonff.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/dark_green.png b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/dark_green.png new file mode 100644 index 0000000..968684f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/graphics/dark_green.png diff --git a/ios/Runner/Wowgame/Resources/res/small/buttons/horizontalButtonPanelBackFFPause.obl b/ios/Runner/Wowgame/Resources/res/small/buttons/horizontalButtonPanelBackFFPause.obl new file mode 100644 index 0000000..5bb378d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/buttons/horizontalButtonPanelBackFFPause.obl @@ -0,0 +1,123 @@ +{ + "object": + { + "type" : "PlainNode", + "width" : 740, + "height" : 230, + "adjustContentSizeForSmallDevices" : true, + "depth" : 10, + "objects": + [ + { + "name" : "fastForwardButton", + "imagePath" : "graphics/button_green.png", + "useAlternativePath": true, + "type" : "SimpleButton", + "centerXPos" : + { + "type" : "relative", + "value" : "divide 6 place 3" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center" + }, + "objects": + [ + { + "name": "arrowsFF", + "imagePath": "graphics/buttonff.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + } + } + ] + }, + { + "name" : "replayButton", + "imagePath" : "graphics/button_yellow.png", + "useAlternativePath": true, + "type" : "SimpleButton", + "opacity" : 0, + "enabled" : false, + "centerXPos" : + { + "type" : "relative", + "value" : "divide 6 place 3" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center" + }, + "objects": + [ + { + "name": "arrowRepeat", + "imagePath": "graphics/button_repeat.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + } + } + ] + }, + { + "name" : "pauseButton", + "type" : "SimpleButton", + "imagePath" : "graphics/button_yellow.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "divide 6 place 5" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center" + }, + "objects": + [ + { + "name": "image", + "imagePath": "graphics/button_pause.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + } + } + ] + } + ] + } +} diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/g_finger.png b/ios/Runner/Wowgame/Resources/res/small/graphics/g_finger.png new file mode 100644 index 0000000..2488e20 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/g_finger.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/g_life_indicator_dead.png b/ios/Runner/Wowgame/Resources/res/small/graphics/g_life_indicator_dead.png new file mode 100755 index 0000000..b5e95fd --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/g_life_indicator_dead.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/g_life_indicator_ok.png b/ios/Runner/Wowgame/Resources/res/small/graphics/g_life_indicator_ok.png new file mode 100755 index 0000000..9a28393 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/g_life_indicator_ok.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/level_halo.png b/ios/Runner/Wowgame/Resources/res/small/graphics/level_halo.png new file mode 100755 index 0000000..39ba2ba --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/level_halo.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_1.png new file mode 100755 index 0000000..704a86b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_2.png new file mode 100755 index 0000000..732430f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_3.png b/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_3.png new file mode 100755 index 0000000..3b09d67 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/levels/level_3.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_back1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_back1.png new file mode 100755 index 0000000..49955b7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_back1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_back2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_back2.png new file mode 100755 index 0000000..9694941 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_back2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_front.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_front.png new file mode 100755 index 0000000..f498d72 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/cart_front.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/clock.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/clock.png new file mode 100755 index 0000000..0f6aff7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/clock.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/food_in_cart.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/food_in_cart.png new file mode 100755 index 0000000..10271d9 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/food_in_cart.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/gum.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/gum.png new file mode 100755 index 0000000..14cb9bd --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/gum.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/hand_leather.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/hand_leather.png new file mode 100755 index 0000000..2b322a2 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/hand_leather.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/hand_sling.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/hand_sling.png new file mode 100755 index 0000000..dd021a6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/hand_sling.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/apples.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/apples.png new file mode 100755 index 0000000..a07005a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/apples.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/baguettes.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/baguettes.png new file mode 100755 index 0000000..13eb3c1 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/baguettes.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/bananas.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/bananas.png new file mode 100755 index 0000000..603dbb4 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/bananas.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/cakes.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/cakes.png new file mode 100755 index 0000000..f8dc069 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/cakes.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/chocolate.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/chocolate.png new file mode 100755 index 0000000..5db6fbb --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/chocolate.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/cucumbers.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/cucumbers.png new file mode 100755 index 0000000..947e0dd --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/cucumbers.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/donuts.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/donuts.png new file mode 100755 index 0000000..ad2388b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/donuts.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/icecream.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/icecream.png new file mode 100755 index 0000000..c8a9502 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/icecream.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/lettuce.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/lettuce.png new file mode 100755 index 0000000..72313d3 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/lettuce.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/milk.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/milk.png new file mode 100755 index 0000000..809f330 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/milk.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/orange.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/orange.png new file mode 100755 index 0000000..449f12e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/orange.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/tomatoes.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/tomatoes.png new file mode 100755 index 0000000..c122d57 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/shelf_food/tomatoes.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple1.png new file mode 100644 index 0000000..f3c47e5 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple2.png new file mode 100644 index 0000000..f916afd --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple_splodge.png new file mode 100755 index 0000000..0824010 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/apple_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/baguette.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/baguette.png new file mode 100755 index 0000000..2366e98 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/baguette.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana1.png new file mode 100755 index 0000000..4c831c6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana2.png new file mode 100755 index 0000000..81a492d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana_splodge.png new file mode 100755 index 0000000..61969c7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/banana_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake1.png new file mode 100755 index 0000000..b12804c --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake2.png new file mode 100755 index 0000000..9723ecc --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake_splodge.png new file mode 100755 index 0000000..e7c1fc7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cake_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate1.png new file mode 100755 index 0000000..70d97ad --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate2.png new file mode 100755 index 0000000..c8f77fe --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate_splodge.png new file mode 100755 index 0000000..084143c --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/chocolate_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber1.png new file mode 100755 index 0000000..9322cc0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber2.png new file mode 100755 index 0000000..94b2613 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber_splodge.png new file mode 100755 index 0000000..29130dc --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/cucumber_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut1.png new file mode 100755 index 0000000..8a9e1ac --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut2.png new file mode 100755 index 0000000..75cc6b3 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut_splodge.png new file mode 100755 index 0000000..6c7c093 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/donut_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream1.png new file mode 100644 index 0000000..56c714b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream2.png new file mode 100644 index 0000000..f5fd385 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream_splodge.png new file mode 100755 index 0000000..ae352d8 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/icecream_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/lettuce.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/lettuce.png new file mode 100755 index 0000000..75b269f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/lettuce.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/milk.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/milk.png new file mode 100755 index 0000000..770d77b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/milk.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/orange.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/orange.png new file mode 100755 index 0000000..d5660e0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/orange.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato1.png new file mode 100644 index 0000000..8ba4dcb --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato2.png new file mode 100644 index 0000000..d278841 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato_splodge.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato_splodge.png new file mode 100755 index 0000000..fde6d01 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/single_food/tomato_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/sling.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/sling.png new file mode 100755 index 0000000..5d5b055 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/sling.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head1.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head1.png new file mode 100755 index 0000000..46e9def --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head1.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head2.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head2.png new file mode 100755 index 0000000..b0406dd --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head2.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head3.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head3.png new file mode 100755 index 0000000..e8fc164 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head3.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head4.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head4.png new file mode 100755 index 0000000..5808057 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head4.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head5.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head5.png new file mode 100755 index 0000000..4ddbbe7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/steve_head5.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/wooden_shelf.png b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/wooden_shelf.png new file mode 100755 index 0000000..27c3f24 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/graphics/wooden_shelf.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/scene_layout.scl b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/scene_layout.scl new file mode 100644 index 0000000..de9f05d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/shoot_game/scene_layout.scl @@ -0,0 +1,699 @@ +{ + "resFolder" : + { + "path":"graphics/shoot_game/graphics/", + "alternativePath":"buttons/", + "objectLayoutsPath" : "buttons/" + }, + "sceneLayout": + { + "layers": + [ + { + "name" : "backgroundLayer", + "objects": + [ + { + "name": "background", + "type" : "PlainSprite", + "imagePath" : "background.png", + "stretchMode" : "aspectFill", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + } + ] + }, + { + "name" : "objectLayer", + "objects": + [ + { + "name": "cartWhole", + "type" : "PlainNode", + "width" : 853, + "height" : 1032, + "depth" : 6, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "top" + }, + "objects" : + [ + { + "name": "cartBack", + "type" : "PlainSprite", + "imagePath" : "cart_back2.png", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "cartBack2", + "type" : "PlainSprite", + "imagePath" : "cart_back1.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "cartFood", + "type" : "PlainNode", + "width" : 853, + "height" : 1032, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "cartFront", + "type" : "PlainSprite", + "imagePath" : "cart_front.png", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "steveHeadHappy", + "type" : "PlainSprite", + "imagePath" : "steve_head1.png", + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadOhNo1", + "type" : "PlainSprite", + "imagePath" : "steve_head2.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadOhNo2", + "type" : "PlainSprite", + "imagePath" : "steve_head3.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadGrr", + "type" : "PlainSprite", + "imagePath" : "steve_head4.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadSad", + "type" : "PlainSprite", + "imagePath" : "steve_head5.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + } + ] + }, + + { + "name": "clock", + "type" : "PlainSprite", + "imagePath" : "clock.png", + "depth" : 9, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -100 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top" + }, + "objects": + [ + { + "type" : "Label", + "name": "clockLabel", + "text" : "3:00", + "fontPath" : "fonts/ComicSansMSRegular.ttf", + "baseFontSize" : 120, + "colour" : {"r" : 180, "g" : 180, "b": 180, "a" : 255}, + "scaleUpForSmallDevices" : false, + "anchorPoint" : + { + "x" : 0.5, + "y" : 0.5 + }, + "centerXPos" : + { + "type" : "relative", + "value" : "center" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "bottom", + "padding" : 10 + } + } + ] + }, + { + "name": "shelfWhole", + "type" : "PlainNode", + "width" : 5930, + "height" : 519, + "depth" : 7, + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding":-30 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding":-40 + }, + "objects" : + [ + { + "name": "shelf", + "type" : "RepeatSprite", + "imagePath" : "wooden_shelf.png", + "width" : 5930, + "height" : 519, + "centerXPos": + { + "type" : "relative", + "value" : "left" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "apples", + "type" : "PlainSprite", + "imagePath" : "shelf_food/apples.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 0 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "baguettes", + "type" : "PlainSprite", + "imagePath" : "shelf_food/baguettes.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 500 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "bananas", + "type" : "PlainSprite", + "imagePath" : "shelf_food/bananas.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 1000 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "cakes", + "type" : "PlainSprite", + "imagePath" : "shelf_food/cakes.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 1450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "chocolate", + "type" : "PlainSprite", + "imagePath" : "shelf_food/chocolate.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 1940 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 10 + } + }, + { + "name": "cucumbers", + "type" : "PlainSprite", + "imagePath" : "shelf_food/cucumbers.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 2450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -30 + } + }, + { + "name": "donuts", + "type" : "PlainSprite", + "imagePath" : "shelf_food/donuts.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 2950 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "icecream", + "type" : "PlainSprite", + "imagePath" : "shelf_food/icecream.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 3450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "lettuce", + "type" : "PlainSprite", + "imagePath" : "shelf_food/lettuce.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 3930 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "milk", + "type" : "PlainSprite", + "imagePath" : "shelf_food/milk.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 4480 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "oranges", + "type" : "PlainSprite", + "imagePath" : "shelf_food/orange.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 4940 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "tomatoes", + "type" : "PlainSprite", + "imagePath" : "shelf_food/tomatoes.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 5450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + } + ] + }, + { + "name": "slingStick", + "type" : "PlainSprite", + "imagePath": "hand_sling.png", + "depth" : 8, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom" + }, + "objects" : + [ + { + "name": "slingGumLeft", + "type" : "PlainSprite", + "imagePath": "gum.png", + "anchorPoint" : { + "x" : 0.5, + "y" : 1 + }, + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 84 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : 40 + } + }, + { + "name": "slingGumRight", + "type" : "PlainSprite", + "imagePath": "gum.png", + "anchorPoint" : { + "x" : 0.5, + "y" : 1 + }, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -32 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : 36 + } + } + ] + }, + { + "name": "slingHandWhole", + "type" : "PlainNode", + "width" : 207, + "height" : 1180, + "depth" : 9, + "centerXPos": + { + "type" : "relative", + "value" : "center", + "padding" : 30 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -390 + }, + "objects": + [ + { + "name": "sling", + "type" : "PlainSprite", + "imagePath": "sling.png", + "centerXPos": + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : 0 + } + }, + { + "name": "slingHand", + "type" : "PlainSprite", + "imagePath": "hand_leather.png", + "centerXPos": + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + } + ] + }, + { + "name": "wellDoneBackground", + "imagePath": "well_done_pic.png", + "opacity" : 0, + "depth": 90, + "stretchMode" : "aspectFill", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "type" : "Label", + "name": "wellDoneLabel", + "text" : "Well done!", + "fontPath" : "fonts/ComicSansMSBold.ttf", + "baseFontSize" : 150, + "colour" : {"r" : 250, "g" : 250, "b": 250, "a" : 255}, + "opacity" : 0, + "depth": 91, + "anchorPoint" : + { + "x" : 0.5, + "y" : 0.5 + }, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 100 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 700 + } + }, + { + "loadObjectFromFile" : "horizontalButtonPanelBackFFPause.obl", + "name": "horizontalButtonPanel", + "depth" : 100, + "centerXPos" : + { + "type" : "relative", + "value" : "left", + "padding" : 20 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "top", + "padding" : -20 + } + }, + { + "name": "settingsButton", + "imagePath" : "graphics/button_setting.png", + "useAlternativePath": true, + "type" : "SimpleButton", + "depth" : 200, + "centerXPos" : + { + "type" : "relative", + "value" : "left", + "padding" : 20 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "top", + "padding" : -18 + } + } + ] + } + ] + } +} diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/tos_popup/accept_button.png b/ios/Runner/Wowgame/Resources/res/small/graphics/tos_popup/accept_button.png new file mode 100644 index 0000000..cc1c768 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/tos_popup/accept_button.png diff --git a/ios/Runner/Wowgame/Resources/res/small/graphics/tos_popup/accept_popup.png b/ios/Runner/Wowgame/Resources/res/small/graphics/tos_popup/accept_popup.png new file mode 100644 index 0000000..521c8a7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/small/graphics/tos_popup/accept_popup.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/app_links/app_link_halloween.png b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/app_link_halloween.png new file mode 100644 index 0000000..690fa9a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/app_link_halloween.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/app_links/app_link_toy.png b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/app_link_toy.png new file mode 100644 index 0000000..d58e450 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/app_link_toy.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/app_links/doll_toy_app.png b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/doll_toy_app.png new file mode 100644 index 0000000..9464cf7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/doll_toy_app.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/app_links/halo_icon.png b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/halo_icon.png new file mode 100644 index 0000000..d994ee6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/halo_icon.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/app_links/steve_maggie.png b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/steve_maggie.png new file mode 100644 index 0000000..bf59bd9 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/steve_maggie.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/app_links/witch_halloween_app.png b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/witch_halloween_app.png new file mode 100644 index 0000000..b769ec0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/app_links/witch_halloween_app.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_back.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_back.png new file mode 100644 index 0000000..a600165 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_back.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_go.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_go.png new file mode 100644 index 0000000..6c7b579 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_go.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_green.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_green.png new file mode 100644 index 0000000..9ad0fb5 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_green.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_grey.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_grey.png new file mode 100644 index 0000000..346364b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_grey.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_orange.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_orange.png new file mode 100644 index 0000000..c9abb91 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_orange.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_pause.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_pause.png new file mode 100644 index 0000000..033bbe1 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_pause.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_purple.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_purple.png new file mode 100644 index 0000000..99c4909 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_purple.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_red.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_red.png new file mode 100644 index 0000000..a91fb14 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_red.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_repeat.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_repeat.png new file mode 100644 index 0000000..2391654 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_repeat.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_setting.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_setting.png new file mode 100644 index 0000000..e4a64a0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_setting.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_sound_off.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_sound_off.png new file mode 100644 index 0000000..3b663da --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_sound_off.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_sound_on.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_sound_on.png new file mode 100644 index 0000000..e068cb5 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_sound_on.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_turquoise.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_turquoise.png new file mode 100644 index 0000000..9e5e4cf --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_turquoise.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_yellow.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_yellow.png new file mode 100644 index 0000000..84fc05f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/button_yellow.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/buttonff.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/buttonff.png new file mode 100644 index 0000000..7258ef6 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/buttonff.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/dark_green.png b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/dark_green.png new file mode 100644 index 0000000..0ddd356 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/graphics/dark_green.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/buttons/horizontalButtonPanelBackFFPause.obl b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/horizontalButtonPanelBackFFPause.obl new file mode 100644 index 0000000..5bb378d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/buttons/horizontalButtonPanelBackFFPause.obl @@ -0,0 +1,123 @@ +{ + "object": + { + "type" : "PlainNode", + "width" : 740, + "height" : 230, + "adjustContentSizeForSmallDevices" : true, + "depth" : 10, + "objects": + [ + { + "name" : "fastForwardButton", + "imagePath" : "graphics/button_green.png", + "useAlternativePath": true, + "type" : "SimpleButton", + "centerXPos" : + { + "type" : "relative", + "value" : "divide 6 place 3" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center" + }, + "objects": + [ + { + "name": "arrowsFF", + "imagePath": "graphics/buttonff.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + } + } + ] + }, + { + "name" : "replayButton", + "imagePath" : "graphics/button_yellow.png", + "useAlternativePath": true, + "type" : "SimpleButton", + "opacity" : 0, + "enabled" : false, + "centerXPos" : + { + "type" : "relative", + "value" : "divide 6 place 3" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center" + }, + "objects": + [ + { + "name": "arrowRepeat", + "imagePath": "graphics/button_repeat.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + } + } + ] + }, + { + "name" : "pauseButton", + "type" : "SimpleButton", + "imagePath" : "graphics/button_yellow.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "divide 6 place 5" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center" + }, + "objects": + [ + { + "name": "image", + "imagePath": "graphics/button_pause.png", + "useAlternativePath": true, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 0 + } + } + ] + } + ] + } +} diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_finger.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_finger.png new file mode 100644 index 0000000..5add97f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_finger.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_life_indicator_dead.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_life_indicator_dead.png new file mode 100755 index 0000000..118a12c --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_life_indicator_dead.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_life_indicator_ok.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_life_indicator_ok.png new file mode 100755 index 0000000..59aa93e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/g_life_indicator_ok.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/level_halo.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/level_halo.png new file mode 100755 index 0000000..907434d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/level_halo.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_1.png new file mode 100755 index 0000000..ea59758 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_2.png new file mode 100755 index 0000000..4e46e4b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_3.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_3.png new file mode 100755 index 0000000..85baf8b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/levels/level_3.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/background.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/background.png new file mode 100755 index 0000000..2cdc003 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/background.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_back1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_back1.png new file mode 100755 index 0000000..f04da03 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_back1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_back2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_back2.png new file mode 100755 index 0000000..883e523 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_back2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_front.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_front.png new file mode 100755 index 0000000..a55ee3a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/cart_front.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/clock.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/clock.png new file mode 100755 index 0000000..a176afe --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/clock.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/food_in_cart.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/food_in_cart.png new file mode 100755 index 0000000..5f2e9f9 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/food_in_cart.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/gum.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/gum.png new file mode 100755 index 0000000..74f6374 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/gum.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/hand_leather.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/hand_leather.png new file mode 100755 index 0000000..b95182c --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/hand_leather.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/hand_sling.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/hand_sling.png new file mode 100755 index 0000000..551bc41 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/hand_sling.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/apples.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/apples.png new file mode 100755 index 0000000..8b335a0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/apples.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/baguettes.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/baguettes.png new file mode 100755 index 0000000..9c68b2d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/baguettes.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/bananas.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/bananas.png new file mode 100755 index 0000000..2b5b0e2 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/bananas.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/cakes.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/cakes.png new file mode 100755 index 0000000..dbb61a5 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/cakes.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/chocolate.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/chocolate.png new file mode 100755 index 0000000..8a83a4f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/chocolate.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/cucumbers.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/cucumbers.png new file mode 100755 index 0000000..9d42f50 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/cucumbers.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/donuts.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/donuts.png new file mode 100755 index 0000000..103ab58 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/donuts.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/icecream.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/icecream.png new file mode 100755 index 0000000..343bd4b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/icecream.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/lettuce.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/lettuce.png new file mode 100755 index 0000000..c9575f8 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/lettuce.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/milk.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/milk.png new file mode 100755 index 0000000..728bf48 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/milk.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/orange.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/orange.png new file mode 100755 index 0000000..5105f07 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/orange.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/tomatoes.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/tomatoes.png new file mode 100755 index 0000000..4ee6215 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/shelf_food/tomatoes.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple1.png new file mode 100644 index 0000000..6c4a54d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple2.png new file mode 100644 index 0000000..e7e0b8d --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple_splodge.png new file mode 100755 index 0000000..f7ac77b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/apple_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/baguette.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/baguette.png new file mode 100755 index 0000000..22306f3 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/baguette.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana1.png new file mode 100755 index 0000000..a6a8670 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana2.png new file mode 100755 index 0000000..9641753 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana_splodge.png new file mode 100755 index 0000000..ca7d04b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/banana_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake1.png new file mode 100755 index 0000000..b2769d5 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake2.png new file mode 100755 index 0000000..6deeea8 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake_splodge.png new file mode 100755 index 0000000..41008d0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cake_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate1.png new file mode 100755 index 0000000..3193cbb --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate2.png new file mode 100755 index 0000000..38ab32a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate_splodge.png new file mode 100755 index 0000000..57e6d92 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/chocolate_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber1.png new file mode 100755 index 0000000..679288e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber2.png new file mode 100755 index 0000000..28822e7 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber_splodge.png new file mode 100755 index 0000000..b77dd8b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/cucumber_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut1.png new file mode 100755 index 0000000..d9f91a9 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut2.png new file mode 100755 index 0000000..1e999e3 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut_splodge.png new file mode 100755 index 0000000..3d5a791 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/donut_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream1.png new file mode 100644 index 0000000..e173fa4 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream2.png new file mode 100644 index 0000000..c2b1de0 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream_splodge.png new file mode 100755 index 0000000..f7ba6eb --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/icecream_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/lettuce.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/lettuce.png new file mode 100755 index 0000000..e7d9697 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/lettuce.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/milk.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/milk.png new file mode 100755 index 0000000..b2e19a9 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/milk.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/orange.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/orange.png new file mode 100755 index 0000000..105462a --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/orange.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato1.png new file mode 100644 index 0000000..45c9a63 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato2.png new file mode 100644 index 0000000..8be716b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato_splodge.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato_splodge.png new file mode 100755 index 0000000..dee207b --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/single_food/tomato_splodge.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/sling.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/sling.png new file mode 100755 index 0000000..eef7706 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/sling.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head1.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head1.png new file mode 100755 index 0000000..802761f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head1.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head2.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head2.png new file mode 100755 index 0000000..0e3e657 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head2.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head3.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head3.png new file mode 100755 index 0000000..e5c66ef --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head3.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head4.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head4.png new file mode 100755 index 0000000..9039229 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head4.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head5.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head5.png new file mode 100755 index 0000000..d99cb47 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/steve_head5.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/well_done_pic.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/well_done_pic.png new file mode 100644 index 0000000..37a0deb --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/well_done_pic.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/wooden_shelf.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/wooden_shelf.png new file mode 100755 index 0000000..63a858f --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/graphics/wooden_shelf.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/scene_layout.scl b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/scene_layout.scl new file mode 100644 index 0000000..3005886 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/shoot_game/scene_layout.scl @@ -0,0 +1,699 @@ +{ + "resFolder" : + { + "path":"graphics/shoot_game/graphics/", + "alternativePath":"buttons/", + "objectLayoutsPath" : "buttons/" + }, + "sceneLayout": + { + "layers": + [ + { + "name" : "backgroundLayer", + "objects": + [ + { + "name": "background", + "type" : "PlainSprite", + "imagePath" : "background.png", + "stretchMode" : "aspectFill", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + } + ] + }, + { + "name" : "objectLayer", + "objects": + [ + { + "name": "cartWhole", + "type" : "PlainNode", + "width" : 853, + "height" : 1032, + "depth" : 6, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "top" + }, + "objects" : + [ + { + "name": "cartBack", + "type" : "PlainSprite", + "imagePath" : "cart_back2.png", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "cartBack2", + "type" : "PlainSprite", + "imagePath" : "cart_back1.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "cartFood", + "type" : "PlainNode", + "width" : 853, + "height" : 1032, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "cartFront", + "type" : "PlainSprite", + "imagePath" : "cart_front.png", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "steveHeadHappy", + "type" : "PlainSprite", + "imagePath" : "steve_head1.png", + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadOhNo1", + "type" : "PlainSprite", + "imagePath" : "steve_head2.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadOhNo2", + "type" : "PlainSprite", + "imagePath" : "steve_head3.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadGrr", + "type" : "PlainSprite", + "imagePath" : "steve_head4.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + }, + { + "name": "steveHeadSad", + "type" : "PlainSprite", + "imagePath" : "steve_head5.png", + "opacity" : 0, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -34 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : -170 + } + } + ] + }, + + { + "name": "clock", + "type" : "PlainSprite", + "imagePath" : "clock.png", + "depth" : 9, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -100 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top" + }, + "objects": + [ + { + "type" : "Label", + "name": "clockLabel", + "text" : "3:00", + "fontPath" : "fonts/ComicSansMSRegular.ttf", + "baseFontSize" : 120, + "colour" : {"r" : 180, "g" : 180, "b": 180, "a" : 255}, + "scaleUpForSmallDevices" : false, + "anchorPoint" : + { + "x" : 0.5, + "y" : 0.5 + }, + "centerXPos" : + { + "type" : "relative", + "value" : "center" + }, + "centerYPos" : + { + "type" : "relative", + "value" : "bottom", + "padding" : 10 + } + } + ] + }, + { + "name": "shelfWhole", + "type" : "PlainNode", + "width" : 5930, + "height" : 519, + "depth" : 7, + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding":-30 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding":-40 + }, + "objects" : + [ + { + "name": "shelf", + "type" : "RepeatSprite", + "imagePath" : "wooden_shelf.png", + "width" : 5930, + "height" : 519, + "centerXPos": + { + "type" : "relative", + "value" : "left" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "name": "apples", + "type" : "PlainSprite", + "imagePath" : "shelf_food/apples.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 0 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "baguettes", + "type" : "PlainSprite", + "imagePath" : "shelf_food/baguettes.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 500 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "bananas", + "type" : "PlainSprite", + "imagePath" : "shelf_food/bananas.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 1000 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "cakes", + "type" : "PlainSprite", + "imagePath" : "shelf_food/cakes.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 1450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -0 + } + }, + { + "name": "chocolate", + "type" : "PlainSprite", + "imagePath" : "shelf_food/chocolate.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 1940 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 10 + } + }, + { + "name": "cucumbers", + "type" : "PlainSprite", + "imagePath" : "shelf_food/cucumbers.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 2450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -30 + } + }, + { + "name": "donuts", + "type" : "PlainSprite", + "imagePath" : "shelf_food/donuts.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 2950 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "icecream", + "type" : "PlainSprite", + "imagePath" : "shelf_food/icecream.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 3450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "lettuce", + "type" : "PlainSprite", + "imagePath" : "shelf_food/lettuce.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 3930 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "milk", + "type" : "PlainSprite", + "imagePath" : "shelf_food/milk.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 4480 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "oranges", + "type" : "PlainSprite", + "imagePath" : "shelf_food/orange.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 4940 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + }, + { + "name": "tomatoes", + "type" : "PlainSprite", + "imagePath" : "shelf_food/tomatoes.png", + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 5450 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + } + ] + }, + { + "name": "slingStick", + "type" : "PlainSprite", + "imagePath": "hand_sling.png", + "depth" : 8, + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom" + }, + "objects" : + [ + { + "name": "slingGumLeft", + "type" : "PlainSprite", + "imagePath": "gum.png", + "anchorPoint" : { + "x" : 0.5, + "y" : 1 + }, + "centerXPos": + { + "type" : "relative", + "value" : "left", + "padding" : 84 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : 40 + } + }, + { + "name": "slingGumRight", + "type" : "PlainSprite", + "imagePath": "gum.png", + "anchorPoint" : { + "x" : 0.5, + "y" : 1 + }, + "centerXPos": + { + "type" : "relative", + "value" : "right", + "padding" : -32 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : 36 + } + } + ] + }, + { + "name": "slingHandWhole", + "type" : "PlainNode", + "width" : 207, + "height" : 1180, + "depth" : 9, + "centerXPos": + { + "type" : "relative", + "value" : "center", + "padding" : 30 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : -390 + }, + "objects": + [ + { + "name": "sling", + "type" : "PlainSprite", + "imagePath": "sling.png", + "centerXPos": + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos": + { + "type" : "relative", + "value" : "top", + "padding" : 0 + } + }, + { + "name": "slingHand", + "type" : "PlainSprite", + "imagePath": "hand_leather.png", + "centerXPos": + { + "type" : "relative", + "value" : "center", + "padding" : 0 + }, + "centerYPos": + { + "type" : "relative", + "value" : "bottom", + "padding" : 0 + } + } + ] + }, + { + "name": "wellDoneBackground", + "imagePath": "well_done_pic.png", + "opacity" : 0, + "depth": 90, + "stretchMode" : "aspectFill", + "centerXPos": + { + "type" : "relative", + "value" : "center" + }, + "centerYPos": + { + "type" : "relative", + "value" : "center" + } + }, + { + "type" : "Label", + "name": "wellDoneLabel", + "text" : "Well done!", + "fontPath" : "fonts/ComicSansMSBold.ttf", + "baseFontSize" : 150, + "colour" : {"r" : 250, "g" : 250, "b": 250, "a" : 255}, + "opacity" : 0, + "depth": 91, + "anchorPoint" : + { + "x" : 0.5, + "y" : 0.5 + }, + "centerXPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 100 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "center", + "padding" : 700 + } + }, + { + "loadObjectFromFile" : "horizontalButtonPanelBackFFPause.obl", + "name": "horizontalButtonPanel", + "depth" : 100, + "centerXPos" : + { + "type" : "relative", + "value" : "left", + "padding" : 20 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "top", + "padding" : -20 + } + }, + { + "name": "settingsButton", + "imagePath" : "graphics/button_setting.png", + "useAlternativePath": true, + "type" : "SimpleButton", + "depth" : 200, + "centerXPos" : + { + "type" : "relative", + "value" : "left", + "padding" : 20 + }, + "centerYPos" : + { + "type" : "relative", + "value" : "top", + "padding" : -20 + } + } + ] + } + ] + } +} diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/tos_popup/accept_button.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/tos_popup/accept_button.png new file mode 100644 index 0000000..7eab66e --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/tos_popup/accept_button.png diff --git a/ios/Runner/Wowgame/Resources/res/xlarge/graphics/tos_popup/accept_popup.png b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/tos_popup/accept_popup.png new file mode 100644 index 0000000..84bb3e4 --- /dev/null +++ b/ios/Runner/Wowgame/Resources/res/xlarge/graphics/tos_popup/accept_popup.png