require "scripts/style"

kFirstMatchY = 165;
kSecondMatchY= 370;
kMatchPicHalfWidth = 77; -- 155 is the width
kCreditPicHalfWidth = 20; -- 40 is the width

function setStaticBasicItemPics( matchNum )
	
    t = { SetStyle(QuickTaskStyle), BeginGroup() };

    local offsetY = kFirstMatchY + (matchNum-3)*47;

-- match pic
    table.insert(t,
        Bitmap
        {
            name = "match"..matchNum.."Pic",
            image = "pics/matchimages/match"..matchNum,
            x = kCenter-130,
            y = offsetY,
            scale = 0.8
        }
    );
-- basic items stacked
    table.insert(t,
        Bitmap
        {
            name = "allItemsStacked"..matchNum,
            image = "pics/onetime_dialog_gfx/all_lvl1_item_stacked",
            x = kCenter+50,
            y = offsetY,
            scale = 0.9            
        }
    );
-- credits pic
    table.insert(t,
        Bitmap
        {
            name = "creditForItems"..matchNum,
            image = "pics/items/points",
            x = kCenter+kMatchPicHalfWidth-kCreditPicHalfWidth+130,
            y = offsetY+5,
        }
    );
    
    return Group(t);
end

function setStaticOtherItemPics( matchNum )
	
    t = { SetStyle(QuickTaskStyle), BeginGroup() };

    local offsetY = kSecondMatchY + (matchNum-3)*47;

-- match pic
    table.insert(t,
        Bitmap
        {
            name = "otherMatch"..matchNum.."Pic",
            image = "pics/matchimages/match"..matchNum,
            x = kCenter-50,
            y = offsetY,
            scale = 0.8
        }
    );
-- credits pic
    table.insert(t,
        Bitmap
        {
            name = "otherAllItemsStacked"..matchNum,
            image = "pics/items/points",
            x = kCenter+kMatchPicHalfWidth-kCreditPicHalfWidth+50,
            y = offsetY+5,
        }
    );
    
    return Group(t);
end


function setItemPointPics( matchNum, basic )
	
    t = { SetStyle(QuickTaskStyle), BeginGroup() };

    local offsetX = kCenter-20;
    local offsetY;
    
    if(basic == true) then
        offsetY = kFirstMatchY + (matchNum-3)*47;    
    else
        offsetY = kSecondMatchY + (matchNum-3)*47;    
    end
    
    if(basic == true) then
-- points for resources
        table.insert(t,
            Bitmap
            {
                name = "itemMatch"..matchNum.."PointPic",
                image = "pics/onetime_dialog_gfx/"..(matchNum*matchNum),
                x = offsetX,
                y = offsetY,
                scale = 0.8
            }
        
        );
        offsetX = kCenter+130;
    else
        offsetX = kCenter+53;
    end
    
-- credits for resources
    table.insert(t,
        Bitmap
        {
            name = "itemMatch"..matchNum.."CreditPic",
            image = "pics/onetime_dialog_gfx/"..(matchNum*matchNum),
            x = offsetX,
            y = offsetY,
            scale = 0.8
        }
    );
    
    return Group(t);
end


MakeDialog
{
	-- Name the modal dialog
	name="itemsInThisStyle",
	Bitmap
	{
		image="backgrounds/dialog_itemsandmatches",
		x = kCenter,
		y = kCenter,

-- Title
			Text
			{
				align=kHAlignLeft,
				font = StandardButtonFontFour,
				name = "itemsInStyleTitle",
				x=kCenter,
                y=50,
                w=kMax-100, h=30,
				flags = kHAlignCenter + kVAlignCenter,
				label = "itemsInStyleTitle"
			};

-- Description 1
			Text
			{
				align=kHAlignLeft,
				font = StandardButtonFontBig,
				name = "itemsInStyleDescription1",
				x=kCenter,
                y=85,
                w=kMax-100, h=80,
				flags = kHAlignCenter + kVAlignCenter,
				label = "itemsInStyle01Description1"
			};
-- Description 2
			Text
			{
				align=kHAlignLeft,
				font = StandardButtonFontBig,
				name = "itemsInStyleDescription2",
				x=kCenter,
                y=315,
                w=kMax-100, h=60,
				flags = kHAlignCenter + kVAlignCenter,
				label = "itemsInStyle01Description2"
			};

            SetStyle(SmallEmptyRoundButtonStyle),
			Button
			{
				x = kCenter,
				y = kMax-86, --84,
				name="itemsInStyleOK",
				label="ok",
				close=true,
				default=true,
				type = kPush,
                command=
                    function()
                    end	                    
			},            
-- set pics for basic items
            setStaticBasicItemPics(3);
            setItemPointPics(3, true);
            setStaticBasicItemPics(4);
            setItemPointPics(4, true);            
            setStaticBasicItemPics(5);
            setItemPointPics(5, true);
-- set pics for other items
            setStaticOtherItemPics(3);
            setItemPointPics(3, false);            
            setStaticOtherItemPics(4);
            setItemPointPics(4, false);            
            setStaticOtherItemPics(5);            
            setItemPointPics(5, false);            
--		},
	},
}


