-------------------------------------------------------------------------------
class 'CPanel' (BaseScreen)

local PANEL_MG_TOP_Y    = 711
local PANEL_MG_BOTTOM_Y = 780

local PANEL_HO_TOP_Y    = 710
local PANEL_HO_BOTTOM_Y = 827

-- black bar constants
--  [ HEIGHT of BLACK_BAR plates must be >= BLACK_BAR_SHOW_Y + BLACK_BAR_MOMENTUM_DY ]
local BLACK_BAR_MOMENTUM_DY = 5
local BLACK_BAR_SHOW_Y      = 32-BLACK_BAR_MOMENTUM_DY
local BLACK_BAR_HIDE_Y      = -50

local MOVE_MINIGAME_HELP_TIME  = 0.4
local HIDE_MINIGAME_HELP_DELAY = 1
local HIDE_MINIGAME_HELP_FIRST_DELAY = 8

START_HINT_TIMER     = 10
START_MINIGAME_TIMER = 20
HINT_TIME_FACTORS = {[CASUAL_MODE] = 1, [ADVANCED_MODE] = 2, [HARD_MODE] = 4}

if IsDebugMode() then
    START_HINT_TIMER     = START_HINT_TIMER / 20
    START_MINIGAME_TIMER = START_MINIGAME_TIMER / 20
end
-----------------------------------------------------------------------------------

function CPanel:__init(name, screen)
    self.screen = screen
	BaseScreen.__init(self, name, screen)
	
	screen:GetObject('fade'):Hide()
	screen:SetLayer(2)

    self.timer = Timer()
    
    self.hint_time              = 0
    self.prevMode               = EPanelMode.PM_NONE
    self.mode                   = EPanelMode.PM_NONE
    self.bMinigameHelpOpen      = false
    self.bMinigameHelpAnimating = false
    self.bMinigameWasShown      = false
    self.blackBarEff            = nil
    self.bDogOver               = false
    
    self:GetObject('OpenNotesAnim'):GetAnimation():Stop()
    
    local menu_button
    local notebook_button
    local hint_button
    local skip_button
    local comics_skip_button
    local strategy_guide_button
    
    -- main buttons
    do
        menu_button = self:CreateButton('bttn_menu', 'Menu')
        menu_button:SetAction('OnMenuButtonClick', self)
        menu_button:SetActionSound("Menu_button_click")
        menu_button:SetKeyEquivalent(KEY_ESCAPE)
        
        notebook_button = self:CreateButton('bttn_note', 'Notes')
        notebook_button:SetAction('OnNotesButtonClick', self)
        notebook_button:SetActionSound("Menu_button_click")
        
        self.hint_button_rect = {x=980,
                                 y=630,
                                 w=50,
                                 h=105}
                                 
        hint_button = self:CreateButton('bttn_hint', 'Hint')
        hint_button:SetAction('OnHintButtonClick', self)
        hint_button:SetActionSound("Menu_button_click")
        hint_button:UseRectAndTextureTestpoint(true)
        
        skip_button = self:CreateButton('bttn_skip', 'Skip')
        skip_button:SetAction('OnSkipButtonClick', self)
        skip_button:SetActionSound("Menu_button_click")
        
        comics_skip_button = self:CreateButton('bttn_comics_skip', 'SkipComics')
        comics_skip_button:SetAction('OnSkipComicsButtonClick', self)
        comics_skip_button:UseRectAndTextureTestpoint(true)
    end
	
	-- strategy guide button
	if IsFileExists(BUTTON_PANEL_STRATEGY_GUIDE_FILE_NAME) then
	    anim = CreateAnimation(BUTTON_PANEL_STRATEGY_GUIDE_FILE_NAME,0,0,88,40,3,0)
	    anim:SetHotSpot(44,20)
	    anim:SetBlendMode(2)
	    anim:SetColor('0xFFFFFFFF')
	    screen:CreateObject('bttn_strategy_guide',anim,39,750,410,0,1,1)
	
        strategy_guide_button = self:CreateButton('bttn_strategy_guide', 'Strategy')
        strategy_guide_button:SetAction('OnStrategyGuideButtonClick', self)
        strategy_guide_button:SetActionSound("Menu_button_click")
        
        if not IsCollectorsEdition() then
            strategy_guide_button:SetVisible(false)
            strategy_guide_button:SetActive(false)
        end
    end
    
