--============================================================================
--  puzzlegame.lua
--  Copyright (c) 2009, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------

require( "scripts/style.lua" );

gPuzzleBackground = "";
if (gPuzzleLevel == 1 or 6 or 7) then
    gPuzzleBackground = "images/gui/jigsaw/ae_gui_jigsaw_1_background";
    gParticles="assets/particles/fx_mn_news/fx_spk20.xml";
    gParticlesX=405;
    gParticlesY=231; --369;
end
if (gPuzzleLevel == 2) then
    gPuzzleBackground = "images/gui/jigsaw/ae_gui_jigsaw_2_background";
    gParticles="assets/particles/fx_mn_key/fx_spk30.xml";
    gParticlesX=392;
    gParticlesY=244; --356;
end
if (gPuzzleLevel == 4) then
	gPuzzleBackground = "images/gui/jigsaw/ae_gui_jigsaw2_motor";
	gParticles="assets/particles/fx_mn_motor/fx_spk50.xml";
    gParticlesX=400;
    gParticlesY=266; --334;
end
if (gPuzzleLevel == 5) then
	gPuzzleBackground = "images/gui/jigsaw/ae_gui_jigsaw_3_background";
	gParticles="assets/particles/fx_mn_key/fx_spk30.xml";
    gParticlesX=392;
    gParticlesY=239; --361;
end

gPuzzleGuide = "";
if (gPuzzleLevel == 1) then
	gPuzzleGuide = "images/gui/jigsaw/ae_jigsaw_1_newspaper_guide.png";
end
if (gPuzzleLevel == 6) then
	gPuzzleGuide = "images/gui/jigsaw/ae_jigsaw_4_map_05_guide.png";
end
if (gPuzzleLevel == 7) then
	gPuzzleGuide = "images/gui/jigsaw/ae_jigsaw_5_map_guide.png";
end

MakeDialog {
	-- Name the modal dialog
	name = "jigsawgame",
	Bitmap {
		name = "backgroundimage",
		image = gPuzzleBackground,
		
		Bitmap {
			name = "bmpGuide",
			image = gPuzzleGuide,
			x = 401 - 500 / 2,
			y = 251 - 300 / 2,
		},

		PuzzleWindow {
			x = 0,
			y = 0,
			w = 800, 
			h = 600,

            level = gPuzzleLevel;
			
			SetStyle(ButtonStyle),
			Button {
				x = 601,
				y = 545,
				name = "btnMenu",
				graphics = MenuButtonGraphics,
				cancel = true,
				command = 
					function()
						DoModal("scripts/pause.lua");
					end
			},
			Bitmap {
			   name = "bmpSkipDisabled",
				image = gLocalizedPath.."images/buttons/ae_skip_i",
				x = 10,
				y = 545,
			},
			Button {
				x = 10,
				y = 545,
				name = "btnSkip",
				graphics = SkipButtonGraphics,
				cancel = true,
				command =
					function()
						DoModal("scripts/skip_message.lua");
                        SendMessage("minigameSkipped");
                        SetState(kPause, false);
					end
			},
			WindowFx {
				name = "WindowFx";
				x=0; y=0; w=800; h=600;
				ParticleFile=gParticles;
				ParticleX=gParticlesX;
				ParticleY=gParticlesY;
			},
		},
		Text {
			name = "txtJigsawtitle",
			font = StandardButtonFont,
			label = "JigsawTitle",
			x = 300, y = 525,
			w = 200, h = 30,
			flags = kHAlignCenter,
		},
	},

    FadeWindow {
        w = 800,
        h = 600,
        name = "FadeWindow",

        Bitmap {
            image = "images/panelblack",
            name = "bmpPanelBlack",
            x = 0,
            y = 0,
        }
    },

}
