---------------------------------------------------------------------------------------------------
--  Copyright © 2009 PoBros, Incorporated. All Rights Reserved.
--
--  This source code is the proprietary confidential property of PoBros Incorporated.
--  Modification, reproduction, publication, or distribution in any form to any party 
--  other than the licensee is strictly prohibited.
--
--  FOR USE BY AUTHORIZED PERSONS ONLY
---------------------------------------------------------------------------------------------------

require( "scripts/style.lua" );

local kButtonXGap = 15;

---------------------------------------------------------------------------------------------------

function StoryboardComplete()
end

---------------------------------------------------------------------------------------------------

function ContinueForward()
	local panel = gDialogTable.panel;
	
	if( CheckForValidLicense() ) then
		if( panel == 9 ) then
			FadeOut( "PopModal( 'storyboard' );DisplayDialog{'scripts/storyboard.lua';panel=10};" );
		elseif( panel == 10 ) then
			StoryboardButtonPress( "SwapToModal( \'scripts/map.lua\' );" );
		else
			StoryboardButtonPress( "SwapToModal( \'scripts/gameplay.lua\' );" );
		end
	else
		StoryboardButtonPress( "SwapToModal( \'scripts/mainmenu.lua\' );" );
	end
end

---------------------------------------------------------------------------------------------------

MakeDialog
{
	name = "storyboard";
	SetStyle( StoryboardStyle );
	
	Storyboard
	{
		panelnumber = gDialogTable.panel;
		collisionbuffer = 8;
		timecellscrimfade = 2000;
		playlistvolume = 0.5;
		playlistfadetime = 250;
		
		playlist =
		{
			playlisttrack = gs_musicPanel;
			timefadeout = 250;
			timecrossfade = 0;
			groupid = {gs_musicPanelGroupID;};
		};
		
		text =
		{
			panel9 =
			{
				endtext = GetString( "theend" );
			};
			
			panel10 =
			{
				starttext = GetString( "monthslater" );
			};
			
			info =
			{
				tablestring = "panel%s";
				fadetime = 4000;
			};
			
			text =
			{
				x = 400;
				y = 300;
				flags = kHAlignCenter + kVAlignCenter;
				font = StoryboardTextFont;
				w = 800;
				h = 600;
			};
		};
		
		panel =
		{
			cellenddelay = 0;
			activetime = 650;
			introdelay = 500;
			enddelay = 500;
		};
		
		cellinfo =
		{
			scaleintro = 1.2;
			scaleactive = 1.15;
			timecolorfade = 2000;
			timeintro = 1300;
			timeswitch = 500;
			timeminimum = 2500;
			timebubbleenddelay = 0;
			groupid = gs_sfxPanelGroupID;
			
			speechinfo =
			{
				font = SpeechBubbleFont;
				alphaintro = 0.9;
				alphaoutro = 0.72;
				timeanimate = 250;
				groupid = gs_sfxVoiceOversGroupID;
			};
			
			skiptext =
			{
				w = 256;
				h = 64;
				font = StoryboardSkipFont;
				color = Color( 255, 230, 180, 255 );
				hilight = WhiteTextFontColor;
				text = "<b>" .. GetString( "next" ) .. "</b>";
				offset = 2;
			};
		};
		
		SetStyle( ButtonStyle );

		Button
		{
			x = kMax - 150 - kButtonXGap;
			y = kMax - 50;
			name = "skip";
			text = "skip";
			command = function() ContinueForward(); end
		};
		
		Button
		{
			x = kMax - 225 - kButtonXGap;
			y = kMax - 50;
			buttongraphics = MediumButtonGraphics;
			name = "continue";
			text = "continue";
			command = function() ContinueForward(); end
		};
		
		Button
		{
			x = kButtonXGap;
			y = kMax - 50;
			name = "menu";
			text = "menu";
			
			command =
				function()
					PausePanel();
					value = DoModal( "scripts/pause.lua" );
					
					if( value == "mainmenu" ) then
						FadeOut( "SwapToModal( 'scripts/mainmenu.lua' );" );
					else
						ResumePanel();
					end
				end
		};
	};
};

---------------------------------------------------------------------------------------------------

EnableWindow( "continue", false );