dofile('data/Scripts/scenes/08a_street_pavilion/anim/08a_street_pavilion_anim_z_hat.lua')
dofile('data/Scripts/scenes/08a_street_pavilion/anim/08a_street_pavilion_anim_z_table.lua')

class 'l_08a_street_pavilion' (LevelEventHandler)

function l_08a_street_pavilion:__init(name)
	LevelEventHandler.__init(self, name)
	
	-- animations ----------------------------------
	
	
	-- link scenes ---------------------------------
	LinkScene('area_link_08', 'CursorDoorDown', 'l_08_street')
	
	-- main logic ----------------------------------
	
	ObjectOpacity('layer_chest_open',       0)
	ObjectOpacity('layer_fortunetell_head', 0)
	ObjectOpacity('layer_fortunetell_body', 0)
	ObjectOpacity('layer_magic_ball',       0)
	ObjectOpacity('layer_winder',           0)
	ObjectOpacity('layer_drawer',           0)
	ObjectOpacity('layer_magic_ball_break', 0)
	-------------------------
	
	ObjectVisible('area_zoom_chest', false)
	-------------------------
	
	local function on_click_chest(e)
	    ObjectVisible(e.target, false)
	    
	    if e.save then
	        ObjectOpacity('layer_chest_open', 1)
	        ObjectVisible('area_zoom_chest', true)
	    else
	        local time = 0.5
	        ObjectOpacity('layer_chest_open', 1, time)
	        MakeSoundEntity('08a_open_chest'):PlaySound(false)
	        
	        self.timer:Add( function()
	                            ObjectVisible('area_zoom_chest', true)
                            end,
                            time)
	    end
	end
	
	RegisterActiveObject('area_click_chest', on_click_chest)
	
	-- zoom zones ----------------------------------
	
	-- ZOOM CLOWN
	do
	    CreateSmartZoomZone('clown')
	    ---------------------
	    
	    local function on_find_winder(e)
	        ObjectVisible(e.target, false)
	    end
	    ---------------------
	    
	    RegisterToolFindInfo('08_winder', 'area_find_zc_winder', on_find_winder)
	end
	
	-- ZOOM HAT
	do
	    CreateSmartZoomZone('hat')
	    ---------------------
	    
	    self.anim_hat = AnimationBundle(Loader_08_Zoom_Hat_Animations(Object('z_hat_bg')))
	    self.anim_hat:GetAnimation('action'):SetVisible(true)
	    self.anim_hat:GetAnimation('action'):SetClippingRect(self.zoom_hat:GetClippingInfo())
	    ---------------------
	    
	    ObjectVisible('area_find_zh_magic_ball', false)
	    ---------------------
	    
	    local function on_click_hat(e)
	        ObjectVisible(e.target, false)
	        
	        local compos = self.anim_hat:GetAnimation('action')
	        
	        if e.save then
	            compos:Rewind(true)
	            ObjectOpacity('layer_hat', 0)
	            ObjectVisible('area_find_zh_magic_ball', true)
	        else
	            local time = compos:GetDuration()
	            compos:Play()
	            ObjectOpacity('layer_hat', 0, time)
	            MakeSoundEntity('08a_click_hat'):PlaySound(false)
	            
	            self.mouseBlocker:Push()
	            self.timer:Add( function()
	                                self.mouseBlocker:Pop()
	                                ObjectVisible('area_find_zh_magic_ball', true)
	                            end,
	                            time * 0.5)
	        end
	    end
	    ---------------------
	    
	    local function on_find_magic_ball(e)
	        ObjectVisible(e.target, false)
	        ObjectOpacity('layer_magic_ball_1', 0)
	    end
	    ---------------------
	    
	    RegisterActiveObject('area_click_zh_hat', on_click_hat)
	    RegisterToolFindInfo('08_magic_ball', 'area_find_zh_magic_ball', on_find_magic_ball)
	end
	
	-- ZOOM CHEST
	do
	    CreateSmartZoomZone('chest')
	    ---------------------
	    
	    play_field:IgnoreOnTestPoint('z_chest_keys_cover')
	    ---------------------
	    
	    self.piano = {}
	    self.piano.keys = {}
	    self.piano.time = 0.1
	    self.piano.currKey = nil
	    
	    for i=1, 8 do
	        local objName = 'z_chest_key_'..tostring(i)
	        local object  = Object(objName)
	        
	        object:SetClippingRect(self.zoom_chest:GetClippingInfo())
	        
	        local key = {}
	        key.name  = objName
	        key.obj   = object
	        key.eff   = nil
	        key.sound = (i <= 6) and MakeSoundEntity('08a_key_'..i) or nil
	        key.clickable = (i <= 6)
	        
	        self.piano.keys[objName] = key
	        self.custom_cursors[objName]      = (key.clickable) and 'CursorActive' or nil
	        self.ignore_on_highlight[objName] = true
	    end
	    
	    self.piano.onObjectMouseDown = function(object)
	        local objectName = object:GetName()
	        local key = self.piano.keys[objectName]
	        
	        if key and key.clickable then
	            if key.eff then
	                key.eff:Destroy()
	                key.eff = nil
	            end
	            
	            key.eff = key.obj:ChangeOpacity(key.obj:GetOpacity(), 0.01, self.piano.time)
	            key.eff:SetDestroysOnEnd(false)
	            
	            if key.sound then
                    key.sound:StopSound()
                    key.sound:PlaySound(false)
                end
	            
	            self.piano.currKey = objectName
	        end
	    end
	    
	    self.piano.onObjectMouseUp = function()
	        local key = self.piano.keys[self.piano.currKey]
	        
	        if key then
	            if key.eff then
	                key.eff:Destroy()
	                key.eff = nil
	            end
	            
	            key.eff = key.obj:ChangeOpacity(key.obj:GetOpacity(), 1, self.piano.time)
	            key.eff:SetDestroysOnEnd(false)
	            
	            self.piano.currKey = nil
	        end
	    end
	    
	    
	    ---------------------
	    
	    ObjectOpacity('z_chest_lantern_out', 0)
	    ---------------------
	    
	    ObjectVisible('area_find_zc_fortunetell_body', false)
	    ---------------------
	    
	    local function on_click_lantern(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_chest_lantern_in',  0)
	            ObjectOpacity('z_chest_lantern_out', 1)
	            ObjectVisible('area_find_zc_fortunetell_body', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_chest_lantern_in',  0, time)
	            ObjectOpacity('z_chest_lantern_out', 1, time)
	            
	            MakeSoundEntity('08a_click_lantern'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_find_zc_fortunetell_body', true)
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_find_fortunetell_body(e)
	        ObjectVisible(e.target, false)
	    end
	    ---------------------
	    
	    RegisterActiveObject('area_click_zc_lantern', on_click_lantern)
	    RegisterToolFindInfo('08_fortunetell_body', 'area_find_zc_fortunetell_body', on_find_fortunetell_body)
	end
	
	-- ZOOM BOX
	do
	    CreateSmartZoomZone('box')
	    ---------------------
	    
	    ObjectOpacity('z_box_cover', 0)
	    ---------------------
	    
	    ObjectVisible('area_find_zb_fortunetell_head', false)
	    ---------------------
	    
	    local function on_click_ball(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_box_cover', 1)
	            ObjectVisible('area_find_zb_fortunetell_head', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_box_cover', 1, time)
	            MakeSoundEntity('08a_click_ball'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_find_zb_fortunetell_head', true)
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_find_fortunetell_head(e)
	        ObjectVisible(e.target, false)
	    end
	    ---------------------
	    
	    RegisterActiveObject('area_click_zb_ball', on_click_ball)
	    RegisterToolFindInfo('08_fortunetell_head', 'area_find_zb_fortunetell_head', on_find_fortunetell_head)
	end
	
	-- ZOOM TABLE
	do
	    CreateSmartZoomZone('table')
	    ---------------------
	    
	    self.anim_table = AnimationBundle(Loader_08A_Zoom_Table_Animations(Object('z_table_bg')))
	    --self.anim_table:GetAnimation('idle'):SetVisible(true)
	    
	    ---------------------
	    
	    self.TABLE_OBJECTS_OPACITY_TIME = 0.5
	    self.tools_applied_count = 0
	    self.tools_dropped_count = 0
	    ---------------------
	    
	    self.leyersPos = {}
	    self.leyersPos['fortunetell_body'] = {x=367, y=337}
	    self.leyersPos['fortunetell_head'] = {x=366, y=322}
	    self.leyersPos['magic_ball']       = {x=395, y=342}
	    ---------------------
	    
	    ObjectOpacity('z_table_fortunetell_body', 0)
        ObjectOpacity('z_table_fortunetell_head', 0)
        ObjectOpacity('z_table_magic_ball',       0)
        ObjectOpacity('z_table_winder',           0)
        
        ObjectOpacity('z_table_fortunetell_body_in', 0)
        ObjectOpacity('z_table_fortunetell_head_in', 0)
        ObjectOpacity('z_table_magic_ball_in',       0)
        ObjectOpacity('z_table_winder_in',           0)
        ObjectOpacity('z_table_winder_in_2',         0)
        
        ObjectOpacity('z_table_drawer', 0)
        ObjectOpacity('z_table_hammer', 0)
        ObjectOpacity('z_table_hammer_drag', 0)
        
        ObjectOpacity('z_table_shawl_2', 0)
	    ---------------------
	    
	    ObjectVisible('area_get_zt_fortunetell_body', false)
        ObjectVisible('area_get_zt_fortunetell_head', false)
        ObjectVisible('area_get_zt_magic_ball',       false)
        ObjectVisible('area_get_zt_winder',           false)
        ObjectVisible('area_get_zt_hammer',           false)
        
        ObjectVisible('area_drop_zt_magic_ball',       false)
        ObjectVisible('area_drop_zt_fortunetell_body', false)
        ObjectVisible('area_drop_zt_fortunetell_head', false)
        ObjectVisible('area_drop_zt_winder',           false)
        ObjectVisible('area_drop_zt_hammer',           false)
        
        ObjectVisible('area_click_zt_winder',          false)
        ObjectVisible('area_find_zt_doctor_key',       false)
	    ---------------------
	    
	    if IsNotePushed('note_08_poster') then
	        ObjectVisible('area_hint_zt_need_poster', false)
	    else
	        ObjectVisible('area_apply_zt_tools', false)
	    end
	    ---------------------
	    
	    self.zoom_table.on_open = function()
	        if self.sound_magic_ball_idle then
	            self.sound_magic_ball_idle:SetVolume(1)
	        end
	    end
	    ---------------------
	    
	    self.zoom_table.on_close = function()
	        if self.sound_magic_ball_idle then
	            self.sound_magic_ball_idle:SetVolume(0.1)
	        end
	    end
	    ---------------------
	    
	    local function on_apply_tools(e)
	        self.tools_applied_count = self.tools_applied_count + 1
	        -----------------
	        
	        if self.tools_applied_count < 4 then
	            self.custom_cursors[e.target] = 'CursorGlass'
	        else
	            ObjectVisible(e.target, false)
	        end
	        -----------------
	        
	        local id = string.sub(e.toolName, 4)
	        
	        if e.save then
	            ObjectOpacity('z_table_'..id, 1)
	            
	            if id ~= 'winder' then
                    ObjectOpacity('layer_'..id, 1)
                end
	            
	            if self.tools_applied_count == 4 then
                    ObjectVisible('area_get_zt_fortunetell_body', true)
                    ObjectVisible('area_get_zt_fortunetell_head', true)
                    ObjectVisible('area_get_zt_magic_ball',       true)
                    ObjectVisible('area_get_zt_winder',           true)
                    
                    ObjectVisible('area_drop_zt_magic_ball',       true)
                    ObjectVisible('area_drop_zt_fortunetell_body', true)
                    ObjectVisible('area_drop_zt_winder',           true)
                end
	        else
                ObjectOpacity('z_table_'..id, 1, self.TABLE_OBJECTS_OPACITY_TIME)
                
                if id ~= 'winder' then
                    ObjectOpacity('layer_'..id, 1, self.TABLE_OBJECTS_OPACITY_TIME)
                end
                
                if self.apply_tools_sound == nil then
                    self.apply_tools_sound = MakeSoundEntity('08a_apply_tools')
                end
                
                self.apply_tools_sound:StopSound()
                self.apply_tools_sound:PlaySound(false)
	            
	            if self.tools_applied_count == 4 then
                    self.timer:Add( function()
                                        ObjectVisible('area_get_zt_fortunetell_body', true)
                                        ObjectVisible('area_get_zt_fortunetell_head', true)
                                        ObjectVisible('area_get_zt_magic_ball',       true)
                                        ObjectVisible('area_get_zt_winder',           true)
                                        
                                        ObjectVisible('area_drop_zt_magic_ball',       true)
                                        ObjectVisible('area_drop_zt_fortunetell_body', true)
                                        ObjectVisible('area_drop_zt_winder',           true)
                                    end,
                                    self.TABLE_OBJECTS_OPACITY_TIME)
                end
	        end
	    end
	    ---------------------
	    
	    local function on_click_apply_tools_area(e)
	        return 'BBT_08_NEED_APPLY_TOOLS_ON_TABLE'
	    end
	    ---------------------
	    
	    local function on_drop_target_tools(e)
	        self.tools_dropped_count = self.tools_dropped_count + 1
	        
	        local id = string.sub(e.objName, 9)
	        
	        ObjectVisible('area_get_zt_'..id,  false)
	        ObjectVisible('area_drop_zt_'..id, false)
	        
	        if self.leyersPos[id] then
                local pos    = self.leyersPos[id]
                local object = Object('layer_'..id)
                
                object:SetXY(pos.x, pos.y)
                object:SetAngle(0)
            end
	        
	        if e.save then
	            ObjectOpacity(e.objName..'_in', 1)
	            ObjectOpacity(e.objName,        0)
	            
	            if id == 'fortunetell_body' then
	                ObjectOpacity('z_table_shawl_1', 0)
	                ObjectOpacity('z_table_shawl_2', 1)
	            end
	            
	            if id == 'winder' then
	                ObjectOpacity('layer_'..id, 1)
	            end
	            
	            if self.tools_dropped_count == 4 then
	                ObjectVisible('area_click_zt_winder', true)
	            end
	        else
	            ObjectOpacity(e.objName..'_in', 1, self.TABLE_OBJECTS_OPACITY_TIME)
	            ObjectOpacity(e.objName,        0, self.TABLE_OBJECTS_OPACITY_TIME)
	            
	            if id == 'fortunetell_body' then
	                ObjectOpacity('z_table_shawl_1', 0, self.TABLE_OBJECTS_OPACITY_TIME)
	                ObjectOpacity('z_table_shawl_2', 1, self.TABLE_OBJECTS_OPACITY_TIME)
	            end
	            
	            if id == 'winder' then
	                ObjectOpacity('layer_'..id, 1, self.TABLE_OBJECTS_OPACITY_TIME)
	            end
	            
	            if self.tools_dropped_count == 4 then
	                self.timer:Add( function()
	                                    ObjectVisible('area_click_zt_winder', true)
	                                end,
	                                self.TABLE_OBJECTS_OPACITY_TIME)
	            end
	        end
	    end
	    ---------------------
	    
	    local function on_drop_targetfortunetell_body(e)
	        on_drop_target_tools(e)
	        
	        if e.save then
	            ObjectVisible('area_drop_zt_fortunetell_head', true)
	        else
	            MakeSoundEntity('08a_drop_body'):PlaySound(false)
	            
	            self.timer:Add( function()
	                                ObjectVisible('area_drop_zt_fortunetell_head', true)
                                end,
                                self.TABLE_OBJECTS_OPACITY_TIME)
	        end
	    end
	    ---------------------
	    
	    local function on_drop_targetfortunetell_head(e)
	        on_drop_target_tools(e)
	        
	        if not e.save then
	            MakeSoundEntity('08a_drop_head'):PlaySound(false)
	        end
	    end
	    ---------------------
	    
	    local function on_drop_target_magic_ball(e)
	        on_drop_target_tools(e)
	        
	        if not e.save then
	            MakeSoundEntity('08a_drop_magic_ball'):PlaySound(false)
	        end
	    end
	    ---------------------
	    
	    local function on_drop_target_winder(e)
	        on_drop_target_tools(e)
	        
	        if not e.save then
	            MakeSoundEntity('08a_drop_winder'):PlaySound(false)
	        end
	    end
	    ---------------------
	    
	    local function on_click_winder(e)
	        ObjectVisible(e.target, false)
	        
	        if e.save then
	            ObjectOpacity('z_table_winder_in',   0)
	            ObjectOpacity('z_table_winder_in_2', 1)
	            
	            ObjectOpacity('z_table_fortunetell_body_in', 0)
                ObjectOpacity('z_table_fortunetell_head_in', 0)
                ObjectOpacity('z_table_magic_ball_in',       0)
                ObjectOpacity('z_table_shawl_2',             0)
	            
	            ObjectOpacity('z_table_drawer', 1)
	            ObjectOpacity('z_table_hammer', 1)
	            ObjectOpacity('layer_drawer',   1)
	            
	            self.anim_table:GetAnimation('idle'):SetVisible(true)
	            self.anim_table:GetAnimation('idle'):Rewind(true)
	            self.anim_table:PlayAnimation('magic_ball_idle')
	            
	            self.sound_magic_ball_idle = MakeSoundEntity('08a_magic_ball_idle')
                self.sound_magic_ball_idle:PlaySound(true)
                self.sound_magic_ball_idle:SetVolume(0.1)
	            
	            ObjectVisible('area_get_zt_hammer',  true)
                ObjectVisible('area_drop_zt_hammer', true)
	        else
	            local time = 0.5
	            ObjectOpacity('z_table_winder_in',   0, time)
	            ObjectOpacity('z_table_winder_in_2', 1, time)
	            
	            MakeSoundEntity('08a_click_winder'):PlaySound(false)
	            
	            self.mouseBlocker:Push()
	            self.timer:Add( function()
	                                ObjectOpacity('z_table_fortunetell_body_in', 0)
                                    ObjectOpacity('z_table_fortunetell_head_in', 0)
                                    ObjectOpacity('z_table_magic_ball_in',       0)
                                    ObjectOpacity('z_table_shawl_2',             0)
                                    
	                                self.anim_table:PlayAnimation('idle')
	                                MakeSoundEntity('08a_magic_ball_start'):PlaySound(false)
	                                
	                                self.timer:Add( function()
	                                                    self.anim_table:PlayAnimation('magic_ball_idle')
	                                                end,
	                                                1.5)
	                                
	                                self.timer:Add( function() 
                                                        local drawerOpenTime = 0.5
                                                        ObjectOpacity('z_table_drawer', 1, drawerOpenTime)
                                                        ObjectOpacity('z_table_hammer', 1, drawerOpenTime)
                                                        ObjectOpacity('layer_drawer',   1, drawerOpenTime)
                                                        
                                                        self.sound_magic_ball_idle = MakeSoundEntity('08a_magic_ball_idle')
                                                        self.sound_magic_ball_idle:PlaySound(true)
                                                        
                                                        self.timer:Add( function()
                                                                            self.mouseBlocker:Pop()
                                                                            ObjectVisible('area_get_zt_hammer',  true)
                                                                            ObjectVisible('area_drop_zt_hammer', true)
                                                                        end,
                                                                        drawerOpenTime)
                                                    end,
                                                    self.anim_table:GetAnimation('idle'):GetDuration())
	                            end,
	                            time)
	        end
	    end
	    ---------------------
	    
	    local function on_get_hammer(e)
	        local time = 0.1
	        
	        ObjectOpacity('z_table_hammer_drag', 1, time)
	        ObjectOpacity('z_table_hammer',      0, time)
	    end
	    ---------------------
	    
	    local function on_drop_hammer(e)
	        local time = 0.1
	        
	        self.timer:Add( function()
                                ObjectOpacity('z_table_hammer_drag', 0, time)
                                ObjectOpacity('z_table_hammer',      1, time)
                            end,
                            e.time - time)
	    end
	    ---------------------
	    
	    local function on_drop_target_hammer(e)
	        ObjectVisible('area_get_zt_hammer',  false)
            ObjectVisible('area_drop_zt_hammer', false)
	                                                    
	        ObjectOpacity('z_table_hammer_drag', 0)
            ObjectOpacity('z_table_hammer',      0)
            
            ObjectOpacity('layer_magic_ball',       0)
            ObjectOpacity('layer_magic_ball_break', 1)
            
            self.anim_table:StopAnimation('magic_ball_idle')
            self.anim_table:GetAnimation('idle'):GetElementByName('Layer_4'):SetOpacity(0)
            
            local compos = self.anim_table:GetAnimation('magic_ball_crash')
            compos:SetVisible(true)
            
            self.sound_magic_ball_idle:StopSound()
            
            if e.save then
                compos:Rewind(true)
                ObjectVisible('area_find_zt_doctor_key', true)
            else
                compos:Play()
                MakeSoundEntity('08a_drop_target_hammer'):PlaySound(false)
                
                self.timer:Add( function()  
                                    ObjectVisible('area_find_zt_doctor_key', true)
                                end,
                                1) --compos:GetDuration())
            end
	    end
	    ---------------------
	    
	    local function on_find_doctor_key(e)
	        
	    end
	    ---------------------
	    
	    RegisterMonologObject('area_hint_zt_need_poster', 'BBT_08A_NEED_POSTER')
	    RegisterToolApplyInfo('08_fortunetell_body', 'area_apply_zt_tools', on_apply_tools, on_click_apply_tools_area)
	    RegisterToolApplyInfo('08_fortunetell_head', 'area_apply_zt_tools', on_apply_tools, on_click_apply_tools_area)
	    RegisterToolApplyInfo('08_magic_ball',       'area_apply_zt_tools', on_apply_tools, on_click_apply_tools_area)
	    RegisterToolApplyInfo('08_winder',           'area_apply_zt_tools', on_apply_tools, on_click_apply_tools_area)
	    
	    RegisterDragObject('z_table_fortunetell_body', 'area_get_zt_fortunetell_body', 'area_drop_zt_fortunetell_body', on_get_fortunetell_body, on_drop_fortunetell_body, on_drop_targetfortunetell_body, nil, true)
	    RegisterDragObject('z_table_fortunetell_head', 'area_get_zt_fortunetell_head', 'area_drop_zt_fortunetell_head', on_get_fortunetell_head, on_drop_fortunetell_head, on_drop_targetfortunetell_head, nil, true)
	    RegisterDragObject('z_table_magic_ball',       'area_get_zt_magic_ball',       'area_drop_zt_magic_ball',       on_get_magic_ball,       on_drop_magic_ball,       on_drop_target_magic_ball,      nil, true)
	    RegisterDragObject('z_table_winder',           'area_get_zt_winder',           'area_drop_zt_winder',           on_get_winder,           on_drop_winder,           on_drop_target_winder,          nil, true)
	    
	    RegisterActiveObject('area_click_zt_winder', on_click_winder)
	    
	    RegisterDragObject('z_table_hammer_drag', 'area_get_zt_hammer', 'area_drop_zt_hammer', on_get_hammer, on_drop_hammer, on_drop_target_hammer, nil, true)
	    RegisterToolFindInfo('08_doctor_key', 'area_find_zt_doctor_key', on_find_doctor_key)
	end
end

function l_08a_street_pavilion:OnUpdate(dt)
end

function l_08a_street_pavilion:OnAllItemsFound()
end

function l_08a_street_pavilion:OnObjectMouseEnter(object)
end

function l_08a_street_pavilion:OnObjectMouseLeave(object)
    self.piano.onObjectMouseUp()
end

function l_08a_street_pavilion:OnScreenObjectMouseDown(object, key)
    self.piano.onObjectMouseDown(object)
end

function l_08a_street_pavilion:OnObjectMouseDownProcessed(is_wrong_click)
end

function l_08a_street_pavilion:OnMouseMove(previous_pos, current_pos)
end

function l_08a_street_pavilion:OnObjectMouseUp(object)
    self.piano.onObjectMouseUp(object)
end

function l_08a_street_pavilion:OnObjectFound(object)
end

function l_08a_street_pavilion:OnToolFound(tool)
end

function l_08a_street_pavilion:OnToolApply(tool, object)
end

function l_08a_street_pavilion:OnToolAddToInventory(tool)
end

function l_08a_street_pavilion:OnObjectReachPanel(object)
end

function l_08a_street_pavilion:OnButtonPress(title)
end

function l_08a_street_pavilion:OnSetTool(tool)
end

function l_08a_street_pavilion:OnLoaded()
end

function l_08a_street_pavilion:OnDestroy()
end

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function l_08a_street_pavilion:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/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_08',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_clown',anim,817,383,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_hat',anim,263,128,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_chest',anim,207,486,100,0,1.6,1.16)
	
	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_box',anim,576,409,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,380,364,100,0,2.31,0.8)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_chest_open.png',0,0,204,134,1,0)
	anim:SetHotSpot(102,67)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_chest_open',anim,196,462,51,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_fortunetell_body.png',0,0,32,36,1,0)
	anim:SetHotSpot(16,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_fortunetell_body',anim,296,350,51,270,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_fortunetell_head.png',0,0,30,28,1,0)
	anim:SetHotSpot(15,14)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_fortunetell_head',anim,300,375,52,-29,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_hat.png',0,0,83,107,1,0)
	anim:SetHotSpot(41,53)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_hat',anim,255,143,52,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_magic_ball_1.png',0,0,23,23,1,0)
	anim:SetHotSpot(11,11)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_magic_ball_1',anim,265,147,51,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_magic_ball_2.png',0,0,32,24,1,0)
	anim:SetHotSpot(16,12)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_magic_ball',anim,456,360,53,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_click_chest',anim,207,486,100,0,1.6,1.14)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_drawer.png',0,0,90,50,1,0)
	anim:SetHotSpot(45,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_drawer',anim,354,372,54,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_magic_ball_break.png',0,0,46,34,1,0)
	anim:SetHotSpot(23,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_magic_ball_break',anim,396,342,54,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/08a_street_pavilion/main/layers/layer_winder.png',0,0,32,22,1,0)
	anim:SetHotSpot(16,11)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('layer_winder',anim,415,366,54,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