--[[ voloshin
    local collection_button = self:CreateButton('bttn_collection', 'Collection')
    collection_button:SetAction('OnCollectionButtonClick', self)
    Helpers.AttachInPlace(self:GetObject('FishFinAnim'), collection_button)
--]]
    
    do
        local obj  = self:GetObject('skip_button_cover')
        local tmpl = self:GetObject('bttn_comics_skip')
        obj:SetScaleX( tmpl:GetAnimation():GetWidth()  / 8)
        obj:SetScaleY( tmpl:GetAnimation():GetHeight() / 8)
        obj:SetXY(tmpl:GetX(), tmpl:GetY())
        obj:SetVisible(false)
    end
    
    self.buttons = {}
    self.buttons.comics_skip_button    = comics_skip_button
    self.buttons.notebook_button       = notebook_button
    self.buttons.strategy_guide_button = strategy_guide_button
    self.buttons.menu_button           = menu_button
    self.buttons.hint_button           = hint_button
    self.buttons.skip_button           = skip_button
    --self.buttons.collection_button     = collection_button
    
    self.mg_help = CreateTextEntity(COMICS_FONT, '')
    self.mg_help:AttachTo(screen:GetObject('panel_mg'))
    self.mg_help:SetTextAlignment(HGETEXT_CENTER + HGETEXT_MIDDLE)
    self.mg_help:SetBorderSize(620, 60)
    self.mg_help:SetXY(0, 2)
    self.mg_help:SetZ(1)
    self.mg_help:SetSpacing(0.8)
    --self.mg_help:SetTracking(0)
    self.mg_help:SetScale(0.5)
	self.mg_help:SetAutoScale(true)
    
    --[[
	self.collection_te = CreateTextEntity(COLLECTION_FONT, '')
	self.collection_te:AttachTo( screen )
	self.collection_te:SetScrXY(80, 752)
	self.collection_te:SetZ(450)
	self.collection_te:SetText('33/33')
    ]]
    
    local dialogHeight = self:GetObject('dialog'):GetAnimation():GetHeight()-4
    self.dialog_bottom_y = SCR_H + (dialogHeight/2)
    self.dialog_top_y    = SCR_H - (dialogHeight/2)
    
    local ctc_parent = self:GetObject('dialog')
    local ctc_right  = self:GetObject('dialog'):GetAnimation():GetWidth() / 2 - 20
    
    local ctc_text = CreateTextEntity(MENU_FONT, 'CLICK_TO_CONTINUE')
    ctc_text:SetTextAlignment(HGETEXT_TOP + HGETEXT_LEFT)
	ctc_text:SetScale(0.4)
    ctc_text:AttachTo( ctc_parent )
	ctc_text:SetXY(ctc_right - ctc_text:GetWidth(), 55)
	ctc_text:SetZ(1)
	
	self.comicsCtcText = ctc_text
    self:GetObject('black_bar'):SetY(BLACK_BAR_HIDE_Y)
    
    -- dog animations
    do
        self.dog = {}
        self.dog.anims = {}
        
        local x = self:GetObject('cover_dog'):GetX()
        local y = self:GetObject('cover_dog'):GetY()
        
        do
            self.dog.anims.bark = self:GetObject('anim_dog_bark')
            self.dog.anims.bark:GetAnimation():SetMode(HGEANIM_FWD + HGEANIM_NOLOOP)
            self.dog.anims.bark:GetAnimation():Stop()
            self.dog.anims.bark:SetXY(x, y)
            self.dog.anims.bark:SetOpacity(0)
        end
        
        do
            self.dog.anims.sniff = self:GetObject('anim_dog_sniff')
            self.dog.anims.sniff:GetAnimation():SetMode(HGEANIM_FWD + HGEANIM_LOOP)
            self.dog.anims.sniff:GetAnimation():Stop()
            self.dog.anims.sniff:SetXY(x, y)
            self.dog.anims.sniff:SetOpacity(0)
        end
        
        do
            self.dog.anims.idle = CreateVideoEntity('data/Texture/GUI/Panel/video/dog_idle.ogg', '', true)
            self.dog.anims.idle:SetZ(281)
            self.dog.anims.idle:SetXY(x, y)
            self.dog.anims.idle:SetLoop(true)
            self.dog.anims.idle:SetHideOnStop(true)
            --self.dog.anims.idle:PlayVideo()
        end
        
        do
            self.dog.anims.idle2 = CreateVideoEntity('data/Texture/GUI/Panel/video/dog_idle2.ogg', '', true)
            self.dog.anims.idle2:SetZ(281)
            self.dog.anims.idle2:SetXY(x, y-2)
            self.dog.anims.idle2:SetLoop(true)
            self.dog.anims.idle2:SetHideOnStop(true)
            --self.dog.anims.idle2:PlayVideo()
        end
    end
    
    -- attach
    do
        local rightPlate = screen:GetObject('plate_right')
        local leftPlate  = screen:GetObject('plate_left')
        
        Helpers.AttachInPlace(menu_button,       leftPlate)
        Helpers.AttachInPlace(notebook_button,   leftPlate)
        Helpers.AttachInPlace(hint_button,       rightPlate)
        Helpers.AttachInPlace(skip_button,       rightPlate)
        --Helpers.AttachInPlace(collection_button, leftPlate)
        
        hint_button:SetRect(980, 630, 50, 105)
        
        if self.buttons.strategy_guide_button then
            Helpers.AttachInPlace(strategy_guide_button, leftPlate)
        end
        
        Helpers.AttachInPlace(screen:GetObject('anim_candle_fire'), leftPlate)
        Helpers.AttachInPlace(screen:GetObject('OpenNotesAnim'),    leftPlate)
        Helpers.AttachInPlace(screen:GetObject('book_glow'),        leftPlate)
        
        Helpers.AttachInPlace(screen:GetObject('hint_sandglass'),   rightPlate)
        Helpers.AttachInPlace(screen:GetObject('hint_sand_bottom'), rightPlate)
        Helpers.AttachInPlace(screen:GetObject('hint_sand_top'),    rightPlate)
        Helpers.AttachInPlace(screen:GetObject('hint_glow_anchor'), rightPlate)
        Helpers.AttachInPlace(screen:GetObject('anim_hint_reset'),  rightPlate)
        Helpers.AttachInPlace(screen:GetObject('cover_dog'),        rightPlate)
        
        Helpers.AttachInPlace(self.dog.anims.bark,  rightPlate)
        Helpers.AttachInPlace(self.dog.anims.sniff, rightPlate)
        Helpers.AttachInPlace(self.dog.anims.idle,  rightPlate)
        Helpers.AttachInPlace(self.dog.anims.idle2, rightPlate)
        
        Helpers.AttachInPlace(screen:GetObject('hint_glow'),    screen:GetObject('hint_glow_anchor'))
        Helpers.AttachInPlace(screen:GetObject('title_ho_txt'), screen:GetObject('panel_ho'))
        Helpers.AttachInPlace(screen:GetObject('title_mg_txt'), screen:GetObject('panel_mg'))
    end
    
    self:IgnoreOnTestPoint('HighlightingNotes')
    self:IgnoreOnTestPoint('OpenNotesAnim')
    self:IgnoreOnTestPoint('hint_sandglass')
    self:IgnoreOnTestPoint('hint_sand_bottom')
    self:IgnoreOnTestPoint('hint_sand_top')
    self:IgnoreOnTestPoint('hint_glow_anchor')
    self:IgnoreOnTestPoint('hint_glow')
    self:IgnoreOnTestPoint('title_ho_txt')
    self:IgnoreOnTestPoint('title_mg_txt')
    self:IgnoreOnTestPoint('black_bar')
    self:IgnoreOnTestPoint('book_glow')
    
    do
        local obj = screen:GetObject('anim_hint_reset')
        obj:GetAnimation():SetMode(HGEANIM_FWD + HGEANIM_NOLOOP)
        obj:GetAnimation():Stop()
        obj:SetOpacity(0)
    end

	self:GetObject('book_glow'      ):SetOpacity(0)
    self:GetObject('OpenNotesAnim'  ):SetOpacity(0)
	self:GetObject('panel_mg'       ):SetOpacity(0)
	
	self:SetSkipComicsButtonVisible(false)
	
	local tableAchors = {{'plate_left', 1}, {'plate_right', -1}}
	self.Achors = {}
	for i,v in pairs(tableAchors) do
	    local Name = v[1]
	    local Obj = screen:GetObject(Name)
	    
	    self.Achors[Name] = {Entity = Obj}
	    self.Achors[Name].StartPos = {x = Obj:GetX(),  y = Obj:GetY()}
	    self.Achors[Name].Direction = v[2]
	end
	
	self.GUIIsVisible = true
	
	-- create effector hitn glow -------------------------------------------------
	do
        local time = 1
        local eff  = CreateAnimationEffector()
        eff:AttachTo(self:GetObject('hint_glow'))
        eff:SetMode(_ANIM_LOOP)
        eff:SetKey(_TRACK_O, 0,          0.5)
        eff:SetKey(_TRACK_O, time * 0.5, 1)
        eff:SetKey(_TRACK_O, time,       0.5)
        eff:Play()
    end
