class 'l_MoreInfoScreen' (BaseScreen)

local BUTTON_FORUM_FILE_NAME           = 'data/Texture/GUI/MoreInfo/bttn_forums.png'
local BUTTON_STRATEGY_GUIDE_FILE_NAME  = 'data/Texture/GUI/MoreInfo/bttn_strategy_guide.png'

function l_MoreInfoScreen:__init(name, screen)
	BaseScreen.__init(self, name, screen)

	-- create buttons
	do
	    local bttn_ok = self:CreateButtonByName('Ok', KEY_ENTER)
	    
	    local start_y = 220
	    local delta_y = 75
	    local row     = 1
	    
	    if not IS_SURVEY then
            if IS_COLLECTORS_EDITION and mainMenu.bttn_extras then
                local bttn_strategy_guide = self:CreateContentButton(512, start_y + delta_y * row, 1, 'MIS_STRATEGY_GUIDE', 'OnStrategyGuideButtonClick')
                row = row + 1
            end
        end
	    
	    local bttn_credits = self:CreateContentButton(512, start_y + delta_y * row, 1, 'MIS_CREDITS', 'OnCreditsButtonClick')
	    row = row + 1
	    
	    if not IS_SURVEY then
            local bttn_help = self:CreateContentButton(512, start_y + delta_y * row, 1, 'MIS_HELP', 'OnHelpButtonClick')
            row = row + 1
        end
	    
	    if not IS_SURVEY then
            if IsFileExists('data/Links/ForumURL.txt') then
                local bttn_forums = self:CreateContentButton(512, start_y + delta_y * row, 1, 'MIS_FORUMS', 'OnForumsButtonClick')
                row = row + 1
            end
        end
    end
end

function l_MoreInfoScreen:CreateContentButton(x, y, scale, caption, onClickEventHandler)
    local highlightColor = '0x88FF7777'

    local button = self:MakeButton(x, y, 100, 100)
    button:DisableIfHidden(true)
	button:AttachTo(self.screen)

	button:SetTitle( GetString(caption) )
    button:GetCaption():SetFont(MENU_FONT)
    button:GetCaption():SetHighlightColor(highlightColor)
    button:GetCaption():SetScale(scale)
    button:SetZ(260)
     
    -- rect corrections 
    local width = button:GetCaption():GetWidth()
    local height = button:GetCaption():GetHeight()
    local scrX, scrY = button:GetScrX(), button:GetScrY()
    button:SetRect(scrX - width / 2, scrY - height / 2, width, height)
     
    button:SetActionSound('Menu_button_click')
    button:SetAction(onClickEventHandler, self)
     
    return button
end

function l_MoreInfoScreen:OnUpdate(dt)
end

function l_MoreInfoScreen:OnObjectMouseEnter(object)
end

function l_MoreInfoScreen:OnObjectMouseLeave(object)
end

function l_MoreInfoScreen:OnScreenObjectMouseDown(object)
end

function l_MoreInfoScreen:OnObjectMouseDownProcessed(is_wrong_click)
end

function l_MoreInfoScreen:OnObjectMouseUp(object)
end

function l_MoreInfoScreen:OnObjectFound(object)
end

function l_MoreInfoScreen:OnButtonPress(title)
end

function l_MoreInfoScreen:OnMouseMove(previous_pos, current_pos)
end

function l_MoreInfoScreen:OnSetTool(tool)
end

function l_MoreInfoScreen:OnLoaded()
end

function l_MoreInfoScreen:OnDestroy()
end
--------------------------------------------------------------------------------

function l_MoreInfoScreen:OnForumsButtonClick()
    if APP:IsFullScreen() then
        APP:Minimize()
    end

    APP:OpenUrlFromFile('data/Links/ForumURL.txt')
end
--------------------------------------------------------------------------------

function l_MoreInfoScreen:OnHelpButtonClick()
    CreateHelpScreen()
end
--------------------------------------------------------------------------------

function l_MoreInfoScreen: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 l_MoreInfoScreen:OnCreditsButtonClick()
    CreateCreditsScreen()
end
--------------------------------------------------------------------------------

function l_MoreInfoScreen:OnOkButtonClick()
    PopUpScreensMgr:Pop()
end
--------------------------------------------------------------------------------

function CreateMoreInfoScreen()
    local screen = CreateScriptedScreen('data/Scripts/screens/MoreInfoScreen.lua', 'l_MoreInfoScreen')
    PopUpScreensMgr:Push(screen, false, nil) 
end
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function l_MoreInfoScreen:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/GUI/OK/WindowOK.png',0,0,580,450,1,0)
	anim:SetHotSpot(290,225)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('WindowOK',anim,512,384,100,0,1,1)
	
	anim = CreateAnimation('data/Texture/GUI/Buttons/bttn_ok.png',0,0,162,104,3,0)
	anim:SetHotSpot(81,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bttn_ok',anim,512,583,180,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
