class 'l_04_Gazebo_HO' (PlayField)

function l_04_Gazebo_HO:__init(game_scene, name, path)
	PlayField.__init(self, game_scene, name, path)	
		
	self.is_outdoor_scene = false
	
	-- interactive help --------------------------------------------------------
    self.tutorial = self:getGameScene():getTutorial()
    ----------------------------------------------------------------------------   

	self:generate_tasks()
	
	self.timer:add(function()
            if self.tutorial:isActive() then            
                if ( not self.tutorial:isTipShown( 'HO_TASK' ) ) then
                    self.tutorial:showTip( 'HO_TASK', 0 )
                elseif ( not self.tutorial:isTipShown( 'HO_MATCH3' ) ) then
                    self.tutorial:showTip( 'HO_MATCH3', 0, true)
                end
            end
        end, 0)
end

--------------------------------------------------------------------------------
function l_04_Gazebo_HO:generate_tasks()
	


	-- Hide active object & areas
	 self:entityHide('butterfly','heart','ring','mouse')
	 self:entityHide('area_click_casket',
	 				 'area_get_pen','area_drop_pen'
	 				 )
	 self:entityHide(--'area_click_flower',
	 				-- 'area_get_cheese','area_drop_cheese'
	 				 )
	-- hide anim interactives
	 self:getEntityNamed('compositionbutterfly'):stop()
	 self:getEntityNamed('compositionhearth'):hide()
	 self:getEntityNamed('compositionbutterfly'):rewind(false)
	 self:entityHide('flower_close')
									  					

	local first_tool_name = '04_pick'
	local second_tool_name = '04_chisel'
	local randomTasks = {	'bow',
							'crown',
							'dandelion',
							'griffin',							
							'socrates',
						}		

	local actionTasks     = {'mouse', 'heart', 'ring', 'butterfly'}
    local firstDealTasks  = {'mouse', 'amphora', 'butterfly','clover','mediator','sun','handprint','jewel', 'fan'}
    local secondDealTasks = {'heart', 'ring','amur','shield','hunting','chisel','pitcher','lute', 'nest','cobra'}

    self.ho_logic:defineToolFindOrder(first_tool_name, second_tool_name)
    self.ho_logic:registerTasks('HO_04_', randomTasks, actionTasks, firstDealTasks, secondDealTasks)
	self.ho_logic:start()

