From 721018c64a68642985205f08ed423b33889f39c4 Mon Sep 17 00:00:00 2001 From: Deve Date: Sat, 2 Nov 2024 10:02:55 +0100 Subject: [PATCH] Try disable tutorial on android TV to make google happy --- src/modes/overworld.cpp | 9 +++++++++ src/states_screens/help/help_screen_1.cpp | 20 ++++++++++++++++++++ src/states_screens/help/help_screen_1.hpp | 3 +++ src/states_screens/main_menu_screen.cpp | 19 +++++++++++++++++++ src/states_screens/race_gui_overworld.cpp | 10 ++++++++++ 5 files changed, 61 insertions(+) diff --git a/src/modes/overworld.cpp b/src/modes/overworld.cpp index 1f060ecbf69..0fed626666e 100644 --- a/src/modes/overworld.cpp +++ b/src/modes/overworld.cpp @@ -38,6 +38,10 @@ #include "tracks/track.hpp" #include "tracks/track_object_manager.hpp" +#ifdef ANDROID +#include +#endif + //----------------------------------------------------------------------------- OverWorld::OverWorld() : World() { @@ -242,6 +246,11 @@ void OverWorld::onFirePressed(Controller* who) { if (challenges[n].m_challenge_id == "tutorial") { +#ifdef ANDROID + if (SDL_IsAndroidTV()) + return; +#endif + scheduleTutorial(); return; } diff --git a/src/states_screens/help/help_screen_1.cpp b/src/states_screens/help/help_screen_1.cpp index bb6c6d5ba75..eda76f31db2 100644 --- a/src/states_screens/help/help_screen_1.cpp +++ b/src/states_screens/help/help_screen_1.cpp @@ -21,6 +21,10 @@ #include "guiengine/widgets/button_widget.hpp" #include "modes/tutorial_utils.hpp" +#ifdef ANDROID +#include +#endif + using namespace GUIEngine; // ----------------------------------------------------------------------------- @@ -37,6 +41,22 @@ void HelpScreen1::loadedFromFile() // ----------------------------------------------------------------------------- +void HelpScreen1::beforeAddingWidget() +{ +#ifdef ANDROID + if (SDL_IsAndroidTV()) + { + Widget* tutorial = getWidget("startTutorial"); + if (tutorial) + tutorial->setVisible(false); + + Widget* tutorial_icon = getWidget("tutorialIcon"); + if (tutorial_icon) + tutorial_icon->setVisible(false); + } +#endif +} + void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const int playerID) { if (name == "startTutorial") diff --git a/src/states_screens/help/help_screen_1.hpp b/src/states_screens/help/help_screen_1.hpp index e517f721c73..2676718e49e 100644 --- a/src/states_screens/help/help_screen_1.hpp +++ b/src/states_screens/help/help_screen_1.hpp @@ -35,6 +35,9 @@ class HelpScreen1 : public GUIEngine::Screen, public GUIEngine::ScreenSingleton< /** \brief implement callback from parent class GUIEngine::Screen */ virtual void loadedFromFile() OVERRIDE; + + /** \brief implement callback from parent class GUIEngine::Screen */ + virtual void beforeAddingWidget() OVERRIDE; /** \brief implement callback from parent class GUIEngine::Screen */ virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index bb35a2d8d4d..ccd4a461383 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -72,6 +72,10 @@ #include +#ifdef ANDROID +#include +#endif + using namespace GUIEngine; using namespace Online; @@ -119,6 +123,15 @@ void MainMenuScreen::beforeAddingWidget() if (w) w->setVisible(false); #endif + +#ifdef ANDROID + if (SDL_IsAndroidTV()) + { + Widget* tutorial = getWidget("startTutorial"); + if (tutorial) + tutorial->setVisible(false); + } +#endif } // ---------------------------------------------------------------------------- @@ -327,6 +340,12 @@ void MainMenuScreen::onUpdate(float delta) if (player->getUseFrequency() != 0) return; +#ifdef ANDROID + // Don't show tutorial dialog on Android TV + if (SDL_IsAndroidTV()) + return; +#endif + player->incrementUseFrequency(); class PlayTutorial : public MessageDialog::IConfirmDialogListener diff --git a/src/states_screens/race_gui_overworld.cpp b/src/states_screens/race_gui_overworld.cpp index a82c5dd95fa..f72d6a39635 100644 --- a/src/states_screens/race_gui_overworld.cpp +++ b/src/states_screens/race_gui_overworld.cpp @@ -58,6 +58,11 @@ #include #include #include + +#ifdef ANDROID +#include +#endif + using namespace irr; #include @@ -526,6 +531,11 @@ void RaceGUIOverworld::drawGlobalMiniMap() if (challenges[n].m_challenge_id == "tutorial") { +#ifdef ANDROID + if (SDL_IsAndroidTV()) + continue; +#endif + gui::ScalableFont* font = GUIEngine::getTitleFont(); font->draw(_("Tutorial"), pos, video::SColor(255,255,255,255), false, true /* vcenter */, NULL);