end
-------------------------------------------------------------------------------

function CPanel:OnSceneStart()
    if self.mode == EPanelMode.PM_HIDDENOBJECT then
        GetCurrentLevel().logic:GetIndicator():Fill()
    end
		    
    if GetCurrentLevel().mode == 'hidden_object' then
--[[
        local parchment = self:GetObject('parchment_ho_anim')
        local back      = self:GetObject('panel_ho')
        
        self:IgnoreOnTestPoint('parchment_ho_anim')
        Helpers.AttachInPlace(parchment, back)

        local parchment_anim = parchment:GetAnimation()
        parchment_anim:Stop()
        parchment_anim:SetMode(HGEANIM_NOLOOP)

        if IsSceneVisited(GetCurrentLevel().name) then
            parchment_anim:SetFrame(parchment_anim:GetFrames() - 1)
            parchment_anim:Stop()
            self:SetTaskListVisible(true)
        else
            local delay = 0.5
            self.timer:Add(bind(parchment_anim.Play, parchment_anim), delay)
            self.timer:Add(bind(self.SetTaskListVisible, self, true, true), delay + GetAnimationLength(parchment_anim))
        end
]]
    end
end
-------------------------------------------------------------------------------

function CPanel:OnMenuButtonClick()
    local level = GetCurrentLevel()
    
    if level.obj_punish and level.obj_punish:IsVisible() then
        return
    end
    
    CreateInGameMenu()
end
-----------------------------------------------------------------------------------

function CPanel:OnHintButtonClick()
	if Hint() then
	    self:ResetHint()
    else
        local index = math.random(5)
        ShowBlackBar('C_NOTHING_TO_DO_'..index)
    end
end
-----------------------------------------------------------------------------------

function CPanel:OnSkipButtonClick()
    if self:GetHintTime() <= 0 then
        local mode = (self.prevMode == nil) and EPanelMode.PM_QUEST
                                             or self.prevMode
        
        self:SetMode(mode)
        GetCurrentLevel():DefaultSkipMiniGame()
        
        PlaySound('Menu_button_click')
    end
end
-----------------------------------------------------------------------------------

function CPanel:OnNotesButtonClick(bIgnoreMouseBlocker)
    if (self.bIgnoreMouseBlockerForNotebook or bIgnoreMouseBlocker or not IsMouseBlocked()) and self:GetMode() ~= EPanelMode.PM_CLEAN then
        self.buttons.notebook_button:SetActive(false)
        
        if self:GetObject('OpenNotesAnim'):GetOpacity() > 0 then
            self.buttons.notebook_button:SetActive(true)
            self.buttons.notebook_button:SetOpacity(0)
                                
            CreateNotesScreen()
        else
            local additional_offset = 0
            
            if HasGameState('NotebookActive') then
                additional_offset = .2
                
                self.eff_add_note:Destroy()
                self.eff_add_note = nil
                
                local glowObject = self:GetObject('book_glow')
                glowObject:ChangeOpacity(glowObject:GetOpacity(), 0, additional_offset)
            end
            
            self.timer:Add( function()
                                self.buttons.notebook_button:SetActive(true)
                                self.buttons.notebook_button:SetOpacity(0)
                                
                                self:GetObject('OpenNotesAnim'):GetAnimation():SetColor('0xFFFFFFFF')
                                self:GetObject('OpenNotesAnim'):GetAnimation():SetMode(HGEANIM_NOLOOP + HGEANIM_FWD)
                                self:GetObject('OpenNotesAnim'):GetAnimation():Play()
                                
                                self:GetObject('OpenNotesAnim'):SetOpacity(1)
                                self:GetObject('book_glow'    ):SetOpacity(0)
                                
                                PlaySound('Diary_opening')
                            end,
                            additional_offset)
        
            local time_openning_book = GetAnimationLength(self:GetObject('OpenNotesAnim'):GetAnimation())
            self.NoteOpenTimer = self.timer:Add(function()
                                                    self.NoteOpenTimer = nil
                                                    CreateNotesScreen()
                                                end,
                                                time_openning_book + additional_offset)
        end
    end
end
-------------------------------------------------------------------------------

function CPanel:OnSkipComicsButtonClick()
    GetCurrentLevel().comics:Skip()
    PlaySound('Menu_button_click')
end
-------------------------------------------------------------------------------
--[[
function CPanel:ShowCollectionButton(do_show, duration)
	duration = duration or .5
	if do_show == nil then do_show = true end
	
	local state = GM:GetCurrPlayer().gameState
	
	if do_show then
		if state:HasState('MetaFishIsHidden') then
			state:RemoveState('MetaFishIsHidden')
		end
		self.buttons.collection_button:ChangeOpacity(0, 1, duration)
	else
		if not state:HasState('MetaFishIsHidden') then
			state:AddState('MetaFishIsHidden', 't')
		end
		self.buttons.collection_button:ChangeOpacity(1, 0, duration)
	end
end
--]]
-------------------------------------------------------------------------------
--[[
function CPanel:OnCollectionButtonClick()
    if IsMouseBlocked() or (GetCurrentLevel().active_zone and GetCurrentLevel().active_zone.mode==ZOOM_TYPE_INFO_WINDOW) then
        return
    end
    
    if HasGameState(HIGHLIGHT_FISH) then
		RemoveGameState(HIGHLIGHT_FISH)
	end
	
    local zone_fish = GetCurrentLevel().zone_fish
    zone_fish:Open()
end
--]]
-------------------------------------------------------------------------------

function CPanel:OnStrategyGuideButtonClick()
    if IsCollectorsEdition() and not GM:IsDemoMode() then
--        CreateStrategyGuideScreen(true)
    else
        if GetGameManager():IsDemoMode() then
            CreateOKScreen(GetString('SE_CLICK_ON_STRATEGY_GUIDE_DEMO_MODE'), nil, false)
        else
            CreateOKScreen(GetString('SE_CLICK_ON_STRATEGY_GUIDE'), nil, false)
        end
    end
