class 'l_09_Andreas_house_Z_Table' (ZoomZone)

function l_09_Andreas_house_Z_Table:__init(name, mode, PlayField)
	ZoomZone.__init(self, name, mode, PlayField)

	self:entityHide('area_find_treasure_map')
	self:entityHide('area_apply_zt_phone')
	
	self:entityHide('area_get_map','area_drop_map','area_apply_09_treasure_picture_part_1','area_apply_08_treasure_picture_part_2')
	do
		local function on_take_note(event)	  
		end

		local function on_find_note(event)
			self:entityShow('area_get_map','area_drop_map','area_apply_09_treasure_picture_part_1','area_apply_08_treasure_picture_part_2')
		    self:entityHide('area_find_flyNote')
	    	self.playfield:entityHide('Layer_book')

	        self.playfield:addFlyNote('Note_09_Book_with_symbols', event.save, 'Layer_09_Fly_Book_with_symbols', true, nil, nil, Vector2f(0.5, 0.5), on_take_note)
	    	
	    	if not event.save then
	    		self:entityFadeHide('zt_book_with_symbols')	
	    	else
	    		self:entityHide('zt_book_with_symbols')
	    	end

	   	end
	    self:registerActiveObject('area_find_flyNote', on_find_note, false)
	end

		local function on_apply_apply_09_treasure_picture_part_1(event)	
			self.playfield:entityShow('Layer_map_1')
	   		self:getEntityNamed('zt_map_3'):show()
	   		self:getEntityNamed('area_apply_08_treasure_picture_part_2'):hide()
	    if not event.save then
	    	self:playSound('08_give_picture_part')
	    	self:getEntityNamed('zt_map_3'):ChangeOpacity(0, 1, 0.5)
	    else
		end
		if IsToolApplied('09_treasure_picture_part_2') and HasGameState('09_photo_of_map') then self:entityShow('area_apply_zt_phone') end
	end
	self:registerToolApplyInfo('06_treasure_picture_part_1', 'area_apply_08_treasure_picture_part_2', on_apply_apply_09_treasure_picture_part_1, 'BBT_06_NEED_TREASURE_PICTURE_PART_1')

	local function on_apply_apply_08_treasure_picture_part_2(event)	
	   		self:getEntityNamed('zt_map_1'):show()
	   		self.playfield:entityShow('Layer_map_2')
	   		self:getEntityNamed('area_apply_09_treasure_picture_part_1'):hide()
	    if not event.save then
	    	self:playSound('08_give_picture_part')
	    	self:getEntityNamed('zt_map_1'):ChangeOpacity(0, 1, 0.5)
	    else
		end
		if HasGameState('09_photo_of_map') and IsToolApplied('06_treasure_picture_part_1') then 
			self:entityShow('area_apply_zt_phone') 
		end
	end
	self:registerToolApplyInfo('09_treasure_picture_part_2', 'area_apply_09_treasure_picture_part_1', on_apply_apply_08_treasure_picture_part_2, 'BBT_09_NEED_TREASURE_PICTURE_PART_2')

	local function on_drop_map(event)
	    self:entityHide('area_get_map', 'area_drop_map')
	    self.playfield:getEntityNamed('Layer_map_3'):setXY(200,396)
    	if not event.save then
    	   self:playSound('08_give_picture_part')
    	   SetGameState('09_photo_of_map','true')
    	   self:entityFadeShow('zt_map_2_drop')
    	   self:entityFadeHide('zt_map_2_get')
    	else
    	    self:entityShow('zt_map_2_drop') 
    	    self:entityHide('zt_map_2_get') 
    	end	
    	if IsToolApplied('09_treasure_picture_part_2') and IsToolApplied('06_treasure_picture_part_1') then 
    		self:entityShow('area_apply_zt_phone') 
       	end
    end
   self:registerDragObject('zt_map_2_get', 'area_get_map', 'area_drop_map', on_get, on_miss, on_drop_map, nil,true)

   local function on_click_apply_or_phone(event)
	    self:entityHide(event.target)
	    self:entityShow('area_find_treasure_map')
	     self.playfield:addNote('Note_09_Map')
	    
	    if not event.save then
	    	self:playSound('09_apply_zt_phone')
	    	--self:close()
	        self.playfield.zoom_comics_father_1:open()
	    else
	    	--self:closeAndDisable()
	    end
	end
	self:registerActiveObject('area_apply_zt_phone', on_click_apply_or_phone, false, 'CursorCamera')

	local function find_treasure_map(event)
	    self:entityHide(event.target)
	    self.playfield:entityHide('Layer_map_1','Layer_map_2','Layer_map_3')
	    if not event.save then 

	    	local node = path_manager:findNode(NodeType.SCENE, '06_Town')
	        if node then
	            node:setState(NodeState.ENABLED)
	        end   
		        
	    	self:playSound('08_take_picture_part')
	    	self:entityFadeHide('zt_map_2_drop', 'zt_map_1', 'zt_map_3')
	    else 
	    	self:entityHide('zt_map_2_drop', 'zt_map_1', 'zt_map_3')
	    end	
	    self:closeAndDisable()

	    addGameTask('14') 
	end
	self:registerToolFindInfo('09_treasure_note', 'area_find_treasure_map', find_treasure_map)

	-- local function find_old_ke(event)
	--     self:entityHide(event.target)
	--     if IsToolFound('09_treasure_note') then self:closeAndDisable() end
	-- end
	-- self:registerToolFindInfo('09_old_key', 'area_find_old_key', find_old_ke)

