require "scripts/style"

kMaxStations = 22;
kReBuildIconOffsetY = 480;
kPriceIconStartX = 60;
kPriceIconOffsetX = 90;
kPriceNumberStartX = 100;
kPriceNumberOffsetX = 90;

-- statistics
--kStatisticsX = 500;
--kStatisticsNumberX = kStatisticsX + 70;

function showStationCostRelatedStuff( show )
	SetWindowVisible( "FoodCostIcon", show )
	SetWindowVisible( "FoodCostNumber", show )
	SetWindowVisible( "MoneyCostIcon", show )
	SetWindowVisible( "MoneyCostNumber", show )
	SetWindowVisible( "StoneCostIcon", show )
	SetWindowVisible( "StoneCostNumber", show )
	SetWindowVisible( "WoodCostIcon", show )
	SetWindowVisible( "WoodCostNumber", show )
end

function makeStatisticsForLevel( levelNum, sOffsetX, sOffsetY )

	t = { SetStyle(QuickTaskStyle), BeginGroup() };
    sOffsetNumberX = sOffsetX + 70;
    sRowOffset = 20;

		table.insert(t,
-- Level X text
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_LevelText"..levelNum,
                x=sOffsetX,y=sOffsetY - 30, w=140,h=25,
                flags = kHAlignCenter,
                label = "infoPage_Level"..(levelNum+1).."Text"
            }
        );
		table.insert(t,
-- time passed matched
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_TimePassedText"..levelNum,
                x=sOffsetX,y=sOffsetY, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_TimePassedText"
            }
        );
        table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_TimePassedValue"..levelNum,
                x=sOffsetNumberX,y=sOffsetY, w=70,h=25,
                flags = kHAlignRight,
                label = "infoBar_LevelTimeEmpty"
            }
        );
-- all items matched
		table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_AllItemsText"..levelNum,
                x=sOffsetX,y=sOffsetY + sRowOffset, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_AllItemsText"
            }
        );
        table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_AllItemsValue"..levelNum,
                x=sOffsetNumberX,y=sOffsetY + sRowOffset, w=70,h=25,
                flags = kHAlignRight,
                label = "zeroNumber"
            }
        );
-- match3
        table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch3Text"..levelNum,
                x=sOffsetX,y=sOffsetY + sRowOffset*2, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_ItemsMatch3Text"
            }
        );
		table.insert(t,        
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch3Value"..levelNum,
                x=sOffsetNumberX,y=sOffsetY + sRowOffset*2, w=70,h=25,
                flags = kHAlignRight,
                label = "zeroNumber"
            }
        );
-- match4
		table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch4Text"..levelNum,
                x=sOffsetX,y=sOffsetY + sRowOffset*3, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_ItemsMatch4Text"
            }
        );
		table.insert(t,        
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch4Value"..levelNum,
                x=sOffsetNumberX,y=sOffsetY + sRowOffset*3, w=70,h=25,
                flags = kHAlignRight,
                label = "zeroNumber"
            }
        );            
-- match5 or more
		table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch5pText"..levelNum,
                x=sOffsetX,y=sOffsetY + sRowOffset*4, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_ItemsMatch5pText"
            }
        );
		table.insert(t,        
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch5pValue"..levelNum,
                x=sOffsetNumberX,y=sOffsetY + sRowOffset*4, w=70,h=25,
                flags = kHAlignRight,
                label = "zeroNumber"
            }
        );
-- number of tries on this level 
		table.insert(t,
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_LevelTriesText"..levelNum,
                x=sOffsetX,y=sOffsetY + sRowOffset*5, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_LevelTriesText"
            }
        );
		table.insert(t,            
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_LevelTriesValue"..levelNum,
                x=sOffsetNumberX,y=sOffsetY + sRowOffset*5, w=70,h=25,
                flags = kHAlignRight,
                label = "zeroNumber"
            }	
        );
   
    return Group(t);
end