end
-------------------------------------------------------------------------------

function CPanel:GetHintSkipButton()
    if self:GetMode() == EPanelMode.PM_MINIGAME then
        return self.buttons.skip_button
    end
    
    return self.buttons.hint_button
end
-------------------------------------------------------------------------------

function CPanel:GetStartMinigameHintTime()
    local hint_timer = START_MINIGAME_TIMER
    
    if IsAdvancedPlayMode() then
        hint_timer = hint_timer * HINT_TIME_FACTORS[ADVANCED_MODE]
    elseif IsHardPlayMode() then
        hint_timer = hint_timer * HINT_TIME_FACTORS[HARD_MODE]
    end
    
    return hint_timer
end
-------------------------------------------------------------------------------

function CPanel:GetStartHiddenObjectHintTime()
    local hint_timer = START_HINT_TIMER
    
    if IsAdvancedPlayMode() then
        hint_timer = hint_timer * HINT_TIME_FACTORS[ADVANCED_MODE]
    elseif IsHardPlayMode() then
        hint_timer = hint_timer * HINT_TIME_FACTORS[HARD_MODE]
    end
    
    return hint_timer
end
-------------------------------------------------------------------------------

function CPanel:GetSavedHiddenObjectHintTime()
    local state_name = GetCurrentLevel():GetHintTimerState()
    local hint_timer = 0
        
    if HasGameState(state_name) then
        hint_timer = tonumber(GetGameState(state_name):Get(0))
    end
    
    return hint_timer
end
-------------------------------------------------------------------------------

function CPanel:OnLostFocus()
end
-------------------------------------------------------------------------------

function CPanel:OnButtonPress(title)
end
-------------------------------------------------------------------------------

function CPanel:OnUpdate(dt)
	--if self:GetMode() == EPanelMode.PM_HIDDENOBJECT then
	--    self:UpdateActionTasksColor()
    --end
    
    do
        local hint_time = self:GetHintTime() - dt
        local obj       = self:GetObject('hint_glow_anchor')
        
        if hint_time <= 0 then
            hint_time = 0
        end
        self:SetHintTime(hint_time)
        
        if hint_time == 0 then
            obj:SetOpacity(obj:GetOpacity() + dt)
        else
            obj:SetOpacity(obj:GetOpacity() - dt)
        end
    end
    
    if not self.bMinigameOpen then
        local obj = self:GetObjectUnderMouse()
        
        if obj and obj:GetName() == 'panel_mg' then
            self:ShowMinigameHelp()
        end
    end
    
    local additionalLogic = GetCurrentLevel():GetAdditionalLogic()
    if additionalLogic then
        additionalLogic:OnPanelUpdate(dt)
    end
end
-------------------------------------------------------------------------------

function CPanel:GetMode()
    return self.mode
end
-------------------------------------------------------------------------------

function CPanel:SetMode(mode)
	local cur_mode = self:GetMode()
	
	if cur_mode ~= mode then
	    local gui_move_time = 0.35
		local gui_dx        = 240
		local dialog_dy     = self:GetObject('dialog'):GetAnimation():GetHeight()
		
		local function GUISetVisible(Value)
		    if self.GUIIsVisible ~= Value then
		        self.GUIIsVisible = Value
		        
                for Name, Anchor in pairs(self.Achors) do
                    Anchor.Entity:DestroyEffectors()
                    if Value then
                        Anchor.Entity:MoveTo(Anchor.StartPos.x, Anchor.StartPos.y, gui_move_time)
                    else
                        Anchor.Entity:MoveTo(Anchor.StartPos.x-gui_dx*Anchor.Direction, Anchor.StartPos.y, gui_move_time)
                    end
                    
                    self.timer:Add( function()
                                        self.buttons.hint_button:SetRect(self.hint_button_rect.x,
                                                                         self.hint_button_rect.y,
                                                                         self.hint_button_rect.w,
                                                                         self.hint_button_rect.h)
                                        
                                    end,
                                    gui_move_time + 0.1)
                end
		    end
		end
		
		local function MoveDialogTo(y)
		    local dialog = self:GetObject('dialog')
			dialog:MoveTo(dialog:GetX(), y, gui_move_time)
		end
		
		local function PanelChangeOpacity(obj_name, opacity, time)
		    local obj = self:GetObject(obj_name)
		    local eff = obj:ChangeOpacity(obj:GetOpacity(), opacity, time)
		    eff:SetDestroysOnEnd(true)
		end
		
		-- restore
		
        if cur_mode == EPanelMode.PM_COMICS then
            MoveDialogTo(self.dialog_bottom_y)
        end
		
		-- set new mode
		
		self.prevMode = self.mode
		self.mode     = mode
		
		if mode == EPanelMode.PM_COMICS then
			GUISetVisible(false)
			MoveDialogTo(self.dialog_top_y)
			PanelChangeOpacity('panel_mg', 0, gui_move_time)

            self:SetHintButtonVisible(false)
            self:SetSkipButtonVisible(false)
            GetCurrentLevel():GetInventoryLuaObject():Close()

		elseif mode == EPanelMode.PM_CLEAN then
			GUISetVisible(false)
			PanelChangeOpacity('panel_mg', 0, gui_move_time)
			
			local inv = GetCurrentLevel():GetInventoryLuaObject()
            if inv:GetTool() then
                inv:DropTool()
            end
            inv:Close()
			
			GetCurrentLevel().mode = 'clean'

		elseif mode == EPanelMode.PM_QUEST then
		    GUISetVisible(true)
			self:SetNotebookButtonVisible(true)
            self:SetHintButtonVisible(true)
            self:SetSkipButtonVisible(false)
            
			self:GetObject('panel_ho'):Hide()
			PanelChangeOpacity('panel_mg', 0, gui_move_time)
			
			GetCurrentLevel():GetInventoryLuaObject():Open()
			GetCurrentLevel().mode = 'quest'

		elseif mode == EPanelMode.PM_HIDDENOBJECT then
		    GUISetVisible(true)
            self:SetNotebookButtonVisible(true)
            self:SetHintButtonVisible(true)
            self:SetSkipButtonVisible(false)
            
            self:GetObject('panel_ho'):Show()
            PanelChangeOpacity('panel_mg', 0, gui_move_time)
            
			GetCurrentLevel():GetInventoryLuaObject():Close(0)
            GetCurrentLevel().mode = 'hidden_object'
            
        elseif mode == EPanelMode.PM_HIDDENPICTURE then
            GUISetVisible(true)
            self:SetNotebookButtonVisible(true)
            self:SetHintButtonVisible(true)
            self:SetSkipButtonVisible(false)
            
            if cur_mode == EPanelMode.PM_MINIGAME then
			    --PanelChangeOpacity('panel_ho', 1, gui_move_time)
			    self:MoveHOPanelTo(PANEL_HO_TOP_Y, gui_move_time)
			else
			    self:GetObject('panel_ho'):Show()
		    end
		    
            PanelChangeOpacity('panel_mg', 0, gui_move_time)
			GetCurrentLevel():GetInventoryLuaObject():Close(0)
            GetCurrentLevel().mode = 'hidden_picture'

		elseif mode == EPanelMode.PM_MINIGAME then
		    GUISetVisible(true)
			self:SetNotebookButtonVisible(true)
            self:SetHintButtonVisible(false)
            self:SetSkipButtonVisible(true)
			
			if cur_mode == EPanelMode.PM_HIDDENPICTURE then
			    --PanelChangeOpacity('panel_ho', 0, gui_move_time)
			    self:MoveHOPanelTo(PANEL_HO_BOTTOM_Y, gui_move_time)
			else
			    self:GetObject('panel_ho'):Hide()
		    end
		    
			PanelChangeOpacity('panel_mg', 1, gui_move_time)
			GetCurrentLevel():GetInventoryLuaObject():Close()
			
			self:SetHintTime(self:GetStartMinigameHintTime())
			
			local time = (cur_mode == EPanelMode.PM_MINIGAME) and 0 or nil
			
			if GetCurrentLevel().dont_show_halp_on_set_mg then
			    self:HideMinigameHelp(time)
			else
			    self:ShowMinigameHelp(time)
		    end
			
			local mgHelpText
			local activeZone = GetActiveZone()
			
			if activeZone and activeZone.mgHelpText then
			    mgHelpText = activeZone.mgHelpText
		    else
		        mgHelpText = GetCurrentLevel().name
                mgHelpText = string.sub(mgHelpText, 3)
                mgHelpText = 'HELP_'..string.upper(mgHelpText)
			end
			
			self.mg_help:SetText(GetString(mgHelpText))
			GetCurrentLevel().mode = 'mini_game'
		end
	end
