class 'Match3HelpScreenSmall' (BaseScreen)

Match3HelpScreenSmall.DONT_SHOW_STATE_ICE = 'MATCH3_DONT_SHOW_HELP_ICE'
Match3HelpScreenSmall.DONT_SHOW_STATE_EYE = 'MATCH3_DONT_SHOW_HELP_EYE'

function Match3HelpScreenSmall:__init(name, screen)
	BaseScreen.__init(self, name, screen);
    
    self.level = GetCurrentLevel()
    self.type  = nil
    
    self:GetObject('fade'):SetVisible(false)
    
    do
        local button = self:CreateButton('bttn_ok')
        button:SetAction('OnOkButtonClick', self)
        button:SetActionSound("Menu_button_click")
        button:SetKeyEquivalent(KEY_ESCAPE)
    end
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:SetType(type)
    local parent    = self:GetObject('Match3HelpWindowSmall')
    local textScale = 0.6
    local typeUpper = string.upper(type)
    
    self.type = type
	
	do
	    local anim = CreateAnimationByTextureName('data/Texture/GUI/Match3Help/big_ico/layer_big_'..type..'.png')
        local obj  = self.screen:CreateObject('indicator',anim,10,-80,1,0,1,1)
        obj:AttachTo(parent)
	end
	
	do
		local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_TEXT_'..typeUpper)
		text:AttachTo(parent)
		text:SetX(0)
		text:SetY(0)
		text:SetZ(1)
		text:SetScale(textScale)
		text:SetSpacing(0.55)
		text:SetTracking(-10.5)
		text:SetTextAlignment(HGETEXT_CENTER + HGETEXT_MIDDLE)
		text:SetBorderSize(300, 100)
	end
	
	do
	    local tile = self.screen:GetObject('CheckboxTile')
	    local size = 25
	    
	    self.chBox = CreateCheckBox()
	    self.chBox:AttachTo(parent)
	    self.chBox:SetRect(tile:GetX() - size/2, tile:GetY() - size/2, size, size)
	    self.chBox:SetZ(2)
	    self.chBox:SetOnTexture("data/Texture/GUI/Match3Help/CheckboxTick.png")
	    self.chBox:SetState(0)
	    self.chBox:SetAction("OnChangeDontShowCheckBox", self)
	    
	    local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_CHECKBOX')
		text:AttachTo(parent)
		text:SetX(-43)
		text:SetY(143)
		text:SetZ(1)
		text:SetScale(textScale)
		text:SetSpacing(0.55)
		text:SetTracking(-10.5)
		text:SetTextAlignment(HGETEXT_LEFT + HGETEXT_TOP)
		text:SetBorderSize(400, 0)
    end
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:OnChangeDontShowCheckBox()
    local state = Match3HelpScreenSmall['DONT_SHOW_STATE_'..string.upper(self.type)]
    
    if self.chBox:GetState() == 1 then
        if not HasGameState(state, 'true') then
            SetGameState(state, 'true')
        end
    else
        if HasGameState(state, 'true') then
            RemoveGameState(state, 'true')
        end
    end
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:OnButtonPress(action)
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:OnOkButtonClick()
    self:Hide()
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:OnUpdate(dt)
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:Show()
    local inventory = current_scene:getPlayField():getPanel()
    self:GetTopLevelScreen():setOrder( inventory:getOrder() + 1 )

    SetCursor('CursorDefault')
    
	current_scene:getPlayField():getMouseBlocker():push()
    PopUpScreensMgr:Push(self:GetTopLevelScreen())
end
-------------------------------------------------------------------------------

function Match3HelpScreenSmall:Hide()
    self.level.mouseBlocker:Pop()
    PopUpScreensMgr:Pop()
end
-------------------------------------------------------------------------------

function CreateMatch3HelpScreenSmall(type)
    local screen = CreatedScreen('data/Scripts/screens/Match3HelpScreenSmall.lua', 'Match3HelpScreenSmall');
	PopUpScreensMgr:push(screen, false, nil)
	
	return screen
end
--------------------------------------------------------------------------------



--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function Match3HelpScreenSmall:LoadData(screen)
	local anim
	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_block',anim,512,31,99,0,20,5)
	
	anim = CreateAnimation('data/Texture/GUI/Match3Help/Match3HelpWindowSmall.png',0,0,414,496,1,0)
	anim:SetHotSpot(207,248)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Match3HelpWindowSmall',anim,512,384,100,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Match3Help/CheckboxTile.png',0,0,30,30,1,0)
	anim:SetHotSpot(15,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('CheckboxTile',anim,445,520,101,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Buttons/bttn_ok.png',0,0,230,74,3,0)
	anim:SetHotSpot(115,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_ok',anim,512,570,1001,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Match3Help/Match3HelpTitle.png',0,0,174,22,1,0)
	anim:SetHotSpot(87,11)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Match3HelpTitle',anim,513,173,1001,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
