class 'Match3HelpScreen' (BaseScreen)

Match3HelpScreen.DONT_SHOW_STATE = 'MATCH3_DONT_SHOW_HELP'

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

	local parent = self:GetObject('Match3HelpWindow')
	local textScale = 0.6
	
	do
	    --[[
		local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_TITLE')
		text:AttachTo(parent)
		text:SetY(-210)
		text:SetZ(1)
		text:SetScale(textScale)
		text:SetSpacing(0.55)
		text:SetTracking(-10.5)
		text:SetTextAlignment(HGETEXT_CENTER + HGETEXT_TOP)
		text:SetBorderSize(400, 0)
		--]]
	end
	
	do
		local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_TEXT_1')
		text:AttachTo(parent)
		text:SetY(50)
		text:SetX(-230)
		text:SetZ(1)
		text:SetScale(textScale)
		text:SetSpacing(0.55)
		text:SetTracking(-10.5)
		text:SetTextAlignment(HGETEXT_CENTER + HGETEXT_TOP)
		text:SetBorderSize(170, 100)
	end
	
	do
		local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_TEXT_2')
		text:AttachTo(parent)
		text:SetY(50)
		text:SetX(0)
		text:SetZ(1)
		text:SetScale(textScale)
		text:SetSpacing(0.55)
		text:SetTracking(-10.5)
		text:SetTextAlignment(HGETEXT_CENTER + HGETEXT_TOP)
		text:SetBorderSize(170, 100)
	end
	
	do
		local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_TEXT_3')
		text:AttachTo(parent)
		text:SetY(50)
		text:SetX(230)
		text:SetZ(1)
		text:SetScale(textScale)
		text:SetSpacing(0.55)
		text:SetTracking(-10.5)
		text:SetTextAlignment(HGETEXT_CENTER + HGETEXT_TOP)
		text:SetBorderSize(170, 100)
	end
	
	do
	    self.chBox = CreateCheckBox()
	    self.chBox:AttachTo(parent)
	    self.chBox:SetRect(419, 495, 25, 25)
	    self.chBox:SetZ(1)
	    self.chBox:SetOnTexture("data/Texture/GUI/Options/CheckboxTick.png")
	    self.chBox:SetState(0)
	    self.chBox:SetAction("OnChangeDontShowCheckBox", self)
	    
	    local text = CreateTextEntity(HELP_FONT, 'MATCH3_TUTORIAL_CHECKBOX')
		text:AttachTo(parent)
		text:SetX(-60)
		text:SetY(125)
		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 Match3HelpScreen:OnButtonPress(action)
	Helpers.CallFunctionByName(action, self)
end
-------------------------------------------------------------------------------

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

function Match3HelpScreen:OnChangeDontShowCheckBox()
    if self.chBox:GetState() == 1 then
        if not HasGameState(Match3HelpScreen.DONT_SHOW_STATE, 'true') then
            SetGameState(Match3HelpScreen.DONT_SHOW_STATE, 'true')
        end
    else
        if HasGameState(Match3HelpScreen.DONT_SHOW_STATE, 'true') then
            RemoveGameState(Match3HelpScreen.DONT_SHOW_STATE, 'true')
        end
    end
end
-------------------------------------------------------------------------------

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

function Match3HelpScreen:Show()
    local inventory = play_field:GetLevelScreen():GetInventory()
    self:GetTopLevelScreen():SetLayer( inventory:GetLayer() + 1 )

    SetCursor('CursorDefault')
    
	self.level.mouseBlocker:Push()
    PopUpScreensMgr:Push(self:GetTopLevelScreen())
end
-------------------------------------------------------------------------------

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

function CreateMatch3HelpScreen()
 --   local scr = CreateScriptedScreen('data/Scripts/screens/Match3HelpScreen.lua', 'Match3HelpScreen');
	--local screen = scr:GetAssociatedLuaObject();
	--screen:Show()
	
	return screen
end
--------------------------------------------------------------------------------



--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function Match3HelpScreen:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/GUI/Match3Help/Match3HelpWindow.png',0,0,694,484,1,0)
	anim:SetHotSpot(347,242)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Match3HelpWindow',anim,512,386,1000,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,573,1001,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_block',anim,512,31,99,0,20,5)
	
	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,170,1001,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
