require( "scripts/style.lua" );
require( "scripts/ui/style_text.lua" );

gCurScreen = 0;

function SetScreen( screen )

    if screen == 1 then
        EnableWindow("helptext1",true)
        EnableWindow("helptext2",false)
    elseif screen ==2 then
        EnableWindow("helptext1",false)
        EnableWindow("helptext2",true)
    end

    gCurScreen = screen ;
end

HelpStyle = {
    flags = kVAlignCenter + kHAlignLeft,
};

MakeDialog
{
    -- Name the modal dialog
    name = "help",
    WindowExt
    {
        --image = "backgrounds/helpbackground",
        x = 512,
        y = 384,
        w = 1024,
        h = 768,
        name = "dlg_help",
        state_handlers = {
            hidden = function()
                CloseWindow();
            end;
        },

        Bitmap
        {
            name = "helptext1",
            w = kMax,
            h = kMax,
            image = "help/page_1",

            -- STORY
            SetStyle(HelpStyle),
            CreateText(19, BlackColor, 60, 60, "help_story_title", 200, 20),
            CreateText(14, BlackColor, 60, 80, "help_story_body", 180, 225),

            -- MECHANICS
            CreateText(19, BlackColor, 60, 365, "help_mechanics_title", 200, 20),
            CreateText(14, BlackColor, 60, 385, "help_mechanics_body", 400, 63),
            
            -- PLANTS
            CreateText(19, BlackColor, 60, 580, "help_plants_title", 200, 20),
            CreateText(14, BlackColor, 60, 595, "help_plants_body", 376, 58),
            
            -- GOAL
            CreateText(19, BlackColor, 560, 45, "help_goal_title", 200, 20),
            CreateText(14, BlackColor, 560, 65, "help_goal_body", 385, 62),
            
            -- SHOP
            CreateText(19, BlackColor, 560, 260, "help_shop_title", 200, 20),
            CreateText(14, BlackColor, 560, 285, "help_shop_body", 290, 65),
            
            -- QUESTS
            CreateText(19, BlackColor, 560, 460, "help_quests_title", 200, 20),
            CreateText(14, BlackColor, 560, 480, "help_quests_body", 263, 179),
            
            SetStyle(ButtonStyle),
            Button
            {
                label = "back",
                name = "back",
                cancel = true,
                align = kHAlignLeft + kVAlignBottom,
                x = kCenter - 55,
                y = kMax - 5,
                font = CreateNamedFont(MinionSbItSymbolSet, 24, ButtonBrown),
                command = function() 
                    PlaySound("audio/sfx/main_menu/screenswitch.ogg");
                    HideControl("dlg_help"); 
                end;
            },
            Button
            {
                label = "next",
                name = "next",
                default = true,
                align = kHAlignRight + kVAlignBottom,
                x = kCenter + 55,
                y = kMax-5,
                font = CreateNamedFont(MinionSbItSymbolSet, 24, ButtonBrown),
                command = function()
                    SetScreen( gCurScreen + 1 );
                end;
            }
        },
        Bitmap
        {
            name = "helptext2",
            w = kMax,
            h = kMax,
            image = "help/page_2",

            -- SPECIAL PLANTS
            SetStyle(HelpStyle),
            CreateText(19, BlackColor, 60, 55, "help_special_plants_title", 200, 20),
            CreateText(14, BlackColor, 60, 75, "help_special_plants_body", 387, 169),
            
            -- OBJECTS
            CreateText(19, BlackColor, 60, 400, "help_objects_title", 200, 20),
            CreateText(14, BlackColor, 60, 415, "help_objects_body", 376, 120),

            -- PESTS
            CreateText(19, BlackColor, 560, 45, "help_pests_title", 200, 20),
            CreateText(14, BlackColor, 560, 70, "help_pests_body", 391, 72),
            
            -- MAGIC
            CreateText(19, BlackColor, 560, 280, "help_magic_title", 200, 20),
            CreateText(14, BlackColor, 560, 300, "help_magic_body", 228, 124),
            
            -- POTION
            CreateText(19, BlackColor, 560, 500, "help_potion_title", 200, 20),
            CreateText(14, BlackColor, 560, 515, "help_potion_body", 235, 152),
            
            SetStyle(ButtonStyle),
            Button
            {
                label = "prev",
                name = "prev",
                align = kHAlignLeft + kVAlignBottom,
                x = kCenter - 55,
                y = kMax - 5,
                font = CreateNamedFont(MinionSbItSymbolSet, 24, ButtonBrown),
                command = function()
                    SetScreen( gCurScreen - 1 );
                end;
            },
            Button
            {
                label = "done",
                name = "done",
                cancel = true,
                default = true,
                align = kHAlignRight + kVAlignBottom,
                x = kCenter + 55,
                y = kMax - 5,
                font = CreateNamedFont(MinionSbItSymbolSet, 24, ButtonBrown),
                command = function() 
                    PlaySound("audio/sfx/main_menu/screenswitch.ogg");
                    HideControl("dlg_help"); 
                end;
            },
        },
    },
};

SetScreen(1);
