GameScreen.textures_path = "graphics/screens/15_white/location/"


function GameScreen:RestoreScene()
        if(GetState(CURRENT_SCREEN, "state") == "") then
        local ho_end = function()
            SetState(CURRENT_SCREEN, "state", "finish")
            DelayedExec(2.0, function()
                clApplication:LoadLocation("015_sport")
            end, 113) 
        end
        
        local start_ho = function()
        end
        HUDScreen:ShowHintText({path = self.textures_path.."Hint_15", x = 319, y = 898, end_fun = start_ho, bar_pos = {303, 886}})
        
        self:SetMiniGame(mgt_find_and_apply2)
        mgt_find_and_apply2:SetSuccessSound("sound/interface/found.ogg")
        mgt_find_and_apply2:SetFailSound("sound/interface/wrong.ogg")
        self.mini_game:Init(self.item_list, ho_end, true);

    elseif(GetState(CURRENT_SCREEN, "state") == "finish") then
        clApplication:LoadLocation("015_sport")
    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.."_outline")
    end 
end

function GameScreen:InitScreen()
    self:LoadScreen()

    self.item_list = {
        {obj = {"paddle", {x = 602, y = 20}}, finish_pos = {x = 602, y = 20}},
        {obj = {"kettle", {x = 1217, y = 737}}, finish_pos = {x = 1217, y = 737}},
        {obj = {"fryer", {x = 725, y = 249}}, finish_pos = {x = 725, y = 249}},
        {obj = {"mallet", {x = 314, y = 83}}, finish_pos = {x = 314, y = 83}},
        {obj = {"spoon", {x = 863, y = 473}}, finish_pos = {x = 863, y = 473}},
        {obj = {"whisk", {x = 696, y = 571}}, finish_pos = {x = 696, y = 571}},
        {obj = {"strainer", {x = 595, y = 419}}, finish_pos = {x = 595, y = 419}},
        {obj = {"corkscrew", {x = 412, y = 537}}, finish_pos = {x = 412, y = 537}},
        {obj = {"blender", {x = 243, y = 392}}, finish_pos = {x = 243, y = 392}},
        {obj = {"sieve", {x = 6, y = 439}}, finish_pos = {x = 6, y = 439}},
        {obj = {"decanter", {x = 654, y = 659}}, finish_pos = {x = 654, y = 659}},
        {obj = {"wineglass", {x = 1438, y = 809}}, finish_pos = {x = 1438, y = 809}},
    }
    
    self:RestoreScene();
    
    self:AddHiddenCrystal("crystal_15_part")
    
    MusicPlay({"sound/ambient/15_25_29_ambient.ogg", "sound/music/surreal.ogg"}, 15) 
end
------------------------------------------------------------------------------------------------------
function GameScreen:onObjectClick(item_name)
 
end
------------------------------------------------------------------------------------------------------
function GameScreen:Update()
    if(clApplication.game_pause) then return end
    
    if(self.drag_light) then
        ItemSetPosition(self.drag_light, messenger_table.mouse_X  - 256, messenger_table.mouse_Y - 256);
    end
    
    if(self.mini_game and self.mini_game.Update) then
        self.mini_game:Update()
    end
end
------------------------------------------------------------------------------------------------------
-------------------------------------------Mouse functions--------------------------------------------
------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------
function GameScreen:LoadScreen()
	--[[---Background---]]--
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "15_white", "graphics/screens/15_white/location/15_white", 0, 0);
	
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "crystal_15_part", "graphics/screens/15_white/location/crystal_15_part", 1150, 889);
	
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "paddle", "graphics/screens/15_white/location/paddle_part", 689, 28);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "kettle", "graphics/screens/15_white/location/kettle_part", 1228, 745);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "fryer", "graphics/screens/15_white/location/fryer_part", 730, 216);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "mallet", "graphics/screens/15_white/location/mallet_part", 365, 93);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "spoon", "graphics/screens/15_white/location/spoon_part", 928, 474);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "whisk", "graphics/screens/15_white/location/whisk_part", 697, 570);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "strainer", "graphics/screens/15_white/location/strainer_part", 615, 475);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "corkscrew", "graphics/screens/15_white/location/corkscrew_part", 453, 545);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "blender", "graphics/screens/15_white/location/blender_part", 222, 379);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "sieve", "graphics/screens/15_white/location/sieve_part", 3, 488);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "decanter", "graphics/screens/15_white/location/decanter_part", 650, 660);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "wineglass", "graphics/screens/15_white/location/wineglass_part", 1455, 835);
	
	
	self:CreateObj(OBJ_TYPE.NO_ACTIVE, "match_light", "graphics/screens/15_white/location/white_light", 432, 200);
    ItemSetHotSpot("match_light", 256, 256)
    ItemSetScale("match_light", 10.0)
    self.drag_light = "match_light";
    
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "outline_bar", "graphics/screens/15_white/location/outline_bar", 18, 982);
	ItemSetOpacity("outline_bar", 0.5)
	
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "wineglass_outline", "graphics/screens/15_white/location/wineglass_outline", 1260, 1000);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "whisk_outline", "graphics/screens/15_white/location/whisk_outline", 1208, 1000);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "decanter_outline", "graphics/screens/15_white/location/decanter_outline", 1124, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "spoon_outline", "graphics/screens/15_white/location/spoon_outline", 1082, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "sieve_outline", "graphics/screens/15_white/location/sieve_outline", 935, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "mallet_outline", "graphics/screens/15_white/location/mallet_outline", 852, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "fryer_outline", "graphics/screens/15_white/location/fryer_outline", 604, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "paddle_outline", "graphics/screens/15_white/location/paddle_outline", 562, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "kettle_outline", "graphics/screens/15_white/location/kettle_outline", 359, 1000);
    self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "corkscrew_outline", "graphics/screens/15_white/location/corkscrew_outline", 190, 1000);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "strainer_outline", "graphics/screens/15_white/location/strainer_outline", 126, 1000);
	self:CreateObj(OBJ_TYPE.ACTIVE_ALL, "blender_outline", "graphics/screens/15_white/location/blender_outline", 35, 1000);
	

    
	
    clScreenManager:add_screen("hud") 
end