require( "scripts/style.lua" );

local pnl_water_barrel_rollover_name = "pnl_water_barrel_rollover";

function fn_Spawn_Storage()
    return Group
    {
        Bitmap
        {
            image = "game/common/progress/storage_progress_counter",
            x = 110,
            y = 0,
            TextVisual
            {
                name = "txt_storage_shadow",
                flags = kHAlignCenter + kVAlignCenter,
                font = CreateNamedFont(MinionSbItSymbolSet, 23, GreenOutline),
                x = 66, y = 72,
                h = 24, w = 40,
                context = {"bud_collected",},
                context_change = function(item, old_val, new_val)
                    txt_storage_shadow_SetText(GetString("green_outline", tostring(new_val)));
                end;
            },
            TextVisual
            {
                name = "txt_storage",
                flags = kHAlignCenter + kVAlignCenter,
                font = CreateNamedFont(MinionSbItSymbolSet, 23, BudGold),
                x = 65, y = 71,
                h = 24, w = 40,
                context = {"bud_collected",},
                context_change = function(item, old_val, new_val)
                    txt_storage_SetText(GetString("green_outline", tostring(new_val)));
                end;
            },
            
            TextVisual
            {
                name = "txt_storage_cap_shadow",
                flags = kHAlignLeft + kVAlignCenter,
                font = CreateNamedFont(MinionSbItSymbolSet, 18, GreenOutline),
                x = 104, y = 74,
                h = 20, w = 40,
                context = {"storage_capacity",},
                context_change = function(item, old_val, new_val)
                    txt_storage_cap_shadow_SetText(GetString("green_outline", "/"..tostring(new_val)));
                end;
            },
            TextVisual
            {
                name = "txt_storage_cap",
                flags = kHAlignLeft + kVAlignCenter,
                font = CreateNamedFont(MinionSbItSymbolSet, 18, Green),
                x = 103, y = 73,
                h = 20, w = 40,
                context = {"storage_capacity",},
                context_change = function(item, old_val, new_val)
                    txt_storage_cap_SetText(GetString("green_outline", "/"..tostring(new_val)));
                end;
            },
        },
    };
end;

function fn_Spawn_Texts()
    return Group
    {
        SetStyle(TextStyle),
        -- Collect 2 of 3
        CreateMinionNamedText(18, BlackColor, 255, 715, "stub", 290, 22, "quest_counter"),
        -- you have 3 days to achieve expert
        TextVisual
        {
            name = "info_expert_reminder",
            x = 260, y = 740,
            h = 20, w = 255,
            font = CreateNamedFont(MinionSbItSymbolSet, 18, ButtonBrown),
            context = {"quest_deadline",},
            context_change = function(item, old_val, new_val)
                if new_val ~= 0 then
                    EnableWindow("info_expert_reminder", true);
                    if new_val ~= 1 then
                        info_expert_reminder_SetText(GetString("expert_reminder", tostring(new_val)));
                    else
                        info_expert_reminder_SetText(GetString("expert_reminder_1day"));
                    end;
                else
                    EnableWindow("info_expert_reminder", false);
                end;
            end;
        },
        
        SetStyle(TextStyle),
        -- MONEY
        TextVisual
        {
            name = "txt_money_shadow",
            x=761,y=706,
            h=23,w=90,
            flags=kHAlignCenter+kVAlignCenter,
            font = CreateNamedFont(MinionSymbolSet, 23, CaptionBrown),
            context = {"money"},
            context_change = function(item, old_val, new_val)
                txt_money_shadow_SetText(GetString("caption_outline", tostring(new_val)));
            end;
        },
        TextVisual
        {
            name = "txt_money",
            x=760,y=705,
            h=23,w=90,
            flags=kHAlignCenter+kVAlignCenter,
            font = CreateNamedFont(MinionSymbolSet, 23, CaptionYellow),
            context = {"money"},
            context_change = function(item, old_val, new_val)
                txt_money_SetText(GetString("caption_outline", tostring(new_val)));
            end;
        },
        
        -- WATER
        TextVisual
        {
            name = "txt_water_shadow",
            flags = kHAlignCenter + kVAlignCenter,
            font = CreateNamedFont(MinionSbItSymbolSet, 24, BlueOutline),
            x=921,y=712,
            h = 24, w = 30,
            context = {"water",},
            context_change = function(item, old_val, new_val)
                txt_water_shadow_SetText(GetString("blue_outline", tostring(new_val)));
            end;
        },
        TextVisual
        {
            name = "txt_water",
            flags = kHAlignCenter + kVAlignCenter,
            font = CreateNamedFont(MinionSbItSymbolSet, 24, BudGold),
            x=920,y=711,
            h = 24, w = 30,
            context = {"water",},
            context_change = function(item, old_val, new_val)
                txt_water_SetText(GetString("blue_outline", tostring(new_val)));
            end;
        },
        
        TextVisual
        {
            name = "txt_water_cap_shadow",
            flags = kHAlignLeft + kVAlignCenter,
            font = CreateNamedFont(MinionSbItSymbolSet, 19, BlueOutline),
            x = 951,y = 714,
            h = 20, w = 40,
            context = {"waterbarrel_capacity",},
            context_change = function(item, old_val, new_val)
                txt_water_cap_shadow_SetText(GetString("blue_outline", "/"..tostring(new_val)));
            end;
        },
        TextVisual
        {
            name = "txt_water_cap",
            flags = kHAlignLeft + kVAlignCenter,
            font = CreateNamedFont(MinionSbItSymbolSet, 19, LightBlueText),
            x = 950,y = 713,
            h = 20, w = 40,
            context = {"waterbarrel_capacity",},
            context_change = function(item, old_val, new_val)
                txt_water_cap_SetText(GetString("blue_outline", "/"..tostring(new_val)));
            end;
        },
        
        -- DAY COUNTER
        TextVisual
        {
            name = "text_day_count_shadow",
            x=24,y=147,
            h=24,w=90,
            flags=kHAlignCenter+kVAlignCenter,
            font = CreateNamedFont(OndineSymbolSet, 24, CaptionBrown),
            context = {"day_elapsed",},
            context_change = function(item, old_val, new_val)
                text_day_count_shadow_SetText(GetString("caption_outline", GetString("day_elapsed", tostring(new_val))));
            end;
        },
        TextVisual
        {
            name = "text_day_count",
            x=24,y=146,
            h=24,w=90,
            flags=kHAlignCenter+kVAlignCenter,
            font = CreateNamedFont(OndineSymbolSet, 24, CaptionYellow),
            context = {"day_elapsed",},
            context_change = function(item, old_val, new_val)
                text_day_count_SetText(GetString("caption_outline", GetString("day_elapsed", tostring(new_val))));
            end;
        },
        
        -- Quest badge picture
        SetStyle({}),
        BitmapVisual
        {
            name = "scroll",
            image="interface/game/pnl_quest_mirror/scroll_small",
            x = 605,
            y = 725,
            
            BitmapVisual
            {
                name = "scroll_picture",
                x = 75,
                y = 57,
                w = 150,
                h = 86,
                image="game/garden_1/laboratory/potions_store/pot_02",
            },
            
            SetStyle(TextStyle),
            CreateOndineText(20, BlueOutline, kCenter+1, 17, "#"..GetString("blue_outline", GetString("scroll_goal")), 60, 20),
            CreateOndineText(20, LightBlueText, kCenter, 16, "#"..GetString("blue_outline", GetString("scroll_goal")), 60, 20),
        },
    };
end;