end
-----------------------------------------------------------------------------------

function CPanel:SetHintButtonVisible(visible)
    local bttn = self.buttons.hint_button
    
    if visible then
        bttn:Show()
    else
        bttn:Hide()
    end
end
-----------------------------------------------------------------------------------

function CPanel:SetSkipButtonVisible(visible)
    local bttn = self.buttons.skip_button
    
    if visible then
        bttn:Show()
    else
        bttn:Hide()
    end
end
-----------------------------------------------------------------------------------

function CPanel:SetSkipComicsButtonVisible(visible)
    local bttn = self.buttons.comics_skip_button
    
    if visible then
        bttn:Show()
    else
        bttn:Hide()
    end
    
    self:GetObject('skip_button_cover'):SetVisible(visible)
end
-----------------------------------------------------------------------------------

function CPanel:ResetHint()
    self.buttons.hint_button:SetActive(false)
    self:GetObject('hint_sand_top'   ):SetOpacity(0)
    self:GetObject('hint_sand_bottom'):SetOpacity(0)
    self:GetObject('hint_sandglass'  ):SetOpacity(0)
    self:GetObject('hint_glow_anchor'):SetOpacity(0)
    
    local obj = self:GetObject('anim_hint_reset')
    local time = GetAnimationLength(obj:GetAnimation())
    
    obj:GetAnimation():Play()
    obj:SetOpacity(1)
    
    self.timer:Add( function()
                        obj:SetOpacity(0)
                        self:GetObject('hint_sand_top'   ):SetOpacity(1)
                        self:GetObject('hint_sand_bottom'):SetOpacity(1)
                        self:GetObject('hint_sandglass'  ):SetOpacity(1)
                        self.buttons.hint_button:SetActive(true)
                        
                        self:SetHintTime(self:GetStartHiddenObjectHintTime())
                    end,
                    time)
end
-----------------------------------------------------------------------------------

function CPanel:GetHintTime()
    return self.hint_time
end
-----------------------------------------------------------------------------------

function CPanel:SetHintTime(time)
    self.hint_time = time
    
    local mode = self:GetMode()
    
    if mode == EPanelMode.PM_HIDDENOBJECT or mode == EPanelMode.PM_QUEST then
        self:SetHiddenObjectHintTime(time)
    elseif mode == EPanelMode.PM_MINIGAME then
        self:SetMinigameHintTime(time)
    end
end
-------------------------------------------------------------------------------

function CPanel:SetHintObjectRectByTime(obj, timeScale, bInvert)
    local x, y, w, h = Helpers.GetObjectScrRect( obj )
    
    if timeScale > 0 then
        local th = (bInvert) and (h * (1-timeScale)) or (h * timeScale)
        obj:SetClippingRect(x, y + th, w, h-th)
    else
        if bInvert then
            obj:SetClippingRect(x, h, w, 0)
        else
            obj:SetClippingRect(0, 0, 0, 0)
        end
    end
end
-------------------------------------------------------------------------------

function CPanel:SetHiddenObjectHintTime(time)
    local start_time = self:GetStartHiddenObjectHintTime()
    local timeScale  = time / start_time
    
    self:SetHintObjectRectByTime(self:GetObject('hint_sand_bottom'), timeScale)
    self:SetHintObjectRectByTime(self:GetObject('hint_sand_top'),    timeScale, true)
    
    local bttn = self:GetHintSkipButton()
    if time > 0 then
        bttn:Stop()
    else
        bttn:Go()
    end
    
    SetGameState(GetCurrentLevel():GetHintTimerState(), tostring(self.hint_time))
end
-----------------------------------------------------------------------------------

function CPanel:SetMinigameHintTime(time)
    local start_time = self:GetStartMinigameHintTime()
    local timeScale  = time / start_time
    
    self:SetHintObjectRectByTime(self:GetObject('hint_sand_bottom'), timeScale)
    self:SetHintObjectRectByTime(self:GetObject('hint_sand_top'),    timeScale, true)
    
    local bttn = self:GetHintSkipButton()
    if time > 0 then
        bttn:Stop()
    else
        bttn:Go()
    end
end
-------------------------------------------------------------------------------