end

--------------------------------------------------------------------------------
--                      GENERATED CONTENT. DO NOT EDIT.                       --
--------------------------------------------------------------------------------

function l_09_Andreas_house_Z_Table:CreateLoaderTable()
	local objects =
	{
		{ name = 'zt_bg',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/09_Andreas_house/Z_Table/zt_bg.JPG',  width = 640,  height = 480,  },
		{ name = 'zt_map_1',  entityType = 'SpriteEntity',  x = 543,  y = 547,  order = 0,  isVisible = false,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/09_Andreas_house/Z_Table/zt_map_1.png',  width = 232,  height = 146,  },
		{ name = 'zt_map_3',  entityType = 'SpriteEntity',  x = 720,  y = 529,  order = 0,  isVisible = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/09_Andreas_house/Z_Table/zt_map_3.png',  width = 212,  height = 248,  },
		{ name = 'zt_map_2_drop',  entityType = 'SpriteEntity',  x = 568,  y = 458,  order = 0,  isVisible = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/09_Andreas_house/Z_Table/zt_map_2.png',  width = 242,  height = 164,  },
		{ name = 'zt_map_2_get',  entityType = 'SpriteEntity',  x = 318,  y = 237,  order = 0,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/09_Andreas_house/Z_Table/zt_map_2.png',  width = 242,  height = 164,  },
		{ name = 'area_apply_08_treasure_picture_part_2',  entityType = 'SpriteEntity',  x = 724,  y = 505,  order = 30,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 200,  height = 226,  },
		{ name = 'area_apply_09_treasure_picture_part_1',  entityType = 'SpriteEntity',  x = 547,  y = 561,  order = 30,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 200,  height = 111,  },
		{ name = 'area_get_map',  entityType = 'SpriteEntity',  x = 322,  y = 236,  order = 15,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 206,  height = 150,  },
		{ name = 'area_drop_map',  entityType = 'SpriteEntity',  x = 553,  y = 434,  order = 15,  angle = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 206,  height = 150,  },
		{ name = 'area_apply_zt_phone',  entityType = 'SpriteEntity',  x = 669,  y = 489,  order = 5,  isVisible = false,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  width = 300,  height = 261,  },
		{ name = 'area_find_treasure_map',  entityType = 'SpriteEntity',  x = 653,  y = 482,  order = 0,  isVisible = false,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 300,  height = 200,  },
		{ name = 'zt_book_with_symbols',  entityType = 'SpriteEntity',  x = 614,  y = 418.522,  order = 0,  editingLocked = false,  treeItemIsExpanded = false,  hotSpot = {x = 219, y = 194},  texturePath = 'Data/Textures/Scenes/09_Andreas_house/Z_Table/zt_book_with_symbols.png',  width = 438,  height = 388,  },
		{ name = 'area_find_flyNote',  entityType = 'SpriteEntity',  x = 614.826,  y = 393.435,  order = 60,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  hotSpot = {x = 203.044, y = 174.348},  width = 406.088,  height = 348.696,  },
	}
	return objects
end
