dofile('data/Scripts/scenes/07_shed/anim/07_shed_anim_bg.lua')

class 'l_07_shed' (LevelEventHandler)

function l_07_shed:__init(name)
	LevelEventHandler.__init(self, name)
	
	-- animations ----------------------------------
	self.anim_bg = AnimationBundle(Loader_07_BG_Animations(Object('bg')))
	self.anim_bg:PlayAnimation('bg')
	
	-- link scenes ---------------------------------
	LinkScene('area_link_06', 'CursorDoorDown',   'l_06_garden')
	
	-- zoom zones ----------------------------------
	
	-- ZOOM BASKET
	do
	    CreateSmartZoomZone('basket')
	    ---------------------
	    
	    local function on_find_leather_belt(e)
	    end
	    ---------------------
	    
	    RegisterToolFindInfo('06_leather_belt', 'area_find_zb_leather_belt', on_find_leather_belt)
	end
	
	-- ZOOM TOOLBOX
	do
	    CreateSmartZoomZone('toolbox')
	    ---------------------
	    
	    ObjectOpacity('z_toolbox_chisel_2', 0)
	    ObjectVisible('area_find_ztb_chisel', false)
	    ---------------------
	    
	    local function on_apply_leather_belt(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_toolbox_chisel',   0)
	            ObjectOpacity('z_toolbox_chisel_2', 1)
	            
	            ObjectVisible('area_find_ztb_chisel', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_toolbox_chisel',   0, time)
	            ObjectOpacity('z_toolbox_chisel_2', 1, time)
	            
	            MakeSoundEntity('07_apply_leather_belt'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_find_ztb_chisel', true)
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_find_chisel(e)
	        ObjectOpacity('z_toolbox_chisel_2', 0)
	        ObjectOpacity('layer_chisel',       0)
	    end
	    ---------------------
	    
	    RegisterToolApplyInfo('06_leather_belt', 'area_apply_ztb_leather_belt', on_apply_leather_belt, 'BBT_07_NEED_APPLY_LEATHER_BELT')
	    RegisterToolFindInfo('07_chisel', 'area_find_ztb_chisel', on_find_chisel)
	end
	
	-- ZOOM TABLE
	do
	    CreateSmartZoomZone('table')
	    ---------------------
	    
	    ObjectOpacity('z_table_handle', 0)
	    ---------------------
	    
	    ObjectVisible('area_find_zt_hammer', false)
	    ---------------------
	    
	    local function on_apply_hammer_handle(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_table_handle', 1)
	            ObjectVisible('area_find_zt_hammer', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_table_handle', 1, time)
	            MakeSoundEntity('07_apply_hammer_handle'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_find_zt_hammer', true)
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_find_hammer(e)
	        ObjectOpacity('z_table_handle', 0)
	        ObjectOpacity('z_table_hammer', 0)
	        ObjectOpacity('layer_hammer_part', 0)
	    end
	    ---------------------
	    
	    RegisterToolApplyInfo('06_hammer_handle', 'area_apply_zt_hammer_handle', on_apply_hammer_handle, 'BBT_07_NEED_APPLY_HAMMER_HANDLE')
	    RegisterToolFindInfo('07_hammer', 'area_find_zt_hammer', on_find_hammer)
	end
	
	-- ZOOM STUMP
	do
	    CreateSmartZoomZone('stump')
	    ---------------------
	    --07_garden_pruner
	    
	    ObjectVisible('area_find_zs_axe',     false)
	    ObjectVisible('area_apply_zs_hammer', false)
	    
	    ObjectOpacity('z_stump_crack',        0)
	    ObjectOpacity('z_stump_chisel_in',    0)
	    ObjectOpacity('z_stump_chisel_out',   0)
	    ObjectOpacity('layer_chisel_applied', 0)
	    ---------------------
	    
	    local function on_apply_chisel(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_stump_chisel_out',   1)
	            ObjectOpacity('layer_chisel_applied', 1)
	            ObjectVisible('area_apply_zs_hammer', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_stump_chisel_out',   1, time)
	            ObjectOpacity('layer_chisel_applied', 1, time)
	            
	            MakeSoundEntity('07_apply_chisel'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_apply_zs_hammer', true)
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_apply_hammer(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_stump_chisel_out', 0)
	            ObjectOpacity('z_stump_chisel_in',  1)
	            ObjectOpacity('z_stump_crack',      1)
	            ObjectVisible('area_find_zs_axe', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_stump_chisel_out', 0, time)
	            ObjectOpacity('z_stump_chisel_in',  1, time)
	            ObjectOpacity('z_stump_crack',      1, time)
	            
	            MakeSoundEntity('07_apply_hammer'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_find_zs_axe', true)
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_find_garden_pruner(e)
	        ObjectVisible(e.target, false)
	        ObjectOpacity('z_stump_garden_pruner', 0)
	        ObjectOpacity('layer_garden_pruner',   0)
	        
	        NotebookPushNote('note_07_garden_pruner')
	        
	        if IsToolFound('07_axe') then
	            self.zoom_stump:CloseAndDisable()
	        end
	    end
	    ---------------------
	    
	    local function on_find_axe(e)
	        ObjectOpacity('z_stump_axe', 0)
	        ObjectOpacity('layer_axe',   0)
	        
	        if IsToolFound('07_garden_pruner') then
	            self.zoom_stump:CloseAndDisable()
	        end
	    end
	    ---------------------
	    
	    RegisterToolApplyInfo('07_chisel', 'area_apply_zs_chisel', on_apply_chisel, 'BBT_07_NEED_APPLY_CHISEL')
	    RegisterToolApplyInfo('07_hammer', 'area_apply_zs_hammer', on_apply_hammer, 'BBT_07_NEED_APPLY_HAMMER')
	    RegisterToolFindInfo('07_garden_pruner', 'area_find_zs_garden_pruner', on_find_garden_pruner, false)
	    RegisterToolFindInfo('07_axe',           'area_find_zs_axe',           on_find_axe,           false)
	end
end

function l_07_shed:OnUpdate(dt)
end

function l_07_shed:OnAllItemsFound()
end

function l_07_shed:OnObjectMouseEnter(object)
end

function l_07_shed:OnObjectMouseLeave(object)
end

function l_07_shed:OnScreenObjectMouseDown(object, key)
end

function l_07_shed:OnObjectMouseDownProcessed(is_wrong_click)
end

function l_07_shed:OnMouseMove(previous_pos, current_pos)
end

function l_07_shed:OnObjectMouseUp(object)
end

function l_07_shed:OnObjectFound(object)
end

function l_07_shed:OnToolFound(tool)
end

function l_07_shed:OnToolApply(tool, object)
end

function l_07_shed:OnToolAddToInventory(tool)
end

function l_07_shed:OnObjectReachPanel(object)
end

function l_07_shed:OnButtonPress(title)
end

function l_07_shed:OnSetTool(tool)
end

function l_07_shed:OnLoaded()
end

function l_07_shed:OnDestroy()
end

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function l_07_shed:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/Scenes/07_shed/main/layers/bg.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bg',anim,512,384,50,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_link_06',anim,512,700,100,0,128,17)
	
	anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_zoom_toolbox',anim,766,273,100,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_zoom_table',anim,451,335,100,0,1.7,0.7)
	
	anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_zoom_stump',anim,344,512,100,0,1.7,1)
	
	anim = CreateAnimation('data/Texture/Scenes/07_shed/main/layers/layer_axe.png',0,0,96,40,1,0)
	anim:SetHotSpot(48,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_axe',anim,366,488,51,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/07_shed/main/layers/layer_chisel.png',0,0,24,56,1,0)
	anim:SetHotSpot(12,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_chisel',anim,763,252,51,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/07_shed/main/layers/layer_chisel_applied.png',0,0,22,50,1,0)
	anim:SetHotSpot(11,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_chisel_applied',anim,364,486,52,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/07_shed/main/layers/layer_garden_pruner.png',0,0,58,40,1,0)
	anim:SetHotSpot(29,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_garden_pruner',anim,289,514,51,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/07_shed/main/layers/layer_hammer_part.png',0,0,42,16,1,0)
	anim:SetHotSpot(21,8)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_hammer_part',anim,452,330,51,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_zoom_basket',anim,688,436,100,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