function CPanel:OnObjectMouseEnter(object)
    local logic   = GetCurrentLevel():GetAdditionalLogic()
    local objName = object:GetName()
    
    if objName == 'plate_left' then
        --[[
		self.fish_timer:Clear()
		self.fish_timer:Add(function() self.buttons.collection_button:Show() end, 1)
		--]]
	end
	
	if objName == 'area_dog' then
	    self.bDogOver = true
	end
    
    if logic then
        logic:OnPanelObjectMouseEnter(object)
    end
end
-------------------------------------------------------------------------------

function CPanel:OnObjectMouseLeave(object)
    local logic   = GetCurrentLevel():GetAdditionalLogic()
    local objName = object:GetName()
    
    --[[
    if object:GetName() == 'plate_left' and HasGameState(HIGHLIGHT_FISH) then
		self:CycleFinAnimation()
	end
	--]]
	
	if objName == 'area_dog' then
	    self.bDogOver = false
	end
    
    if logic then
        logic:OnPanelObjectMouseLeave(object)
    end
end
-------------------------------------------------------------------------------

function CPanel:OnScreenObjectMouseDown(object)
    local level = GetCurrentLevel()
    local additionalLogic = level:GetAdditionalLogic()
        
    DropObjectRequest(nil, false)
    
    if additionalLogic then
        additionalLogic:OnPanelObjectMouseDown(object)
    end
    
    if not IsMouseBlocked() then
        if level.mode == 'hidden_object'
            and IsAboveReturnFromZoomZone()
            and (not additionalLogic:IsAllTaskObjectsFound())
        then
            SetCursor('CursorDefault')
            level:OnClose()
        end
        
        if object:GetName() == 'panel_mg' and not self.bMinigameHelpAnimating then 
            self:HideMinigameHelp(nil, true)
        end
    end
    
    -- TODO: voloshin
    --[[
    if (not object or object:GetName() ~= 'skip_button_cover') and
       ( (not IsMouseBlocked()) or
         ( IsMouseBlocked() and level.comics and (not level.comics.IsMonolog()) ) 
       )
    then
        UpdateComicsRequest()
    end
    --]]
    
    if (not object) or (object:GetName() ~= 'skip_button_cover') then
        if not IsMouseBlocked() then
            HideBlackBar()
        end
        
        UpdateComicsRequest()
    end
    
    if self.dog.bIgnoreClickDogArea then
        self.dog.bIgnoreClickDogArea = nil
    else
        if self.bDogOver then
            self:InteractDog()
        end
    end
end
-----------------------------------------------------------------------------------

function CPanel:IsDogOver()
    return self.bDogOver
end
-----------------------------------------------------------------------------------

function CPanel:MoveHOPanelTo(targetY, time)
    local obj = self:GetObject('panel_ho')
    
    time = time or 0
    
    if self.moveHOPanelEffector then
        self.moveHOPanelEffector:Destroy()
        self.moveHOPanelEffector = nil
    end
    
    if time == 0 then
        obj:SetY(targetY)
    else
        self.moveHOPanelEffector = CreateAnimationEffector()
        self.moveHOPanelEffector:AttachTo(obj)
        self.moveHOPanelEffector:SetDestroysOnEnd(false)
        self.moveHOPanelEffector:SetKey(_TRACK_Y, 0,    obj:GetY())
        self.moveHOPanelEffector:SetKey(_TRACK_Y, time, targetY)
        self.moveHOPanelEffector:Play()
    end
end
-----------------------------------------------------------------------------------

function CPanel:ShowMinigameHelp(time)
    if self.bMinigameHelpAnimating then
        return
    end
    
    if self.bMinigameHelpOpen then
        return
    end
    
    self.bMinigameHelpOpen = true
    time  = time  or MOVE_MINIGAME_HELP_TIME
    delay = (self.bMinigameWasShown) and HIDE_MINIGAME_HELP_DELAY
                                      or HIDE_MINIGAME_HELP_FIRST_DELAY
    self.bMinigameWasShown = true
    
    local obj = self:GetObject('panel_mg')
    
    if time == 0 then
        obj:SetY(PANEL_MG_TOP_Y)
    else
        local dy  = PANEL_MG_TOP_Y - obj:GetY()
        local dir = (dy ~= 0) and dy/math.abs(dy) or 0
        local momentumY = 3
        
        local eff = CreateAnimationEffector()
        eff:SetDestroysOnEnd(true)
        eff:SetMode(_ANIM_NOLOOP)
        eff:AttachTo(obj)
        eff:SetKey(_TRACK_Y, 0,         PANEL_MG_BOTTOM_Y)
        eff:SetKey(_TRACK_Y, time*0.7,  PANEL_MG_TOP_Y - momentumY*dir)
        eff:SetKey(_TRACK_Y, time,      PANEL_MG_TOP_Y)
        eff:Play()
        
        self.bMinigameHelpAnimating = true
        self.timer:Add( function()
                            self.bMinigameHelpAnimating = false
                        end,
                        time)
    end
    
    obj:Show()
    
    self.timer:Add( function()
                        self:HideMinigameHelp()
                    end,
                    delay)
end
-----------------------------------------------------------------------------------

function CPanel:HideMinigameHelp(time, ignoreOverCheck)
    if self.bMinigameHelpAnimating then
        return
    end
    
    time = time or MOVE_MINIGAME_HELP_TIME
    
    if self.helpCloseRequest then
		self.helpCloseRequest:Kill()
		self.helpCloseRequest = nil
	end
	
	if not ignoreOverCheck then
        local objUnderMouse = self:GetObjectUnderMouse()
        
        if objUnderMouse and objUnderMouse:GetName() == 'panel_mg' then
            self.helpCloseRequest = self.timer:Add( function()
                                                        self:HideMinigameHelp()
                                                    end,
                                                    HIDE_MINIGAME_HELP_DELAY)
            return
        end
    end
    
    local obj = self:GetObject('panel_mg')
    
    if time == 0 then
        obj:SetY(PANEL_MG_BOTTOM_Y)
        self.bMinigameHelpOpen = false
    else
        local eff = CreateAnimationEffector()
        eff:SetDestroysOnEnd(true)
        eff:AttachTo(obj)
        eff:SetKey(_TRACK_Y, 0,    obj:GetY())
        eff:SetKey(_TRACK_Y, time, PANEL_MG_BOTTOM_Y)
        eff:Play()
        
        self.bMinigameHelpAnimating = true
        self.timer:Add( function()
                            self.bMinigameHelpOpen = false
                            self.bMinigameHelpAnimating = false
                        end,
                        time)
    end
