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

local dlgname="resource_loader";
local dlg_loader_timer = {
    name = "panels",
    category = "UI",
};

MakeDialog
{
    Bitmap
    {
        x=0,y=0,
        w=1024,h=768,
        --scale=2000,
        image="cutscenes/black",

        ResourceLoader
        {
            x=0,y=-3000,
            w=1024,h=309,
            
            name=dlgname,
            timer_settings = dlg_loader_timer,
            
            progress_pos_x = 512,
            progress_pos_y = 220,
            
            fun_image_pos_x = 512,
            fun_image_pos_y = 80,
            animated_icon = ResourseLoaderParameters.WindowAnimation,
            
            gamesector = ResourseLoaderParameters.SectorToLoad,

            state_curves = {
                container = "curves/dlg_down_left.xml",
                showing = {
                    curve = "",
                    inverse = false,
                    offset = false
                },
                hiding = {
                    curve = "",
                    inverse = true,
                    offset = false
                },
            },

            state_handlers = {
                justcreated = function()
                    ShowControl(dlgname);
                    kQuitConfirmShowed = true;
                end;
                hidden = function()
                    --CloseWindow();
                    SwapToModal(ResourseLoaderParameters.NextScript);
                    kQuitConfirmShowed = false;
                end;
            },
            
            Bitmap
            {
                x = kCenter,
                y = kCenter,
                
                SetStyle(TextStyle),
                CreateOndineText(36, CaptionBrown, kCenter+1, kCenter-19, "#"..GetString("caption_outline", GetString("loading")), 200, 36),
                CreateOndineText(36, CaptionYellow, kCenter, kCenter-20, "#"..GetString("caption_outline", GetString("loading")), 200, 36),
                
                image="backgrounds/dialog",
            },
        },
    },
}