
LoadResource("fonts.xml")

LoadResource("HelpResources.xml")

LoadResource("HousePlanResources.xml")
LoadResource("MenuResource.xml")
LoadResource("MoviePlayerResources.xml")
LoadResource("ISpyAvatarResources.xml")
LoadResource("ISpyFieldResources.xml")

GUI:LoadText("new_text.xml", "Russian", 0)

LoadResource("Slot_Resource.xml")
LoadResource("Pers_Resource.xml")
LoadResource("LP_Resource.xml")
LoadResource("Second_Person_Resource.xml")
LoadResource("GUI_Resource.xml")
LoadResource("CreditsResource.xml")
LoadResource("Textures\\LoadScreen\\LoadWinget\\LoadScreen.xml")

LoadResource("ISpySound.xml")
LoadResource("Music.xml")
LoadResource("NewSound.xml")
Sound:LoadGardenSounds("GardenSounds.xml")

LoadAllEffects()
--[[
LoadEffects("ISpyEffects2.xml")
LoadEffects("ISpyEffects.xml")
LoadEffects("CustomerHeart.xml")
LoadEffects("Lantern.xml")
LoadEffects("BuildEffects.xml")
LoadEffects("CoinEffect.xml")
LoadEffects("Fountans.xml")
LoadEffects("Fontan1.xml")
LoadEffects("Bird.xml")
LoadEffects("LP_Effects.xml")
LoadEffects("DropPart.xml")
LoadEffects("DogSleep.xml")
LoadEffects("StartButton.xml")
LoadEffects("GardenEff.xml")
LoadEffects("effects\\LocationsEffects.xml")
LoadEffects("GardenEndGame.xml")
]]
SaveAllEffects()

local sndVolume = gameInfo:getSoundVolume()
local musVolume = gameInfo:getMusicVolume()
local envVolume = gameInfo:getEnvVolume()

Sound:SetSoundVolume(sndVolume)
Sound:SetMusicVolume(musVolume)
Sound:SetEnvVolume(envVolume)

gameInfo:setLocalString("NameLetter", "")
gameInfo:setLocalString("TalkHistoryISpyText", "");

GUI:LoadLayers("Credits_GUI.xml")
GUI:LoadLayers("Garden_GUI.xml")
GUI:LoadLayers("Shop_GUI.xml")
GUI:LoadLayers("Cross_GUI.xml")
GUI:LoadLayers("Tutorial_GUI.xml")
GUI:LoadLayers("MenuInGame_GUI.xml")
GUI:LoadLayers("MoviePlayer_GUI.xml")

GUI:LoadLayers("Help.xml")

GUI:LoadLayers("ISpyField_GUI.xml")

if not gameInfo:NoPlayers() then
	local namesWidget = GUI:getLayer("Profiles"):getWidget("Names")
	local numOfPlayers = gameInfo:getNumberOfPlayers()-1
	for i = 0, numOfPlayers do
		local playerName = gameInfo:getPlayerName(i)
		namesWidget:AcceptMessage(Message("Add", playerName))
	end
	namesWidget:AcceptMessage(Message("Set", gameInfo:getName()))
else
	--сразу же загрузить стартовый мультик, чтобы переход от экрана загрузки в стартовый мультик был плавный
    Screen:pushLayer( GUI:getLayer("MoviePlayer"))
    MoviePlayerPlay("start")
	GUI:getLayer("MoviePlayer"):getWidget("MoviePlayerWidget"):AcceptMessage(Message("Pause"))
end

--UploadResourceGroup("Garden1Iter")
UploadGardenResource()
GUI:LoadLayers("LoadScreen.xml")
Screen:pushLayer( GUI:getLayer("LoadScreen") )
GUI:getLayer("LoadScreen"):getWidget("LoadScreen"):AcceptMessage(Message("SetMode", "2"))

--курсор
lastCustomCursor = gameInfo:isCustomCursor()
GUI:getLayer("Options"):getWidget("CustomCursor"):AcceptMessage(Message("SetState", tostring(lastCustomCursor))) -- checkbox на слое Options
SetCustomCursor(lastCustomCursor) -- приложение

--для панели скринсейвера
local iBoolean = "0"
if gameInfo:enableScreenSaver() then
	iBoolean = "1"
end
GUI:getLayer("ScreenSaverOptions"):getWidget("EnableScreensaver"):AcceptMessage(Message("SetState", iBoolean))

iBoolean = "0"
if gameInfo:isRainInScreenSaver() then
	iBoolean = "1"
end
GUI:getLayer("ScreenSaverOptions"):getWidget("IsRainSS"):AcceptMessage(Message("SetState", iBoolean))

GUI:getLayer("ScreenSaverOptions"):getWidget("ScreenSaverMusic"):AcceptMessage(Message("SetPos", tostring(gameInfo:getMusicVolumeInScreenSaver())))
GUI:getLayer("ScreenSaverOptions"):getWidget("ScreenSaverSound"):AcceptMessage(Message("SetPos", tostring(gameInfo:getSoundVolumeInScreenSaver())))
GUI:getLayer("ScreenSaverOptions"):getWidget("ScreenSaverEnv"):AcceptMessage(Message("SetPos", tostring(gameInfo:getEnvVolumeInScreenSaver())))
GUI:getLayer("ScreenSaverOptions"):getWidget("RainStrenghtSlider"):AcceptMessage(Message("SetPos", tostring(gameInfo:getRainStrenghtSS())))