end
-----------------------------------------------------------------------------------

function CPanel:CanMinigameHide()
    return self:GetMode() == EPanelMode.PM_MINIGAME
       and self.bMinigameHelpOpen
       and not self.bMinigameHelpAnimating
end
-----------------------------------------------------------------------------------

function CPanel:SetBlackBarVisible(visible, time)
    local targetY = (visible) and BLACK_BAR_SHOW_Y or BLACK_BAR_HIDE_Y
    local obj     = self:GetObject('black_bar')
    
    if self.blackBarEff then
        self.blackBarEff:Destroy()
        self.blackBarEff = nil
    end
    
    if time == 0 then
        obj:SetY(targetY)
    else
        local momentumTime = time * ((visible) and 0.7 or 0.3)
        local momentumY    = BLACK_BAR_SHOW_Y + BLACK_BAR_MOMENTUM_DY
        
        local eff = CreateAnimationEffector()
        eff:SetMode(_ANIM_NOLOOP)
        eff:AttachTo(obj)
        eff:SetKey(_TRACK_Y, 0,            obj:GetY())
        eff:SetKey(_TRACK_Y, momentumTime, momentumY)
        eff:SetKey(_TRACK_Y, time,         targetY)
        eff:Play()
        
        self.blackBarEff = eff
    end
end
-----------------------------------------------------------------------------------

function CPanel:NoteAdded(save)
    if self:IsCanShowNote() then--and not HasGameState('NotebookActive') then
        local createAddNoteEffector = function()
            if self.eff_add_note then
                self.eff_add_note:Destroy()
            end
            
            local time = 1
            self.eff_add_note = CreateAnimationEffector()
            self.eff_add_note:AttachTo(self:GetObject('book_glow'))
            self.eff_add_note:SetMode(_ANIM_LOOP)
            self.eff_add_note:SetKey(_TRACK_O, 0,          0)
            self.eff_add_note:SetKey(_TRACK_O, time * 0.5, 1)
            self.eff_add_note:SetKey(_TRACK_O, time,       0)
            self.eff_add_note:Play()
        end
        
        if not save then
			PlaySound('Diary_add')
			
			if not HasGameState('NotebookActive') then
			    createAddNoteEffector()
			end
		else
		    createAddNoteEffector()
		end
    end
end
-------------------------------------------------------------------------------
function CPanel:IsCanShowNote()
    return self:GetMode() ~= EPanelMode.PM_CLEAN and self.screen:GetObject('OpenNotesAnim'):GetOpacity() == 0 
end
-------------------------------------------------------------------------------

function CPanel:SetNotebookButtonVisible(visible)
    self.buttons.notebook_button:SetVisible(visible)
    
    self:GetObject('book_glow'    ):SetVisible(visible)
    self:GetObject('OpenNotesAnim'):SetVisible(visible)
end
-----------------------------------------------------------------------------------

function CPanel:NoteClosed()
    local obj = self:GetObject('OpenNotesAnim')
    
    obj:GetAnimation():SetMode(HGEANIM_NOLOOP + HGEANIM_REV)
    obj:GetAnimation():Play()
	obj:SetOpacity(1)
	
	self.timer:Add( function()
	                    PlaySound('Diary_closing')
	                end,
	                0.25)
	
    self.NoteClosedTimer = self.timer:Add(  function()
                                                self.NoteClosedTimer = nil
                                                self:GetObject('OpenNotesAnim'):SetOpacity(0)
                                                self.buttons.notebook_button:SetOpacity(1)
                                            end,
                                            GetAnimationLength(obj:GetAnimation()))
end
-----------------------------------------------------------------------------------
--[[
function CPanel:UpdateCollectObjectsIndicator()
    local com = GetCurrentLevel().collectManager
    local found = com:GetFoundObjectsCount()
    local total = com:GetTotalObjectsCount()
    local text  = tostring(found)..'/'..tostring(total)
    
    self.collection_te:SetText(text)
end
--]]
-----------------------------------------------------------------------------------

function CPanel:SetActiveDogState(bActive)
    if self.dog.bActive ~= bActive then
        if bActive then
            self:_startActiveDog()
        else
            self:_stopActiveDog()
            self.dog.bIgnoreClickDogArea = true
        end
    end
end
-----------------------------------------------------------------------------------

function CPanel:_startActiveDog()
    if self.dog.interactAction then
        self.dog.interactAction:Kill()
        self.dog.interactAction = nil
        
        self.dog.anims.bark:GetAnimation():Stop()
    else
        self:StopIdleDog()
    end
    
    self.dog.anims.bark:SetOpacity(1)
    self.dog.anims.bark:GetAnimation():Play()
    PlaySound('dog_bark')
    
    self.dog.bActive = true
    self.dog.activeteAction = self.timer:Add(   function()
                                                    self.dog.activeteAction = nil
                                                    
                                                    self.dog.anims.bark:SetOpacity(0)
                                                    self.dog.anims.sniff:SetOpacity(1)
                                                    self.dog.anims.sniff:GetAnimation():Play()
                                                end,
                                                GetAnimationLength(self.dog.anims.bark:GetAnimation()))
end
-----------------------------------------------------------------------------------

function CPanel:_stopActiveDog()
    if self.dog.interactAction then
        self.dog.interactAction:Kill()
        self.dog.interactAction = nil
        
        self.dog.anims.bark:GetAnimation():Stop()
        self.dog.anims.bark:SetOpacity(0)
    end
    
    if self.dog.activeteAction then
        self.dog.activeteAction:Kill()
        self.dog.activeteAction = nil
        
        self.dog.anims.bark:GetAnimation():Stop()
        self.dog.anims.bark:SetOpacity(0)
    else
        self.dog.anims.sniff:GetAnimation():Stop()
        self.dog.anims.sniff:SetOpacity(0)
    end
    
    self.dog.bActive = false
    self:PlayIdleDog()
end
-----------------------------------------------------------------------------------

function CPanel:SetDogIcoVisible(visible)
    if visible then
        self:PlayIdleDog()
        self:GetObject('cover_dog'):SetOpacity(0)
        self:GetObject('area_dog' ):SetVisible(true)
        
        PlaySound('dog_ico_change')
    else
        self:StopIdleDog()
        self:GetObject('cover_dog'):SetOpacity(1)
        self:GetObject('area_dog' ):SetVisible(false)
    end
