require "scripts/style" ;

local chapter = "1";
if (gDialogTable.chapter) then
	chapter = gDialogTable.chapter ;
end

local town = "1";
if (gDialogTable.town) then
	town = gDialogTable.town ;
end

local income = "0";
if (gDialogTable.income) then
	income = gDialogTable.income ;
end
local expertweek = "1";
if (gDialogTable.expertweek) then
	expertweek = gDialogTable.expertweek ;
end
local playerweek = "1";
if (gDialogTable.playerweek) then
	playerweek = gDialogTable.playerweek ;
end

ReplayOkButtonStyle = {
	parent = DefaultStyle,
	font = StandardButtonFont,
	sound = kDefaultButtonSound,
	rolloversound = kDefaultButtonRollOverSound,
	type= kPush,
	graphics = {
		"buttons/button_nextup",
		"buttons/button_nextdown",
		"buttons/button_nextover"
	}
};

ReplayCancelButtonStyle = {
	parent = DefaultStyle,
	font = StandardButtonFont,
	sound = kDefaultButtonSound,
	rolloversound = kDefaultButtonRollOverSound,
	type= kPush,
	graphics = {
		"buttons/button_noup",
		"buttons/button_nodown",
		"buttons/button_noover"
	}
};

ReplayHeaderText = {
	parent=DefaultStyle,
	font = {"fonts/expressway_condensed_semibold.mvec", 24, Color(255,255,255,255)},
	flags = kVAlignCenter + kHAlignCenter,
	x=kCenter,y=46,w=kMax-50,h=kMax-80
};

ReplayBodyText = {
	parent=DefaultStyle,
	font = {"fonts/expressway_semibold.mvec", 18, Color(120,120,120,255)},
	flags = kVAlignCenter + kHAlignCenter,
	x=kCenter,y=46,w=kMax-50,h=kMax-80
};

MakeDialog
{
	name=name, -- Remember, this is like saying table['name']=name, so it works.
    Bitmap
    {
		image="backgrounds/popup_replaybg",
		x=kCenter,
		y=kCenter,

		--SetStyle(DialogTitleText),
        SetStyle(ReplayHeaderText),
        -- shadow for replay text
        Text
        {
			flags=kHAlignCenter+kVAlignTop,
			font = {"fonts/expressway_condensed_semibold.mvec", 24, Color(80,80,80,255)},
			label="replaypopup_title",
			w=250, h=30,
			x=49,
			y=17
        },
        Text
        {
			flags=kHAlignCenter+kVAlignTop,
			label="replaypopup_title",
			w=250, h=30,
			x=50,
			y=16
        },
        
        SetStyle(ReplayBodyText),
        Text
        {
			flags=kHAlignLeft+kVAlignTop,
			label="replaypopup_income",
			w=120, h=30,
			x=44,
			y=54
        },
        Text
        {
			flags=kHAlignRight+kVAlignTop,
			label="#"..income,
			w=120, h=30,
			x=176,
			y=54
        },
        
        Text
        {
			flags=kHAlignLeft+kVAlignTop,
			label="replaypopup_expertweek",
			w=120, h=30,
			x=44,
			y=74
        },
        Text
        {
			flags=kHAlignRight+kVAlignTop,
			label="#"..expertweek,
			w=120, h=30,
			x=176,
			y=74
        },
        
        Text
        {
			flags=kHAlignLeft+kVAlignTop,
			label="replaypopup_achievedweek",
			w=150, h=30,
			x=44,
			y=94
        },
        Text
        {
			flags=kHAlignRight+kVAlignTop,
			label="#"..playerweek,
			w=120, h=30,
			x=176,
			y=94
        },
        Text
        {
			flags=kHAlignCenter+kVAlignTop,
			label="replaypopup_message",
			w=270, h=30,
			x=38,
			y=134
        },

        SetStyle(ReplayOkButtonStyle),
        Button
        {
			command=
				function()
					ModalReturn('replay_yes');
				end;
            close = true,
            flags = 5,
            --label = "replay",
            name = "replay",
            x = 266,
            y = 168,
        },
        SetStyle(ReplayCancelButtonStyle),
        Button
        {
			close = true,
            flags = 5,
            --label = "close",
            name = "close",
            x = 226,
            y = 168,
        }
    },

} -- MakeDialog
