GameScreen.textures_path = "graphics/screens/30_orchard/location/"

function GameScreen:RestoreScreen()
    ------------------------------------------------------------------------------------------------------------------------------ 
    --Первая загрузка екрана
    ------------------------------------------------------------------------------------------------------------------------------ 
    if(GetState(CURRENT_SCREEN, "state") == "") then
    
        --local _end_fun = function()
            SetState(CURRENT_SCREEN, "state", "ho")
            DelayedExec(1.0, function()
                self:StartHO();
            end, 113)
        --end
        HUDScreen:ShowTips({path = "graphics/screens/30_orchard/location/Text_30", x = 314, y = 1112, end_fun = _end_fun})
    elseif(GetState(CURRENT_SCREEN, "state") == "ho")then
        self:StartHO();
    elseif(GetState(CURRENT_SCREEN, "state") == "finish")then
        SetState("screen_019_house", "state", "wizard2")
        clApplication:LoadLocation("019_house")
    end
  
    
    for found_item in string.gmatch(GetState(CURRENT_SCREEN, "found_obj"), "[_%a%d]+") do
		ItemRemove(self.name, found_item)
		ItemRemove(self.name, found_item.."_shadow")
    end 
end

function GameScreen:InitScreen()
    self:LoadScreen()
   
    ------------------------------------------------------------------------------------------------------------------------------ 
    --OTHER       
    self:SetItemSound("woodpecker", "sound/woodpecker.ogg");
    self:SetItemSound("bird", {"sound/bird_01.ogg", "sound/bird_02.ogg"});
    self:SetItemSound("wheelbarrow", {"sound/wood_creak_01.ogg", "sound/wood_creak_02.ogg"});
    self:SetItemSound("watering_can", "sound/ward_can.ogg");
    self:SetItemSound("water", "sound/creek_splash.ogg");
    self:SetItemSound("bees", {"sound/bee_01.ogg", "sound/bee_02.ogg"});
  
    
    MusicPlay({"sound/music/past_garden.ogg", "sound/ambient/21_ambient.ogg"} , 30) 
    
    self:AddHiddenCrystal("crystal_30_part")
    
    self:RestoreScreen()
end

    
function GameScreen:StartHO()    
    self.item_list = {
        {obj = {"hare", {x = 867, y = 428}}},
        {obj = {"fungus", {x = 1291, y = 434}}},
        {obj = {"caterpillar", {x = 825, y = 12}}, hint = {x = 819, y = 6}},
        {obj = {"lizard", {x = 418, y = 317}}, },
        {obj = {"frog", {x = 408, y = 814}}, },
        {obj = {"snail", {x = 673, y = 527}}, },
        {obj = {"vole", {x = 520, y = 937}}, },
        {obj = {"mole_cricket", {x = 592, y = 1093}}, },
        {obj = {"hamster", {x = 657, y = 809}}, }, 
        {obj = {"beetle", {x = 1299, y = 59}}, },
        {obj = {"mole", {x = 1084, y = 914}}, },
        {obj = {"vespiary", {x = 144, y = 184}},  },
     }
    
    local on_finish = function()
        SetState(CURRENT_SCREEN, "state", "finish");
        self.mini_game = nil;

        DelayedExec(1.0, function()
            local comics_finish = function()
                DelayedExec(1.0, function()
                    SetState("screen_020_wizard", "state", "after_30")
                    SetState("screen_019_house", "state", "wizard2")
                    clApplication:LoadLocation("019_house")
                end, 113)
            end
            local comics = clScreenManager:add_screen("030_gardener_dlg") 	
            comics.on_finish = comics_finish;
        end, 113)
    end       
                    
    self:SetMiniGame(mgt_hidden_object)   
    self.mini_game:Init(self.item_list, on_finish);
end
------------------------------------------------------------------------------------------------------
-------------------------------------------Mouse functions--------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "30_orchard", "graphics/screens/30_orchard/location/30_orchard", 0, 0);
    
    self:CreateObj(OBJ_TYPE.TRIGGER, "woodpecker", "graphics/screens/30_orchard/location/woodpecker", 1505, 241);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bird", "graphics/screens/30_orchard/location/bird", 678, 295);
    self:CreateObj(OBJ_TYPE.TRIGGER, "wheelbarrow", "graphics/screens/30_orchard/location/wheelbarrow", 770, 593);
    self:CreateObj(OBJ_TYPE.TRIGGER, "watering_can", "graphics/screens/30_orchard/location/watering_can", 548, 726);
    self:CreateObj(OBJ_TYPE.TRIGGER, "water", "graphics/screens/30_orchard/location/water", 366, 847);
    self:CreateObj(OBJ_TYPE.TRIGGER, "bees", "graphics/screens/30_orchard/location/bees", 74, 625);
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hare", "graphics/screens/30_orchard/location/hare_part", 916, 652);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "fungus_shadow", "graphics/screens/30_orchard/location/fungus_shadow", 1387, 491);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "fungus", "graphics/screens/30_orchard/location/fungus_part", 1315, 459);   
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "caterpillar", "graphics/screens/30_orchard/location/caterpillar_part", 847, 22);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lizard", "graphics/screens/30_orchard/location/lizard_part", 470, 329);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "frog", "graphics/screens/30_orchard/location/frog_part", 435, 830);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "snail", "graphics/screens/30_orchard/location/snail_part", 747, 518);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "vole", "graphics/screens/30_orchard/location/vole_part", 558, 961);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "mole_cricket", "graphics/screens/30_orchard/location/mole_cricket_part", 650, 1122);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "hamster", "graphics/screens/30_orchard/location/hamster_part", 717, 828);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "beetle", "graphics/screens/30_orchard/location/beetle_part", 1355, 127);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "mole", "graphics/screens/30_orchard/location/mole_part", 1088, 917);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "vespiary_shadow", "graphics/screens/30_orchard/location/vespiary_shadow", 150, 169);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "vespiary", "graphics/screens/30_orchard/location/vespiary_part", 179, 210);
    
    
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_30_part", "graphics/screens/30_orchard/location/crystal_30_part", 1245, 1078);

    clScreenManager:add_screen("hud") 
end