gFileName = "backgrounds/page4_";
gCurrentFile = 1;
gFilesCount = 1;


ComicsFont1 = {
  standardFont,
  18,
  BlackColor
};
ComicsFont2 = {
  standardFont,
  16,
  BlackColor
};
ComicsFont3 = {
  standardFont,
  22,
  BlackColor
};
ComicsFont4 = {
  standardFont,
  15,
  BlackColor
};

function SetScreen(screen)
    if(screen<1 or screen>gFilesCount)then
        if(--[[gStartLevelAfterClose==0 and--]] screen<1 )then
            PopModal("tutorial");
            return;
        end;
        PopModal("tutorial");
    else
        gCurrentFile = screen;
        if(gCurrentFile==1)then
            SetLabel("first_button", GetString( "close"));
            EnableWindow("first_button",false);
        else
            SetLabel("first_button",GetString("prev"));
            EnableWindow("first_button",true);          
        end;
        
        if(gCurrentFile==gFilesCount)then
            SetLabel("second_button",GetString("start"));
        else
            SetLabel("second_button",GetString("next"));
        end;
        
        SetBitmap("tutorial_image",gFileName..gCurrentFile);
        
        for wt_ind = 1,gFilesCount,1 do
            if (wt_ind == gCurrentFile) then 
                EnableWindow("text_page"..wt_ind,true);
            else
                EnableWindow("text_page"..wt_ind,false);
            end
        end
        
    end
end

MakeDialog
{
    name="tutorial",
    ParamTimer
    {
        param = "ComicScreenTime";
    };
    
    Bitmap
    {
        name="tutorial_image",
        image=gFileName..gCurrentFile,
        x=0,
        y=0,
        w = 800,
        h = 600,
        Window 
        {
            name = "text_page1",
            x=0,y=0,w=800,h=600,
            Text {
                name="text1_1",
                font = ComicsFont2,
                x = 247, y = 9,w = 135, h = 62,
                label="comics_farm4_1_text1",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_2",
                font = ComicsFont2,
                x = 490, y = 9,w = 107, h = 60,
                label="comics_farm4_1_text2",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_3",
                x = 56, y = 213,w = 110, h = 38,
                font = ComicsFont2,
                label="comics_farm4_1_text3",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_4",
                font = ComicsFont4,
                x = 171, y = 162,w = 62, h = 92,
                label="comics_farm4_1_text4",
                flags = kHAlignCenter + kVAlignCenter,
            },


            Text {
                name="text1_5",
                font = ComicsFont2,
                x = 354, y = 199,w = 115, h = 62,
                label="comics_farm4_1_text5",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_6",
                font = ComicsFont2,
                x = 555, y = 181,w = 145, h = 82,
                label="comics_farm4_1_text6",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_7",
                font = ComicsFont2,
                x = 359, y = 272,w = 94, h = 30,
                label="comics_farm4_1_text7",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_8",
                font = ComicsFont2,
                x = 513, y = 246,w = 130, h = 62,
                label="comics_farm4_1_text8",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_9",
                font = ComicsFont1,
                x = 563, y = 316,w = 220, h = 62,
                label="comics_farm4_1_text9",
                flags = kHAlignCenter + kVAlignCenter,
            },
            Text {
                name="text1_10",
                font = ComicsFont1,
                x = 479, y = 488,w = 220, h = 62,
                label="comics_farm4_1_text10",
                flags = kHAlignCenter + kVAlignCenter,
            },

            
            
            
            

        },
       
        Button
        {
            x=5,
            y=550,
            w=100,
            h = 44,
            font = StandardButtonFont,
            graphics = TutorialButton,
            name="first_button",
            label="prev",
            type = kPush,
            sound = kDefaultButtonSound,
            command=
                function()
                    SetScreen(gCurrentFile-1);
                end
        },
        
        Button
        {
            x=350,
            y=550,
            w=100,
            h = 44,
            font = StandardButtonFont,
            graphics = TutorialButton,
            name="skip_button",
            label="skip",
            sound = kDefaultButtonSound,            
            type = kPush,
            command=
                function()
                    SetScreen(999999);
                end
        },
        
        
        
        Button
        {
            x=680,
            y=550,
            w=100,
            h = 44,         
            font = StandardButtonFont,
            graphics = TutorialButton,
            name="second_button",
            label="next",
            type = kPush,
            sound = kDefaultButtonSound,            
            command=
                function()
                    SetScreen(gCurrentFile+1);
                end
        };
        
    };

}
SetUnderlineDistance("text1_3",-3);
SetUnderlineDistance("text1_4",-4);
SetUnderlineDistance("text1_8",-2);
SetUnderlineDistance("text1_6",-3);
SetUnderlineDistance("text1_5",-3);
SetUnderlineDistance("text1_2",-2);
SetUnderlineDistance("text1_7",-3);

--[[
SetUnderlineDistance("text3_4",-3);

SetUnderlineDistance("text4_1",-2);
SetUnderlineDistance("text4_3",-4);
SetUnderlineDistance("text4_4",-2);
SetUnderlineDistance("text4_5",-2);
SetUnderlineDistance("text4_6",-2);
SetUnderlineDistance("text4_7",-2);
SetUnderlineDistance("text4_8",-2);
--]]

SetScreen(1);
