GameScreen.textures_path = "graphics/screens/24_fish/location/"

function GameScreen:RestoreScreen()
    ------------------------------------------------------------------------------------------------------------------------------ 
    --Первая загрузка екрана
    ------------------------------------------------------------------------------------------------------------------------------ 
    if(GetState(CURRENT_SCREEN, "ho") == "") then
        --стартовый диалог
        clScreenManager:add_screen("hud")   
        ItemSetOpacity(HUDScreen.name, 0.0)
    
        --local tip_end = function()
            
            ItemChangeOpacity(HUDScreen.name, 1.0, 0.5)
            DelayedExec(1.0, function()
                SetState(CURRENT_SCREEN, "ho", "active")
                self:StartHO();
            end, 113)
        --end
        HUDScreen:ShowTips({path = self.textures_path.."Text_24", x = 567, y = 1128, end_fun = tip_end})
    end
    ------------------------------------------------------------------------------------------------------------------------------ 
    --ХО
    ------------------------------------------------------------------------------------------------------------------------------ 
    if(GetState(CURRENT_SCREEN, "ho") == "active") then
        self:StartHO();
    end
    ------------------------------------------------------------------------------------------------------------------------------ 
    --после ХО
    ------------------------------------------------------------------------------------------------------------------------------ 
    if(GetState(CURRENT_SCREEN, "ho") == "completed") then
        clApplication:LoadLocation("025_utility")
    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("metal_dish", "sound/metal_pot_24.ogg");
    self:SetItemSound("yellow_pot", "sound/ceramic_pot_01.ogg");
    self:SetItemSound("big_black_pot", "sound/big_black_pot.ogg");
    self:SetItemSound("basin", "sound/metal_basin.ogg");
    self:SetItemSound("plate_02", "sound/plate_hit_02.ogg");
    self:SetItemSound("plate_01", "sound/plate_hit_01.ogg");
          
    MusicPlay({"sound/ambient/22_24_26_ambient.ogg", "sound/music/past.ogg"} , 24) 
    
    self:AddHiddenCrystal("crystal_24_part")
    
    
    self:RestoreScreen()
end

function GameScreen:StartHO()    
    self.item_list = {
        {obj = {"fish", {x = 598, y = 908}}},
        {obj = {"avocado", {x = 1440, y = 952}}},
        {obj = {"mussels", {x = 321, y = 839}}, },
        {obj = {"squash", {x = 1203, y = 768}}, },
        {obj = {"garlic", {x = 47, y = 275}}, },
        {obj = {"tomato", {x = 170, y = 647}}, },
        {obj = {"eggplant", {x = 1376, y = 677}}, },
        {obj = {"chili_01", {x = 817, y = 263}}, },
        {obj = {"chili_02", {x = 1236, y = 924}}, },
        {obj = {"chili_03", {x = 792, y = 1048}}, },
        {obj = {"beans", {x = 418, y = 647}}, },
        {obj = {"lemon", {x = 1351, y = 69}}, },
        {obj = {"olives", {x = 912, y = 750}}, },
        {obj = {"pumpkin", {x = 285, y = 1011}}, hint = {x = 285, y = 1081}},
     }
     
    
    local on_finish = function()
        HUDScreen:SetInvntoryOnlyMode()
        SetState(CURRENT_SCREEN, "ho", "completed");
        self.mini_game = nil;
        local tip_end = function()
            DelayedExec(1.0, function()
                clApplication:LoadLocation("025_utility")
            end, 113)
        end
        DelayedExec(1.0, function()
            HUDScreen:ShowTips({path = self.textures_path.."Text_24a", x = 320, y = 1113, end_fun = tip_end})
        end, 113)
    end
       
    clScreenManager:add_screen("hud")                  
    self:SetMiniGame(mgt_hidden_object)
    self.mini_game.list_type = 2;   
    self.mini_game:Init(self.item_list, on_finish);
end

------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "24_fish", "graphics/screens/24_fish/location/24_fish", 0, 0);
    
    self:CreateObj(OBJ_TYPE.TRIGGER, "metal_dish", "graphics/screens/24_fish/location/metal_dish", 272, 709);
    self:CreateObj(OBJ_TYPE.TRIGGER, "yellow_pot", "graphics/screens/24_fish/location/yellow_pot", 1410, 782);
    self:CreateObj(OBJ_TYPE.TRIGGER, "big_black_pot", "graphics/screens/24_fish/location/big_black_pot", 1097, 478);
    self:CreateObj(OBJ_TYPE.TRIGGER, "basin", "graphics/screens/24_fish/location/basin", 679, 653);
    self:CreateObj(OBJ_TYPE.TRIGGER, "plate_02", "graphics/screens/24_fish/location/plate_02", 35, 581);
    self:CreateObj(OBJ_TYPE.TRIGGER, "plate_01", "graphics/screens/24_fish/location/plate_01", 40, 495);

    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "avocado", "graphics/screens/24_fish/location/avocado_part", 1465, 985);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "lemon", "graphics/screens/24_fish/location/lemon_part", 1381, 81);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "olives", "graphics/screens/24_fish/location/olives_part", 939, 773);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "pumpkin", "graphics/screens/24_fish/location/pumpkin_part", 301, 1064);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "chili_01", "graphics/screens/24_fish/location/chili_01_part", 833, 292);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "chili_02", "graphics/screens/24_fish/location/chili_02_part", 1278, 952);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "chili_03", "graphics/screens/24_fish/location/chili_03_part", 851, 1081);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "eggplant", "graphics/screens/24_fish/location/eggplant_part", 1423, 705);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "tomato", "graphics/screens/24_fish/location/tomato_part", 191, 668);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "garlic", "graphics/screens/24_fish/location/garlic_part", 34, 287);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "fish", "graphics/screens/24_fish/location/fish_part", 676, 928);  
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "fish_shadow", "graphics/screens/24_fish/location/fish_shadow", 670, 884); 
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "squash", "graphics/screens/24_fish/location/squash_part", 1251, 824);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "mussels", "graphics/screens/24_fish/location/mussels_part", 378, 873);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "beans", "graphics/screens/24_fish/location/beans_part", 449, 693);

       
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_24_part", "graphics/screens/24_fish/location/crystal_24_part", 964, 691);
end