MakeDialog
{
	-- Name the modal dialog
	name="infoPage",
	Bitmap
	{
        image="backgrounds/dialog_fullscreen",
		x=kCenter,
		y=kCenter,
		
		infoPageWindow{
			x = 0, y = 0, w=kMax, h=kMax,
-- horizontal line to cut the pages
			Bitmap
			{
				name="infoPage_line",
				image="pics/infopage_line",
				x=480,--508,
				y=40,
			},	  
-- station pic backgrounds
			Bitmap
			{
				name="infoPage_stationPicBackground",
				image="buildings/station_unlock_background",
				x=70,
				y=70,
                alpha=true,
			},    
			Bitmap
			{
				name="infoPage_stationTextBackground",
				image="buildings/menu_backgrounds/menu_bcg_00",
				x=490,
				y=80,
                --scale=0.7,
                alpha=true,
			},             
-- Station picture
			Bitmap
			{
				name="infoPage_stationPic",
				image="buildings/icons/building_icon_00",
				x=65.5,
				y=81,
			},            
-- Station Name            
			Text
			{
				align=kHAlignLeft,
				font = StandardButtonFontHuge,
				name = "infoPage_stationName",
				x=220,--50,
				y=90,--120,
				w=240,--400,
				h=60,
				flags = kHAlignCenter + kVAlignCenter,
				label = "StationName1infoPage"
			};           
-- Station description
			Text
			{
				font = StandardButtonFontBig,
				name = "stationlongtext",
				x=50,y=185,w=400,h=480,
				flags = kHAlignLeft + kVAlignTop,
				label = "station01LongText",--currentStationText,
			};
-- OK button			
			SetStyle(SmallEmptyRoundButtonStyle),
			Button
			{
				x=60,
				y=670,
				name="resumebutton",
				label="ok",
				close = true,	-- Just close this window
				cancel=true,
				command=
					function()
						SetState( kPause, false );
					end;

			};	
			Button
			{
				x=380,
				y=660,
				name="NextStationInfoButton",
				graphics=NextStationButtonGraphics,
				type = kPush,
				command=
					function()
							nextStationInfo()
					end	
			};			
			Button
			{
				x=300,
				y=660,
				name="PrevStationInfoButton",
				graphics=PrevStationButtonGraphics,
				type = kPush,
				command=
					function()
							prevStationInfo()
					end	
			};            
-- required resources icons and numbers	
-- FOOD		
			Bitmap
			{
				name="FoodCostIcon",
				image="pics/food_lvl1",
				x=kPriceIconStartX,
				y=kReBuildIconOffsetY,
			},		
			Text
			{
				font = PointTextFont,
				name = "FoodCostNumber",
				x=kPriceNumberStartX,
				y=kReBuildIconOffsetY + 8,
				w=50,
				h=30,
				label = "FoodNumber"
			};			
-- MONEY            
			Bitmap
			{
				name="MoneyCostIcon",
				image="pics/money_lvl1",
				x=kPriceIconStartX + kPriceIconOffsetX,
				y=kReBuildIconOffsetY,
			},	
			Text
			{
				font = PointTextFont,
				name = "MoneyCostNumber",
				x=kPriceNumberStartX + kPriceNumberOffsetX,
				y=kReBuildIconOffsetY + 8,
				w=50,
				h=30,
				label = "MoneyNumber"
			};				
-- STONE            
			Bitmap
			{
				name="StoneCostIcon",
				image="pics/stone_lvl1",
				x=kPriceIconStartX + kPriceIconOffsetX*2,
				y=kReBuildIconOffsetY,
			},	
			Text
			{
				font = PointTextFont,
				name = "StoneCostNumber",
				x=kPriceNumberStartX + kPriceNumberOffsetX*2,
				y=kReBuildIconOffsetY + 8,
				w=50,
				h=30,
				label = "StoneNumber"
			};		
-- WOOD            
			Bitmap
			{
				name="WoodCostIcon",
				image="pics/wood_lvl1",
				x=kPriceIconStartX + kPriceIconOffsetX*3,
				y=kReBuildIconOffsetY,
			},	
			Text
			{
				font = PointTextFont,
				name = "WoodCostNumber",
				x=kPriceNumberStartX + kPriceNumberOffsetX*3,
				y=kReBuildIconOffsetY + 8,
				w=50,
				h=30,
				label = "WoodNumber"
			};		
-- Statistics related things
-- Statistics text
			Text
			{
				align=kHAlignLeft,
				font = StandardButtonFontHuge,
				name = "infoPage_statisticsText",
				x=505,--50,
				y=50,--120,
				w=400,
				h=30,
				flags = kHAlignCenter + kVAlignCenter,
				label = "StatisticsText"
			}; 
            makeStatisticsForLevel( 0, 530, 145);
            makeStatisticsForLevel( 1, 747, 145);
            
            makeStatisticsForLevel( 2, 530, 345);
            makeStatisticsForLevel( 3, 747, 345);

            makeStatisticsForLevel( 4, 530, 545);
            makeStatisticsForLevel( 5, 747, 545);            
--[[
-- time passed matched
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_TimePassedText",
                x=kStatisticsX,y=140, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_TimePassedText"
            };
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_TimePassedValue",
                x=kStatisticsNumberX,y=140, w=70,h=25,
                flags = kHAlignRight,
                label = "TimePassedValue"
            };
-- all items matched
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_AllItemsText",
                x=kStatisticsX,y=160, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_AllItemsText"
            };
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_AllItemsValue",
                x=kStatisticsNumberX,y=160, w=70,h=25,
                flags = kHAlignRight,
                label = "AllItemsValue"
            };		
-- match3
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch3Text",
                x=kStatisticsX,y=180, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_ItemsMatch3Text"
            };
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch3Value",
                x=kStatisticsNumberX,y=180, w=70,h=25,
                flags = kHAlignRight,
                label = "ItemsMatch3Value"
            };
-- match4
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch4Text",
                x=kStatisticsX,y=200, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_ItemsMatch4Text"
            };
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch4Value",
                x=kStatisticsNumberX,y=200, w=70,h=25,
                flags = kHAlignRight,
                label = "ItemsMatch4Value"
            };				
-- match5 or more
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch5pText",
                x=kStatisticsX,y=220, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_ItemsMatch5pText"
            };
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_ItemsMatch5pValue",
                x=kStatisticsNumberX,y=220, w=70,h=25,
                flags = kHAlignRight,
                label = "ItemsMatch5pValue"
            };	
-- number of tries on this level 
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_LevelTriesText",
                x=kStatisticsX,y=240, w=100,h=25,
                flags = kHAlignLeft,
                label = "infoPage_LevelTriesText"
            };
            Text
            {
                font = QuickTaskButtonFont,--StandardButtonFont,
                name = "infoPage_LevelTriesValue",
                x=kStatisticsNumberX,y=240, w=70,h=25,
                flags = kHAlignRight,
                label = "LevelTriesValue"
            };	
        --]]
-- -------------------------
		}
	},
}