end
-----------------------------------------------------------------------------------

function CPanel:PlayIdleDog()
    self.dog.anims.idle2:StopVideo()
    self.dog.anims.idle:PlayVideo()
    
    local minTime = 5
    local maxTime = 15
    local time = minTime + math.random() * (maxTime - minTime)
    
    self.idleAction = self.timer:Add(function()
                                        self.idleAction = nil
                                        
                                        self.dog.anims.idle:StopVideo()
                                        self.dog.anims.idle2:PlayVideo()
                                        
                                        self.idleAction = self.timer:Add(function()
                                                                            self.idleAction = nil
                                                                            self:PlayIdleDog()
                                                                         end,
                                                                         self.dog.anims.idle2:GetDuration())
                                    end,
                                    time)
end
-----------------------------------------------------------------------------------

function CPanel:StopIdleDog()
    self.dog.anims.idle:StopVideo()
    self.dog.anims.idle2:StopVideo()
    
    if self.idleAction then
        self.idleAction:Kill()
        self.idleAction = nil
    end
end
-----------------------------------------------------------------------------------

function CPanel:InteractDog()
    if self.dog.activeteAction or self.dog.interactAction then
        return
    end
    
    if self.dog.bActive then
        self.dog.anims.sniff:SetOpacity(0)
        self.dog.anims.sniff:GetAnimation():Stop()
    else
        self:StopIdleDog()
    end
    
    self.dog.anims.bark:SetOpacity(1)
    self.dog.anims.bark:GetAnimation():Play()
    PlaySound('dog_bark')
    
    self.dog.interactAction = self.timer:Add(function()
                                                self.dog.interactAction = nil
                                                
                                                self.dog.anims.bark:GetAnimation():Stop()
                                                self.dog.anims.bark:SetOpacity(0)
                                                
                                                if self.dog.bActive then
                                                    self.dog.anims.sniff:GetAnimation():Play()
                                                    self.dog.anims.sniff:SetOpacity(1)
                                                else
                                                    self:PlayIdleDog()
                                                end
                                             end,
                                             GetAnimationLength(self.dog.anims.bark:GetAnimation()))
end
-----------------------------------------------------------------------------------

function CPanel:UpdateHintTimeByMode(currentPlayMode, previousPlayMode)
    local currentFactor  = HINT_TIME_FACTORS[currentPlayMode]
    local previousFactor = HINT_TIME_FACTORS[previousPlayMode]
    self.hint_time = self.hint_time * currentFactor / previousFactor
end
-----------------------------------------------------------------------------------

-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function CPanel:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/GUI/Panel/bttn/bttn_menu_txt.png',0,0,120,30,3,0)
	anim:SetHotSpot(60,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_menu',anim,100,660,400,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/bttn/bttn_note.png',0,0,142,104,3,0)
	anim:SetHotSpot(71,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_note',anim,96,718,281,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/bttn/bttn_hint_txt.png',0,0,106,30,3,0)
	anim:SetHotSpot(53,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_hint',anim,929,659,405,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/bttn/bttn_skip_txt.png',0,0,106,30,3,0)
	anim:SetHotSpot(53,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_skip',anim,929,659,406,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/bttn/bttn_skip_dialogue.png',0,0,168,45,3,0)
	anim:SetHotSpot(84,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_comics_skip',anim,934,30,433,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/plate_left.png',0,0,218,170,1,0)
	anim:SetHotSpot(109,85)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('plate_left',anim,109,683,280,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(2,3)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('plate_left_block',anim,46,683,174,0,23,17)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/plate_right.png',0,0,218,170,1,0)
	anim:SetHotSpot(109,85)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('plate_right',anim,915,683,280,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('plate_right_block',anim,960,696,174,0,24,18)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/panel_mg.png',0,0,760,118,1,0)
	anim:SetHotSpot(380,59)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('panel_ho',anim,513,710,290,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/panel_mg.png',0,0,760,118,1,0)
	anim:SetHotSpot(380,59)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('panel_mg',anim,513,710,350,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/comics_dialog.png',0,0,1012,169,1,0)
	anim:SetHotSpot(506,84)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('dialog',anim,512,849,5500,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/black_bar.png',0,0,1024,111,1,0)
	anim:SetHotSpot(512,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('black_bar',anim,511,33,100,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('skip_button_cover',anim,512,384,100,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/title_ho_txt.png',0,0,108,20,1,0)
	anim:SetHotSpot(54,10)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('title_ho_txt',anim,513,684,291,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/title_mg_txt.png',0,0,54,20,1,0)
	anim:SetHotSpot(27,10)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('title_mg_txt',anim,513,684,351,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/note/book_opening_anim.png',0,0,142,104,22,24)
	anim:SetHotSpot(71,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('OpenNotesAnim',anim,96,718,450,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/hint/hint_sandglass.png',0,0,80,150,1,0)
	anim:SetHotSpot(40,75)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('hint_sandglass',anim,984,694,281,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/animations/anim_candle_fire.png',0,0,30,54,48,24)
	anim:SetHotSpot(15,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('anim_candle_fire',anim,17,629,281,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/hint/hint_sand_bottom.png',0,0,26,30,1,0)
	anim:SetHotSpot(13,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('hint_sand_bottom',anim,1002,703,282,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/hint/hint_sand_top.png',0,0,26,26,1,0)
	anim:SetHotSpot(13,13)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('hint_sand_top',anim,1009,661,282,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/note/book_glow.png',0,0,142,104,1,0)
	anim:SetHotSpot(71,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('book_glow',anim,96,719,282,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/hint/hint_glow.png',0,0,58,114,1,0)
	anim:SetHotSpot(29,57)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('hint_glow',anim,995,680,283,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('0x00FFFFFF')
	screen:CreateObject('hint_glow_anchor',anim,1007,756,100,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/cover_dog.png',0,0,76,76,1,0)
	anim:SetHotSpot(38,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('cover_dog',anim,919,727,282,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/animations/anim_hint_reset.png',0,0,75,110,13,24)
	anim:SetHotSpot(37,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('anim_hint_reset',anim,986,683,300,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_dog',anim,919,725,283,0,0.8,0.8)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/animations/anim_dog_bark.png',0,0,82,80,12,24)
	anim:SetHotSpot(41,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('anim_dog_bark',anim,919,727,281,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Panel/animations/anim_dog_sniff.png',0,0,82,80,20,24)
	anim:SetHotSpot(41,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('anim_dog_sniff',anim,919,727,281,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
