dofile('Data/Scripts/Common/Utils/Bind.lua')
dofile('Data/Scripts/Common/Utils/Constants.lua')
dofile('Data/Scripts/Common/Utils/ConditionsChecker.lua')
dofile('Data/Scripts/Common/Utils/Timer.lua')
dofile('Data/Scripts/Common/Utils/GameState.lua')
dofile('Data/Scripts/Common/Utils/Utilities.lua')
dofile('Data/Scripts/Common/Utils/ScreenManager.lua')
dofile('Data/Scripts/Common/Utils/ReferenceCounter.lua')
dofile('Data/Scripts/Common/Utils/Persistence.lua')
dofile('Data/Scripts/Common/Utils/TreeNodeBase.lua')

dofile('Data/Scripts/Common/Utils/Counter/Counter.lua')
dofile('Data/Scripts/Common/Utils/Counter/ListenedCounter.lua')
dofile('Data/Scripts/Common/Utils/Signals/LuaSignal.lua')
dofile('Data/Scripts/Common/Utils/Signals/LuaConnection.lua')
dofile('Data/Scripts/Common/Utils/Drag/DragObjectBase.lua')
dofile('Data/Scripts/Common/Utils/Drag/DragObject.lua')
dofile('Data/Scripts/Common/Utils/Drag/DragObjectManager.lua')

dofile('Data/Scripts/Common/Utils/MusicManager.lua')
dofile('Data/Scripts/Common/Utils/ScoreManagerBase.lua')

dofile('Data/Scripts/Common/Utils/Helpers/Helpers.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersDebug.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersHiddenObject.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersLevel.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersScreen.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersEffect.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersPlayMode.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersSound.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersVideo.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersVector2f.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersXML.lua')
dofile('Data/Scripts/Common/Utils/Helpers/HelpersExtraContent.lua')

dofile('Data/Scripts/Common/Achievments/AchievmentsManager.lua')
dofile('Data/Scripts/Common/Achievments/Achievment.lua')

dofile('Data/Scripts/Common/Screens/Node.lua')
dofile('Data/Scripts/Common/Screens/BaseScreen.lua')
dofile('Data/Scripts/Common/Screens/Note.lua')

dofile('Data/Scripts/Common/HOLogic/HiddenBaseLogic.lua')
dofile('Data/Scripts/Common/HOLogic/HiddenObjectLogic.lua')
dofile('Data/Scripts/Common/HOLogic/HiddenPictureLogic.lua')

dofile('Data/Scripts/Common/Screens/ZoomZoneBase.lua')
dofile('Data/Scripts/Common/Game/Playfield/AlternativeHOZoomBase.lua')
dofile('Data/Scripts/Common/Comics/Comics.lua')

dofile('Data/Scripts/Common/Tools/CollectionTools.lua')
dofile('Data/Scripts/Common/Tools/GlobalToolTarget.lua')

dofile('Data/Scripts/Common/Editor.lua')

dofile('Data/Scripts/Common/Hint/AutoPlayer.lua')
dofile('Data/Scripts/Common/IngameEditor/IngameEditor.lua')
dofile('Data/Scripts/Common/ResourceManager/ResourceManager.lua')

--if IS_COLLECTORS_EDITION then
	dofile('Data/Scripts/Common/Screens/Extra/Pages/Base/ExtraPageBase.lua')
	dofile('Data/Scripts/Common/Screens/Extra/Pages/Base/ExtraCollectionPageBase.lua')
	dofile('Data/Scripts/Common/Screens/Extra/Pages/Base/ExtraReplayPageBase.lua')
	dofile('Data/Scripts/Common/Screens/Extra/ExtraScreenBase.lua')
--end

Application.onScreenModeChange:add(	function()
										ProfilesManager:save()

										local top_screen = PopUpScreensMgr:GetTop()
										if top_screen.onScreenModeChange then
										    top_screen:onScreenModeChange()
										end
									end)

function initCommonGame()
	local splashScreens = Application:getApplicationDescriptor().splashScreens
	
	if splashScreens:size() > 0 then
        local start_str = ''
        local end_str = ''
        for i = 0, splashScreens:size() - 1 do
            local splash = splashScreens:get(i)
            
            if resourceExists(splash) then
                start_str = start_str..'createSplashScreen(\''..splash..'\', function() '
                end_str = end_str..' end)'
            end
        end
        
        start_str = start_str..'createBigFishGamesScreen()'..end_str
        loadstring(start_str)()
	else
	    createBigFishGamesScreen()
	end
end