-------------------------First dial-----------------------------------------
	
	 self:getEntityNamed('lute'):setRespondable(false)
 	--drag--------------------------------------------------------------------------

	
	--------------------------------------------------------------------------
    local function on_drop_cheese(event)
    	SetTaskActionObject('mouse', false)
    	
    	if not event.save then
    	   self:entityFadeHide('area_get_cheese','area_drop_cheese', 'cheese_rat', 'compositioneye_in_hole_idle')
    	   self:entityFadeShow('mouse')
    	   self:playSound('04_HO_area_drop_cheese')
    	else
    		if not IsTaskObjectFound(self:getName(), 'mouse') then
	    		self:entityShow('mouse')	
	    	end	
	    	self:entityHide('area_get_cheese','area_drop_cheese', 'cheese_rat','compositioneye_in_hole_idle')
	       -- self:entityHide('mouse')
    	end	
    end
    self:registerDragObject('cheese_rat', 'area_get_cheese', 'area_drop_cheese', on_get, on_miss, on_drop_cheese, nil, nil, nil, nil, nil, nil, 'mouse')
    ----------------------------------------------------------------------------
    --on click --------------------------------------------------------------------------
		local function on_area_click_flower(event)
			 SetTaskActionObject('butterfly', false)
	    	 self:entityHide('area_click_flower')

	    	if not event.save then
		    	self:entityHide('flower_close')
	    		 self:getEntityNamed('compositionbutterfly'):play()
	    		--self:playSound('')
	    		self.timer:add(function()
	                 self:getEntityNamed('compositionbutterfly'):hide() 
		    	 	self:entityShow('butterfly')
		    		self:entityShow('flower_open')
	         	end, 2)
	    	else
	    		 self:getEntityNamed('compositionbutterfly'):hide()
	    		 if not IsTaskObjectFound(self:getName(), 'butterfly') then
           		    self:entityShow('butterfly')
    			 end
	    		
	    		self:entityShow('flower_open')
	    		self:entityHide('flower_close')
	    	end	
		end

		self:registerActiveObject('area_click_flower', on_area_click_flower, false, nil, 'butterfly')  

	--  -------------------------Second dial-----------------------------------------
 	if IsToolFound('04_pick') then
 		self:getEntityNamed('lute'):setRespondable(true)
 		self:entityHide('area_click_flower','area_get_cheese','area_drop_cheese')
		  self:entityShow('area_get_pen','area_drop_pen',
		  					'area_click_casket')

	--drag--------------------------------------------------------------------------
		local function on_drop_textile(event)
		    	SetTaskActionObject('heart', false)
		    	self:entityHide('area_get_pen', 'area_drop_pen')
		    
	    	if not event.save then
	    		self:getEntityNamed('compositionhearth'):play()
		    	self:entityHide('pen')
	    		self:playSound('04_HO_area_drop_pen')
	    		self.timer:add(function()
	                self:getEntityNamed('compositionhearth'):hide() 
		    	   	self:entityShow('heart')
		    	end, 2)
	    	else 

	    		if not IsTaskObjectFound(self:getName(), 'heart') then
	    			self:entityShow('heart')
	    		end


	    		 self:entityShow('heart')
	    		 self:entityHide('pen')
	    	end	
	    end
	    self:registerDragObject('pen', 'area_get_pen', 'area_drop_pen', nil, nil, on_drop_textile, nil, nil, nil, nil, nil, nil, 'heart')
		--------------------------------------------------------
	   
    	--on click -------------------------------------------------------------------------
		local function on_area_click_casket(event)
				SetTaskActionObject('ring', false)
		    	self:entityHide('area_click_casket')
		    
	    	if not event.save then

	       	 	self:entityFadeHide('casket_close_ring')
	       	 	self:entityFadeShow('casket_open_ring')
	       	 	self:getEntityNamed('casket_open_ring'):setRespondable(false)
	       	 	self:entityFadeShow('ring')
	       	 	self:playSound('04_HO_area_click_casket')
	        else
	        	 if not IsTaskObjectFound(self:getName(), 'ring') then
            		self:entityShow('ring')
   				 end
	    		self:entityHide('casket_close_ring')
	    		self:entityShow('casket_open_ring')
	    		self:getEntityNamed('casket_open_ring'):setRespondable(false)
	    	end	
		end
		
		self:registerActiveObject('area_click_casket', on_area_click_casket, false, nil, 'ring')  
 	end

 	---watering can
		self:registerBBT('area_drop_pen', 'BBT_03_CE_HO_PEN')
		self:registerBBT('area_drop_cheese', 'BBT_03_CE_HO_CHEESE')
 		
 		 
end
--------------------------------------------------------------------------------



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

function l_04_Gazebo_HO:CreateLoaderTable()
	local objects =
	{
		{ name = 'Bg',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Bg.jpg',  width = 1366,  height = 768,  },
		{ name = 'fan',  entityType = 'SpriteEntity',  x = 376,  y = 144,  order = 1,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/fan.png',  width = 258,  height = 150,  },
		{ name = 'griffin',  entityType = 'SpriteEntity',  x = 921,  y = 177,  order = 1,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/griffin.png',  width = 218,  height = 216,  },
		{ name = 'hunting',  entityType = 'SpriteEntity',  x = 736,  y = 522,  order = 1,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/hunting.png',  width = 228,  height = 82,  },
		{ name = 'nest',  entityType = 'SpriteEntity',  x = 292,  y = 130.5,  order = 1,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/nest.png',  width = 196,  height = 183,  },
		{ name = 'shield',  entityType = 'SpriteEntity',  x = 880,  y = 294.5,  order = 1,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/shield.png',  width = 312,  height = 287,  },
		{ name = 'sun',  entityType = 'SpriteEntity',  x = 868,  y = 304.5,  order = 1,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/sun.png',  width = 108,  height = 107,  },
		{ name = 'amphora',  entityType = 'SpriteEntity',  x = 101,  y = 331,  order = 1,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/amphora.png',  width = 187,  height = 184,  },
		{ name = 'rat_hole',  entityType = 'SpriteEntity',  x = 719,  y = 557.5,  order = 1,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/rat_hole.png',  width = 58,  height = 51,  },
		{ name = 'mouse',  entityType = 'SpriteEntity',  x = 713.5,  y = 579,  order = 2,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/mouse.png',  width = 159,  height = 66,  },
		{ name = 'amur',  entityType = 'SpriteEntity',  x = 566,  y = 187.5,  order = 5,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/amur.png',  width = 152,  height = 203,  },
		{ name = 'Layer_papper_over',  entityType = 'SpriteEntity',  x = 573,  y = 356,  order = 5,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Layer_papper_over.png',  width = 212,  height = 172,  },
		{ name = 'bow',  entityType = 'SpriteEntity',  x = 754,  y = 439,  order = 5,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/bow.png',  width = 160,  height = 90,  },
		{ name = 'socrates',  entityType = 'SpriteEntity',  x = 474.5,  y = 334.5,  order = 5,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/socrates.png',  width = 195,  height = 259,  },
		{ name = 'pitcher',  entityType = 'SpriteEntity',  x = 930.5,  y = 496,  order = 5,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/pitcher.png',  width = 131,  height = 184,  },
		{ name = 'flower_open',  entityType = 'SpriteEntity',  x = 97,  y = 560,  order = 6,  isVisible = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/flower_open.png',  width = 203,  height = 219,  },
		{ name = 'flower_close',  entityType = 'SpriteEntity',  x = 97,  y = 560,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/flower_close.png',  width = 203,  height = 219,  },
		{ name = 'casket_close_ring',  entityType = 'SpriteEntity',  x = 837,  y = 439,  order = 6,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/casket_close_ring.png',  width = 105,  height = 78,  },
		{ name = 'casket_open_ring',  entityType = 'SpriteEntity',  x = 796,  y = 440,  order = 6,  isVisible = false,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/casket_open_ring.png',  width = 187,  height = 79,  },
		{ name = 'jewel',  entityType = 'SpriteEntity',  x = 589,  y = 139.5,  order = 6,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/jewel.png',  width = 84,  height = 91,  },
		{ name = 'mediator',  entityType = 'SpriteEntity',  x = 689,  y = 434.5,  order = 6,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/mediator.png',  width = 72,  height = 67,  },
		{ name = 'crown',  entityType = 'SpriteEntity',  x = 325.5,  y = 311,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/crown.png',  width = 209,  height = 140,  },
		{ name = 'lute',  entityType = 'SpriteEntity',  x = 234,  y = 429.5,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/lute.png',  width = 300,  height = 415,  },
		{ name = 'clover',  entityType = 'SpriteEntity',  x = 896.5,  y = 407,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/clover.png',  width = 101,  height = 94,  },
		{ name = 'butterfly',  entityType = 'SpriteEntity',  x = 89,  y = 469,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/butterfly.png',  width = 72,  height = 81,  },
		{ name = 'ring',  entityType = 'SpriteEntity',  x = 841.5,  y = 444,  order = 7,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/ring.png',  width = 43,  height = 36,  },
		{ name = 'chisel',  entityType = 'SpriteEntity',  x = 892,  y = 648,  order = 7,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/chisel.png',  width = 87,  height = 138,  },
		{ name = 'handprint',  entityType = 'SpriteEntity',  x = 296,  y = 546,  order = 7,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/handprint.png',  width = 102,  height = 102,  },
		{ name = 'Layer_pitcher_over',  entityType = 'SpriteEntity',  x = 931,  y = 544,  order = 10,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Layer_pitcher_over.png',  width = 188,  height = 115,  },
		{ name = 'pen',  entityType = 'SpriteEntity',  x = 294.5,  y = 166.5,  order = 10,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/pero_serdce.png',  width = 141,  height = 59,  },
		{ name = 'Layer_clover_over',  entityType = 'SpriteEntity',  x = 940.016,  y = 438.127,  order = 10,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Layer_clover_over.png',  width = 31,  height = 48,  },
		{ name = 'Layer_hunting_over',  entityType = 'SpriteEntity',  x = 816,  y = 562.5,  order = 10,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Layer_hunting_over.png',  width = 112,  height = 113,  },
		{ name = 'Layer_nest_over',  entityType = 'SpriteEntity',  x = 237,  y = 95.5,  order = 10,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Layer_nest_over.png',  width = 128,  height = 123,  },
		{ name = 'cheese_rat',  entityType = 'SpriteEntity',  x = 226,  y = 243.889,  order = 10,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/cheese_rat.png',  width = 106,  height = 98,  },
		{ name = 'dandelion',  entityType = 'SpriteEntity',  x = 816,  y = 629.5,  order = 12,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/dandelion.png',  width = 98,  height = 93,  },
		{ name = 'Layer_odyvancik_over',  entityType = 'SpriteEntity',  x = 840,  y = 656.5,  order = 13,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/Layer_odyvancik_over.png',  width = 70,  height = 63,  },
		{ name = 'area_drop_pen',  entityType = 'SpriteEntity',  x = 634,  y = 322,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_get_pen',  entityType = 'SpriteEntity',  x = 293,  y = 164,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 130,  height = 100,  },
		{ name = 'area_click_casket',  entityType = 'SpriteEntity',  x = 842,  y = 449,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_click_flower',  entityType = 'SpriteEntity',  x = 101,  y = 483,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_get_cheese',  entityType = 'SpriteEntity',  x = 238,  y = 241,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = 'area_drop_cheese',  entityType = 'SpriteEntity',  x = 705,  y = 567,  order = 20,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = true,  width = 100,  height = 100,  },
		{ name = '04_Gazebo_HO_Animation',  entityType = 'CompositionContainer',  x = -171,  y = 0,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  path = 'Data/Scripts/HO/04_Gazebo/Animation/04_Gazebo_HO_Animation.lua',  },
		{ name = 'compositionMain',  entityType = 'CompositionSequence',  parentName = '04_Gazebo_HO_Animation',  x = 0,  y = 0,  order = 0,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = false,  isCyclic = true,  speed = 1,  },
		{ name = 'compositionbutterfly',  entityType = 'CompositionSequence',  parentName = '04_Gazebo_HO_Animation',  x = 0,  y = 0,  order = 2,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  speed = 1,  },
		{ name = 'compositionhearth',  entityType = 'CompositionSequence',  parentName = '04_Gazebo_HO_Animation',  x = 0,  y = 0,  order = 10,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  speed = 1,  },
		{ name = 'papper_heart',  entityType = 'SpriteEntity',  parentName = '04_Gazebo_HO_Animation',  x = 811,  y = 314,  order = 6,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Layers/papper_heart.png',  width = 280,  height = 204,  },
		{ name = 'heart',  entityType = 'SpriteEntity',  parentName = '04_Gazebo_HO_Animation',  x = 796.5,  y = 325,  order = 7,  isVisible = false,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/heart.png',  width = 59,  height = 71,  },
		{ name = 'cobra',  entityType = 'SpriteEntity',  parentName = '04_Gazebo_HO_Animation',  x = 348,  y = 431,  order = 1,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/HO/04_Gazebo/Items/cobra.png',  width = 227,  height = 219,  },
		{ name = '04_Gazebo_HO_eye_Animation',  entityType = 'CompositionContainer',  x = 0,  y = 0,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  path = 'Data/Scripts/HO/04_Gazebo/Animation/04_Gazebo_HO_eye_Animation.lua',  },
		{ name = 'compositioneye_in_hole_idle',  entityType = 'CompositionSequence',  parentName = '04_Gazebo_HO_eye_Animation',  x = 703.71,  y = 545.685,  order = 10,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = false,  isCyclic = true,  speed = 1,  },
	}
	return objects
end
